File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 23
23
"release" : " ./release.js" ,
24
24
"show_changelog" : " ./show_changelog.js" ,
25
25
"test_downstream_projects" : " ./test_downstream_projects.js" ,
26
+ "publish_yalc_package" : " ./publish_yalc_package.js" ,
26
27
"util" : " ./util.js"
27
28
},
28
29
"dependencies" : {
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+ const fs = require ( 'fs' ) ;
3
+ const util = require ( './util' ) ;
4
+
5
+ const ORIG_DIR = process . cwd ( ) ;
6
+
7
+ function publishYalcPackage ( installDir , githubUrl ) {
8
+ if ( ! installDir || ! githubUrl ) {
9
+ throw new Error ( 'Usage: publish_yalc_package [INSTALL_DIR] [GITHUB_URL]' ) ;
10
+ }
11
+
12
+ if ( ! fs . existsSync ( installDir ) ) {
13
+ util . _exec ( 'git clone ' + githubUrl + ' ' + installDir ) ;
14
+ }
15
+
16
+ process . chdir ( installDir ) ;
17
+ util . _exec ( 'git fetch origin' ) ;
18
+ util . _exec ( 'git reset --hard origin/master' ) ;
19
+ util . _exec ( 'git clean --force -d' ) ;
20
+ util . _exec ( 'yarn --check-files' ) ;
21
+ util . _exec ( 'npm run build' ) ;
22
+ util . _exec ( 'yalc publish' ) ;
23
+
24
+ process . chdir ( ORIG_DIR ) ;
25
+ }
26
+
27
+ if ( require . main === module ) {
28
+ publishYalcPackage ( process . argv [ 2 ] , process . argv [ 3 ] )
29
+ }
30
+
31
+ module . exports = publishYalcPackage ;
You can’t perform that action at this time.
0 commit comments