Skip to content

Instantly share code, notes, and snippets.

@nerdic-coder
Created June 2, 2018 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerdic-coder/659cff7655e18986ec0ffb538864dbfe to your computer and use it in GitHub Desktop.
Save nerdic-coder/659cff7655e18986ec0ffb538864dbfe to your computer and use it in GitHub Desktop.
stencil-cli start-app.js
// 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