Skip to content

Instantly share code, notes, and snippets.

@rmdashrfv
Created February 10, 2023 17:44
Show Gist options
  • Select an option

  • Save rmdashrfv/363fa4c8535820ae9c98d5ac3d3a1fa4 to your computer and use it in GitHub Desktop.

Select an option

Save rmdashrfv/363fa4c8535820ae9c98d5ac3d3a1fa4 to your computer and use it in GitHub Desktop.
Code Challenge script
const { exec } = require('child_process')
const fs = require('fs')
if (process.argv.length < 3) {
console.log('File must be run as "node start.js your-name" (e.g., "node start.js ada-lovelace"')
return;
}
let concatName = process.argv[2]
fs.writeFileSync('bin/config', concatName, (err) => err && console.log('Error occurred when writing file:', err))
exec('git clone code-challenge.bundle')
exec(`cd code-challenge.bundle && git checkout -b ${concatName}`)
exec('cd code-challenge && git commit --allow-empty -m "Initial commit"')
console.log('Removing code-challenge.bundle')
exec('rm code-challenge.bundle')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment