Created
June 2, 2018 19:51
-
-
Save nerdic-coder/659cff7655e18986ec0ffb538864dbfe to your computer and use it in GitHub Desktop.
stencil-cli start-app.js
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
// Command for starting a new stencil starter app, example 'stencil start-app my-app' | |
if (process.argv[2] === 'start-app') { | |
if (!shell.which('git')) { | |
shell.echo('Sorry, this script requires git'); | |
shell.exit(1); | |
} | |
var projectName = process.argv[3]; | |
if (!projectName) { | |
shell.echo('Please state the project name after the "start-app" command.'); | |
shell.exit(1); | |
} | |
shell.exec('git clone https://github.com/ionic-team/stencil-app-starter ' + projectName); | |
shell.cd(projectName); | |
shell.echo('Running: git remote rm origin'); | |
shell.exec('git remote rm origin'); | |
shell.echo('Updating npm package names to ' + projectName + '.'); | |
shell.ls('package*.json').forEach(function (file) { | |
shell.sed('-i', '@stencil/starter', projectName, file); | |
}); | |
shell.echo('Running: npm install'); | |
shell.exec('npm install'); | |
shell.exit(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment