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

create-noderize

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-noderize - npm Package Compare versions

Comparing version 0.2.0 to 0.2.2

85

dist/index.js

@@ -83,2 +83,3 @@ #!/usr/bin/env node

Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (immutable) */ __webpack_exports__["run"] = run;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ncp__ = __webpack_require__(1);

@@ -109,4 +110,3 @@ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ncp___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_ncp__);

function run(_x, _x2) {
function run(_x) {
return _run.apply(this, arguments);

@@ -117,6 +117,8 @@ }

_run = _asyncToGenerator(function* (name, {
typescript = false
}) {
typescript = false,
forceNpm = false,
forceYarn = false
} = {}) {
if (!name) {
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.red("[WARN]")} No path given!`);
printWarn(`No path given!`);
return;

@@ -126,10 +128,10 @@ } // Get absolute path

const path = Object(__WEBPACK_IMPORTED_MODULE_3_path__["resolve"])(__WEBPACK_IMPORTED_MODULE_4_fs___default.a.realpathSync(process.cwd()), name);
const path = Object(__WEBPACK_IMPORTED_MODULE_3_path__["resolve"])(__WEBPACK_IMPORTED_MODULE_4_fs___default.a.realpathSync(process.cwd()), name); // Check if exist
if (__WEBPACK_IMPORTED_MODULE_4_fs___default.a.existsSync(path)) {
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.red("[WARN]")} Path exists!`);
printWarn(`Path exists!`);
return;
}
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.blueBright("[INFO]")} Copying...${typescript ? " (TypeScript)" : ""}`); // Copy from template
printInfo(`Copying...`); // Copy from template

@@ -139,8 +141,7 @@ try {

} catch (error) {
console.error(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.redBright("[ERROR]")} Error copying.`);
console.error(error);
error(`Error copying.`, error);
return;
}
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.blueBright("[INFO]")} Setting up...`); // Set the "name" field in package.json
printInfo(`Setting up...`); // Set the "name" field in package.json

@@ -166,4 +167,3 @@ try {

} catch (error) {
console.error(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.redBright("[ERROR]")} Error saving package.json.`);
console.error(error);
printError(`Error saving package.json.`, error);
} // Move "gitignore" to ".gitignore"

@@ -174,5 +174,4 @@

__WEBPACK_IMPORTED_MODULE_4_fs___default.a.renameSync(Object(__WEBPACK_IMPORTED_MODULE_3_path__["resolve"])(path, "gitignore"), Object(__WEBPACK_IMPORTED_MODULE_3_path__["resolve"])(path, ".gitignore"));
} catch (error) {
console.error(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.redBright("[ERROR]")} Error moving .gitignore.`);
console.error(error);
} catch (err) {
printError(`Error moving .gitignore.`, error);
}

@@ -185,32 +184,34 @@

} catch (error) {
console.error(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.redBright("[ERROR]")} Error moving src/index.js to src/index.ts`);
console.error(error);
printError(`Error moving src/index.js to src/index.ts.`, error);
}
}
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.blueBright("[INFO]")} Installing packages...`);
const useYarn = shouldUseYarn();
printInfo(`Installing packages...`);
console.log();
const useYarn = forceYarn ? true : forceNpm ? false : shouldUseYarn();
try {
// Install using yarn/npm
// Install latest
if (useYarn) {
Object(__WEBPACK_IMPORTED_MODULE_5_child_process__["execSync"])("yarn", {
cwd: path
Object(__WEBPACK_IMPORTED_MODULE_5_child_process__["execSync"])("yarn add -D noderize-scripts", {
cwd: path,
stdio: "inherit"
});
} else {
Object(__WEBPACK_IMPORTED_MODULE_5_child_process__["execSync"])("npm install", {
cwd: path
Object(__WEBPACK_IMPORTED_MODULE_5_child_process__["execSync"])("npm install -D noderize-scripts", {
cwd: path,
stdio: "inherit"
});
}
} catch (error) {
console.error(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.redBright("[ERROR]")} Error installing packages.`);
console.error(error);
printError(`Error installing packages.`, error);
}
const runCommand = useYarn ? "yarn" : "npm run";
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.greenBright("[INFO]")} Done! Your Noderize app is ready!`);
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.greenBright("[INFO]")} You may visit your app with ${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.cyan(`cd ${name}`)}`);
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.greenBright("[INFO]")} Develop by using ${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.cyan(`${runCommand} watch`)}`);
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.greenBright("[INFO]")} Build a production version using ${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.cyan(`${runCommand} build`)}`);
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.greenBright("[INFO]")} Visit documentation at ${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.cyan(`https://noderize.js.org`)}`);
console.log();
printDone(`Done! Your Noderize app is ready!`);
printDone(`You may visit your app with ${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.cyan(`cd ${name}`)}`);
printDone(`Develop by using ${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.cyan(`${runCommand} watch`)}`);
printDone(`Build a production version using ${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.cyan(`${runCommand} build`)}`);
printDone(`Visit documentation at ${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.cyan(`https://noderize.js.org`)}`);
});

@@ -229,4 +230,5 @@ return _run.apply(this, arguments);

}
}
} // Parse args
const args = __WEBPACK_IMPORTED_MODULE_6_minimist___default()(process.argv.slice(2));

@@ -236,2 +238,19 @@ const name = args._.length > 0 ? args._[0] : null;

function printInfo(text) {
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.blueBright("[INFO]")} ${text}`);
}
function printDone(text) {
console.log(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.greenBright("[DONE]")} ${text}`);
}
function printWarn(text) {
console.warn(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.yellowBright("[WARN]")} ${text}`);
}
function printError(text, error) {
console.error(`${__WEBPACK_IMPORTED_MODULE_1_chalk___default.a.redBright("[ERROR]")} ${text}`);
console.error(error);
}
/***/ }),

