-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: instead of detecting firstPush, we now look for a gk-lockfile c…
…ommit on the branch
- Loading branch information
Showing
14 changed files
with
42 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,68 +35,68 @@ test('monorepo: root package', () => { | |
prepare() | ||
expect.assertions(2) | ||
runUpdateInSubdir('fixtures/root-package') | ||
expect(exec.getCall(4).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(12) | ||
expect(exec.getCall(5).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(13) | ||
}) | ||
|
||
test('monorepo: no package.json', () => { | ||
prepare() | ||
expect.assertions(1) | ||
runUpdateInSubdir('fixtures/no-package') | ||
expect(exec.callCount).toEqual(0) | ||
expect(exec.callCount).toEqual(1) | ||
}) | ||
|
||
test('monorepo: root and one sub package', () => { | ||
prepare() | ||
expect.assertions(3) | ||
runUpdateInSubdir('fixtures/root-and-one-sub') | ||
expect(exec.getCall(4).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(9).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(17) | ||
expect(exec.getCall(5).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(10).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(18) | ||
}) | ||
|
||
test('monorepo: root and two sub package', () => { | ||
prepare() | ||
expect.assertions(4) | ||
runUpdateInSubdir('fixtures/root-and-two-sub') | ||
expect(exec.getCall(4).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(9).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(14).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(22) | ||
expect(exec.getCall(5).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(10).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(15).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(23) | ||
}) | ||
|
||
test('monorepo: root and two sub package at different levels', () => { | ||
prepare() | ||
expect.assertions(4) | ||
runUpdateInSubdir('fixtures/root-and-two-diff-sub') | ||
expect(exec.getCall(4).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(9).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(14).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(22) | ||
expect(exec.getCall(5).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(10).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(15).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(23) | ||
}) | ||
|
||
test('monorepo: no root and one sub package', () => { | ||
prepare() | ||
expect.assertions(2) | ||
runUpdateInSubdir('fixtures/no-root-and-one-sub') | ||
expect(exec.getCall(4).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(12) | ||
expect(exec.getCall(5).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(13) | ||
}) | ||
|
||
test('monorepo: no root and two sub package', () => { | ||
prepare() | ||
expect.assertions(3) | ||
runUpdateInSubdir('fixtures/no-root-and-two-sub') | ||
expect(exec.getCall(4).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(9).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(17) | ||
expect(exec.getCall(5).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(10).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(18) | ||
}) | ||
|
||
test('monorepo: no root and two sub package at different levels', () => { | ||
prepare() | ||
expect.assertions(3) | ||
runUpdateInSubdir('fixtures/no-root-and-two-diff-sub') | ||
expect(exec.getCall(4).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(9).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(17) | ||
expect(exec.getCall(5).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.getCall(10).calledWith('npm install -S [email protected]')).toBeTruthy() | ||
expect(exec.callCount).toEqual(18) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ const fs = require('fs') | |
|
||
const config = require('./lib/config') | ||
const info = require('./ci-services')() | ||
const hasLockfileCommit = require('./lib/git-helpers').hasLockfileCommit | ||
|
||
const env = process.env | ||
|
||
|
@@ -32,14 +33,14 @@ module.exports = function upload () { | |
return console.error('Not running on the initial Greenkeeper branch. Will only run on Greenkeeper branches that update a specific dependency') | ||
} | ||
|
||
if (!info.firstPush) { | ||
return console.error('Only running on first push of a new branch') | ||
} | ||
|
||
if (!info.uploadBuild) { | ||
return console.error('Only uploading on one build job') | ||
} | ||
|
||
if (hasLockfileCommit(info)) { | ||
return console.error('greenkeeper-lockfile already has a commit on this branch') | ||
} | ||
|
||
let remote = `[email protected]:${info.repoSlug}` | ||
if (info.gitUrl) remote = info.gitUrl | ||
|
||
|