From e326f36d00ef4f3e87d70f09ca9a7ba44fecb4b0 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Mon, 6 Jan 2020 22:27:41 +0200 Subject: [PATCH] refactor: move createLatestManifestGetter move createLatestManifestGetter to plugin-commands-outdated --- packages/cli-utils/package.json | 6 +--- packages/cli-utils/src/index.ts | 1 - packages/cli-utils/test/index.ts | 1 - .../plugin-commands-outdated/package.json | 5 +++ .../src/createLatestManifestGetter.ts | 0 .../plugin-commands-outdated/src/outdated.ts | 3 +- .../test/getLatestManifest.spec.ts | 2 +- .../plugin-commands-outdated/test/index.ts | 1 + pnpm-lock.yaml | 34 ++++++++++--------- 9 files changed, 28 insertions(+), 25 deletions(-) delete mode 100644 packages/cli-utils/test/index.ts rename packages/{cli-utils => plugin-commands-outdated}/src/createLatestManifestGetter.ts (100%) rename packages/{cli-utils => plugin-commands-outdated}/test/getLatestManifest.spec.ts (95%) diff --git a/packages/cli-utils/package.json b/packages/cli-utils/package.json index fb387c19b1..960d4d0615 100644 --- a/packages/cli-utils/package.json +++ b/packages/cli-utils/package.json @@ -15,7 +15,7 @@ "lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts", "tsc": "rimraf lib && tsc", "pretest": "rimraf node_modules/.bin/pnpm", - "test": "pnpm run tsc && ts-node test --type-check", + "test": "pnpm run tsc", "prepublishOnly": "pnpm run tsc" }, "repository": "https://github.com/pnpm/pnpm/blob/master/packages/cli-utils", @@ -32,22 +32,18 @@ "@pnpm/cli-utils": "link:", "@pnpm/logger": "^3.1.0", "@pnpm/types": "workspace:4.0.0", - "@types/lru-cache": "^5.1.0", "@types/ramda": "^0.26.38", "pnpm": "link:../pnpm", "rimraf": "3.0.0" }, "dependencies": { "@pnpm/config": "workspace:6.0.0", - "@pnpm/default-resolver": "workspace:6.0.3", "@pnpm/error": "workspace:1.0.0", "@pnpm/package-is-installable": "workspace:4.0.1", "@pnpm/read-project-manifest": "workspace:2.0.1", "@pnpm/utils": "workspace:0.12.2", "chalk": "3.0.0", "load-json-file": "6.2.0", - "lru-cache": "5.1.1", - "mem": "6.0.1", "ramda": "0.26.1", "version-selector-type": "2.0.1" }, diff --git a/packages/cli-utils/src/index.ts b/packages/cli-utils/src/index.ts index 52e44a4423..75d4d297cc 100644 --- a/packages/cli-utils/src/index.ts +++ b/packages/cli-utils/src/index.ts @@ -4,7 +4,6 @@ import packageManager from './pnpmPkgJson' export { getConfig, getSaveType, packageManager } -export * from './createLatestManifestGetter' export * from './getPinnedVersion' export * from './packageIsInstallable' export * from './readProjectManifest' diff --git a/packages/cli-utils/test/index.ts b/packages/cli-utils/test/index.ts deleted file mode 100644 index cd7dd7754b..0000000000 --- a/packages/cli-utils/test/index.ts +++ /dev/null @@ -1 +0,0 @@ -import './getLatestManifest.spec' diff --git a/packages/plugin-commands-outdated/package.json b/packages/plugin-commands-outdated/package.json index 97a924b2ee..f6d60086ea 100644 --- a/packages/plugin-commands-outdated/package.json +++ b/packages/plugin-commands-outdated/package.json @@ -39,6 +39,7 @@ "@pnpm/prepare": "workspace:0.0.0", "@pnpm/types": "workspace:4.0.0", "@types/common-tags": "1.8.0", + "@types/lru-cache": "^5.1.0", "@types/mz": "^2.7.0", "@types/ramda": "^0.26.38", "@types/table": "^4.0.7", @@ -52,6 +53,7 @@ "@pnpm/cli-utils": "workspace:0.2.5", "@pnpm/common-cli-options-help": "workspace:0.1.2", "@pnpm/config": "workspace:6.0.0", + "@pnpm/default-resolver": "workspace:6.0.3", "@pnpm/error": "workspace:1.0.0", "@pnpm/lockfile-file": "workspace:3.0.1", "@pnpm/matcher": "workspace:1.0.0", @@ -59,8 +61,11 @@ "@pnpm/outdated": "workspace:6.0.5", "@pnpm/semver-diff": "1.0.2", "@pnpm/store-path": "2.1.1", + "@pnpm/utils": "workspace:0.12.2", "chalk": "3.0.0", "common-tags": "1.8.0", + "lru-cache": "5.1.1", + "mem": "6.0.1", "ramda": "0.26.1", "render-help": "0.0.0", "table": "5.4.6", diff --git a/packages/cli-utils/src/createLatestManifestGetter.ts b/packages/plugin-commands-outdated/src/createLatestManifestGetter.ts similarity index 100% rename from packages/cli-utils/src/createLatestManifestGetter.ts rename to packages/plugin-commands-outdated/src/createLatestManifestGetter.ts diff --git a/packages/plugin-commands-outdated/src/outdated.ts b/packages/plugin-commands-outdated/src/outdated.ts index 05bec9dd7f..ab4fcd34e5 100644 --- a/packages/plugin-commands-outdated/src/outdated.ts +++ b/packages/plugin-commands-outdated/src/outdated.ts @@ -1,4 +1,4 @@ -import { createLatestManifestGetter, docsUrl, readProjectManifestOnly, TABLE_OPTIONS } from '@pnpm/cli-utils' +import { docsUrl, readProjectManifestOnly, TABLE_OPTIONS } from '@pnpm/cli-utils' import { FILTERING, OPTIONS, UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help' import { Config, types as allTypes } from '@pnpm/config' import PnpmError from '@pnpm/error' @@ -25,6 +25,7 @@ import renderHelp = require('render-help') import stripAnsi = require('strip-ansi') import { table } from 'table' import wrapAnsi = require('wrap-ansi') +import { createLatestManifestGetter } from './createLatestManifestGetter' import outdatedRecursive from './recursive' import { DEFAULT_COMPARATORS, diff --git a/packages/cli-utils/test/getLatestManifest.spec.ts b/packages/plugin-commands-outdated/test/getLatestManifest.spec.ts similarity index 95% rename from packages/cli-utils/test/getLatestManifest.spec.ts rename to packages/plugin-commands-outdated/test/getLatestManifest.spec.ts index fe1bfae2c2..8b6e1dec16 100644 --- a/packages/cli-utils/test/getLatestManifest.spec.ts +++ b/packages/plugin-commands-outdated/test/getLatestManifest.spec.ts @@ -1,6 +1,6 @@ -import { getLatestManifest } from '@pnpm/cli-utils' import { ResolveFunction } from '@pnpm/default-resolver' import test = require('tape') +import { getLatestManifest } from '../lib/createLatestManifestGetter' test('getLatestManifest()', async (t) => { t.plan(4) diff --git a/packages/plugin-commands-outdated/test/index.ts b/packages/plugin-commands-outdated/test/index.ts index e2d4d25aa5..e0ca8d2f69 100644 --- a/packages/plugin-commands-outdated/test/index.ts +++ b/packages/plugin-commands-outdated/test/index.ts @@ -11,6 +11,7 @@ import path = require('path') import stripAnsi = require('strip-ansi') import test = require('tape') import { promisify } from 'util' +import './getLatestManifest.spec' import './recursive' const copyFile = promisify(fs.copyFile) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 479090d8d7..988fe59da9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -85,41 +85,33 @@ importers: packages/cli-utils: dependencies: '@pnpm/config': 'link:../config' - '@pnpm/default-resolver': 'link:../default-resolver' '@pnpm/error': 'link:../error' '@pnpm/package-is-installable': 'link:../package-is-installable' '@pnpm/read-project-manifest': 'link:../read-project-manifest' '@pnpm/utils': 'link:../utils' chalk: 3.0.0 load-json-file: 6.2.0 - lru-cache: 5.1.1 - mem: 6.0.1 ramda: 0.26.1 version-selector-type: 2.0.1 devDependencies: '@pnpm/cli-utils': 'link:' '@pnpm/logger': 3.1.0 '@pnpm/types': 'link:../types' - '@types/lru-cache': 5.1.0 '@types/ramda': 0.26.39 pnpm: 'link:../pnpm' rimraf: 3.0.0 specifiers: '@pnpm/cli-utils': 'link:' '@pnpm/config': 'workspace:6.0.0' - '@pnpm/default-resolver': 'workspace:6.0.3' '@pnpm/error': 'workspace:1.0.0' '@pnpm/logger': ^3.1.0 '@pnpm/package-is-installable': 'workspace:4.0.1' '@pnpm/read-project-manifest': 'workspace:2.0.1' '@pnpm/types': 'workspace:4.0.0' '@pnpm/utils': 'workspace:0.12.2' - '@types/lru-cache': ^5.1.0 '@types/ramda': ^0.26.38 chalk: 3.0.0 load-json-file: 6.2.0 - lru-cache: 5.1.1 - mem: 6.0.1 pnpm: 'link:../pnpm' ramda: 0.26.1 rimraf: 3.0.0 @@ -237,7 +229,7 @@ importers: '@types/common-tags': 1.8.0 '@types/normalize-path': 3.0.0 '@types/pretty-time': 1.1.0 - '@types/ramda': ^0.26.39 + '@types/ramda': ^0.26.38 '@types/semver': ^6.2.0 '@zkochan/zen-push': 1.0.0 ansi-diff: 1.1.1 @@ -1375,7 +1367,7 @@ importers: '@pnpm/lockfile-file': 'workspace:3.0.1' '@pnpm/plugin-commands-audit': 'link:' '@pnpm/types': 'workspace:4.0.0' - '@types/ramda': ^0.26.39 + '@types/ramda': ^0.26.38 '@types/table': ^4.0.7 chalk: 3.0.0 ramda: 0.26.1 @@ -1564,6 +1556,7 @@ importers: '@pnpm/cli-utils': 'link:../cli-utils' '@pnpm/common-cli-options-help': 'link:../common-cli-options-help' '@pnpm/config': 'link:../config' + '@pnpm/default-resolver': 'link:../default-resolver' '@pnpm/error': 'link:../error' '@pnpm/lockfile-file': 'link:../lockfile-file' '@pnpm/matcher': 'link:../matcher' @@ -1571,8 +1564,11 @@ importers: '@pnpm/outdated': 'link:../outdated' '@pnpm/semver-diff': 1.0.2 '@pnpm/store-path': 2.1.1 + '@pnpm/utils': 'link:../utils' chalk: 3.0.0 common-tags: 1.8.0 + lru-cache: 5.1.1 + mem: 6.0.1 ramda: 0.26.1 render-help: 0.0.0 table: 5.4.6 @@ -1585,6 +1581,7 @@ importers: '@pnpm/prepare': 'link:../../privatePackages/prepare' '@pnpm/types': 'link:../types' '@types/common-tags': 1.8.0 + '@types/lru-cache': 5.1.0 '@types/mz': 2.7.0 '@types/ramda': 0.26.39 '@types/table': 4.0.7 @@ -1598,6 +1595,7 @@ importers: '@pnpm/common-cli-options-help': 'workspace:0.1.2' '@pnpm/config': 'workspace:6.0.0' '@pnpm/constants': 'workspace:3.0.0' + '@pnpm/default-resolver': 'workspace:6.0.3' '@pnpm/error': 'workspace:1.0.0' '@pnpm/filter-workspace-packages': 'workspace:1.0.1' '@pnpm/lockfile-file': 'workspace:3.0.1' @@ -1610,14 +1608,18 @@ importers: '@pnpm/semver-diff': 1.0.2 '@pnpm/store-path': 2.1.1 '@pnpm/types': 'workspace:4.0.0' + '@pnpm/utils': 'workspace:0.12.2' '@types/common-tags': 1.8.0 + '@types/lru-cache': ^5.1.0 '@types/mz': ^2.7.0 - '@types/ramda': ^0.26.39 + '@types/ramda': ^0.26.38 '@types/table': ^4.0.7 '@types/wrap-ansi': 3.0.0 chalk: 3.0.0 common-tags: 1.8.0 + lru-cache: 5.1.1 make-dir: 3.0.0 + mem: 6.0.1 mz: 2.7.0 ramda: 0.26.1 render-help: 0.0.0 @@ -1676,7 +1678,7 @@ importers: '@types/cross-spawn': ^6.0.1 '@types/lru-cache': ^5.1.0 '@types/mz': ^2.7.0 - '@types/ramda': ^0.26.39 + '@types/ramda': ^0.26.38 '@zkochan/rimraf': 1.0.0 cp-file: 7.0.0 cross-spawn: 7.0.1 @@ -1829,7 +1831,7 @@ importers: '@pnpm/utils': 'workspace:0.12.2' '@types/common-tags': ^1.8.0 '@types/mz': ^2.7.0 - '@types/ramda': ^0.26.39 + '@types/ramda': ^0.26.38 '@zkochan/rimraf': 1.0.0 common-tags: 1.8.0 execa: 4.0.0 @@ -1882,7 +1884,7 @@ importers: '@types/common-tags': ^1.8.0 '@types/is-windows': ^1.0.0 '@types/mz': ^2.7.0 - '@types/ramda': ^0.26.39 + '@types/ramda': ^0.26.38 '@types/signal-exit': ^3.0.0 common-tags: 1.8.0 delay: 4.3.0 @@ -1949,7 +1951,7 @@ importers: '@pnpm/utils': 'workspace:0.12.2' '@types/archy': 0.0.31 '@types/common-tags': ^1.8.0 - '@types/ramda': ^0.26.39 + '@types/ramda': ^0.26.38 '@types/sinon': ^7.5.1 '@zkochan/rimraf': 1.0.0 archy: 1.0.0 @@ -2092,7 +2094,7 @@ importers: '@types/mkdirp': 0.5.2 '@types/mz': ^2.7.0 '@types/ncp': 2.0.3 - '@types/ramda': ^0.26.39 + '@types/ramda': ^0.26.38 '@types/retry': 0.12.0 '@types/semver': ^6.2.0 '@types/table': ^4.0.7