Comparing version 2.5.4 to 2.5.5
@@ -6,88 +6,85 @@ /* | ||
// Dependency to execute code in terminal | ||
const execSync = require("child_process").execSync; | ||
const execSync = require('child_process').execSync; | ||
// File system, dependency to check paths | ||
const fs = require("fs"); | ||
const fs = require('fs'); | ||
// Question dependencies | ||
const readline = require("readline"); | ||
const readline = require('readline'); | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
terminal: false, | ||
input: process.stdin, | ||
output: process.stdout, | ||
terminal: false, | ||
}); | ||
// Emoji function | ||
const emoji = require("node-emoji"); | ||
const emoji = require('node-emoji'); | ||
const e = (n) => emoji.get(n); | ||
function cra(options) { | ||
/* ********************************** */ | ||
/* LOG ARGUMENTS */ | ||
/* ********************************** */ | ||
Object.values(options).length > 0 && console.log("#".meta); | ||
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"); | ||
/* ********************************** */ | ||
/* LOG ARGUMENTS */ | ||
/* ********************************** */ | ||
Object.values(options).length > 0 && console.log('#'.meta); | ||
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'); | ||
/* ********************************** */ | ||
/* CREATE OUTPUT DIR */ | ||
/* ********************************** */ | ||
const createReactApp = (name) => { | ||
if (name) { | ||
let exists = fs.existsSync(`${name}`); | ||
if (!exists) { | ||
if (options.start === true) { | ||
execSync( | ||
`npx create-react-app ${name} --template 07 && cd ${name} && yarn && yarn start && code .`, | ||
{ | ||
stdio: "inherit", | ||
} | ||
); | ||
} else { | ||
execSync(`npx create-react-app ${name} --template 07`, { | ||
stdio: "inherit", | ||
}); | ||
} | ||
rl.close("success"); | ||
} else { | ||
console.log( | ||
`\n${e("worried")} Folder already exists: ${`${name}`.meta}` | ||
.error | ||
); | ||
rl.close("failure"); | ||
} | ||
} else { | ||
rl.close("failure"); | ||
} | ||
}; | ||
/* ********************************** */ | ||
/* CREATE OUTPUT DIR */ | ||
/* ********************************** */ | ||
const createReactApp = (name) => { | ||
if (name) { | ||
let exists = fs.existsSync(`${name}`); | ||
if (!exists) { | ||
if (options.start === true) { | ||
execSync( | ||
`npx --yes create-react-app ${name} --template 07 && cd ${name} && yarn && yarn start && code .`, | ||
{ | ||
stdio: 'inherit', | ||
} | ||
); | ||
} else { | ||
execSync(`npx --yes create-react-app ${name} --template 07`, { | ||
stdio: 'inherit', | ||
}); | ||
} | ||
rl.close('success'); | ||
} else { | ||
console.log( | ||
`\n${e('worried')} Folder already exists: ${`${name}`.meta}`.error | ||
); | ||
rl.close('failure'); | ||
} | ||
} else { | ||
rl.close('failure'); | ||
} | ||
}; | ||
// Check for arguments or ask for info | ||
if (options.name) { | ||
createReactApp(options.name); | ||
} else { | ||
rl.question( | ||
`${e("shrug")} Hva skal prosjektet hete? ${ | ||
"e.g. 07_cra_byggma-kalkulator".meta | ||
} `, | ||
function (name) { | ||
name === "" ? rl.close() : createReactApp(name); | ||
} | ||
); | ||
} | ||
// Check for arguments or ask for info | ||
if (options.name) { | ||
createReactApp(options.name); | ||
} else { | ||
rl.question( | ||
`${e('shrug')} Hva skal prosjektet hete? ${ | ||
'e.g. 07_cra_byggma-kalkulator'.meta | ||
} `, | ||
function (name) { | ||
name === '' ? rl.close() : createReactApp(name); | ||
} | ||
); | ||
} | ||
// Conclusion | ||
rl.on("close", function (status) { | ||
if (status === "success") { | ||
console.log(`\n${e("partying_face")} CRA === true!`.green); | ||
} else if (status === "failure") { | ||
console.log(`\n${e("worried")} CRA === false!`.red); | ||
} | ||
process.exit(0); | ||
}); | ||
// Conclusion | ||
rl.on('close', function (status) { | ||
if (status === 'success') { | ||
console.log(`\n${e('partying_face')} CRA === true!`.green); | ||
} else if (status === 'failure') { | ||
console.log(`\n${e('worried')} CRA === false!`.red); | ||
} | ||
process.exit(0); | ||
}); | ||
} | ||
module.exports = cra; |
@@ -6,67 +6,65 @@ /* | ||
// Dependency to execute code in terminal | ||
const execSync = require("child_process").execSync; | ||
const execSync = require('child_process').execSync; | ||
// File system, dependency to check paths | ||
const fs = require("fs"); | ||
const fs = require('fs'); | ||
// Question dependencies | ||
const readline = require("readline"); | ||
const readline = require('readline'); | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
terminal: false, | ||
input: process.stdin, | ||
output: process.stdout, | ||
terminal: false, | ||
}); | ||
// Emoji function | ||
const emoji = require("node-emoji"); | ||
const emoji = require('node-emoji'); | ||
const e = (n) => emoji.get(n); | ||
function craumb(options) { | ||
/* ********************************** */ | ||
/* LOG ARGUMENTS */ | ||
/* ********************************** */ | ||
Object.values(options).length > 0 && console.log("#".meta); | ||
options.name && console.log(`Project name: ${options.name.info}`); | ||
Object.values(options).length > 0 && console.log("#".meta, "\n"); | ||
/* ********************************** */ | ||
/* LOG ARGUMENTS */ | ||
/* ********************************** */ | ||
Object.values(options).length > 0 && console.log('#'.meta); | ||
options.name && console.log(`Project name: ${options.name.info}`); | ||
Object.values(options).length > 0 && console.log('#'.meta, '\n'); | ||
/* ********************************** */ | ||
/* CREATE OUTPUT DIR */ | ||
/* ********************************** */ | ||
const createCraumb = (name) => { | ||
if (name) { | ||
execSync( | ||
` npx create-react-app 07_cra_${name} --template 07 && cd 07_cra_${name} && cd ../ && git clone https://github.com/07-media-sor/07_umb9_boilerplate.git && dotnet new --debug:reinit && dotnet new -i ./07_umb9_boilerplate && dotnet new 07-umb9-template -o 07_umb9_${name} && rm -rf ./07_umb9_boilerplate && cd ./07_umb9_${name} && code . && code ../07_cra_${name} && dotnet run`, | ||
{ stdio: "inherit" } | ||
); | ||
rl.close("success"); | ||
} else { | ||
rl.close("failure"); | ||
} | ||
}; | ||
/* ********************************** */ | ||
/* CREATE OUTPUT DIR */ | ||
/* ********************************** */ | ||
const createCraumb = (name) => { | ||
if (name) { | ||
execSync( | ||
` npx --yes create-react-app 07_cra_${name} --template 07 && cd 07_cra_${name} && cd ../ && git clone https://github.com/07-media-sor/07_umb9_boilerplate.git && dotnet new --debug:reinit && dotnet new -i ./07_umb9_boilerplate && dotnet new 07-umb9-template -o 07_umb9_${name} && rm -rf ./07_umb9_boilerplate && cd ./07_umb9_${name} && code . && code ../07_cra_${name} && dotnet run`, | ||
{ stdio: 'inherit' } | ||
); | ||
rl.close('success'); | ||
} else { | ||
rl.close('failure'); | ||
} | ||
}; | ||
// Check for arguments or ask for info | ||
if (options.name) { | ||
createCraumb(options.name); | ||
} else { | ||
rl.question( | ||
`${e("shrug")} Hva skal prosjektet hete? ${ | ||
"e.g. test-project".meta | ||
} `, | ||
function (name) { | ||
name === "" ? rl.close() : createCraumb(name); | ||
} | ||
); | ||
} | ||
// Check for arguments or ask for info | ||
if (options.name) { | ||
createCraumb(options.name); | ||
} else { | ||
rl.question( | ||
`${e('shrug')} Hva skal prosjektet hete? ${'e.g. test-project'.meta} `, | ||
function (name) { | ||
name === '' ? rl.close() : createCraumb(name); | ||
} | ||
); | ||
} | ||
// Conclusion | ||
rl.on("close", function (status) { | ||
if (status === "success") { | ||
console.log(`\n${e("partying_face")} umb9 === true!`.green); | ||
} else if (status === "failure") { | ||
console.log(`\n${e("worried")} umb9 === false!`.red); | ||
} | ||
process.exit(0); | ||
}); | ||
// Conclusion | ||
rl.on('close', function (status) { | ||
if (status === 'success') { | ||
console.log(`\n${e('partying_face')} umb9 === true!`.green); | ||
} else if (status === 'failure') { | ||
console.log(`\n${e('worried')} umb9 === false!`.red); | ||
} | ||
process.exit(0); | ||
}); | ||
} | ||
module.exports = craumb; |
{ | ||
"name": "07-cli", | ||
"version": "2.5.4", | ||
"version": "2.5.5", | ||
"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
68517
724