@@ -238,0 +257,0 @@ /* 1 */

@@ -5,12 +5,12 @@ {

"author": "Charles Crete <charles@cretezy.com>",
"homepage": "https://github.com/Cretezy/noderize/tree/master/packages/create-noderize",
"homepage": "https://github.com/Cretezy/Noderize/tree/master/packages/create-noderize",
"repository": {
"type": "git",
"url": "https://github.com/Cretezy/noderize.git"
"url": "https://github.com/Cretezy/Noderize.git"
},
"version": "0.2.0",
"version": "0.2.2",
"license": "MIT",
"bin": "dist/index.js",
"devDependencies": {
"noderize-scripts": "^0.2.0"
"noderize-scripts": "^0.2.2"
},

@@ -17,0 +17,0 @@ "scripts": {

@@ -9,5 +9,8 @@ import { ncp } from "ncp";

async function run(name, { typescript = false }) {
export async function run(
name,
{ typescript = false, forceNpm = false, forceYarn = false } = {}
) {
if (!name) {
console.log(`${chalk.red("[WARN]")} No path given!`);
printWarn(`No path given!`);
return;

@@ -19,8 +22,9 @@ }

// Check if exist
if (fs.existsSync(path)) {
console.log(`${chalk.red("[WARN]")} Path exists!`);
printWarn(`Path exists!`);
return;
}
console.log(`${chalk.blueBright("[INFO]")} Copying...${typescript ? " (TypeScript)" : ""}`);
printInfo(`Copying...`);

@@ -31,8 +35,7 @@ // Copy from template

} catch (error) {
console.error(`${chalk.redBright("[ERROR]")} Error copying.`);
console.error(error);
error(`Error copying.`, error);
return;
}
console.log(`${chalk.blueBright("[INFO]")} Setting up...`);
printInfo(`Setting up...`);

@@ -54,4 +57,3 @@ // Set the "name" field in package.json

} catch (error) {
console.error(`${chalk.redBright("[ERROR]")} Error saving package.json.`);
console.error(error);
printError(`Error saving package.json.`, error);
}

@@ -62,5 +64,4 @@

fs.renameSync(resolve(path, "gitignore"), resolve(path, ".gitignore"));
} catch (error) {
console.error(`${chalk.redBright("[ERROR]")} Error moving .gitignore.`);
console.error(error);
} catch (err) {
printError(`Error moving .gitignore.`, error);
}

@@ -71,23 +72,24 @@

try {
fs.renameSync(resolve(path, "src", "index.js"), resolve(path, "src", "index.ts"));
fs.renameSync(
resolve(path, "src", "index.js"),
resolve(path, "src", "index.ts")
);
} catch (error) {
console.error(`${chalk.redBright("[ERROR]")} Error moving src/index.js to src/index.ts`);
console.error(error);
printError(`Error moving src/index.js to src/index.ts.`, error);
}
}
console.log(`${chalk.blueBright("[INFO]")} Installing packages...`);
printInfo(`Installing packages...`);
console.log();
const useYarn = shouldUseYarn();
const useYarn = forceYarn ? true : forceNpm ? false : shouldUseYarn();
try {
// Install using yarn/npm
// Install latest
if (useYarn) {
execSync("yarn", { cwd: path });
execSync("yarn add -D noderize-scripts", { cwd: path, stdio: "inherit" });
} else {
execSync("npm install", { cwd: path });
execSync("npm install -D noderize-scripts", { cwd: path, stdio: "inherit" });
}
} catch (error) {
console.error(`${chalk.redBright("[ERROR]")} Error installing packages.`);
console.error(error);
printError(`Error installing packages.`, error);
}

@@ -97,23 +99,10 @@

console.log(`${chalk.greenBright("[INFO]")} Done! Your Noderize app is ready!`);
console.log(
`${chalk.greenBright("[INFO]")} You may visit your app with ${chalk.cyan(
`cd ${name}`
)}`
console.log();
printDone(`Done! Your Noderize app is ready!`);
printDone(`You may visit your app with ${chalk.cyan(`cd ${name}`)}`);
printDone(`Develop by using ${chalk.cyan(`${runCommand} watch`)}`);
printDone(
`Build a production version using ${chalk.cyan(`${runCommand} build`)}`
);
console.log(
`${chalk.greenBright("[INFO]")} Develop by using ${chalk.cyan(
`${runCommand} watch`
)}`
);
console.log(
`${chalk.greenBright(
"[INFO]"
)} Build a production version using ${chalk.cyan(`${runCommand} build`)}`
);
console.log(
`${chalk.greenBright(
"[INFO]"
)} Visit documentation at ${chalk.cyan(`https://noderize.js.org`)}`
);
printDone(`Visit documentation at ${chalk.cyan(`https://noderize.js.org`)}`);
}

@@ -130,4 +119,23 @@

// Parse args
const args = parseArgs(process.argv.slice(2));
const name = args._.length > 0 ? args._[0] : null;
run(name, args);
run(name, args);
function printInfo(text) {
console.log(`${chalk.blueBright("[INFO]")} ${text}`);
}
function printDone(text) {
console.log(`${chalk.greenBright("[DONE]")} ${text}`);
}
function printWarn(text) {
console.warn(`${chalk.yellowBright("[WARN]")} ${text}`);
}
function printError(text, error) {
console.error(`${chalk.redBright("[ERROR]")} ${text}`);
console.error(error);
}

@@ -10,6 +10,3 @@ {

"start": "noderize-scripts start"
},
"devDependencies": {
"noderize-scripts": "^0.1.8"
}
}
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