mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-26 15:59:26 -05:00
chore: create updater to normalize manifests
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
"scripts": {
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/audit/coverage ts-node packages/audit/test",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/audit/coverage ts-node packages/audit/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -13,9 +13,9 @@ export function packageIsInstallable (
|
||||
engineStrict?: boolean,
|
||||
},
|
||||
) {
|
||||
const err = checkPackage(pkgPath, pkg, {
|
||||
pnpmVersion: packageManager.stableVersion,
|
||||
})
|
||||
const pnpmVersion = packageManager.name === 'pnpm'
|
||||
? packageManager.stableVersion : undefined
|
||||
const err = checkPackage(pkgPath, pkg, { pnpmVersion })
|
||||
if (err === null) return
|
||||
if (
|
||||
(err instanceof UnsupportedEngineError && err.wanted.pnpm) ||
|
||||
|
||||
@@ -2,16 +2,20 @@ import { DependencyManifest } from '@pnpm/types'
|
||||
import loadJsonFile = require('load-json-file')
|
||||
import path = require('path')
|
||||
|
||||
const defaultManifest = {
|
||||
name: 'unknown',
|
||||
version: '0.0.0',
|
||||
}
|
||||
let pkgJson
|
||||
try {
|
||||
pkgJson = loadJsonFile.sync<DependencyManifest>(
|
||||
path.join(path.dirname(require.main!.filename), '../package.json'),
|
||||
)
|
||||
} catch (err) {
|
||||
pkgJson = {
|
||||
name: 'unknown',
|
||||
version: '0.0.0',
|
||||
...defaultManifest,
|
||||
...loadJsonFile.sync<DependencyManifest>(
|
||||
path.join(path.dirname(require.main!.filename), '../package.json'),
|
||||
),
|
||||
}
|
||||
} catch (err) {
|
||||
pkgJson = defaultManifest
|
||||
}
|
||||
|
||||
const packageManager = {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"test-with-preview": "ts-node test",
|
||||
"_test": "npm config rm fetch-retry-maxtimeout && cd ../.. && c8 --reporter lcov --reports-dir packages/config/coverage ts-node packages/config/test",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/config/coverage ts-node packages/config/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test"
|
||||
},
|
||||
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/config",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "pnpm run tsc -- --sourceMap && tslint -c ../../tslint.json -p .",
|
||||
"test": "pnpm run tsc -- --sourceMap",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"scripts": {
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/default-resolver/coverage ts-node packages/default-resolver/test",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/default-resolver/coverage ts-node packages/default-resolver/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"_test": "pnpm link . && cd ../.. && c8 --reporter lcov --reports-dir packages/dependency-path/coverage ts-node packages/dependency-path/test",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/dependency-path/coverage ts-node packages/dependency-path/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc",
|
||||
"tsc": "tsc"
|
||||
|
||||
@@ -9,7 +9,7 @@ export { Project }
|
||||
|
||||
export default async (
|
||||
workspaceRoot: string,
|
||||
opts: { engineStrict?: boolean },
|
||||
opts?: { engineStrict?: boolean },
|
||||
) => {
|
||||
const packagesManifest = await requirePackagesManifest(workspaceRoot)
|
||||
const pkgs = await findPackages(workspaceRoot, {
|
||||
@@ -22,7 +22,7 @@ export default async (
|
||||
})
|
||||
pkgs.sort((pkg1: {dir: string}, pkg2: {dir: string}) => pkg1.dir.localeCompare(pkg2.dir))
|
||||
for (const pkg of pkgs) {
|
||||
packageIsInstallable(pkg.dir, pkg.manifest, opts)
|
||||
packageIsInstallable(pkg.dir, pkg.manifest, opts ?? {})
|
||||
}
|
||||
|
||||
return pkgs as Project[]
|
||||
|
||||
@@ -64,10 +64,9 @@
|
||||
"commitmsg": "commitlint -e",
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/headless/coverage ts-node packages/headless/test",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"pretest:e2e": "rimraf ../.tmp/ && registry-mock prepare && ts-node test/pretest",
|
||||
"test-with-preview": "pnpm run test:e2e",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/headless/coverage ts-node packages/headless/test --type-check",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"pre_test": "ts-node test/pretest",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7770 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
"scripts": {
|
||||
"lint": "tslint -c ../../tslint.json --project .",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"_test": "ncp test/fixtures test/fixtures_for_testing && cd ../.. && c8 --reporter lcov --reports-dir packages/link-bins/coverage ts-node packages/link-bins/test --type-check && cd packages/link-bins && rimraf test/fixtures_for_testing",
|
||||
"pre_test": "ncp test/fixtures test/fixtures_for_testing",
|
||||
"post_test": "rimraf test/fixtures_for_testing",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/link-bins/coverage ts-node packages/link-bins/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc",
|
||||
"fix": "tslint -c tslint.json --project . --fix"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"scripts": {
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "tsc",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/local-resolver/coverage ts-node packages/local-resolver/test --ts-node",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/local-resolver/coverage ts-node packages/local-resolver/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc",
|
||||
"fix": "tslint -c tslint.json src/**/*.ts test/**/*.ts --fix"
|
||||
|
||||
@@ -18,5 +18,6 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"homepage": "https://github.com/pnpm/pnpm/blob/master/packages/lockfile-types#readme"
|
||||
"homepage": "https://github.com/pnpm/pnpm/blob/master/packages/lockfile-types#readme",
|
||||
"scripts": {}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"scripts": {
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"_test": "rimraf .store && cd ../.. && c8 --reporter lcov --reports-dir packages/npm-resolver/coverage ts-node packages/npm-resolver/test --type-check",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/npm-resolver/coverage ts-node packages/npm-resolver/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"pretest": "registry-mock prepare",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc",
|
||||
"tsc": "tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/outdated/coverage ts-node packages/outdated/test --type-check",
|
||||
"_test": "run-p -r registry-mock test:tap"
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7771 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap"
|
||||
},
|
||||
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/outdated",
|
||||
"keywords": [
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function checkEngine (
|
||||
if (wantedEngine.node && !semver.satisfies(currentEngine.node, wantedEngine.node)) {
|
||||
unsatisfiedWanted.node = wantedEngine.node
|
||||
}
|
||||
if (wantedEngine.pnpm && !semver.satisfies(currentEngine.pnpm, wantedEngine.pnpm)) {
|
||||
if (currentEngine.pnpm && wantedEngine.pnpm && !semver.satisfies(currentEngine.pnpm, wantedEngine.pnpm)) {
|
||||
unsatisfiedWanted.pnpm = wantedEngine.pnpm
|
||||
}
|
||||
if (Object.keys(unsatisfiedWanted).length) {
|
||||
@@ -35,7 +35,7 @@ export default function checkEngine (
|
||||
|
||||
export type Engine = {
|
||||
node: string,
|
||||
pnpm: string,
|
||||
pnpm?: string,
|
||||
}
|
||||
|
||||
export type WantedEngine = Partial<Engine>
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function packageIsInstallable (
|
||||
engineStrict?: boolean,
|
||||
nodeVersion?: string,
|
||||
optional: boolean,
|
||||
pnpmVersion: string,
|
||||
pnpmVersion?: string,
|
||||
lockfileDir: string,
|
||||
},
|
||||
): boolean | null {
|
||||
@@ -69,7 +69,7 @@ export function checkPackage (
|
||||
},
|
||||
options: {
|
||||
nodeVersion?: string,
|
||||
pnpmVersion: string,
|
||||
pnpmVersion?: string,
|
||||
},
|
||||
): null | UnsupportedEngineError | UnsupportedPlatformError {
|
||||
return checkPlatform(pkgId, {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"start": "pnpm run tsc -- --watch",
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc --pretty",
|
||||
"_test": "rimraf .store && cd ../.. && c8 --reporter lcov --reports-dir packages/package-requester/coverage ts-node packages/package-requester/test --type-check",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/package-requester/coverage ts-node packages/package-requester/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"scripts": {
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/parse-cli-args/coverage ts-node packages/parse-cli-args/test",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/parse-cli-args/coverage ts-node packages/parse-cli-args/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"scripts": {
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-audit/coverage ts-node packages/plugin-commands-audit/test",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-audit/coverage ts-node packages/plugin-commands-audit/test --type-check",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-import/coverage ts-node packages/plugin-commands-import/test --type-check",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7776 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7772 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-installation/coverage ts-node packages/plugin-commands-installation/test --type-check",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7777 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7773 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-listing/coverage ts-node packages/plugin-commands-listing/test --type-check",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7773 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7774 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-outdated/coverage ts-node packages/plugin-commands-outdated/test --type-check",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7774 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7775 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-publishing/coverage ts-node packages/plugin-commands-publishing/test --type-check",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7771 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7776 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-rebuild/coverage ts-node packages/plugin-commands-rebuild/test --type-check",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7779 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7777 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-script-runners/coverage ts-node packages/plugin-commands-script-runners/test --type-check",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7775 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7778 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/plugin-commands-store/coverage ts-node packages/plugin-commands-store/test --type-check",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7778 pnpm run test:e2e",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7779 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
},
|
||||
@@ -46,7 +45,8 @@
|
||||
"execa": "4.0.0",
|
||||
"load-json-file": "6.2.0",
|
||||
"path-exists": "4.0.0",
|
||||
"sinon": "9.0.0"
|
||||
"sinon": "9.0.0",
|
||||
"tempy": "0.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/check-package": "3.0.1",
|
||||
|
||||
@@ -6,12 +6,13 @@ import rimraf = require('@zkochan/rimraf')
|
||||
import execa = require('execa')
|
||||
import path = require('path')
|
||||
import test = require('tape')
|
||||
import tempy = require('tempy')
|
||||
|
||||
const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/`
|
||||
|
||||
test('CLI fails when store status finds modified packages', async function (t) {
|
||||
const project = prepare(t)
|
||||
const storeDir = path.resolve('pnpm-store')
|
||||
const storeDir = tempy.directory()
|
||||
|
||||
await execa('pnpm', ['add', 'is-positive@3.1.0', '--store-dir', storeDir, '--registry', REGISTRY, '--verify-store-integrity'])
|
||||
|
||||
@@ -40,7 +41,7 @@ test('CLI fails when store status finds modified packages', async function (t) {
|
||||
|
||||
test('CLI does not fail when store status does not find modified packages', async function (t) {
|
||||
const project = prepare(t)
|
||||
const storeDir = path.resolve('pnpm-store')
|
||||
const storeDir = tempy.directory()
|
||||
|
||||
await execa('pnpm', ['add', 'is-positive@3.1.0', '--store-dir', storeDir, '--registry', REGISTRY, '--verify-store-integrity'])
|
||||
// store status does not fail on not installed optional dependencies
|
||||
|
||||
@@ -34,7 +34,7 @@ test('find usages for single package in store and in a project', async (t) => {
|
||||
output,
|
||||
stripIndent`
|
||||
Package: is-negative
|
||||
└─┬ Package in store: localhost+7778/is-negative/2.1.0
|
||||
└─┬ Package in store: localhost+${REGISTRY_MOCK_PORT}/is-negative/2.1.0
|
||||
└── Project with dependency: ${path.resolve('node_modules')}` + '\n',
|
||||
'finds usages by package name',
|
||||
)
|
||||
@@ -49,7 +49,7 @@ test('find usages for single package in store and in a project', async (t) => {
|
||||
output,
|
||||
stripIndent`
|
||||
Package: is-negative@2.1.0
|
||||
└─┬ Package in store: localhost+7778/is-negative/2.1.0
|
||||
└─┬ Package in store: localhost+${REGISTRY_MOCK_PORT}/is-negative/2.1.0
|
||||
└── Project with dependency: ${path.resolve('node_modules')}` + '\n',
|
||||
'finds usages by package name and version',
|
||||
)
|
||||
@@ -79,11 +79,11 @@ test('find usages for single package in store and in a project', async (t) => {
|
||||
output,
|
||||
stripIndent`
|
||||
Package: is-negative
|
||||
└─┬ Package in store: localhost+7778/is-negative/2.1.0
|
||||
└─┬ Package in store: localhost+${REGISTRY_MOCK_PORT}/is-negative/2.1.0
|
||||
└── Project with dependency: ${path.resolve('node_modules')}
|
||||
|
||||
Package: is-odd
|
||||
└─┬ Package in store: localhost+7778/is-odd/3.0.0
|
||||
└─┬ Package in store: localhost+${REGISTRY_MOCK_PORT}/is-odd/3.0.0
|
||||
└── Project with dependency: ${path.resolve('node_modules')}` + '\n',
|
||||
'finds usages of two packages',
|
||||
)
|
||||
@@ -115,7 +115,7 @@ test('find usages for package(s) in store but not in any projects', async (t) =>
|
||||
output,
|
||||
stripIndent`
|
||||
Package: is-negative
|
||||
└─┬ Package in store: localhost+7778/is-negative/2.1.0
|
||||
└─┬ Package in store: localhost+${REGISTRY_MOCK_PORT}/is-negative/2.1.0
|
||||
└── No pnpm projects using this package` + '\n',
|
||||
'finds usage of package',
|
||||
)
|
||||
@@ -136,9 +136,9 @@ test('find usages for package(s) in store but not in any projects', async (t) =>
|
||||
output,
|
||||
stripIndent`
|
||||
Package: is-negative
|
||||
├─┬ Package in store: localhost+7778/is-negative/2.1.0
|
||||
├─┬ Package in store: localhost+${REGISTRY_MOCK_PORT}/is-negative/2.1.0
|
||||
│ └── No pnpm projects using this package
|
||||
└─┬ Package in store: localhost+7778/is-negative/2.0.0
|
||||
└─┬ Package in store: localhost+${REGISTRY_MOCK_PORT}/is-negative/2.0.0
|
||||
└── No pnpm projects using this package` + '\n',
|
||||
'finds usages of packages',
|
||||
)
|
||||
|
||||
@@ -157,9 +157,9 @@
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/pnpm/coverage ts-node packages/pnpm/test --type-check",
|
||||
"pretest:e2e": "rimraf node_modules/.bin/pnpm && registry-mock prepare",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"_test": "pnpm run tsc && cross-env PNPM_REGISTRY_MOCK_PORT=7772 npm run test:e2e",
|
||||
"pretest:e2e": "rimraf node_modules/.bin/pnpm",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"_test": "pnpm run tsc && cross-env PNPM_REGISTRY_MOCK_PORT=7780 pnpm run test:e2e",
|
||||
"test": "pnpm run _test",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"release": "sh .scripts/release.sh"
|
||||
|
||||
@@ -157,11 +157,10 @@
|
||||
"commitmsg": "commitlint -e",
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"registry-mock": "registry-mock",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/supi/coverage ts-node packages/supi/test",
|
||||
"test:e2e": "run-p -r registry-mock test:tap",
|
||||
"pretest:e2e": "registry-mock prepare",
|
||||
"test:tap": "cd ../.. && c8 --reporter lcov --reports-dir packages/supi/coverage ts-node packages/supi/test --type-check",
|
||||
"test:e2e": "registry-mock prepare && run-p -r registry-mock test:tap",
|
||||
"test-with-preview": "preview && pnpm run test:e2e",
|
||||
"_test": "pnpm run test:e2e",
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=4873 pnpm run test:e2e",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"prepublishOnly": "pnpm run tsc"
|
||||
|
||||
@@ -434,8 +434,8 @@ test('hoist when updating in one of the workspace projects', async (t) => {
|
||||
{
|
||||
const modulesManifest = await rootNodeModules.readModulesManifest()
|
||||
t.deepEqual(modulesManifest?.hoistedAliases, {
|
||||
'localhost+4873/dep-of-pkg-with-1-dep/100.0.0': ['dep-of-pkg-with-1-dep'],
|
||||
'localhost+4873/foo/100.0.0': ['foo'],
|
||||
[`localhost+${REGISTRY_MOCK_PORT}/dep-of-pkg-with-1-dep/100.0.0`]: ['dep-of-pkg-with-1-dep'],
|
||||
[`localhost+${REGISTRY_MOCK_PORT}/foo/100.0.0`]: ['foo'],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ test('hoist when updating in one of the workspace projects', async (t) => {
|
||||
{
|
||||
const modulesManifest = await rootNodeModules.readModulesManifest()
|
||||
t.deepEqual(modulesManifest?.hoistedAliases, {
|
||||
'localhost+4873/dep-of-pkg-with-1-dep/100.0.0': ['dep-of-pkg-with-1-dep'],
|
||||
[`localhost+${REGISTRY_MOCK_PORT}/dep-of-pkg-with-1-dep/100.0.0`]: ['dep-of-pkg-with-1-dep'],
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1155,7 +1155,7 @@ test('fail if none of the available resolvers support a version spec', async (t:
|
||||
err.pkgsStack,
|
||||
[
|
||||
{
|
||||
id: 'localhost+4873/@types/plotly.js/1.44.29',
|
||||
id: `localhost+${REGISTRY_MOCK_PORT}/@types/plotly.js/1.44.29`,
|
||||
name: '@types/plotly.js',
|
||||
version: '1.44.29',
|
||||
},
|
||||
|
||||
@@ -164,7 +164,13 @@ test('skip optional dependency that does not support the current pnpm version',
|
||||
optionalDependencies: {
|
||||
'for-legacy-pnpm': '*',
|
||||
},
|
||||
}, await testDefaults({ reporter }))
|
||||
}, await testDefaults({
|
||||
packageManager: {
|
||||
name: 'pnpm',
|
||||
version: '4.0.0',
|
||||
},
|
||||
reporter,
|
||||
}))
|
||||
|
||||
await project.hasNot('for-legacy-pnpm')
|
||||
await project.storeHas('for-legacy-pnpm', '1.0.0')
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
|
||||
"prepublishOnly": "pnpm run tsc",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/tarball-fetcher/coverage ts-node packages/tarball-fetcher/test && cd packages/tarball-fetcher && node example",
|
||||
"_test": "cd ../.. && c8 --reporter lcov --reports-dir packages/tarball-fetcher/coverage ts-node packages/tarball-fetcher/test --type-check",
|
||||
"post_test": "node example",
|
||||
"test": "pnpm run tsc -- --sourceMap && pnpm run _test"
|
||||
},
|
||||
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/tarball-fetcher",
|
||||
|
||||
13
pnpm-lock.yaml
generated
13
pnpm-lock.yaml
generated
@@ -1925,6 +1925,7 @@ importers:
|
||||
load-json-file: 6.2.0
|
||||
path-exists: 4.0.0
|
||||
sinon: 9.0.0
|
||||
tempy: 0.4.0
|
||||
specifiers:
|
||||
'@pnpm/assert-store': 'workspace:1.0.0'
|
||||
'@pnpm/check-package': 3.0.1
|
||||
@@ -1956,6 +1957,7 @@ importers:
|
||||
ramda: 0.27.0
|
||||
render-help: 1.0.0
|
||||
sinon: 9.0.0
|
||||
tempy: 0.4.0
|
||||
packages/pnpm:
|
||||
dependencies:
|
||||
'@pnpm/cli-utils': 'link:../cli-utils'
|
||||
@@ -2821,6 +2823,17 @@ importers:
|
||||
specifiers:
|
||||
tslint-config-standard: 9.0.0
|
||||
tslint-eslint-rules: 5.4.0
|
||||
utils/updater:
|
||||
dependencies:
|
||||
'@pnpm/find-workspace-packages': 'link:../../packages/find-workspace-packages'
|
||||
'@pnpm/types': 'link:../../packages/types'
|
||||
is-subdir: 1.1.1
|
||||
path-exists: 4.0.0
|
||||
specifiers:
|
||||
'@pnpm/find-workspace-packages': 'workspace:2.1.10'
|
||||
'@pnpm/types': 'workspace:5.0.0'
|
||||
is-subdir: 1.1.1
|
||||
path-exists: 4.0.0
|
||||
lockfileVersion: 5.1
|
||||
packages:
|
||||
/@babel/code-frame/7.8.3:
|
||||
|
||||
8
utils/updater/package.json
Normal file
8
utils/updater/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@pnpm/find-workspace-packages": "workspace:2.1.10",
|
||||
"@pnpm/types":"workspace:5.0.0",
|
||||
"is-subdir":"1.1.1",
|
||||
"path-exists":"4.0.0"
|
||||
}
|
||||
}
|
||||
76
utils/updater/src/index.ts
Normal file
76
utils/updater/src/index.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import findWorkspacePackages from '@pnpm/find-workspace-packages'
|
||||
import { ProjectManifest } from '@pnpm/types'
|
||||
import isSubdir = require('is-subdir')
|
||||
import path = require('path')
|
||||
import exists = require('path-exists')
|
||||
|
||||
const repoRoot = path.join(__dirname, '../../..')
|
||||
|
||||
; (async () => {
|
||||
const pkgs = await findWorkspacePackages(repoRoot, { engineStrict: false })
|
||||
const pkgsDir = path.join(repoRoot, 'packages')
|
||||
for (const { dir, manifest, writeProjectManifest } of pkgs) {
|
||||
if (!isSubdir(pkgsDir, dir)) continue
|
||||
await writeProjectManifest(await updateManifest(dir, manifest))
|
||||
}
|
||||
})()
|
||||
|
||||
let registryMockPort = 7769
|
||||
|
||||
async function updateManifest (dir: string, manifest: ProjectManifest) {
|
||||
const relative = path.relative(repoRoot, dir)
|
||||
let scripts: Record<string, string>
|
||||
switch (manifest.name) {
|
||||
case '@pnpm/lockfile-types':
|
||||
scripts = {}
|
||||
break
|
||||
case '@pnpm/headless':
|
||||
case '@pnpm/outdated':
|
||||
case '@pnpm/plugin-commands-import':
|
||||
case '@pnpm/plugin-commands-installation':
|
||||
case '@pnpm/plugin-commands-listing':
|
||||
case '@pnpm/plugin-commands-outdated':
|
||||
case '@pnpm/plugin-commands-publishing':
|
||||
case '@pnpm/plugin-commands-rebuild':
|
||||
case '@pnpm/plugin-commands-script-runners':
|
||||
case '@pnpm/plugin-commands-store':
|
||||
case 'pnpm':
|
||||
case 'supi':
|
||||
// supi tests currently works only with port 4873 due to the usage of
|
||||
// the next package: pkg-with-tarball-dep-from-registry
|
||||
const port = manifest.name === 'supi' ? 4873 : ++registryMockPort
|
||||
scripts = {
|
||||
...manifest.scripts,
|
||||
'registry-mock': 'registry-mock',
|
||||
'test:tap': `cd ../.. && c8 --reporter lcov --reports-dir ${path.join(relative, 'coverage')} ts-node ${path.join(relative, 'test')} --type-check`,
|
||||
|
||||
'test:e2e': 'registry-mock prepare && run-p -r registry-mock test:tap',
|
||||
}
|
||||
if (manifest.name === 'pnpm') {
|
||||
scripts.test = 'pnpm run _test'
|
||||
scripts._test = `pnpm run tsc && cross-env PNPM_REGISTRY_MOCK_PORT=${port} pnpm run test:e2e`
|
||||
} else {
|
||||
scripts.test = 'pnpm run tsc -- --sourceMap && pnpm run _test'
|
||||
scripts._test = `cross-env PNPM_REGISTRY_MOCK_PORT=${port} pnpm run test:e2e`
|
||||
}
|
||||
break
|
||||
default:
|
||||
if (await exists(path.join(dir, 'test'))) {
|
||||
scripts = {
|
||||
...manifest.scripts,
|
||||
_test: `cd ../.. && c8 --reporter lcov --reports-dir ${path.join(relative, 'coverage')} ts-node ${path.join(relative, 'test')} --type-check`,
|
||||
test: 'pnpm run tsc -- --sourceMap && pnpm run _test',
|
||||
}
|
||||
} else {
|
||||
scripts = {
|
||||
...manifest.scripts,
|
||||
test: 'pnpm run tsc -- --sourceMap',
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
return {
|
||||
...manifest,
|
||||
scripts,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user