Comparing version 0.27.0 to 0.28.0
@@ -8,2 +8,3 @@ 'use strict' | ||
const unlock = thenify(require('lockfile').unlock) | ||
const semver = require('semver') | ||
const requireJson = require('../fs/require_json') | ||
@@ -38,4 +39,10 @@ const writeJson = require('../fs/write_json') | ||
cmd.unlock = () => unlock(lockfile) | ||
cmd.storeJson = storeJsonController(cmd.ctx.store) | ||
Object.assign(cmd.ctx, cmd.storeJson.read()) | ||
cmd.storeJsonCtrl = storeJsonController(cmd.ctx.store) | ||
const storeJson = cmd.storeJsonCtrl.read() | ||
if (storeJson) { | ||
failIfNotCompatible(storeJson.pnpm) | ||
} | ||
Object.assign(cmd.ctx, storeJson) | ||
if (!opts.quiet) cmd.ctx.log = logger(opts.logger) | ||
@@ -53,2 +60,13 @@ else cmd.ctx.log = () => () => {} | ||
function failIfNotCompatible (storeVersion) { | ||
if (!storeVersion || !semver.satisfies(storeVersion, '>=0.28')) { | ||
throw new Error(`The store structure was changed. | ||
Remove it and run pnpm again. | ||
More info about what was changed at: https://github.com/rstacruz/pnpm/issues/276 | ||
TIPS: | ||
If you have a shared store, remove both the node_modules and the shared shore. | ||
Otherwise just run \`rm -rf node_modules\``) | ||
} | ||
} | ||
function readGlobalPkg (globalPath) { | ||
@@ -55,0 +73,0 @@ if (!globalPath) throw new Error('globalPath is required') |
@@ -5,2 +5,3 @@ 'use strict' | ||
const createGot = require('../network/got') | ||
const pnpmPkgJson = require('../../package.json') | ||
const initCmd = require('./init_cmd') | ||
@@ -60,3 +61,4 @@ const installMultiple = require('../install_multiple') | ||
.then(savePkgs) | ||
.then(_ => cmd.storeJson.save({ | ||
.then(_ => cmd.storeJsonCtrl.save({ | ||
pnpm: pnpmPkgJson.version, | ||
dependents: cmd.ctx.dependents, | ||
@@ -63,0 +65,0 @@ dependencies: cmd.ctx.dependencies |
@@ -33,3 +33,3 @@ 'use strict' | ||
}) | ||
.then(_ => cmd.storeJson.save({ | ||
.then(_ => cmd.storeJsonCtrl.save({ | ||
dependents: cmd.ctx.dependents, | ||
@@ -36,0 +36,0 @@ dependencies: cmd.ctx.dependencies |
@@ -14,3 +14,3 @@ 'use strict' | ||
} catch (err) { | ||
return {} | ||
return null | ||
} | ||
@@ -17,0 +17,0 @@ }, |
'use strict' | ||
module.exports = pkg => pkg.name.replace('/', '!') + '@' + pkg.version | ||
const delimiter = '+' | ||
module.exports = pkg => pkg.name.replace('/', delimiter) + '@' + escapeVersion(pkg.version) | ||
module.exports.delimiter = delimiter | ||
function escapeVersion (version) { | ||
if (!version) return '' | ||
return version.replace(/[/\\:]/g, delimiter) | ||
} |
'use strict' | ||
const pkgFullName = require('../pkg_full_name') | ||
@@ -15,6 +16,8 @@ /** | ||
return resolvePackageName(spec).then(name => { | ||
const fullname = name.replace('/', '!') + ['@github', spec.owner, spec.repo, spec.ref].join('!') | ||
return { | ||
name, | ||
fullname, | ||
fullname: pkgFullName({ | ||
name, | ||
version: ['github', spec.owner, spec.repo, spec.ref].join(pkgFullName.delimiter) | ||
}), | ||
dist: { | ||
@@ -21,0 +24,0 @@ tarball: [ |
'use strict' | ||
const resolve = require('path').resolve | ||
const spawn = require('cross-spawn') | ||
const pkgFullName = require('../pkg_full_name') | ||
@@ -35,6 +36,9 @@ /** | ||
name: localPkg.name, | ||
fullname: localPkg.name.replace('/', '!') + [ | ||
'@file', | ||
escapePkgPath(dependencyPath) | ||
].join('!'), | ||
fullname: pkgFullName({ | ||
name: localPkg.name, | ||
version: [ | ||
'file', | ||
removeLeadingSlash(dependencyPath) | ||
].join(pkgFullName.delimiter) | ||
}), | ||
dist: { | ||
@@ -48,4 +52,4 @@ local: true, | ||
function escapePkgPath (pkgPath) { | ||
return pkgPath.replace(/[/\\:]/g, '!').replace(/^!/, '') | ||
function removeLeadingSlash (pkgPath) { | ||
return pkgPath.replace(/^[/\\]/, '') | ||
} |
{ | ||
"name": "pnpm", | ||
"description": "A fast implementation of npm install", | ||
"version": "0.27.0", | ||
"version": "0.28.0", | ||
"author": "Rico Sta. Cruz <rico@ricostacruz.com>", | ||
@@ -6,0 +6,0 @@ "bin": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68198
1918