Skip to content

Commit

Permalink
remove path-traversal issue in build script
Browse files Browse the repository at this point in the history
  • Loading branch information
jfromaniello committed Mar 25, 2024
1 parent ef742c2 commit 090c549
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
"build-all": "run-s lint clean:* build:*",
"build:node-cjs": "run-s clean:node-cjs compile:node-cjs pkgjson:node-cjs",
"compile:node-cjs": "tsc -p ./tsconfig/node-cjs.json",
"pkgjson:node-cjs": "node ./scripts/pkg-json.mjs ./tsconfig/node-cjs.json > ./dist/node/cjs/package.json",
"pkgjson:node-cjs": "node ./scripts/pkg-json.mjs cjs > ./dist/node/cjs/package.json",
"clean:node-cjs": "rm -rf dist/node/cjs",
"build:node-esm": "run-s clean:node-esm compile:node-esm pkgjson:node-esm",
"compile:node-esm": "tsc -p ./tsconfig/node-esm.json",
"pkgjson:node-esm": "node ./scripts/pkg-json.mjs ./tsconfig/node-esm.json > ./dist/node/esm/package.json",
"pkgjson:node-esm": "node ./scripts/pkg-json.mjs esm > ./dist/node/esm/package.json",
"clean:node-esm": "rm -rf dist/node/esm",
"build:browser": "run-s clean:browser compile:browser pkgjson:browser",
"compile:browser": "tsc -p ./tsconfig/browser.json",
"pkgjson:browser": "node ./scripts/pkg-json.mjs ./tsconfig/browser.json > ./dist/browser/package.json",
"pkgjson:browser": "node ./scripts/pkg-json.mjs browser > ./dist/browser/package.json",
"clean:browser": "rm -rf dist/browser",
"build:types": "run-s clean:types compile:types",
"compile:types": "tsc -p ./tsconfig/types.json",
Expand Down
14 changes: 13 additions & 1 deletion scripts/pkg-json.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ import path from 'path';

const tsconfigs = [];

let tsConfigPath = process.argv[2];
const options = {
'cjs': './tsconfig/node-cjs.json',
'esm': './tsconfig/node-esm.json',
'browser': './tsconfig/browser.json'
};

let option = process.argv[2];
let tsConfigPath = options[option];
if (!tsConfigPath) {
console.error('Invalid option');
process.exit(1);
}

let tsConfig = JSON.parse(fs.readFileSync(tsConfigPath, 'utf8'));
tsconfigs.push(tsConfig);

Expand Down

0 comments on commit 090c549

Please sign in to comment.