-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(yalc): Add publish_yalc_package script for travis scripts
- Loading branch information
1 parent
8b05e84
commit 349cc57
Showing
2 changed files
with
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env node | ||
const fs = require('fs'); | ||
const util = require('./util'); | ||
|
||
const ORIG_DIR = process.cwd(); | ||
|
||
function publishYalcPackage(installDir, githubUrl) { | ||
if (!installDir || !githubUrl) { | ||
throw new Error('Usage: publish_yalc_package [INSTALL_DIR] [GITHUB_URL]'); | ||
} | ||
|
||
if (!fs.existsSync(installDir)) { | ||
util._exec('git clone '+ githubUrl + ' ' + installDir); | ||
} | ||
|
||
process.chdir(installDir); | ||
util._exec('git fetch origin'); | ||
util._exec('git reset --hard origin/master'); | ||
util._exec('git clean --force -d'); | ||
util._exec('yarn --check-files'); | ||
util._exec('npm run build'); | ||
util._exec('yalc publish'); | ||
|
||
process.chdir(ORIG_DIR); | ||
} | ||
|
||
if (require.main === module) { | ||
publishYalcPackage(process.argv[2], process.argv[3]) | ||
} | ||
|
||
module.exports = publishYalcPackage; |