mirror of
https://github.com/pnpm/pnpm.git
synced 2026-02-05 04:31:31 -05:00
! can be part of a valid npm package name. Use + as a delimiter instead. close #276, PR #320 BREAKING CHANGE: Stores created with the ! delimiter are not compatible with the new version that uses +. Any store created by older versions of pnpm has to be removed and reinstalled.
22 lines
532 B
JavaScript
22 lines
532 B
JavaScript
'use strict'
|
|
const join = require('path').join
|
|
const writeFileSync = require('fs').writeFileSync
|
|
const readFileSync = require('fs').readFileSync
|
|
|
|
module.exports = function storeJsonController (storePath) {
|
|
const storeJsonPath = join(storePath, 'store.json')
|
|
|
|
return {
|
|
read () {
|
|
try {
|
|
return JSON.parse(readFileSync(storeJsonPath, 'utf8'))
|
|
} catch (err) {
|
|
return null
|
|
}
|
|
},
|
|
save (storeJson) {
|
|
writeFileSync(storeJsonPath, JSON.stringify(storeJson, null, 2), 'utf8')
|
|
}
|
|
}
|
|
}
|