From 0fe3d4fcb886e763298f6740ce38ee2976388b5e Mon Sep 17 00:00:00 2001 From: aooiuu Date: Fri, 19 Jul 2024 20:56:08 +0800 Subject: [PATCH] =?UTF-8?q?chore(vscode):=20=E4=BF=AE=E6=94=B9=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev.yml | 2 +- .github/workflows/pre-release.yml | 2 +- .github/workflows/release.yml | 2 +- package.json | 2 +- packages/vscode/package.json | 6 ++++-- packages/vscode/scripts/publish.cjs | 7 ++++++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 1582f313..e49ae032 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -49,8 +49,8 @@ jobs: - run: pnpm install - run: pnpm run build - - run: pnpm run vscode:build-tpl + - run: pnpm run vscode:build # https://github.com/HaaLeo/publish-vscode-extension - name: build vscode vsx if: matrix.os == 'windows-latest' diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 275e4c2f..06fd6012 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -49,7 +49,7 @@ jobs: - run: pnpm install - run: pnpm run build - - run: pnpm run vscode:build-tpl + - run: pnpm run vscode:build # https://github.com/HaaLeo/publish-vscode-extension - name: build vscode vsx diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd281a6e..136fce08 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,7 +52,7 @@ jobs: - name: build vscode template if: matrix.os == 'windows-latest' - run: pnpm run vscode:build-tpl + run: pnpm run vscode:build # https://github.com/HaaLeo/publish-vscode-extension - name: build vscode vsx diff --git a/package.json b/package.json index aa78c363..cd830e1a 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "vscode:server": "pnpm --filter=@any-reader/web vscode:dev", "vscode:dev": "npm-run-all core:build shared:build --parallel vscode:server server", "vscode:build-tpl": "pnpm --filter=@any-reader/web vscode:build", - "vscode:build-vsx": "pnpm --filter=@any-reader/vscode build", + "vscode:build-vsx": "pnpm --filter=@any-reader/vscode vscode:prepublish", "vscode:build": "npm-run-all vscode:build-tpl vscode:build-vsx", "server": "pnpm --filter=@any-reader/server dev", "server:build": "pnpm --filter=@any-reader/server build", diff --git a/packages/vscode/package.json b/packages/vscode/package.json index e64366ca..acb138e7 100644 --- a/packages/vscode/package.json +++ b/packages/vscode/package.json @@ -35,9 +35,11 @@ ], "main": "./dist/extension.js", "scripts": { - "build": "tsup", - "dev": "tsx ./scripts/publish.cjs && tsup --watch src", + "compile": "tsup", + "compile-watch": "tsup --watch src", "vscode:prepublish": "tsx ./scripts/publish.cjs", + "dev": "npm-run-all vscode:prepublish compile-watch", + "build": "npm-run-all vscode:prepublish compile pack", "pack": "vsce package --no-dependencies" }, "contributes": { diff --git a/packages/vscode/scripts/publish.cjs b/packages/vscode/scripts/publish.cjs index d59b3598..5a99d188 100644 --- a/packages/vscode/scripts/publish.cjs +++ b/packages/vscode/scripts/publish.cjs @@ -32,8 +32,13 @@ async function publish() { pkg.version = pkg.version.replace(/\.\d+\-.*?$/, '.' + (10000 + version.build)); } + const outputDir = path.join(root, 'dist'); + if (!fs.existsSync(outputDir)) { + fs.mkdirSync(outputDir); + } + // sql-wasm.wasm - fs.copyFileSync(path.resolve(root, '../../node_modules/sql.js/dist/sql-wasm.wasm'), path.join(root, 'dist', 'sql-wasm.wasm')); + fs.copyFileSync(path.resolve(root, '../../node_modules/sql.js/dist/sql-wasm.wasm'), path.join(outputDir, 'sql-wasm.wasm')); pkg.devDependencies = {}; await fs.writeJSON(pkgPath, pkg, { spaces: 2 });