create-application-template 0.7.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
const { writeFile } = require('fs/promises')
|
|
3
3
|
const { execSync } = require('child_process')
|
|
4
|
+
const path = require('path')
|
|
4
5
|
const yargs = require('yargs/yargs')
|
|
5
6
|
const { hideBin } = require('yargs/helpers')
|
|
6
7
|
const packageJson = require('../package.json')
|
|
@@ -22,12 +23,15 @@ const run = async () => {
|
|
|
22
23
|
// consume arguments
|
|
23
24
|
const argv = yargs(hideBin(process.argv)).argv
|
|
24
25
|
|
|
26
|
+
const isNameDotCommand = (argv.name === '.')
|
|
27
|
+
const projectName = isNameDotCommand ? path.basename(process.cwd()) : argv.name
|
|
28
|
+
|
|
25
29
|
if (!argv.name) {
|
|
26
30
|
console.error('WARNING add a project name like so: npx create-application-template --name={my-project}')
|
|
27
31
|
process.exit(1)
|
|
28
32
|
} else {
|
|
29
33
|
console.info('')
|
|
30
|
-
console.info(`Your project name is: ${
|
|
34
|
+
console.info(`Your project name is: ${projectName}`)
|
|
31
35
|
console.info('')
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -42,7 +46,7 @@ const run = async () => {
|
|
|
42
46
|
execCommand(`curl -L ${repo} | tar zx --one-top-level=${argv.name} --strip-components 1`)
|
|
43
47
|
|
|
44
48
|
// groom project
|
|
45
|
-
if (packageJson.hasOwnProperty('name')) packageJson.name =
|
|
49
|
+
if (packageJson.hasOwnProperty('name')) packageJson.name = projectName
|
|
46
50
|
if (packageJson.hasOwnProperty('version')) packageJson.version = '1.0.0'
|
|
47
51
|
if (packageJson.hasOwnProperty('description')) packageJson.description = ''
|
|
48
52
|
if (packageJson.hasOwnProperty('author')) packageJson.author = ''
|