Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support exotic manifests #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions .travis.yml
Expand Up @@ -2,12 +2,9 @@ sudo: false

language: node_js
node_js:
- "4.0.0"
- "4"
- "6"
- "8"
- "10"
- "11"
- "12"

script:
- npm test
Expand Down
14 changes: 8 additions & 6 deletions lib/read-package-json.js
Expand Up @@ -10,8 +10,8 @@
// Requirements
//------------------------------------------------------------------------------

const joinPath = require("path").join
const readPkg = require("read-pkg")
const pathResolve = require("path").resolve
const readManifest = require("@pnpm/read-importer-manifest").default

//------------------------------------------------------------------------------
// Public Interface
Expand All @@ -23,9 +23,11 @@ const readPkg = require("read-pkg")
* @returns {object} package.json's information.
*/
module.exports = function readPackageJson() {
const path = joinPath(process.cwd(), "package.json")
return readPkg(path).then(body => ({
taskList: Object.keys(body.scripts || {}),
packageInfo: { path, body },
return readManifest(process.cwd()).then(readResult => ({
taskList: Object.keys(readResult.manifest.scripts || {}),
packageInfo: {
body: readResult.manifest,
path: pathResolve(readResult.fileName),
},
}))
}
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -14,7 +14,7 @@
"docs"
],
"engines": {
"node": ">= 4"
"node": ">= 8.15"
},
"scripts": {
"_mocha": "mocha \"test/*.js\" --timeout 120000",
Expand All @@ -29,13 +29,13 @@
"codecov": "nyc report -r lcovonly && codecov"
},
"dependencies": {
"@pnpm/read-importer-manifest": "^1.0.0",
"ansi-styles": "^3.2.1",
"chalk": "^2.4.1",
"cross-spawn": "^6.0.5",
"memorystream": "^0.3.1",
"minimatch": "^3.0.4",
"pidtree": "^0.3.0",
"read-pkg": "^3.0.0",
"shell-quote": "^1.6.1",
"string.prototype.padend": "^3.0.0"
},
Expand Down