Skip to content

Commit b5597ad

Browse files
committed
build: copy package docs only at vsix package time
- move the CHANGELOG/LICENSE/README copy out of rollup/rolldown into scripts/copy-package-docs.mjs, run from lana's vscode:prepublish — docs are no longer regenerated on every dev build/watch - drop the redundant `rm -rf lana/out` from rolldown scripts (its cleanDir already clears output); keep it for rollup which has no native clean
1 parent 3cc693c commit b5597ad

5 files changed

Lines changed: 18 additions & 11 deletions

File tree

lana/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
}
312312
},
313313
"scripts": {
314-
"vscode:prepublish": "rm -rf out && pnpm -w run build"
314+
"vscode:prepublish": "pnpm -w run build && pnpm -w run copy:package-docs"
315315
},
316316
"dependencies": {
317317
"@apexdevtools/apex-ls": "^6.0.2",

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040
"build": "pnpm run typecheck && NODE_ENV=production pnpm run build:dev",
4141
"build:fast": "pnpm run typecheck && NODE_ENV=production pnpm run build:dev:fast",
4242
"build:dev": "rm -rf lana/out && rollup -c rollup.config.mjs",
43-
"build:dev:fast": "rm -rf lana/out && rolldown -c rolldown.config.ts",
43+
"build:dev:fast": "rolldown -c rolldown.config.ts",
4444
"watch": "rm -rf lana/out && rollup -w -c rollup.config.mjs",
45-
"watch:fast": "rm -rf lana/out && rolldown -w -c rolldown.config.ts",
45+
"watch:fast": "rolldown -w -c rolldown.config.ts",
46+
"copy:package-docs": "node ./scripts/copy-package-docs.mjs",
4647
"typecheck": "tsgo -b",
4748
"typecheck:tsc": "tsc -b",
4849
"lint": "concurrently -r -g 'eslint **/*.ts' 'prettier --cache **/*.{ts,css,md,scss} --check --experimental-cli' 'pnpm run typecheck'",

rolldown.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { defineConfig } from 'rolldown';
77
import nodePolyfills from '@rolldown/plugin-node-polyfills';
88

99
// rollup plugins
10-
// @ts-expect-error - no type declarations
1110
import postcssUrl from 'postcss-url';
1211
import copy from 'rollup-plugin-copy';
1312
import postcss from 'rollup-plugin-postcss';
@@ -105,7 +104,6 @@ export default defineConfig([
105104
src: ['log-viewer/out/*', 'log-viewer/index.html', 'lana/certinia-icon-color.png'],
106105
dest: 'lana/out',
107106
},
108-
{ src: ['CHANGELOG.md', 'LICENSE.txt', 'README.md'], dest: 'lana' },
109107
],
110108
}),
111109
],

rollup.config.mjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,9 @@ export default [
144144
hook: 'closeBundle',
145145
targets: [
146146
{
147-
src: [
148-
'log-viewer/out/*',
149-
'log-viewer/index.html',
150-
'lana/certinia-icon-color.png',
151-
],
147+
src: ['log-viewer/out/*', 'log-viewer/index.html', 'lana/certinia-icon-color.png'],
152148
dest: 'lana/out',
153149
},
154-
{ src: ['CHANGELOG.md', 'LICENSE.txt', 'README.md'], dest: 'lana' },
155150
],
156151
}),
157152
],

scripts/copy-package-docs.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { copyFile } from 'node:fs/promises';
2+
import path from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
5+
// Copy the package docs into lana/ for vsce packaging only.
6+
// The root files are the sources of truth; the lana/ copies are gitignored
7+
// build artifacts consumed by `vsce package` (see lana/.vscodeignore).
8+
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
9+
const docs = ['CHANGELOG.md', 'LICENSE.txt', 'README.md'];
10+
11+
await Promise.all(
12+
docs.map((file) => copyFile(path.join(repoRoot, file), path.join(repoRoot, 'lana', file))),
13+
);

0 commit comments

Comments
 (0)