diff options
Diffstat (limited to 'tools/astro-vscode')
-rw-r--r-- | tools/astro-vscode/package.json | 15 | ||||
-rw-r--r-- | tools/astro-vscode/scripts/publish.mjs | 41 |
2 files changed, 49 insertions, 7 deletions
diff --git a/tools/astro-vscode/package.json b/tools/astro-vscode/package.json index 338e3c184..e6c8e417f 100644 --- a/tools/astro-vscode/package.json +++ b/tools/astro-vscode/package.json @@ -10,10 +10,10 @@ }, "version": "0.4.2", "author": "Astro", - "publisher": "astro-build", "license": "MIT", + "publisher": "astro-build", "scripts": { - "vscode:prepublish": "yarn build", + "vscode:publish": "node ./scripts/publish.mjs", "build": "astro-scripts build 'src/index.ts'", "dev": "astro-scripts dev 'src/index.ts'" }, @@ -24,14 +24,15 @@ "onLanguage:astro" ], "dependencies": { - "astro-languageserver": "0.4.0" + "astro-languageserver": "file:../astro-languageserver" }, "devDependencies": { - "vscode-html-languageservice": "^3.0.3", + "@types/vscode": "^1.52.0", + "astro-scripts": "file:../../scripts", + "execa": "^5.0.0", "vscode-emmet-helper": "2.1.2", - "vscode-languageclient": "~7.0.0", - "astro-scripts": "0.0.1", - "@types/vscode": "^1.52.0" + "vscode-html-languageservice": "^3.0.3", + "vscode-languageclient": "~7.0.0" }, "main": "./dist/index.js", "files": [ diff --git a/tools/astro-vscode/scripts/publish.mjs b/tools/astro-vscode/scripts/publish.mjs new file mode 100644 index 000000000..93a36e804 --- /dev/null +++ b/tools/astro-vscode/scripts/publish.mjs @@ -0,0 +1,41 @@ +import { promises as fs } from 'fs'; +import { fileURLToPath } from 'url'; +import execa from 'execa'; + +/** Copies `astro-languageserver` to our file */ +async function publish() { + const p0 = execa('yarn', ['lerna', 'run', 'build', '--scope', 'astro-vscode', '--scope', 'astro-languageserver'], { all: true }); + p0.all.setEncoding('utf8'); + for await (const chunk of p0.all) { + console.log(chunk); + + if (/lerna success/g.test(chunk)) { + break; + } + + if (/ERROR/g.test(chunk)) { + process.exit(1); + } + } + + await execa('npm', ['install']); + + const p1 = execa('vsce', ['publish'], { all: true }); + + p1.all.setEncoding('utf8'); + for await (const chunk of p1.all) { + console.log(chunk); + + if (/DONE/g.test(chunk)) { + break; + } + + if (/ERROR/g.test(chunk)) { + process.exit(1); + } + } + + p1.kill(); +} + +publish(); |