Comparing version 2.5.5 to 2.5.6
169
07.js
#!/usr/bin/env node | ||
const { program } = require("commander"); | ||
const yml = require("./commands/yml"); | ||
const cra = require("./commands/cra"); | ||
const gh = require("./commands/gh"); | ||
const umb = require("./commands/umb"); | ||
const craumb = require("./commands/craumb"); | ||
const { program } = require('commander'); | ||
const yml = require('./commands/yml'); | ||
const cra = require('./commands/cra'); | ||
const gh = require('./commands/gh'); | ||
const umb = require('./commands/umb'); | ||
const craumb = require('./commands/craumb'); | ||
// Colors to style console logs | ||
const colors = require("colors"); | ||
const colors = require('colors'); | ||
colors.setTheme({ | ||
info: "cyan", | ||
highlight: "bgCyan", | ||
meta: "grey", | ||
warn: "yellow", | ||
success: "green", | ||
error: "red", | ||
info: 'cyan', | ||
highlight: 'bgCyan', | ||
meta: 'grey', | ||
warn: 'yellow', | ||
success: 'green', | ||
error: 'red', | ||
}); | ||
program | ||
.version(require("./package.json").version) | ||
.command("yml") | ||
.option( | ||
"-o --output <output>", | ||
`Specify a output folder ${"(e.g. ./react-project)".meta}` | ||
) | ||
.option("-s --server <server>", `Specify a server ${"(e.g. 215/213)".meta}`) | ||
.option( | ||
"-sd --serverDir <server>", | ||
`Specify a directory on the server ${ | ||
"(e.g. umbraco/w358109/www/build/)".meta | ||
}` | ||
) | ||
.description("Create a Github workflow with React build and FTP output") | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error("Called %s with options %o", command.name(), options); | ||
} | ||
yml(options); | ||
}); | ||
.version(require('./package.json').version) | ||
.command('yml') | ||
.option( | ||
'-o --output <output>', | ||
`Specify a output folder ${'(e.g. ./react-project)'.meta}` | ||
) | ||
.option('-s --server <server>', `Specify a server ${'(e.g. 215/213)'.meta}`) | ||
.option( | ||
'-sd --serverDir <server>', | ||
`Specify a directory on the server ${ | ||
'(e.g. umbraco/w358109/www/build/)'.meta | ||
}` | ||
) | ||
.description('Create a Github workflow with React build and FTP output') | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error('Called %s with options %o', command.name(), options); | ||
} | ||
yml(options); | ||
}); | ||
program | ||
.command("umb") | ||
.description( | ||
"Create a Umbraco 9 project with API controller using 07 boilerplate" | ||
) | ||
.option( | ||
"-n --name <projectName>", | ||
`Specify a project name ${"(e.g. byggma-kalkulator)".meta}` | ||
) | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error("Called %s with options %o", command.name(), options); | ||
} | ||
umb(options); | ||
}); | ||
.command('umb') | ||
.description( | ||
'Create a Umbraco 9 project with API controller using 07 boilerplate' | ||
) | ||
.option( | ||
'-n --name <projectName>', | ||
`Specify a project name ${'(e.g. byggma-kalkulator)'.meta}` | ||
) | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error('Called %s with options %o', command.name(), options); | ||
} | ||
umb(options); | ||
}); | ||
program | ||
.command("cra") | ||
.description( | ||
"Create a React App using create-react-app with 07_cra_template" | ||
) | ||
.option( | ||
"-n --name <projectName>", | ||
`Specify a project name ${"(e.g. byggma-kalkulator)".meta}` | ||
) | ||
.option("-s --start", `Start project right away if flag is provided`) | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error("Called %s with options %o", command.name(), options); | ||
} | ||
cra(options); | ||
}); | ||
.command('cra') | ||
.description('Create a React App using create-react-app with 07_cra_template') | ||
.option( | ||
'-n --name <projectName>', | ||
`Specify a project name ${'(e.g. byggma-kalkulator)'.meta}` | ||
) | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error('Called %s with options %o', command.name(), options); | ||
} | ||
cra(options); | ||
}); | ||
program | ||
.command("craumb") | ||
.description("Create a React / Umb9 project") | ||
.option( | ||
"-n --name <projectName>", | ||
`Specify a project name ${"(e.g. test-project)".meta}` | ||
) | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error("Called %s with options %o", command.name(), options); | ||
} | ||
craumb(options); | ||
}); | ||
.command('craumb') | ||
.description('Create a React / Umb9 project') | ||
.option( | ||
'-n --name <projectName>', | ||
`Specify a project name ${'(e.g. test-project)'.meta}` | ||
) | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error('Called %s with options %o', command.name(), options); | ||
} | ||
craumb(options); | ||
}); | ||
program | ||
.command("gh") | ||
.description("Create a Github repo using gh-cli") | ||
.option( | ||
"-n --name <projectName>", | ||
`Specify a repo name ${"(e.g. 07_cra_byggma-kalkulator)".meta}` | ||
) | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error("Called %s with options %o", command.name(), options); | ||
} | ||
gh(options); | ||
}); | ||
.command('gh') | ||
.description('Create a Github repo using gh-cli') | ||
.option( | ||
'-n --name <projectName>', | ||
`Specify a repo name ${'(e.g. 07_cra_byggma-kalkulator)'.meta}` | ||
) | ||
.action((options, command) => { | ||
if (options.debug) { | ||
console.error('Called %s with options %o', command.name(), options); | ||
} | ||
gh(options); | ||
}); | ||
@@ -103,0 +100,0 @@ program.parse(); |
@@ -29,4 +29,2 @@ /* | ||
options.name && console.log(`Project name: ${options.name.info}`); | ||
options.start && | ||
console.log(`Starting project when ready since "-s" flag specified`.info); | ||
Object.values(options).length > 0 && console.log('#'.meta, '\n'); | ||
@@ -41,14 +39,8 @@ | ||
if (!exists) { | ||
if (options.start === true) { | ||
execSync( | ||
`yarn create vite ${name} --template react-ts && cd ${name} && yarn && yarn dev && code .`, | ||
{ | ||
stdio: 'inherit', | ||
} | ||
); | ||
} else { | ||
execSync(`yarn create vite ${name} --template react-ts`, { | ||
execSync( | ||
`yarn create vite ${name} --template react-ts && code ${name} && cd ${name} && yarn && open http://localhost:3000/ && yarn dev`, | ||
{ | ||
stdio: 'inherit', | ||
}); | ||
} | ||
} | ||
); | ||
rl.close('success'); | ||
@@ -55,0 +47,0 @@ } else { |
{ | ||
"name": "07-cli", | ||
"version": "2.5.5", | ||
"version": "2.5.6", | ||
"description": "A command line tool for 07 organization", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67864
713