pattern-lab / patternlab-node

The Node version of Pattern Lab
http://patternlab.io
MIT License
2.05k stars 408 forks source link

Installing own starterkit fails #1065

Closed ringods closed 4 years ago

ringods commented 4 years ago

I am developing a custom starterkit. The package also has a custom namespace: @ringods/starterkit-zoho-sites.

Since I do not have a finished version yet, I added the starterkit like this in devDependencies:

    "@ringods/starterkit-zoho-sites": "file:../starterkit-zoho-sites",

At NPM level, the package is installed, but then I try to trigger the install of the starterkit in Patternlab:

$ npx @pattern-lab/cli install --starterkits @ringods/starterkit-zoho-sites
⠇ ⊙ patternlab → Installing starterkit: @ringods/starterkit-zoho-sites⊙ patternlab → fetchPackage: Fetching required dependencies from npm failed for @ringods/starterkit-zoho-sites with Error: Command failed: npm install pattern-lab/@ringods/starterkit-zoho-sites
npm ERR! code ENOLOCAL
npm ERR! Could not install from "pattern-lab/@ringods/starterkit-zoho-sites" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ringods/.npm/_logs/2019-09-28T13_53_10_692Z-debug.log

(node:74278) UnhandledPromiseRejectionWarning: Error: Command failed: npm install pattern-lab/@ringods/starterkit-zoho-sites
npm ERR! code ENOLOCAL
npm ERR! Could not install from "pattern-lab/@ringods/starterkit-zoho-sites" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ringods/.npm/_logs/2019-09-28T13_53_10_692Z-debug.log

    at makeError (/Users/ringods/.npm/_npx/74278/lib/node_modules/@pattern-lab/cli/node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (/Users/ringods/.npm/_npx/74278/lib/node_modules/@pattern-lab/cli/node_modules/execa/index.js:277:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:74278) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:74278) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠏ ⊙ patternlab → Installing starterkit: @ringods/starterkit-zoho-sites

My package name got prefixed with pattern-lab/ and I could trace that to this line in the code:

https://github.com/pattern-lab/patternlab-node/blob/aea1c7f0d816a11cf9116637e65421c5f3f8804e/packages/cli/bin/install-starterkit.js#L15

Why is this done? Can this be changed so that any starterkit can be installed? Or can/should I change the NPM namespace to @pattern-lab?

bmuenzenmeyer commented 4 years ago

Why is this done? Can this be changed so that any starterkit can be installed?

it was done because the original implementation's architecture was extremely conservative and guarded against installing random third party packages. this is not the first disconnect between CLI and Core

Can this be changed so that any starterkit can be installed?

yes! PRs welcome

ringods commented 4 years ago

@bmuenzenmeyer I'll see what I can do regarding a PR. Can you give feedback on what the requirements should be?

Here is what I had in mind:

A sign-off on the requirements would give me a clear path on how to proceed.