From 5550792ab62d905f54b816c2ddf8f0a68d711a43 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Tue, 5 Sep 2017 11:09:07 -0700 Subject: [PATCH 1/3] fix typo --- src/commands/create.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/create.js b/src/commands/create.js index bc4b428bc..3b59c5939 100644 --- a/src/commands/create.js +++ b/src/commands/create.js @@ -79,7 +79,7 @@ export default asyncCommand({ // Attempt to fetch the `template` let archive = await gittar.fetch(repo).catch(err => { err = err || { message:'An error occured while fetching template.' }; - return error(err.code === 404 ? `Could not find repostory: ${repo}` : err.message, 1); + return error(err.code === 404 ? `Could not find repository: ${repo}` : err.message, 1); }); let spinner = ora({ From d93bcb023176039d1bafad254cd89c0f274916cd Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Tue, 5 Sep 2017 11:44:29 -0700 Subject: [PATCH 2/3] fix: ensure safe `name` key within `package.json` - Closes #358 --- src/commands/create.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/create.js b/src/commands/create.js index 3b59c5939..745256227 100644 --- a/src/commands/create.js +++ b/src/commands/create.js @@ -116,9 +116,11 @@ export default asyncCommand({ } if (argv.name) { - spinner.text = 'Updating `name` within `package.json` file'; // Update `package.json` key - pkgData && (pkgData.name = argv.name); + if (pkgData) { + spinner.text = 'Updating `name` within `package.json` file'; + pkgData.name = argv.name.toLowerCase().replace(/\s+/g, '_'); + } // Find a `manifest.json`; use the first match, if any let files = await Promise.promisify(glob)(target + '/**/manifest.json'); let manifest = files[0] && JSON.parse(await fs.readFile(files[0])); From 280bcb32d17269b2749f759f11149af29d6442d1 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Tue, 5 Sep 2017 12:08:01 -0700 Subject: [PATCH 3/3] prompt if `create` w/insufficient data - [poll] asks for ALL fields - Closes #352 --- src/commands/create.js | 48 ++++++++++++++++++++++++------------------ src/lib/setup.js | 22 +++++++++++++++++++ 2 files changed, 49 insertions(+), 21 deletions(-) diff --git a/src/commands/create.js b/src/commands/create.js index 745256227..8b675a6c5 100644 --- a/src/commands/create.js +++ b/src/commands/create.js @@ -6,13 +6,13 @@ import gittar from 'gittar'; import { green } from 'chalk'; import { prompt } from 'inquirer'; import asyncCommand from '../lib/async-command'; -import { install, initGit, addScripts } from './../lib/setup'; import { info, isDir, hasCommand, error, trim, warn } from '../util'; +import { install, initGit, addScripts, isMissing } from './../lib/setup'; const ORG = 'preactjs-templates'; export default asyncCommand({ - command: 'create