-
Notifications
You must be signed in to change notification settings - Fork 47.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added publish command and slightly refactored some other command mess…
…aging
- Loading branch information
Brian Vaughn
committed
Nov 17, 2018
1 parent
75f0f8e
commit 8f6e199
Showing
23 changed files
with
457 additions
and
121 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
24 changes: 24 additions & 0 deletions
24
scripts/release/create-canary-commands/confirm-automated-testing.js
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,24 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const chalk = require('chalk'); | ||
const clear = require('clear'); | ||
const {confirm} = require('../utils'); | ||
|
||
const run = async () => { | ||
clear(); | ||
|
||
console.log( | ||
chalk.red( | ||
'This script does not run any automated tests.' + | ||
'You should run them manually before creating a canary release.' | ||
) | ||
); | ||
|
||
await confirm('Do you want to proceed?'); | ||
|
||
clear(); | ||
}; | ||
|
||
module.exports = run; |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const chalk = require('chalk'); | ||
const {execRead, logPromise} = require('../utils'); | ||
|
||
const run = async ({cwd, packages, version}) => { | ||
const currentUser = await execRead('npm whoami'); | ||
const failedProjects = []; | ||
|
||
const checkProject = async project => { | ||
const owners = (await execRead(`npm owner ls ${project}`)) | ||
.split('\n') | ||
.filter(owner => owner) | ||
.map(owner => owner.split(' ')[0]); | ||
|
||
if (!owners.includes(currentUser)) { | ||
failedProjects.push(project); | ||
} | ||
}; | ||
|
||
await logPromise( | ||
Promise.all(packages.map(checkProject)), | ||
`Checking ${chalk.yellow.bold(currentUser)}'s NPM permissions` | ||
); | ||
|
||
if (failedProjects.length) { | ||
throw Error( | ||
chalk` | ||
Insufficient NPM permissions | ||
{white NPM user {yellow.bold ${currentUser}} is not an owner for:} | ||
{red ${failedProjects.join(', ')}} | ||
{white Please contact a React team member to be added to the above project(s).} | ||
` | ||
); | ||
} | ||
}; | ||
|
||
module.exports = run; |
48 changes: 48 additions & 0 deletions
48
scripts/release/publish-commands/confirm-version-and-tags.js
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,48 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const chalk = require('chalk'); | ||
const clear = require('clear'); | ||
const {readJson} = require('fs-extra'); | ||
const {join} = require('path'); | ||
const {confirm} = require('../utils'); | ||
|
||
const run = async ({cwd, packages, tags}) => { | ||
clear(); | ||
|
||
if (tags.length === 1) { | ||
console.log( | ||
chalk`{green ✓} You are about the publish the following packages under the tag {yellow ${tags}}` | ||
); | ||
} else { | ||
console.log( | ||
chalk`{green ✓} You are about the publish the following packages under the tags {yellow ${tags.join( | ||
', ' | ||
)}}` | ||
); | ||
} | ||
|
||
// Cache all package JSONs for easy lookup below. | ||
for (let i = 0; i < packages.length; i++) { | ||
const packageName = packages[i]; | ||
const packageJSONPath = join( | ||
cwd, | ||
'build/node_modules', | ||
packageName, | ||
'package.json' | ||
); | ||
const packageJSON = await readJson(packageJSONPath); | ||
console.log( | ||
chalk`• {green ${packageName}} @ {yellow ${chalk.yellow( | ||
packageJSON.version | ||
)}}` | ||
); | ||
} | ||
|
||
await confirm('Do you want to proceed?'); | ||
}; | ||
|
||
// Run this directly because it's fast, | ||
// and logPromise would interfere with console prompting. | ||
module.exports = run; |
Oops, something went wrong.