
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
amend-package
Advanced tools
[!CAUTION] Modify package is not recommended. Do not use this way unless there is no other solution and you known there is no risk in your scenario.
Modify npm installed packages.
amend-package has been tested in npm v8+, pnpm v8, yarn v1.x, node v16+.
npm install -D amend-package
amend-package.config.js
(or name it yourself)xxx.config.js
, list it using --list-builtin-config
and use it directly using --builtin-config xxx.config.js
.postinstall
of the package.json
of you project, then it can be called automatically after npm install. e.g.:{
"scripts": {
"postinstall": "npx amend-package --config amend-package.config.cjs"
}
}
# Print help
npx amend-package --help
# Modify all packages.
npx amend-package --config amend-package.config.cjs
# Modify all packages, but try run without real modification.
npx amend-package --config amend-package.config.cjs --dry-run
# Modify the specified package.
npx amend-package --config amend-package.config.cjs --package some_pkg_name
# Revert the modifications to all packages.
npx amend-package --config amend-package.config.cjs --revert
# Revert the modifications to the specified package.
npx amend-package --config amend-package.config.cjs --revert --package some_pkg_name
--help Print help.
--config Specify the config file path. At present only CommonJS is supported in the config file. The config file is loaded via const config = require(require('node:path').resolve(cmdInputConfigPath)). See the example config files in "amend-package/builtin-config/*.config.cjs". Either --builtin-config or --config must be specified.
--builtin-config Specify the config file name. e.g. --builtin-config fix-vue-echarts-esm.config.cjs Either --builtin-config or --config must be specified.
--list-builtin-config List built-in config files.
--dry-run Just log what will be changed but do not change anything.
--package <package_name> Specify the package (npm package name) to modify. If not specified, modify all packages. e.g. --package some_pkg_name
--revert Revert the modifications.
--builtin-case List built-in cases.
--case <case_name> Specify a case to run. If not specified, run all cases.
module.exports = {
amenderMap: {
'some_package_1': ({
setPackageJSONAttr,
ensureSubPackageJSON,
getPackageJSONAttrClone,
getPackageVersion
}) => {
const currentVersion = getPackageVersion();
const expectedVersion = '5.1.2';
if (currentVersion !== expectedVersion) {
throw new Error(
'Please check the patch logic when upgrade "some_package_1".'
+ ' currentVersion: ' + currentVersion
+ ' expectedVersion: ' + expectedVersion
);
}
setPackageJSONAttr('type', 'module');
setPackageJSONAttr('exports', {
".": {
"types": "./index.d.ts",
"require": "./dist/zrender.js",
"import": "./index.js"
},
"./*": "./*",
});
ensureSubPackageJSON(['dist'], ({setPackageJSONAttr}) => setPackageJSONAttr('type', 'commonjs'));
ensureSubPackageJSON(['build'], ({setPackageJSONAttr}) => setPackageJSONAttr('type', 'commonjs'));
},
'some_package_2': ({
setPackageJSONAttr,
ensureSubPackageJSON,
getPackageJSONAttrClone,
getPackageVersion
}) => {
// ...
},
// ...
},
};
FAQs
Modify npm installed packages.
The npm package amend-package receives a total of 5 weekly downloads. As such, amend-package popularity was classified as not popular.
We found that amend-package demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.