@aboe026/update-dependencies

1.1.0 • Public • Published

node-update-dependencies

build coverage

A tool to update/upgrade dependencies managed by either NPM or Yarn.

Install

If your project uses NPM as a package manager, install with

npm install @aboe026/update-dependencies --save-dev

If your project uses Yarn as a package manager, install with

yarn add @aboe026/update-dependencies --dev

Usage

Add the following to the script section of your package.json

"update": "update-dependencies npm"

for NPM projects or

"update": "update-dependencies yarn"

for Yarn projects.

It can also be called directly through command line with either

npx update-dependencies npm

or

yarn dlx update-dependencies yarn

Command Line Interface

update-dependencies [command]

Commands:
  update-dependencies npm   Update packages for a project with NPM as the
                            package manager
  update-dependencies yarn  Update packages for a project with Yarn as the
                            package manager

Options:
      --help     Show help                                             [boolean]
      --version  Show version number                                   [boolean]
  -c, --config   Path to configuration file                             [string]
  -i, --install  Whether or not package updates should be installed
                                                       [boolean] [default: true]

Configuration File

Configuration can also be placed in a configuration file. Files are found using cosmiconfig, so the following files are picked up by default:

package.json
.dependency-updatesrc
.dependency-updatesrc.json`,
.dependency-updatesrc.yaml`,
.dependency-updatesrc.yml
.dependency-updatesrc.js
.dependency-updatesrc.mjs
.dependency-updatesrc.cjs
.config/dependency-updatesrc
.config/dependency-updatesrc.json
.config/dependency-updatesrc.yaml
.config/dependency-updatesrc.yml
.config/dependency-updatesrc.js
.config/dependency-updatesrc.cjs
dependency-updates.config.js
dependency-updates.config.mjs
dependency-updates.config.cjs

You can also use the --config flag to reference a file of any name.


Development

Prerequisites

  • NodeJS

  • Yarn

  • VSCode

    • To enable Editor SDK, run

      yarn dlx @yarnpkg/sdks vscode

      Then in TypeScript file, simultaneously press

      ctrl + shift + p

      and choose option

      Select TypeScript Version

      then select value

      Use Workspace Version

Install Dependencies

To install dependencies, run

yarn install

Start

To run code from non-built source code, run

yarn start

Build

To build the source code into transpiled javascript, run

yarn build

Watch

To automatically rebuild on file changes, run

yarn watch

Clean

To remove any previously built code, run

yarn clean

Run

To run transpiled javascript bundles, run:

yarn run-built

or directly with

node executable.js

Or through the bin command with

update-dependencies

Lint

to check code for programmatic or stylistic problems, run

yarn lint

To automatically fix lint problems, run

yarn lint-fix

Test

To test the project for regressions, run

npm test

This will lint the project, then run unit and e2e tests.

Test execution can be configured with the following environment variables:

Name Required Default Description Example(s)
TEST_RESULT_NAME No If specified, will record test results to the given file name and collect coverage. unit

Unit Tests

Unit tests are for stateless logic tests on small, contained parts of the code base (ideally not reliant on/mock anything outside their scope), and can be run with

yarn test-unit

Note: To run a specific test, execute

yarn test-unit -t 'test name'

With spaces separating describe blocks and test names

End to End Tests

End to End (E2E) Tests run against the final, distributable executable and are meant to test overarching scenarios of the tool to simulate as close as possible the real interactions and use/edge cases.

They required code to be built, and can be run with

yarn test:e2e

Note: To run a specific test, execute

yarn test-e2e -t 'test name'

With spaces separating describe blocks and test names

The E2E tests spin up a private NPM registry in memory using verdaccio.

Test execution can be configured with the following environment variables:

Name Required Default Description Example(s)
E2E_NPM_REGISTRY_PORT Yes 4873 The port to run the NPM registry used by E2E tests. 5984
E2E_TEMP_WORK_DIR Yes test/e2e/.temp-work-dir The directory that E2E tests should create temporary projects for tests. /tmp/node-update-dependencies-e2e

Code Coverage

Code coverage can be generated by running

yarn test-unit-ci

There is no code coverage for e2e tests as those do not run against source code, but transpiled binaries.

To view code coverage in the browser, run

yarn coverage-view

Upgrade Yarn

To upgrade the version of yarn used in the project, run

yarn set version latest

then install to have the change picked up.

Readme

Keywords

none

Package Sidebar

Install

npm i @aboe026/update-dependencies

Weekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

38.9 kB

Total Files

11

Last publish

Collaborators

  • aboe026