Skip to content

Commit

Permalink
fix(postinstall): incorporate amIaDependency for scoped packages
Browse files Browse the repository at this point in the history
  • Loading branch information
AVVS committed Jul 29, 2017
1 parent 69b6a03 commit 23f0fe2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"nyc": "^11.0.3"
},
"dependencies": {
"@makeomatic/condition-semaphore": "^1.0.1",
"am-i-a-dependency": "^1.0.0",
"@makeomatic/condition-semaphore": "^1.0.2",
"bluebird": "^3.5.0",
"chrome-launcher": "^0.3.2",
"chrome-remote-interface": "^0.24.2",
Expand Down
9 changes: 8 additions & 1 deletion scripts/setup-semantic-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
/* eslint-disable import/no-dynamic-require, no-console */

const debug = require('debug')('github-post-release');
const amIaDependency = require('am-i-a-dependency');
const path = require('path');
const fs = require('fs');

const isForced = process.argv.some(a => a === '--force');

function amIaDependency() {
const cwd = process.cwd();
const parts = cwd.split(path.sep);
const parentFolder = parts[parts.length - 2];
const scopedParentFodler = parts[parts.length - 3];
return parentFolder === 'node_modules' || scopedParentFodler === 'node_modules';
}

if (!amIaDependency() && !isForced) {
// top level install (we are running `npm i` in this project)
debug('we are installing own dependencies');
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# yarn lockfile v1


"@makeomatic/condition-semaphore@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@makeomatic/condition-semaphore/-/condition-semaphore-1.0.1.tgz#a7868a639b4b266f46b52af57c2b8684414a3688"
"@makeomatic/condition-semaphore@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@makeomatic/condition-semaphore/-/condition-semaphore-1.0.2.tgz#e393b2ee63b6798320d3642b68955e4d1563742b"
dependencies:
"@semantic-release/error" "^1.0.0"
semver "^5.1.0"
Expand Down Expand Up @@ -132,7 +132,7 @@ [email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/always-error/-/always-error-1.0.0.tgz#95c84042cfa86f38c86ca6c2cc42c0a0103441b2"

[email protected], am-i-a-dependency@^1.0.0:
[email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/am-i-a-dependency/-/am-i-a-dependency-1.0.0.tgz#7c0e2eb126045350852e26e44f6781b3ed387919"

Expand Down

0 comments on commit 23f0fe2

Please sign in to comment.