An npm module to brutally update a Node.js project's dependencies
A little explaination of the name svecchiator:
In Italian "svecchiare" means to remove the old parts from something or to renew something. This module will remove the old dependencies, replacing them with the ones with the latest versions.
Under the hood, svecchiator reads the package.json file and manually calls the npm install and npm uninstall commands to update the dependencies. It alwo works with pnpm and yarn.
To install svecchiator as a local module:
$ npm install svecchiatorTo install svecchiator as a global module:
$ npm install -g svecchiatorSimple:
import { svecchia } from 'svecchiator';
async function main() {
await svecchia();
}
main();With custom configuration:
import { svecchia } from 'svecchiator';
async function main() {
await svecchia({
path: '../my-project',
onlyDevDeps: true,
cleanCache: true,
exclude: ['dree', 'eslint'],
packageManager: 'pnpm'
});
}
main();$ svecchiaThis will uninstall and install again all the deps and dev deps of the current dir project.
$ svecchia --dev --source ./my-projectThis will uninstall and install again only the dev deps of the project in ./my-project.
$ svecchia -e eslint -e dreeThis will exclude the packages dree and eslint
$ svecchia --package-manager pnpmThis will use pnpm instead of npm to uninstall and install the packages.
$ svecchiator --helpThis will show the help of the command.
In case you wanted to add the code completion for cli commands, you can use the following command:
$ svecchia completionIt will output the code completion for your shell. You can then add it to your .bashrc or .zshrc file.
For instance, if you want to add it to your .bashrc file, you can do it like this:
$ svecchia completion >> ~/.bashrcThe documentation generated with TypeDoc is available in this site. There is also a more specific version for development in this site.
Syntax:
svecchiator.svecchia(options)
Description:
A function that given some options, upgrades the dependencies of the package.json file. It works by running the command to uninstall and install them again. Note: the function is async.
Options parameters:
- path: Default value:
.. The path of the folder containing the package.json file. - onlyDevDeps: Default value:
false. If true, only the devDependencies will be updated. - onlyProdDeps: Default value:
false. If true, only the dependencies will be updated. - onlyOptionalDeps: Default value:
false. If true, only the optional dependencies will be updated. - onlyPeerDeps: Default value:
false. If true, only the peer dependencies will be updated. - cleanCache: Default value:
false. If true, the npm cache will be cleaned before updating the dependencies. - exclude: Default value:
[]. The list of dependencies to exclude from the update. - only: Default value:
[]. The list of dependencies to update. If specified and not empty, only the dependencies in this list will be updated. - packageManager: Default value:
npm. The package manager to use. It can benpm,pnpmoryarn.
Made with dree
svecchiator
├── .env.example
├── .eslintignore
├── .eslintrc.cjs
├─> .github
│ └─> workflows
│ ├── build.yml
│ ├── dree.yml
│ ├── lint.yml
│ └── test.yml
├── .gitignore
├── .prettierrc.cjs
├── .release-it.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── babel.config.cjs
├── build.mjs
├─> docs
│ ├── .gitignore
│ └─> tree
│ └── dree.config.json
├── jest.config.ts
├── package.json
├── pnpm-lock.yaml
├─> source
│ ├── index.bin.ts
│ ├── index.ts
│ ├── shims.d.ts
│ └── tsconfig.json
├─> test
│ ├── .eslintrc.cjs
│ ├─> assets
│ │ ├─> withAllDeps
│ │ │ └── package.json
│ │ ├─> withNpmLock
│ │ │ ├── package-lock.json
│ │ │ └── package.json
│ │ ├─> withPnpmLock
│ │ │ ├── package.json
│ │ │ └── pnpm-lock.yaml
│ │ ├─> withProdAndDevDeps
│ │ │ └── package.json
│ │ ├─> withYarnLock
│ │ │ ├── package.json
│ │ │ └── yarn.lock
│ │ ├─> withoutDeps
│ │ │ └── package.json
│ │ ├─> withoutDevDeps
│ │ │ └── package.json
│ │ └─> withoutProdDeps
│ │ └── package.json
│ ├─> suites
│ │ └─> integration
│ │ ├── auto.test.ts
│ │ ├── npm.test.ts
│ │ ├── pnpm.test.ts
│ │ └── yarn.test.ts
│ └─> utils
│ ├── mockExecuteCommand.ts
│ └── paths.ts
├── tsconfig.json
├── typedoc.cjs
└── typedoc.dev.cjs
Make sure that you have all the dependencies installed
To transpile the typescript code
$ pnpm transpileThe transpiled code will be in the dist folder.
To bundle the library with esbuild:
$ pnpm bundleThe bundled code will be in the bundled folder.