Last active
July 15, 2020 19:03
-
-
Save saltnpixels/1e64d689d1f94a9d822974ca4962dbab to your computer and use it in GitHub Desktop.
Ignition Installer
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
#!/usr/bin/env node | |
const { spawn } = require('child_process') | |
const chalk = require('chalk') | |
const args = require('minimist')(process.argv) | |
let folder = args._[2] || './' | |
console.log(chalk.blue('Downloading Ignition Starter Theme')) | |
const degit = require('degit') | |
let emitter = degit('https://github.com/saltnpixels/ignition ') | |
async function download() { | |
await emitter.clone(folder) | |
console.log(chalk.blue(`Ignition Downloaded. Installing Ignition...`)) | |
//run npm i | |
const cmd = await spawn('npm', ['i'], { cwd: `./${folder}`, shell: true }/* ... */) | |
cmd.stdout.on('data', (data) => { | |
// This will render 'live': | |
process.stdout.write(data.toString()) | |
}) | |
cmd.stderr.on('data', (data) => { | |
// This will render 'live': | |
console.error(chalk.red(data.toString())) | |
}) | |
cmd.on('close', (code)=>{ | |
if(code === 0) { | |
console.log(' ') | |
console.log(chalk.cyan.bold('All Set! Open the directory and run "npm run setup"')) | |
} | |
}) | |
// spawn('npm', ['run setup'], { cwd: `./${folder}`, shell: true }/* ... */).stdout.on('data', (data) => { | |
// // This will render 'live': | |
// console.log(data) | |
// }) | |
} | |
download() |
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
{ | |
"name": "ignition-installer", | |
"version": "1.0.0", | |
"description": "", | |
"main": "bin/index.js", | |
"bin": "./index.js", | |
"scripts": { | |
"test": "echo \"Cool\"" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"minimist": "^1.2.5", | |
"chalk": "^4.1.0", | |
"degit": "^2.8.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment