Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

07-cli

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

07-cli - npm Package Compare versions

Comparing version 2.5.3 to 2.5.4

commands/cra-old.js

137

commands/cra.js

@@ -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(
`yarn create vite ${name} --template react-ts && cd ${name} && yarn && yarn dev && code .`,
{
stdio: 'inherit',
}
);
} else {
execSync(`yarn create vite ${name} --template react-ts`, {
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;
{
"name": "07-cli",
"version": "2.5.3",
"description": "A command line tool for 07 organization",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": "07.js",
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"chalk": "^4.1.2",
"colors": "^1.4.0",
"commander": "^8.3.0",
"conf": "^10.0.3",
"js-yaml": "^4.1.0",
"node-color-readline": "^1.0.1",
"node-emoji": "^1.11.0",
"tls-test": "https://tls-test.npmjs.com/tls-test-1.0.0.tgz",
"write-yaml-file": "^4.2.0"
}
"name": "07-cli",
"version": "2.5.4",
"description": "A command line tool for 07 organization",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": "07.js",
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"chalk": "^4.1.2",
"colors": "^1.4.0",
"commander": "^8.3.0",
"conf": "^10.0.3",
"js-yaml": "^4.1.0",
"node-color-readline": "^1.0.1",
"node-emoji": "^1.11.0",
"tls-test": "https://tls-test.npmjs.com/tls-test-1.0.0.tgz",
"write-yaml-file": "^4.2.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc