diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index f4ffd4b..0000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -build -coverage -bin \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 5e7f1b8..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - plugins: ['@typescript-eslint'], - extends: ['standard', 'eslint:recommended', 'plugin:@typescript-eslint/recommended'], - env: { - es2021: true, - node: true - }, - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module' - }, - rules: { - '@typescript-eslint/no-unused-vars': 'error', - '@typescript-eslint/consistent-type-definitions': ['error', 'type'] - } - -} diff --git a/.vitest/helpers.ts b/.vitest/helpers.ts index 2c5d869..9045eb0 100644 --- a/.vitest/helpers.ts +++ b/.vitest/helpers.ts @@ -4,7 +4,7 @@ export const testCommandResult = (command: string): string => { try { const child = execSync(command) return child.toString().trim() - } catch (error) { + } catch { return '' } } @@ -13,7 +13,7 @@ export const testCommandArray = (command: string): string[] => { try { const child = execSync(command) return child.toString().split('\n') - } catch (error) { + } catch { return [''] } } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b808bb..b683b8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog + + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), @@ -7,6 +16,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.0.0] - 2026-06-06 + +### ⚠️ BREAKING CHANGES + +- Node.js Requirement: The minimum supported version is now Node.js v20. This change aligns with the underlying updates in the CLI engine and modern security standards. + +### Added + +- Status Command: Introduced `swpm status` (alias `s`) to show current configuration in different formats (`json`, `json:path`, `plain:path`). Especially useful for CI tools and scripts. +- Formal validation for the latest Node.js LTS releases. + +### Changed + +- Major CLI Engine Upgrade: Migrated yargs from v17.7.2 to v18.0.0, providing better performance and modern ESM argument parsing. +- Dependency Refresh: Comprehensive update of core libraries including chalk, update-notifier, semver, and open to ensure compatibility with the new major version. +- Typing System: Updated @types/yargs to v17.0.35 for improved developer experience and type safety. + +### Fixed + +- Security & Vulnerabilities: Applied multiple patches identified by Snyk across the dependency tree. +- Parser Consistency: Refined the internal command mapping to ensure that flags and aliases behave consistently across all supported package managers (npm, pnpm, yarn, and bun) under the new v18 parser. + ## [2.7.0] - 2026-05-02 ### Added @@ -622,8 +653,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `pin`, `use`, `get`, `see` and `info` options - Pinned validation +[unreleased]: https://github.com/deinsoftware/swpm/compare/v3.0.0...HEAD +[3.0.0]: https://github.com/deinsoftware/swpm/compare/v2.7.0...v3.0.0 [2.7.0]: https://github.com/deinsoftware/swpm/compare/v2.6.0...v2.7.0 -[unreleased]: https://github.com/deinsoftware/swpm/compare/v2.8.0...HEAD [2.6.0]: https://github.com/deinsoftware/swpm/compare/v2.5.2...v2.6.0 [2.5.2]: https://github.com/deinsoftware/swpm/compare/v2.5.1...v2.5.2 [2.5.1]: https://github.com/deinsoftware/swpm/compare/v2.5.0...v2.5.1 diff --git a/CHEATSHEET.md b/CHEATSHEET.md index e28f061..53e1404 100644 --- a/CHEATSHEET.md +++ b/CHEATSHEET.md @@ -1,63 +1,63 @@ # CLI Packages -This is a cheat sheet that you can use as a handy reference for [npm](https://www.npmjs.com/), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/) and [bun](https://bun.sh/) commands. +This is a cheat sheet that you can use as a handy reference for [npm](https://www.npmjs.com/), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) and [deno](https://deno.com/) commands. > Note: `` follow this structure `` ## Package Commands -| TODO | command | swpm | npm | yarn | yarn (berry) | pnpm | bun | -| ---- | ------------------------------------------- | --------------------------------------- | --------------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ------------------------------------ | -| [ ] | clean cache | | `npm cache clean` | `yarn cache clean` | `yarn cache clean` | N/A | `bun pm cache rm` | -| [x] | install from `package.json` | `swpm install` | `npm install` | `yarn [install]` | `yarn [install]` | `pnpm install` | `bun install` | -| [x] | don't read or generate a lockfile | `swpm install --package-lock` | `npm install --no-package-lock` | `yarn install --no-lockfile` | `yarn install --no-lockfile` | N/A | `bun install --no-save` | -| [ ] | don't generate a lockfile | | | `yarn install --pure-lockfile` | `yarn install --pure-lockfile` | | N/A | -| [x] | lockfile is not updated | `swpm install --frozen` | `npm ci` | `yarn install --frozen-lockfile` | `yarn install --immutable` | `pnpm install --frozen-lockfile` | `bun install --frozen-lockfile` | -| [x] | add package | `swpm add [--global]` | `npm install [--global]` | `yarn [global] add ` | `yarn [global] add ` | `pnpm add [--global]` | `bun add [--global]` | -| [x] | add package as `dependencies` | `swpm add ` | `npm install ` | `yarn add ` | `yarn add ` | `pnpm add ` | `bun add ` | -| [x] | add package as `devDependencies` | `swpm add --save-dev` | `npm install --save-dev` | `yarn add --dev` | `yarn add --dev` | `pnpm add --save-dev` | `bun add --dev` | -| [x] | add package as `optionalDependencies` | `swpm add --save-optional` | `npm install --save-optional` | `yarn add --optional` | `yarn add --optional` | `pnpm add --save-optional` | `bun add --optional` | -| [x] | add package as `peerDependencies` | `swpm add --save-peer` | `npm install --save-peer` | `yarn add --peer` | `yarn add --peer` | `pnpm add --save-peer` | N/A | -| [x] | add exact version | `swpm add --save-exact` | `npm install --save-exact` | `yarn add --exact` | `yarn add --exact` | `pnpm add --save-exact` | `bun add --exact` | -| [x] | remove package | `swpm remove [] [--global]` | `npm uninstall [--global]` | `yarn [global] remove ` | `yarn [global] remove ` | `pnpm uninstall [--global]` | `bun remove [] [--global]` | -| [x] | remove package as `dependencies` | `swpm remove ` | `npm uninstall ` | `yarn remove ` | `yarn remove ` | `pnpm uninstall ` | `bun remove ` | -| [x] | remove package as `devDependencies` | `swpm remove --save-dev` | `npm uninstall --save-dev` | `yarn remove --dev` | `yarn remove --dev` | `pnpm uninstall --save-dev` | `bun remove --dev` | -| [x] | remove package as `optionalDependencies` | `swpm remove --save-optional` | `npm uninstall --save-optional` | `yarn remove --optional` | `yarn remove --optional` | `pnpm uninstall --save-optional` | `bun remove --optional` | -| [x] | remove package as `peerDependencies` | `swpm remove --save-peer` | `npm uninstall --save-peer` | `yarn remove --peer` | `yarn remove --peer` | `pnpm uninstall --save-peer` | N/A | -| [x] | update package (no `package.json`) | `swpm update [] [--global]` | `npm update [] [--global]` | `yarn [global] upgrade []` | `yarn [global] semver up []` | `pnpm update [] [--global]` | N/A | -| [x] | upgrade package on `package.json` | `swpm upgrade [--global]` | `npm add @latest [--global]` | `yarn [global] upgrade --latest` | `yarn [global] up ` | `pnpm update --latest [--global]` | N/A | -| [x] | upgrade interactive | `swpm interactive` | N/A | `yarn upgrade-interactive` | `yarn upgrade-interactive` | `pnpm upgrade --interactive` | N/A | -| [ ] | list all package at the top level | | `npm list --depth 0 [--global]` | `yarn [global] list --depth 0` | `yarn [global] list --depth 0` | `pnpm list --depth 0 [--global]` | `bun pm ls` | -| [ ] | audit vulnerable dependencies | | `npm audit [fix]` | `yarn audit` | `yarn audit` | `pnpm audit [--fix]` | | +| TODO | command | swpm | npm | yarn | yarn (berry) | pnpm | bun | deno | +| ---- | ------------------------------------------- | --------------------------------------- | --------------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ------------------------------------ | ------------------------------------ | +| [ ] | clean cache | | `npm cache clean` | `yarn cache clean` | `yarn cache clean` | N/A | `bun pm cache rm` | `deno clean` | +| [x] | install from `package.json` | `swpm install` | `npm install` | `yarn [install]` | `yarn [install]` | `pnpm install` | `bun install` | `deno install` | +| [x] | don't read or generate a lockfile | `swpm install --package-lock` | `npm install --no-package-lock` | `yarn install --no-lockfile` | `yarn install --no-lockfile` | N/A | `bun install --no-save` | `deno install --no-lock` | +| [ ] | don't generate a lockfile | | | `yarn install --pure-lockfile` | `yarn install --pure-lockfile` | | N/A | N/A | +| [x] | lockfile is not updated | `swpm install --frozen` | `npm ci` | `yarn install --frozen-lockfile` | `yarn install --immutable` | `pnpm install --frozen-lockfile` | `bun install --frozen-lockfile` | `deno install --frozen` | +| [x] | add package | `swpm add [--global]` | `npm install [--global]` | `yarn [global] add ` | `yarn [global] add ` | `pnpm add [--global]` | `bun add [--global]` | `deno add [-g]` | +| [x] | add package as `dependencies` | `swpm add ` | `npm install ` | `yarn add ` | `yarn add ` | `pnpm add ` | `bun add ` | `deno add ` | +| [x] | add package as `devDependencies` | `swpm add --save-dev` | `npm install --save-dev` | `yarn add --dev` | `yarn add --dev` | `pnpm add --save-dev` | `bun add --dev` | `deno add --dev ` | +| [x] | add package as `optionalDependencies` | `swpm add --save-optional` | `npm install --save-optional` | `yarn add --optional` | `yarn add --optional` | `pnpm add --save-optional` | `bun add --optional` | `deno add --optional ` | +| [x] | add package as `peerDependencies` | `swpm add --save-peer` | `npm install --save-peer` | `yarn add --peer` | `yarn add --peer` | `pnpm add --save-peer` | N/A | `deno add --peer ` | +| [x] | add exact version | `swpm add --save-exact` | `npm install --save-exact` | `yarn add --exact` | `yarn add --exact` | `pnpm add --save-exact` | `bun add --exact` | N/A | +| [x] | remove package | `swpm remove [] [--global]` | `npm uninstall [--global]` | `yarn [global] remove ` | `yarn [global] remove ` | `pnpm uninstall [--global]` | `bun remove [] [--global]` | `deno remove [-g]` | +| [x] | remove package as `dependencies` | `swpm remove ` | `npm uninstall ` | `yarn remove ` | `yarn remove ` | `pnpm uninstall ` | `bun remove ` | `deno remove ` | +| [x] | remove package as `devDependencies` | `swpm remove --save-dev` | `npm uninstall --save-dev` | `yarn remove --dev` | `yarn remove --dev` | `pnpm uninstall --save-dev` | `bun remove --dev` | `deno remove ` | +| [x] | remove package as `optionalDependencies` | `swpm remove --save-optional` | `npm uninstall --save-optional` | `yarn remove --optional` | `yarn remove --optional` | `pnpm uninstall --save-optional` | `bun remove --optional` | `deno remove ` | +| [x] | remove package as `peerDependencies` | `swpm remove --save-peer` | `npm uninstall --save-peer` | `yarn remove --peer` | `yarn remove --peer` | `pnpm uninstall --save-peer` | N/A | `deno remove ` | +| [x] | update package (no `package.json`) | `swpm update [] [--global]` | `npm update [] [--global]` | `yarn [global] upgrade []` | `yarn [global] semver up []` | `pnpm update [] [--global]` | N/A | `deno outdated --update` | +| [x] | upgrade package on `package.json` | `swpm upgrade [--global]` | `npm add @latest [--global]` | `yarn [global] upgrade --latest` | `yarn [global] up ` | `pnpm update --latest [--global]` | N/A | `deno add ` | +| [x] | upgrade interactive | `swpm interactive` | N/A | `yarn upgrade-interactive` | `yarn upgrade-interactive` | `pnpm upgrade --interactive` | N/A | N/A | +| [ ] | list all package at the top level | | `npm list --depth 0 [--global]` | `yarn [global] list --depth 0` | `yarn [global] list --depth 0` | `pnpm list --depth 0 [--global]` | `bun pm ls` | `deno info` | +| [ ] | audit vulnerable dependencies | | `npm audit [fix]` | `yarn audit` | `yarn audit` | `pnpm audit [--fix]` | | TBA | ## Shared Commands Use the same command structure between package managers. -| TODO | command | swpm | npm | yarn | yarn (berry) | pnpm | bun | -| ---- | -------------------------------------- | -------------------------------------------- | ---------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -------------------------------- | -| [x] | init or create | `swpm init` | `npm init` | `yarn init` | `yarn init` | `pnpm init` | `bun init` | -| [x] | login/logout | `swpm ` | `npm ` | `yarn ` | `yarn ` | `pnpm ` | TBA | -| [x] | run scripts | `swpm run