Skip to content

Commit

Permalink
Simplify build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Feb 3, 2024
1 parent c1d0586 commit 72383e7
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 285 deletions.
273 changes: 0 additions & 273 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 6 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,21 @@
"deno": ">=1.0.0"
},
"scripts": {
"clean": "rimraf --glob \"!(.*).{d.ts,js,cjs,mjs}\" build coverage",
"preversion": "npm run build && npm run test",
"prepack": "npm run build && npm run test",
"postversion": "git push && git push --tags",
"watch": "chokidar src tsconfig.json -c \"npm run build\" --initial",
"build": "npm run build:esm && npm run build:cjs && npm run build:types",
"build:esm": "rimraf build && tsc && npm run move-build && rimraf build",
"build:cjs": "rimraf build && tsc --module commonjs --moduleResolution node && npm run move-build -- -- --cjs && rimraf build",
"build:types": "rimraf build && tsc --declaration --emitDeclarationOnly && npm run move-build && rimraf build",
"move-build": "node -e \"process.chdir('build');const fs=require('fs');const path=require('path');fs.readdirSync('.',{recursive:true,withFileTypes:true}).filter(x=>x.isFile()).forEach(x=>{const f=path.join(x.path,x.name);const o=path.join('..',f);fs.mkdirSync(path.dirname(o),{recursive:true});if(process.argv[1]==='--cjs'){fs.writeFileSync(o.slice(0,-2)+'cjs',fs.readFileSync(f,'utf8').replace(/require\\(\\\"(.+?)\\.js\\\"\\)/g,'require\\(\\\"\\$1.cjs\\\"\\)'));}else{fs.renameSync(f,o);}});\"",
"lint": "eslint src",
"clean": "node scripts/clean.js",
"build": "node scripts/build.js",
"watch": "node scripts/watch.js",
"test": "mocha",
"coverage": "c8 -r text -r text-summary -r lcov --include \"*.js\" npm test"
"coverage": "c8 -r text -r text-summary -r lcov --include \"*.js\" npm test",
"lint": "eslint src"
},
"devDependencies": {
"@types/node": "^20.11.5",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"c8": "^9.1.0",
"chokidar": "^3.5.3",
"chokidar-cli": "^3.0.0",
"eslint": "^8.1.0",
"mocha": "^10.2.0",
"rimraf": "^5.0.1",
Expand Down
Loading

0 comments on commit 72383e7

Please sign in to comment.