Skip to content

Commit a12340f

Browse files
committed
Make the directory structures for ESM, UMD, and CJS the same
- Bump to 2.0.0, since this is a breaking change - Do not compile the test code explicitly; it's compiled through ts-node in the background - Also remove executable from random files that shouldn't be executable Fixes #1124 Signed-off-by: David Thompson <[email protected]>
1 parent 3821411 commit a12340f

File tree

9 files changed

+22
-15
lines changed

9 files changed

+22
-15
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ COPY . .
77
RUN npm install && \
88
npm run build
99

10-
ENTRYPOINT [ "node", "./out/server/src/server.js" ]
10+
ENTRYPOINT [ "node", "./lib/cjs/server.js" ]
1111
CMD [ "--stdio" ]

README.md

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ This repository only contains the server implementation. Here are some known cli
406406
```bash
407407
$ npm run build
408408
```
409-
5. The new built server is now located in ./out/server/src/server.js.
409+
5. The new built server is now located in ./lib/cjs/server.js.
410410
```bash
411-
node (Yaml Language Server Location)/out/server/src/server.js [--stdio]
411+
node (Yaml Language Server Location)/lib/cjs/server.js [--stdio]
412412
```
413413

414414
### Connecting to the language server via stdio
@@ -417,7 +417,7 @@ We have included the option to connect to the language server via [stdio](https:
417417

418418
### ESM and UMD Modules
419419

420-
Building the YAML Language Server produces [CommonJS](http://www.commonjs.org/) modules in the `/out/server/src` directory. In addition, a build also produces [UMD](https://github.com/umdjs/umd) (Universal Module Definition) modules and [ES Modules](https://tc39.es/ecma262/#sec-modules) (ESM) in the `/lib` directory. That gives you choices in using the YAML Language Server with different module loaders on the server side and in the browser with bundlers like webpack.
420+
Building the YAML Language Server produces [CommonJS](http://www.commonjs.org/) modules in the `./lib/cjs` directory. In addition, a build also produces [UMD](https://github.com/umdjs/umd) (Universal Module Definition) modules and [ES Modules](https://tc39.es/ecma262/#sec-modules) (ESM) in the `./lib/umd` and `./lib/esm` directories (repectively). That gives you choices in using the YAML Language Server with different module loaders on the server side and in the browser with bundlers like webpack.
421421

422422
### CI
423423

bin/yaml-language-server

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env node
22

3-
require('../out/server/src/server.js');
3+
require('../lib/cjs/server.js');

out/.gitignore

Whitespace-only changes.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "yaml-language-server",
33
"description": "YAML language server",
4-
"version": "1.19.0",
4+
"version": "2.0.0",
55
"author": "Red Hat",
66
"license": "MIT",
77
"contributors": [
@@ -16,7 +16,7 @@
1616
"bin": {
1717
"yaml-language-server": "bin/yaml-language-server"
1818
},
19-
"main": "./out/server/src/index.js",
19+
"main": "./lib/cjs/index.js",
2020
"l10n": "./l10n",
2121
"keywords": [
2222
"yaml",

src/yamlServerInit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class YAMLServerInit {
5959

6060
public async setupl10nBundle(params: InitializeParams): Promise<void> {
6161
const __dirname = path.dirname(__filename);
62-
const l10nPath: string = params.initializationOptions?.l10nPath || path.join(__dirname, '../../../l10n');
62+
const l10nPath: string = params.initializationOptions?.l10nPath || path.join(__dirname, '../../l10n');
6363
const locale: string = params.locale || 'en';
6464
if (l10nPath) {
6565
const bundleFile = !fs.existsSync(path.join(l10nPath, `bundle.l10n.${locale}.json`))

tsconfig.esm.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
},
99
"exclude": [
1010
"node_modules",
11-
"out",
1211
"lib",
1312
"test"
1413
]

tsconfig.json

100755100644
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,24 @@
33
"alwaysStrict": true,
44
"declaration": true,
55
"forceConsistentCasingInFileNames": true,
6-
"lib": ["es2020", "WebWorker"],
6+
"lib": [
7+
"es2020",
8+
"WebWorker"
9+
],
710
"module": "commonjs",
811
"moduleResolution": "node",
9-
"outDir": "./out/server",
12+
"outDir": "./lib/cjs",
1013
"sourceMap": true,
1114
"target": "es2020",
1215
"allowSyntheticDefaultImports": true,
1316
"skipLibCheck": true
1417
},
15-
"include": [ "src", "test" ],
16-
"exclude": ["node_modules", "out"]
17-
}
18+
"include": [
19+
"src",
20+
],
21+
"exclude": [
22+
"node_modules",
23+
"test",
24+
"lib"
25+
]
26+
}

tsconfig.umd.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
},
88
"exclude": [
99
"node_modules",
10-
"out",
1110
"lib",
1211
"test"
1312
]

0 commit comments

Comments
 (0)