+2
-2
| { | ||
| "name": "mrm-core", | ||
| "version": "6.0.0", | ||
| "version": "6.1.1", | ||
| "description": "Utilities to make tasks for Mrm", | ||
@@ -57,3 +57,3 @@ "author": { | ||
| ], | ||
| "gitHead": "44712dd9ef082e7d95dd1e4d5794904119038a48" | ||
| "gitHead": "365057e0cab0c2de0e87d086f114dcf0c0dc9d18" | ||
| } |
+4
-2
@@ -63,3 +63,3 @@ <!-- Core utils --> | ||
| ``` | ||
| npm install --save-dev mrm-core | ||
| npm install mrm-core | ||
| ``` | ||
@@ -321,3 +321,3 @@ | ||
| ### Install and uninstall npm or Yarn packages | ||
| ### Install and uninstall npm, Yarn, or pnpm packages | ||
@@ -356,2 +356,4 @@ Installs npm package(s) and saves them to `package.json` if they aren’t installed yet or not satisfying range. | ||
| With Yarn Berry, pass `yarnBerry: true` and for pnpm, pass `pnpm: true`. | ||
| ### Utilities | ||
@@ -358,0 +360,0 @@ |
@@ -84,2 +84,13 @@ jest.mock('fs'); | ||
| it('should install a pnpm packages to devDependencies', () => { | ||
| const spawn = jest.fn(); | ||
| createPackageJson({}, {}); | ||
| install(modules, { pnpm: true }, spawn); | ||
| expect(spawn).toBeCalledWith( | ||
| expect.stringMatching(/pnpm(\.cmd)?/), | ||
| ['install', '--save-dev', 'eslint@latest', 'babel-core@latest'], | ||
| options | ||
| ); | ||
| }); | ||
| it('should install an npm packages to dependencies', () => { | ||
@@ -123,2 +134,13 @@ const spawn = jest.fn(); | ||
| it('should install a pnpm packages to dependencies', () => { | ||
| const spawn = jest.fn(); | ||
| createPackageJson({}, {}); | ||
| install(modules, { dev: false, pnpm: true }, spawn); | ||
| expect(spawn).toBeCalledWith( | ||
| expect.stringMatching(/pnpm(\.cmd)?/), | ||
| ['install', '--save', 'eslint@latest', 'babel-core@latest'], | ||
| options | ||
| ); | ||
| }); | ||
| it('should run Yarn if project is already using Yarn', () => { | ||
@@ -366,3 +388,3 @@ const spawn = jest.fn(); | ||
| describe('uninstall()', () => { | ||
| it('should uninstall an npm packages from devDependencies', () => { | ||
| it('should uninstall npm packages from devDependencies', () => { | ||
| const spawn = jest.fn(); | ||
@@ -401,8 +423,25 @@ createPackageJson( | ||
| it('should uninstall an npm packages from dependencies', () => { | ||
| it('should uninstall pnpm packages from devDependencies', () => { | ||
| const spawn = jest.fn(); | ||
| createPackageJson( | ||
| {}, | ||
| { | ||
| eslint: '*', | ||
| 'babel-core': '*', | ||
| } | ||
| ); | ||
| uninstall(modules, { pnpm: true }, spawn); | ||
| expect(spawn).toBeCalledWith( | ||
| expect.stringMatching(/npm(\.cmd)?/), | ||
| ['uninstall', '--save-dev', 'eslint', 'babel-core'], | ||
| options | ||
| ); | ||
| }); | ||
| it('should uninstall npm packages from dependencies', () => { | ||
| const spawn = jest.fn(); | ||
| createPackageJson( | ||
| { | ||
| eslint: '*', | ||
| 'babel-core': '*', | ||
| }, | ||
@@ -409,0 +448,0 @@ {} |
@@ -35,3 +35,3 @@ // @ts-check | ||
| addBadge(imageUrl, linkUrl, altText) { | ||
| if (!content) { | ||
| if (!file.exists()) { | ||
| throw new MrmError(`Can’t add badge: file “${filename}” not found.`); | ||
@@ -38,0 +38,0 @@ } |
+32
-3
@@ -18,2 +18,3 @@ // @ts-check | ||
| * @property {boolean} [yarnBerry] | ||
| * @property {boolean} [pnpm] | ||
| * @property {Record<string, string>} [versions] | ||
@@ -105,2 +106,4 @@ */ | ||
| return runYarn; | ||
| } else if (options.pnpm || isUsingPnpm()) { | ||
| return runPnpm; | ||
| } else { | ||
@@ -112,3 +115,3 @@ return runNpm; | ||
| /** | ||
| * Install given npm packages | ||
| * Install or uninstall given npm packages | ||
| * | ||
@@ -132,3 +135,3 @@ * @param {string[]} deps | ||
| /** | ||
| * Install given Yarn packages | ||
| * Install or uninstall given Yarn packages | ||
| * | ||
@@ -159,3 +162,3 @@ * This will use yarn's `--ignore-workspace-root-check` to allow additions of packages | ||
| /** | ||
| * Install given Yarn@berry packages | ||
| * Install or uninstall given Yarn@berry packages | ||
| * | ||
@@ -179,2 +182,21 @@ * @param {string[]} deps | ||
| /** | ||
| * Install or uninstall given pnpm packages | ||
| * | ||
| * @param {string[]} deps | ||
| * @param {RunOptions} [options] | ||
| * @param {Function} [exec] | ||
| */ | ||
| function runPnpm(deps, options = {}, exec) { | ||
| const args = [ | ||
| options.remove ? 'uninstall' : 'install', | ||
| options.dev ? '--save-dev' : '--save', | ||
| ].concat(deps); | ||
| return execCommand(exec, 'pnpm', args, { | ||
| stdio: options.stdio === undefined ? 'inherit' : options.stdio, | ||
| cwd: options.cwd, | ||
| }); | ||
| } | ||
| /** | ||
| * Add version or latest to package name | ||
@@ -288,2 +310,9 @@ * @param {string} dep | ||
| /* | ||
| * Is project using pnpm? | ||
| */ | ||
| function isUsingPnpm() { | ||
| return fs.existsSync('pnpm-lock.yaml'); | ||
| } | ||
| module.exports = { | ||
@@ -290,0 +319,0 @@ install, |
+2
-0
@@ -91,2 +91,4 @@ interface File { | ||
| yarn?: boolean; | ||
| yarnBerry?: boolean; | ||
| pnpm?: boolean; | ||
| versions?: Dependencies; | ||
@@ -93,0 +95,0 @@ } |
-176
| # Change Log | ||
| All notable changes to this project will be documented in this file. | ||
| See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
| # [6.0.0](https://github.com/sapegin/mrm/compare/mrm-core@5.0.0...mrm-core@6.0.0) (2021-04-07) | ||
| ### Features | ||
| * Autoload tasks and presets ([#99](https://github.com/sapegin/mrm/issues/99)) ([b866455](https://github.com/sapegin/mrm/commit/b866455f98c72b7698ec7cc5fb277df3b3f9ce25)), closes [#97](https://github.com/sapegin/mrm/issues/97) | ||
| * Increase supported node version from 8 to 10 ([#138](https://github.com/sapegin/mrm/issues/138)) ([224c673](https://github.com/sapegin/mrm/commit/224c67332ee71b9e275dbea1435cd9088852ff6f)) | ||
| ### BREAKING CHANGES | ||
| * Node 8 or 9 are no longer supported, the minimum supported version is now 10.13. | ||
| * Mrm will no longer load globally installed tasks and presets but will autoload them directly from npm, similar to how npx works (we're actually using npx under the hood). | ||
| # [5.0.0](https://github.com/sapegin/mrm/compare/mrm-core@4.7.0...mrm-core@5.0.0) (2021-04-01) | ||
| ### Features | ||
| * **lint-staged:** Use husky 6 ([#152](https://github.com/sapegin/mrm/issues/152)) ([133fe08](https://github.com/sapegin/mrm/commit/133fe08b0895b0c994c55d39e0f43af0672fe1f9)) | ||
| ### BREAKING CHANGES | ||
| * **lint-staged:** The lint-staged task will migrate simple-git-hooks back to husky 6, the existing simple-git-hooks dependency will be removed. | ||
| # [4.7.0](https://github.com/sapegin/mrm/compare/mrm-core@4.6.0...mrm-core@4.7.0) (2021-02-25) | ||
| ### Features | ||
| * Add more fields to package.json ([#134](https://github.com/sapegin/mrm/issues/134)) ([d80840a](https://github.com/sapegin/mrm/commit/d80840a5e771976ef38cdf8a3b535a412e1097f6)) | ||
| # [4.6.0](https://github.com/sapegin/mrm/compare/mrm-core@4.5.0...mrm-core@4.6.0) (2021-02-09) | ||
| ### Features | ||
| * **readme:** Make contributing conditional by `includeContributing` option and allow `contributingFile` option for a name ([#123](https://github.com/sapegin/mrm/issues/123)) ([481a316](https://github.com/sapegin/mrm/commit/481a3161bc9c1a778a27b73cd746f4a4d756a41d)) | ||
| # [4.5.0](https://github.com/sapegin/mrm/compare/mrm-core@4.4.0...mrm-core@4.5.0) (2021-02-08) | ||
| ### Features | ||
| * **core:** Allow to use yarn@berry ([#110](https://github.com/sapegin/mrm/issues/110)) ([5c14395](https://github.com/sapegin/mrm/commit/5c14395e8ca7e76c8bdf135cd0211ac42fff12c5)) | ||
| # [4.4.0](https://github.com/sapegin/mrm/compare/mrm-core@4.3.0...mrm-core@4.4.0) (2021-02-03) | ||
| ### Features | ||
| * Allow to specify Yaml version ([#113](https://github.com/sapegin/mrm/issues/113)) ([e4b203e](https://github.com/sapegin/mrm/commit/e4b203eee58b82a196b9b2bd3ef8e3124a1f36db)), closes [#112](https://github.com/sapegin/mrm/issues/112) | ||
| # [4.3.0](https://github.com/sapegin/mrm/compare/mrm-core@4.2.2...mrm-core@4.3.0) (2020-11-04) | ||
| ### Features | ||
| * **core:** Add markdown.removeBadge() method ([7c6386c](https://github.com/sapegin/mrm/commit/7c6386c55036515ea79549da31dff51f59b30719)) | ||
| ## [4.2.2](https://github.com/sapegin/mrm/compare/mrm-core@4.2.1...mrm-core@4.2.2) (2020-10-27) | ||
| **Note:** Version bump only for package mrm-core | ||
| ## [4.2.1](https://github.com/sapegin/mrm/compare/mrm-core@4.2.0...mrm-core@4.2.1) (2020-10-27) | ||
| **Note:** Version bump only for package mrm-core | ||
| # [4.2.0](https://github.com/sapegin/mrm/compare/mrm-core@4.1.3...mrm-core@4.2.0) (2020-10-27) | ||
| ### Features | ||
| * **mrm-core:** Replace js-yaml with yaml ([ca72d6b](https://github.com/sapegin/mrm/commit/ca72d6b8fa94a627285db2454287e550985d1fc7)) | ||
| ## [4.1.3](https://github.com/sapegin/mrm/compare/mrm-core@4.1.2...mrm-core@4.1.3) (2020-10-26) | ||
| ### Bug Fixes | ||
| * **mrm-core:** Fix adding packages to Yarn workspaces ([#100](https://github.com/sapegin/mrm/issues/100)) ([4c23e05](https://github.com/sapegin/mrm/commit/4c23e05087470b3f773c965420bdddc28bf2a5bd)) | ||
| ## [4.1.2](https://github.com/sapegin/mrm/compare/mrm-core@4.1.1...mrm-core@4.1.2) (2020-08-19) | ||
| ### Bug Fixes | ||
| * Handle non-registry installs ([#90](https://github.com/sapegin/mrm/issues/90)) ([2b29a76](https://github.com/sapegin/mrm/commit/2b29a765fe8e4c81a4c968e281e3000d78da500b)), closes [#89](https://github.com/sapegin/mrm/issues/89) | ||
| ## [4.1.1](https://github.com/sapegin/mrm/compare/mrm-core@4.1.0...mrm-core@4.1.1) (2020-06-08) | ||
| ### Bug Fixes | ||
| * TypeScript types: add missing set() function signature for json ([#80](https://github.com/sapegin/mrm/issues/80)) ([6c22a8d](https://github.com/sapegin/mrm/commit/6c22a8ded59d3396375ce3e3def532df066540b4)) | ||
| # [4.1.0](https://github.com/sapegin/mrm/compare/mrm-core@4.0.3...mrm-core@4.1.0) (2020-04-07) | ||
| ### Features | ||
| * Finish interactive mode ([#70](https://github.com/sapegin/mrm/issues/70)) ([52cbb85](https://github.com/sapegin/mrm/commit/52cbb85924d37455cd37d0ab4c1b552bbe0d41ab)) | ||
| ## [4.0.3](https://github.com/sapegin/mrm/compare/mrm-core@4.0.2...mrm-core@4.0.3) (2020-03-20) | ||
| **Note:** Version bump only for package mrm-core | ||
| ## 4.0.2 (2019-12-12) | ||
| **Note:** Version bump only for package mrm-core |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
3852
1.69%412
0.49%120547
-2.62%50
-1.96%