Skip to content

Commit 1aff7e0

Browse files
committed
Initial yarn workspace
1 parent 9f58cea commit 1aff7e0

22 files changed

+1148
-457
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.yarn/** linguist-vendored
2+
/.yarn/releases/* binary
3+
/.yarn/plugins/**/* binary
4+
/.pnp.* binary linguist-generated

.github/workflows/ci.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ jobs:
7373
- name: Use Node.js
7474
uses: actions/setup-node@v4
7575
with:
76-
node-version: 20
77-
registry-url: 'https://registry.npmjs.org'
76+
cache: yarn
77+
node-version-file: .nvmrc
7878

79-
- run: npm ci
79+
- run: yarn install
8080
- run: opam install dune cppo
81-
- run: npm run compile
82-
- run: npm run bundle
81+
- run: yarn compile
82+
- run: yarn bundle
8383

8484
# These 2 runs (or just the second?) are for when you have opam dependencies. We don't.
8585
# Don't add deps. But if you ever do, un-comment these and add an .opam file.
@@ -124,11 +124,11 @@ jobs:
124124
- name: Use Node.js
125125
uses: actions/setup-node@v4
126126
with:
127-
node-version: 20
128-
registry-url: 'https://registry.npmjs.org'
127+
cache: yarn
128+
node-version-file: .nvmrc
129129

130-
- run: npm ci
131-
- run: npm run compile
130+
- run: yarn install
131+
- run: yarn compile
132132

133133
- name: Download MacOS binaries
134134
uses: actions/download-artifact@v4
@@ -209,15 +209,15 @@ jobs:
209209
210210
- name: Package Extension
211211
if: github.ref != 'refs/heads/master'
212-
run: npx vsce package -o rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
212+
run: yarn dlx vsce package -o rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
213213

214214
- name: Package Extension pre-release version
215215
if: github.ref == 'refs/heads/master'
216-
run: npx vsce package -o rescript-vscode-latest-master.vsix ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version
216+
run: yarn dlx vsce package -o rescript-vscode-latest-master.vsix ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version
217217

218218
- name: Package Extension release version
219219
if: startsWith(github.ref, 'refs/tags/')
220-
run: npx vsce package -o rescript-vscode-${{ steps.tag_name.outputs.tag }}.vsix ${{ steps.tag_name.outputs.tag }} --no-git-tag-version
220+
run: yarn dlx vsce package -o rescript-vscode-${{ steps.tag_name.outputs.tag }}.vsix ${{ steps.tag_name.outputs.tag }} --no-git-tag-version
221221

222222
- uses: actions/upload-artifact@v4
223223
if: github.ref != 'refs/heads/master'
@@ -273,37 +273,37 @@ jobs:
273273

274274
- name: Publish extension as pre-release
275275
if: github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'publish tools')
276-
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --pre-release ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version
276+
run: yarn dlx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --pre-release ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version
277277

278278
- name: Publish extension as release
279279
if: startsWith(github.ref, 'refs/tags/')
280-
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} ${{ steps.tag_name.outputs.tag }} --no-git-tag-version
280+
run: yarn dlx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} ${{ steps.tag_name.outputs.tag }} --no-git-tag-version
281281

282282
- name: Publish LSP as pre-release to NPM
283283
if: github.ref == 'refs/heads/master'
284284
working-directory: server
285285
run: |
286286
npm version preminor --preid next-$(git rev-parse --short HEAD)
287-
npm publish --access public --tag next
287+
yarn publish --access public --tag next
288288
env:
289289
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
290290

291291
- name: Publish LSP to NPM
292292
if: startsWith(github.ref, 'refs/tags/')
293293
working-directory: server
294-
run: npm publish --access public
294+
run: yarn publish --access public
295295
env:
296296
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
297297

298298
- name: Build @rescript/tools package
299299
working-directory: tools
300300
run: |
301-
npm ci
302-
npm run build
301+
yarn install
302+
yarn build
303303
304304
- name: Publish @rescript/tools package
305305
if: ${{ startsWith(github.event.head_commit.message, 'publish tools') && (github.ref == 'refs/heads/master') }}
306306
working-directory: tools
307-
run: npm publish --access public
307+
run: yarn publish --access public
308308
env:
309309
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@ rescript-tools.exe
2424
_opam/
2525
_build/
2626

27-
*.tsbuildinfo
27+
*.tsbuildinfo
28+
29+
.yarn/*
30+
!.yarn/patches
31+
!.yarn/plugins
32+
!.yarn/releases
33+
!.yarn/sdks
34+
!.yarn/versions

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

.vscode/extensions.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3-
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4-
5-
// List of extensions which should be recommended for users of this workspace.
6-
"recommendations": [
7-
"dbaeumer.vscode-eslint"
8-
]
9-
}
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
// List of extensions which should be recommended for users of this workspace.
5+
"recommendations": [
6+
"dbaeumer.vscode-eslint",
7+
"arcanis.vscode-zipfs"
8+
]
9+
}

.vscode/settings.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
{
2-
"editor.insertSpaces": false,
3-
"tslint.enable": true,
4-
"typescript.tsc.autoDetect": "off",
5-
"typescript.preferences.quoteStyle": "single",
6-
"editor.codeActionsOnSave": {
7-
"source.fixAll.eslint": "explicit"
8-
},
9-
"ocaml.sandbox": {
10-
"kind": "opam",
11-
"switch": "${workspaceFolder:rescript-vscode}"
12-
}
2+
"editor.insertSpaces": false,
3+
"tslint.enable": true,
4+
"typescript.tsc.autoDetect": "off",
5+
"typescript.preferences.quoteStyle": "single",
6+
"editor.codeActionsOnSave": {
7+
"source.fixAll.eslint": "explicit"
8+
},
9+
"ocaml.sandbox": {
10+
"kind": "opam",
11+
"switch": "${workspaceFolder:rescript-vscode}"
12+
},
13+
"search.exclude": {
14+
"**/.yarn": true,
15+
"**/.pnp.*": true
16+
},
17+
"typescript.tsdk": ".yarn/sdks/typescript/lib",
18+
"typescript.enablePromptUseWorkspaceTsdk": true
1319
}

.yarn/sdks/integrations.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is automatically generated by @yarnpkg/sdks.
2+
# Manual changes might be lost!
3+
4+
integrations:
5+
- vscode

.yarn/sdks/typescript/bin/tsc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, register} = require(`module`);
5+
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
7+
8+
const relPnpApiPath = "../../../../.pnp.cjs";
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require typescript/bin/tsc
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
31+
// Defer to the real typescript/bin/tsc your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`typescript/bin/tsc`));

.yarn/sdks/typescript/bin/tsserver

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, register} = require(`module`);
5+
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
7+
8+
const relPnpApiPath = "../../../../.pnp.cjs";
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require typescript/bin/tsserver
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
31+
// Defer to the real typescript/bin/tsserver your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`typescript/bin/tsserver`));

.yarn/sdks/typescript/lib/tsc.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, register} = require(`module`);
5+
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
7+
8+
const relPnpApiPath = "../../../../.pnp.cjs";
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require typescript/lib/tsc.js
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
31+
// Defer to the real typescript/lib/tsc.js your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`typescript/lib/tsc.js`));

0 commit comments

Comments
 (0)