File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+ const { execSync } = require ( 'child_process' ) ;
3+
4+ const runCommand = command => {
5+ try {
6+ execSync ( `${ command } ` , { stdio : 'inherit' } ) ;
7+ } catch ( e ) {
8+ console . error ( 'Failed to execute ${command}' , e ) ;
9+ return false ;
10+ }
11+ return true ;
12+ } ;
13+
14+ const repoName = process . argv [ 2 ] ;
15+ const gitCheckoutCommand = `git clone --depth 1 https://github.com/gulalicelik/nodejs-express-sequelize-mysql-api-boilerplate.git ${ repoName } ` ;
16+ const installDepsCommand = `cd ${ repoName } && npm install` ;
17+
18+ console . log ( `Cloning the repository with name ${ repoName } ` ) ;
19+ const checkedOut = runCommand ( gitCheckoutCommand ) ;
20+ if ( ! checkedOut ) process . exit ( - 1 ) ;
21+
22+ console . log ( `Installing dependencies for ${ repoName } ` ) ;
23+ const installedDeps = runCommand ( installDepsCommand ) ;
24+ if ( ! installedDeps ) process . exit ( - 1 ) ;
25+
26+ console . log (
27+ 'Congratulations! You are ready. Follow the following commands to start'
28+ ) ;
29+ console . log ( `cd ${ repoName } && npm start` ) ;
Original file line number Diff line number Diff line change 11{
2- "name" : " nodejs-express-sequelize-mysql-api-boilerplate" ,
2+ "name" : " @karinca/ nodejs-express-sequelize-mysql-api-boilerplate" ,
33 "version" : " 1.0.0" ,
44 "description" : " " ,
55 "main" : " index.js" ,
1010 "start:prod" : " pm2 start --env prod" ,
1111 "test" : " echo \" Error: no test specified\" && exit 1"
1212 },
13+ "bin" : {
14+ "create-nodejs-express-sequelize-mysql-api-boilerplate" : " ./bin/cli.js"
15+ },
1316 "repository" : {
1417 "type" : " git" ,
1518 "url" : " git+https://github.com/gulalicelik/nodejs-express-sequelize-mysql-api-boilerplate.git"
You can’t perform that action at this time.
0 commit comments