svecchiator
v4.0.5
Published
An npm module to brutally update a Node.js project's dependencies
Downloads
56
Maintainers
Readme
svecchiator
An npm module to brutally update a Node.js project's dependencies
The name
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.
How does it work
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
.
Install
To install svecchiator as a local module:
$ npm install svecchiator
To install svecchiator as a global module:
$ npm install -g svecchiator
Usage (local module)
Upgrade everything
Simple:
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();
Usage (global module)
Simple
$ svecchia
This will uninstall and install again all the deps and dev deps of the current dir project.
Only dev deps and with another project dir
$ svecchia --dev --source ./my-project
This will uninstall and install again only the dev deps of the project in ./my-project
.
Exclude packages
$ svecchia -e eslint -e dree
This will exclude the packages dree
and eslint
Other package managers
$ svecchia --package-manager pnpm
This will use pnpm
instead of npm
to uninstall and install the packages.
More help
$ svecchiator --help
This will show the help of the command.
Code completion
In case you wanted to add the code completion for cli commands, you can use the following command:
$ svecchia completion
It 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 >> ~/.bashrc
API
Online documentation
The documentation generated with TypeDoc is available in this site. There is also a more specific version for development in this site.
scan
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
,pnpm
oryarn
.
Project structure
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
Development
Make sure that you have all the dependencies installed
Transpile
To transpile the typescript code
$ pnpm transpile
The transpiled code will be in the dist
folder.
Bundle
To bundle the library with esbuild:
$ pnpm bundle
The bundled code will be in the bundled
folder.