Skip to content

Commit

Permalink
feat(meta): Add repository.directory field to package.json
Browse files Browse the repository at this point in the history
See https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md for explanation.

Here's how I did it:
```
npx lerna exec --concurrency 1 --stream -- 'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); json -I -f package.json -e "this.repository.directory=\"$DIRPATH\""'
```
  • Loading branch information
evocateur committed Feb 15, 2019
1 parent e7ac8ab commit aec5023
Show file tree
Hide file tree
Showing 55 changed files with 110 additions and 55 deletions.
3 changes: 2 additions & 1 deletion commands/add/package.json
Expand Up @@ -26,7 +26,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/add"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/bootstrap/package.json
Expand Up @@ -26,7 +26,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/bootstrap"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/changed/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/changed"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/clean/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/clean"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/create/package.json
Expand Up @@ -26,7 +26,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/create"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/diff/package.json
Expand Up @@ -26,7 +26,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/diff"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/exec/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/exec"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/import/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/import"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/init/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/init"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/link/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/link"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/list/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/list"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/publish/package.json
Expand Up @@ -27,7 +27,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/publish"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/run/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/run"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion commands/version/package.json
Expand Up @@ -27,7 +27,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "commands/version"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/child-process/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/child-process"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/cli/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/cli"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/command/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/command"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/conventional-commits/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/conventional-commits"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/filter-options/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/filter-options"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/global-options/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/global-options"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/lerna/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/lerna"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/package-graph/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/package-graph"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/package/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/package"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/project/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/project"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/prompt/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/prompt"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion core/validation-error/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "core/validation-error"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/batch-packages/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/batch-packages"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/check-working-tree/package.json
Expand Up @@ -23,7 +23,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/check-working-tree"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/collect-updates/package.json
Expand Up @@ -25,7 +25,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/collect-updates"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/create-symlink/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/create-symlink"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/describe-ref/package.json
Expand Up @@ -23,7 +23,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/describe-ref"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/filter-packages/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/filter-packages"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/get-npm-exec-opts/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/get-npm-exec-opts"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/get-packed/package.json
Expand Up @@ -20,7 +20,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/get-packed"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/github-client/package.json
Expand Up @@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/github-client"
},
"scripts": {
"test": "echo \"Run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/has-npm-version/package.json
Expand Up @@ -21,7 +21,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/has-npm-version"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/listable/package.json
Expand Up @@ -22,7 +22,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/listable"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/log-packed/package.json
Expand Up @@ -23,7 +23,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/log-packed"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/map-to-registry/package.json
Expand Up @@ -30,7 +30,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/map-to-registry"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
Expand Down
3 changes: 2 additions & 1 deletion utils/npm-conf/package.json
Expand Up @@ -29,7 +29,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/lerna/lerna.git"
"url": "git+https://github.com/lerna/lerna.git",
"directory": "utils/npm-conf"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
Expand Down

0 comments on commit aec5023

Please sign in to comment.