This repository has been archived by the owner on May 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add rollback npm version command (#252)
* feat: add rollback command * chore: update CONTRIBUTING.md
- Loading branch information
chenbin92
authored
Apr 20, 2020
1 parent
8f4ba2c
commit 7176025
Showing
3 changed files
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as execa from 'execa'; | ||
import getPackages from './fn/getPackages'; | ||
|
||
// eslint-disable-next-line | ||
const chalk = require('chalk'); | ||
|
||
(async () => { | ||
const { packageNames } = await getPackages(); | ||
const args = process.argv; | ||
const rollbackVersion = args[2]; | ||
packageNames.forEach((packageName) => { | ||
console.log(`rollback: ${packageName}@${rollbackVersion}`); | ||
execa.commandSync(`npm dist-tags add ${packageName}@${rollbackVersion} latest`, { | ||
stdio: 'inherit' | ||
}); | ||
console.log(); | ||
}); | ||
})().catch((e) => { | ||
console.log(chalk.red(`\n ⚠️ ⚠️ ⚠️ rollback failed\n\n`), e); | ||
process.exit(128); | ||
}); |