Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

throw new Error(${file} does not exist); #10

Open
ajmeese7 opened this issue Feb 13, 2022 · 1 comment
Open

throw new Error(${file} does not exist); #10

ajmeese7 opened this issue Feb 13, 2022 · 1 comment

Comments

@ajmeese7
Copy link

No matter how I configure this project, the only output I get when I run it is this:

D:\_Programming\aaronmeese.com\common\scripts\package-inherit-cli.js:36656
                    throw new Error(`${file} does not exist`);
                    ^

Error: undefined does not exist

Any more helpful documentation would be appreciated.

@nlwillia
Copy link

The problem is that it's using an old version of workspace-tools that doesn't understand native npm workspaces yet.

I was able to get it working as follows:

  1. Clone this project
  2. Update package.json to the latest workspace-tools (currently 0.23.3)
  3. npm run build
  4. Copy the new build/package-inherit-cli.js into your project
  5. Make sure your base directory is actually registered as a package in the workspace config
  6. Reference an inherited json as a module path rather than a file path...it is incredibly picky here and won't help if you get it wrong

So,

// ./packages/base/package.json
{"name": "@my-scope/base"}
// ./packages/base/package.foo.json
{
  "scripts": {
    "foo": "echo foo"
  }
}
// ./packages/child/package.json
{
  ...
  "scripts": {}, // necessary because of issue #1
  "inherits": [
    "@my-scope/base/package.foo.json"
  ]
  ...
}
// ./package.json
{
  "scripts": {
    "preinstall": "node ./packages/base/package-inherit-cli.js update"
  },
  "workspaces": [
    "packages/base",
    "packages/child"
  ]
}

Cool idea, but it needs some maintenance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants