forked from facebook/react
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support untagged releases (facebook#19507)
* Support untagged releases * Fix
- Loading branch information
Showing
10 changed files
with
117 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const {readJson} = require('fs-extra'); | ||
const {join} = require('path'); | ||
const theme = require('../theme'); | ||
|
||
const run = async ({cwd, packages, tag}) => { | ||
// Prevent a "next" release from ever being published as @latest | ||
// All canaries share a version number, so it's okay to check any of them. | ||
const arbitraryPackageName = packages[0]; | ||
const packageJSONPath = join( | ||
cwd, | ||
'build', | ||
'node_modules', | ||
arbitraryPackageName, | ||
'package.json' | ||
); | ||
const {version} = await readJson(packageJSONPath); | ||
const isExperimentalVersion = version.indexOf('experimental') !== -1; | ||
if (version.indexOf('0.0.0') === 0) { | ||
if (tag === 'latest') { | ||
if (isExperimentalVersion) { | ||
console.log( | ||
theme`{error Experimental release} {version ${version}} {error cannot be tagged as} {tag latest}` | ||
); | ||
} else { | ||
console.log( | ||
theme`{error Next release} {version ${version}} {error cannot be tagged as} {tag latest}` | ||
); | ||
} | ||
process.exit(1); | ||
} else if (tag === 'next' && isExperimentalVersion) { | ||
console.log( | ||
theme`{error Experimental release} {version ${version}} {error cannot be tagged as} {tag next}` | ||
); | ||
process.exit(1); | ||
} else if (tag === 'experimental' && !isExperimentalVersion) { | ||
console.log( | ||
theme`{error Next release} {version ${version}} {error cannot be tagged as} {tag experimental}` | ||
); | ||
process.exit(1); | ||
} | ||
} else { | ||
if (tag !== 'latest') { | ||
console.log( | ||
theme`{error Stable release} {version ${version}} {error cannot be tagged as} {tag ${tag}}` | ||
); | ||
process.exit(1); | ||
} | ||
} | ||
}; | ||
|
||
module.exports = run; |
This file was deleted.
Oops, something went wrong.
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