mirror of
https://github.com/quartz-community/note-properties.git
synced 2026-07-22 02:50:26 +00:00
build: bundle dependencies and ship pre-built dist
This commit is contained in:
parent
68c978b9d2
commit
4ebb6e2a18
2 changed files with 24 additions and 1 deletions
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
|
|
@ -28,6 +28,15 @@ jobs:
|
|||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Verify dist is up to date
|
||||
run: |
|
||||
if git diff --quiet dist/; then
|
||||
echo "dist/ is up to date"
|
||||
else
|
||||
echo "::error::dist/ is stale. Run 'npm run build' and commit the result."
|
||||
git diff --stat dist/
|
||||
exit 1
|
||||
fi
|
||||
- name: Verify dist externals
|
||||
run: |
|
||||
node -e "
|
||||
|
|
@ -37,7 +46,7 @@ jobs:
|
|||
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
|
||||
const peerDeps = Object.keys(pkg.peerDependencies || {});
|
||||
const builtins = new Set(['assert','buffer','child_process','cluster','console','constants','crypto','dgram','dns','domain','events','fs','http','http2','https','inspector','module','net','os','path','perf_hooks','process','punycode','querystring','readline','repl','stream','string_decoder','sys','timers','tls','trace_events','tty','url','util','v8','vm','wasi','worker_threads','zlib']);
|
||||
const shared = ['@quartz-community/','preact','@jackyzha0/quartz','vfile'];
|
||||
const shared = ['@quartz-community/','preact','@jackyzha0/quartz','vfile','unified'];
|
||||
const content = fs.readFileSync(dist, 'utf-8');
|
||||
const re = /^\s*(?:import\s+.*\s+from|export\s+.*\s+from)\s+[\"']([^\"'./][^\"']*)[\"']/gm;
|
||||
const unexpected = new Set();
|
||||
|
|
|
|||
|
|
@ -71,6 +71,18 @@ const inlineScriptPlugin: Plugin = {
|
|||
},
|
||||
};
|
||||
|
||||
const SINGLETON_EXTERNALS = [
|
||||
"preact",
|
||||
"preact/hooks",
|
||||
"preact/jsx-runtime",
|
||||
"preact/compat",
|
||||
"@jackyzha0/quartz",
|
||||
"@jackyzha0/quartz/*",
|
||||
"vfile",
|
||||
"vfile/*",
|
||||
"unified",
|
||||
];
|
||||
|
||||
export default defineConfig({
|
||||
entry: {
|
||||
index: "src/index.ts",
|
||||
|
|
@ -85,6 +97,8 @@ export default defineConfig({
|
|||
treeshake: true,
|
||||
target: "es2022",
|
||||
splitting: false,
|
||||
noExternal: [/.*/],
|
||||
external: SINGLETON_EXTERNALS,
|
||||
outDir: "dist",
|
||||
platform: "node",
|
||||
banner: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue