Build updates

This commit is contained in:
Cris Stringfellow 2023-01-13 18:48:30 +08:00
parent be336f1c10
commit 81c3fae639
No known key found for this signature in database
3 changed files with 14 additions and 6 deletions

View File

@ -6,12 +6,14 @@
"main": "src/app.js",
"module": "dist/diskernet.js",
"bin": {
"diskernet": "build/out.cjs"
"diskernet": "build/diskernet.cjs"
},
"scripts": {
"start": "node src/app.js",
"setup": "bash ./scripts/build_setup.sh",
"build": "echo Ensure you 'npm run setup' first && bash ./scripts/compile.sh",
"compile": "npm run build",
"build-only": "bash ./scripts/build_only.sh",
"clean": "rm -rf build/* bin/*",
"super-clean": "npm run clean || : && rm -rf node_modules || : && rm package-lock.json",
"test": "nodemon src/app.js",
@ -19,8 +21,7 @@
"serve": "nodemon src/app.js DiskerNet serve",
"lint": "watch -n 5 npx eslint .",
"test-hl": "node src/highlighter.js",
"postpublish": "cp package.json .package.build.json",
"prepublishOnly": "./node_modules/.bin/esbuild src/app.js --bundle --outfile=build/out.cjs --platform=node"
"prepublishOnly": "npm run build-only"
},
"repository": {
"type": "git",

8
scripts/build_only.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
./node_modules/.bin/esbuild src/app.js --bundle --outfile=dist/diskernet.mjs --format=esm --platform=node
./node_modules/.bin/esbuild src/app.js --bundle --outfile=build/out.cjs --platform=node
echo "#!/usr/bin/env node" > build/diskernet.js
cat build/out.cjs >> build/diskernet.js
chmod +x build/diskernet.js

View File

@ -1,10 +1,9 @@
#!/usr/bin/env bash
./scripts/build_only.sh
unset npm_config_prefix
source $HOME/.nvm/nvm.sh
./node_modules/.bin/esbuild src/app.js --bundle --outfile=build/out.cjs --platform=node
nvm use --lts
pkg --compress GZip .