Skip to content

Commit

Permalink
feat: 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

Make changes by running this command in the root of the monorepo:

```shell
npx lerna exec --concurrency 1 --stream -- \
    'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \
    npx json -I -f package.json -e \
    "this.repository=\
        {\"directory\": \"$DIRPATH\", \
         \"type\": \"git\", \
         \"url\": \"https://github.com/embark-framework/embark.git\"}"'
```

Don't commit changes to private packages, with the exceptions of embark-typings
and embark-reset because those may switch from private to public, and also
because the latter will be included in `node_modules` of embark even if it is
private since embark-reset is presently a bundled dependency of embark.

Don't include the repository field in dapps generated from the template
packages, except for the demo.
  • Loading branch information
michaelsbradleyjr authored and iurimatias committed Mar 11, 2019
1 parent f12ca22 commit a9c5e1a
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 17 deletions.
5 changes: 5 additions & 0 deletions dapps/templates/boilerplate/package.json
Expand Up @@ -22,6 +22,11 @@
"keywords": [],
"author": "",
"license": "MIT",
"repository": {
"directory": "dapps/templates/boilerplate",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"devDependencies": {
"embark": "^4.0.0-beta.0",
"embark-reset": "^4.0.0-beta.0",
Expand Down
5 changes: 5 additions & 0 deletions dapps/templates/demo/package.json
Expand Up @@ -22,6 +22,11 @@
"keywords": [],
"author": "",
"license": "MIT",
"repository": {
"directory": "dapps/templates/demo",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"devDependencies": {
"embark": "^4.0.0-beta.0",
"embark-reset": "^4.0.0-beta.0",
Expand Down
5 changes: 5 additions & 0 deletions dapps/templates/simple/package.json
Expand Up @@ -21,6 +21,11 @@
"keywords": [],
"author": "",
"license": "MIT",
"repository": {
"directory": "dapps/templates/simple",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"devDependencies": {
"embark": "^4.0.0-beta.0",
"embark-reset": "^4.0.0-beta.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/embark-async-wrapper/package.json
Expand Up @@ -15,7 +15,11 @@
"solidity"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embark-async-wrapper",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "./dist/index.js",
"scripts": {
"build": "cross-env BABEL_ENV=node babel src --extensions \".js,.ts\" --out-dir dist --root-mode upward --source-maps",
Expand Down
6 changes: 5 additions & 1 deletion packages/embark-compiler/package.json
Expand Up @@ -15,7 +15,11 @@
"solidity"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embark-compiler",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "./dist/index.js",
"scripts": {
"build": "cross-env BABEL_ENV=node babel src --extensions \".js,.ts\" --out-dir dist --root-mode upward --source-maps",
Expand Down
6 changes: 5 additions & 1 deletion packages/embark-graph/package.json
Expand Up @@ -18,7 +18,11 @@
"dist"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embark-graph",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "./dist/index.js",
"scripts": {
"build": "cross-env BABEL_ENV=node babel src --extensions \".js,.ts\" --out-dir dist --root-mode upward --source-maps",
Expand Down
6 changes: 5 additions & 1 deletion packages/embark-reset/package.json
Expand Up @@ -7,7 +7,11 @@
"description": "DApp reset utlity for embark",
"homepage": "https://embark.status.im/",
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embark-reset",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"bin": "./bin.js",
"main": "index.js",
"dependencies": {
Expand Down
6 changes: 5 additions & 1 deletion packages/embark-typings/package.json
Expand Up @@ -16,7 +16,11 @@
"solidity"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embark-typings",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "",
"types": "index",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion packages/embark-ui/package.json
Expand Up @@ -15,7 +15,11 @@
"solidity"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embark-ui",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"scripts": {
"build": "node scripts/build.js",
"build-storybook": "build-storybook -s public",
Expand Down
6 changes: 5 additions & 1 deletion packages/embark-vyper/package.json
Expand Up @@ -15,7 +15,11 @@
"solidity"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embark-vyper",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "./dist/index.js",
"scripts": {
"build": "cross-env BABEL_ENV=node babel src --extensions \".js,.ts\" --out-dir dist --root-mode upward --source-maps",
Expand Down
6 changes: 5 additions & 1 deletion packages/embark/package.json
Expand Up @@ -15,7 +15,11 @@
"solidity"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embark",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"bin": {
"embark": "./bin/embark"
},
Expand Down
15 changes: 8 additions & 7 deletions packages/embark/src/lib/utils/template_generator.js
Expand Up @@ -160,24 +160,25 @@ class TemplateGenerator {
utils.cd(templatePath);

const pkgJson = fs.readJSONSync('./package.json');
pkgJson.name = name;
if (!(/demo/).test(name)) {
delete pkgJson.repository;
pkgJson.version = '0.0.1';
}
if (pkgJson.devDependencies) {
delete pkgJson.devDependencies['embark'];
delete pkgJson.devDependencies['embark-reset'];
delete pkgJson.devDependencies['npm-run-all'];
delete pkgJson.devDependencies['rimraf'];
}
delete pkgJson.files;
pkgJson.name = name;
if (!pkgJson.scripts) pkgJson.scripts = {};
delete pkgJson.scripts.ci;
delete pkgJson.scripts.clean;
delete pkgJson.scripts.package;
delete pkgJson.scripts.qa;
delete pkgJson.scripts.reset;
pkgJson.scripts.test = 'embark test';
if (pkgJson.devDependencies) {
delete pkgJson.devDependencies['embark'];
delete pkgJson.devDependencies['embark-reset'];
delete pkgJson.devDependencies['npm-run-all'];
delete pkgJson.devDependencies['rimraf'];
}
fs.writeFileSync('package.json', JSON.stringify(pkgJson, null, 2));

if (fs.existsSync('dot.gitignore')) {
Expand Down
6 changes: 5 additions & 1 deletion packages/embarkjs-connector-web3/package.json
Expand Up @@ -13,7 +13,11 @@
"smart-contract"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embarkjs-connector-web3",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "index.js",
"scripts": {
"ci": "npm run qa",
Expand Down
6 changes: 5 additions & 1 deletion packages/embarkjs/package.json
Expand Up @@ -15,7 +15,11 @@
"solidity"
],
"license": "MIT",
"repository": "github:embark-framework/embark",
"repository": {
"directory": "packages/embarkjs",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "dist/node/index.js",
"browser": {
"./dist/node/index.js": "./dist/browser/index.js"
Expand Down

0 comments on commit a9c5e1a

Please sign in to comment.