-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add --push-back * Add --registry * Add --skip-checks * Demand --release and --next * Use parse-git-remote to find dojo remote * If --push-back is specified and no dojo remote found, quit * Move functionality of can-publish-check and repo-is-clean-check into functions * Add checks back to release script
- Loading branch information
1 parent
015059b
commit 76a8776
Showing
5 changed files
with
123 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
import chalk from 'chalk'; | ||
import { runAsPromise } from './utils/process'; | ||
import { isRepoClean } from './utils/checks'; | ||
|
||
(async function() { | ||
const gitOutput = (await runAsPromise('git', ['status', '--porcelain'])).trim(); | ||
|
||
if (gitOutput) { | ||
console.log(chalk.red('there are changes in the working tree')); | ||
process.exit(1); | ||
} | ||
|
||
const revParse = (await runAsPromise('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).trim(); | ||
if (revParse !== 'master') { | ||
console.log(chalk.red('not on master branch')); | ||
if (!(await isRepoClean())) { | ||
process.exit(1); | ||
} | ||
})(); |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import chalk from 'chalk'; | ||
import { runAsPromise } from './process'; | ||
|
||
export async function canPublish(isInitialRelease: boolean) { | ||
let user = ''; | ||
|
||
try { | ||
const whoami = await runAsPromise('npm', ['whoami']); | ||
user = whoami.trim(); | ||
} catch (e) { | ||
console.log(chalk.red('failed running "npm whoami". are you not logged into npm?')); | ||
return false; | ||
} | ||
|
||
if (!isInitialRelease) { | ||
const maintainers = JSON.parse(await runAsPromise('npm', ['view', '.', '--json'])).maintainers.map( | ||
(maintainer: string) => maintainer.replace(/\s<.*/, '') | ||
); | ||
|
||
if (maintainers.indexOf(user) < 0) { | ||
console.log(chalk.red(`cannot publish this package with user ${user}`)); | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
export async function isRepoClean() { | ||
const gitOutput = (await runAsPromise('git', ['status', '--porcelain'])).trim(); | ||
|
||
if (gitOutput) { | ||
console.log(chalk.red('there are changes in the working tree')); | ||
return false; | ||
} | ||
|
||
const revParse = (await runAsPromise('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).trim(); | ||
if (revParse !== 'master') { | ||
console.log(chalk.red('not on master branch')); | ||
return false; | ||
} | ||
|
||
return true; | ||
} |