New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@onr/cli

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onr/cli - npm Package Compare versions

Comparing version
1.0.1
to
1.0.2
+6
-0
CHANGELOG.md
# Change Log
## 1.0.2
### Patch Changes
- Update node version
## 1.0.1

@@ -4,0 +10,0 @@

+4
-4
{
"name": "@onr/cli",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -30,4 +30,4 @@ "main": "dist/index.js",

"devDependencies": {
"@onr/eslint-config": "^0.6.6",
"@onr/prettier-config": "^2.0.1",
"@onr/eslint-config": "^0.6.7",
"@onr/prettier-config": "^2.0.2",
"@types/figlet": "^1.5.4",

@@ -38,3 +38,3 @@ "@types/inquirer": "^6.5.0",

"@types/mustache": "^4.0.1",
"@types/node": "^14.14.21",
"@types/node": "^18.19.47",
"eslint": "^8.57.0",

@@ -41,0 +41,0 @@ "jest": "^29.7.0",

#!/usr/bin/env node
#!/usr/bin/env node
#!/usr/bin/env node
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __async = (__this, __arguments, generator) => {
return new Promise((resolve2, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/index.ts
var import_chalk = __toESM(require("chalk"));
var import_commander = __toESM(require("commander"));
var import_figlet = __toESM(require("figlet"));
var import_inquirer = __toESM(require("inquirer"));
var import_inquirer_fuzzy_path = __toESM(require("inquirer-fuzzy-path"));
// src/commonQuestion.ts
var defaultValue = {
hasStyle: false,
isPage: false,
name: "",
componentBasedOnModuleName: "",
hasCustomRoute: false
};
var Common;
((Common2) => {
Common2.commonQuestion = [
{
default: defaultValue.hasStyle,
message: "Do you want to add style file?",
name: "hasStyle",
type: "confirm"
},
{
default: defaultValue.isPage,
message: "Is a page module?",
name: "isPage",
type: "confirm"
},
{
when(val) {
return !val.isPage;
},
message: "Where should the component be placed?",
type: "fuzzypath",
name: "componentBasedOnModuleName",
excludePath: (nodePath) => nodePath.startsWith("node_modules"),
excludeFilter: (nodePath) => nodePath === ".",
itemType: "directory",
depth: 7,
suggestOnly: true,
rootPath: "./src/modules"
},
{
default: defaultValue.name,
message: (val) => `What is ${val.isPage ? "page" : "component"} name?`,
type: "input",
name: "name"
},
{
default: defaultValue.hasCustomRoute,
message: "Enable the custom route?",
type: "confirm",
name: "hasCustomRoute",
when(val) {
return val.isPage;
}
},
{
default: "",
message: "What is the custom route path?",
type: "input",
name: "customRouteName",
when(val) {
return val.hasCustomRoute;
}
}
];
})(Common || (Common = {}));
// src/helper.ts
var import_fs = require("fs");
var import_path = require("path");
var mustache = __toESM(require("mustache"));
function createComponentTemplate(props) {
const template = (0, import_fs.readFileSync)(
(0, import_path.resolve)(__dirname, "./templates/functional/fc.component.mustache"),
"utf8"
);
const result = mustache.render(template, props);
return result;
}
function createPageTemplate(props) {
const template = (0, import_fs.readFileSync)(
(0, import_path.resolve)(__dirname, "./templates/functional/pages.mustache"),
"utf8"
);
const result = mustache.render(template, props);
return result;
}
function createDefinitionTemplate(props) {
const template = (0, import_fs.readFileSync)(
(0, import_path.resolve)(__dirname, "./templates/functional/fc.d.ts.mustache"),
"utf8"
);
const result = mustache.render(template, props);
return result;
}
function createStyleTemplate(props) {
const template = (0, import_fs.readFileSync)(
(0, import_path.resolve)(__dirname, "./templates/functional/style.component.mustache"),
"utf8"
);
const result = mustache.render(template, props);
return result;
}
function checkExists(absPath) {
return (0, import_fs.existsSync)(absPath);
}
function writeFileRecursive(data, absPath) {
(0, import_fs.mkdirSync)((0, import_path.dirname)(absPath), { recursive: true });
(0, import_fs.writeFileSync)(absPath, data);
return true;
}
function indexAppend(folderPath, nameOfFile) {
(0, import_fs.appendFileSync)((0, import_path.resolve)(folderPath, "index.ts"), `export * from './${nameOfFile}';
`);
}
function caseTransform(str) {
return str.replace(/([A-Z0-9])/g, ($1) => `-${$1.toLowerCase()}`).replace(/^\-/, "");
}
function firstLetter(str) {
return {
upper: `${str[0].toUpperCase()}${str.slice(1)}`,
lower: `${str[0].toLowerCase()}${str.slice(1)}`
};
}
function createCustomRoute(routePath, targetPath) {
const regex = /^(?:[\t ]*(?:\r?\n|\r))+module.exports = routes;/gm;
const content = (0, import_fs.readFileSync)("./src/server/routes.js", "utf8");
const replaceTemplate = mustache.render(
(0, import_fs.readFileSync)((0, import_path.resolve)(__dirname, "./templates/functional/routes.mustache"), "utf8"),
{ routePath, targetPath }
);
const replaceContent = content.replace(regex, replaceTemplate);
(0, import_fs.writeFileSync)("./src/server/routes.js", replaceContent, { encoding: "utf8" });
}
var TemplateCreator = class {
static component(name, rootPath, hasStyle) {
const styleName = `${firstLetter(name).upper}Style`;
const _template = createComponentTemplate({
name,
hasStyle,
styleName,
definitionName: firstLetter(name).upper,
isComponent: true,
tag: "div"
});
const _componentPath = rootPath;
if (hasStyle) {
const _styleTemplate = createStyleTemplate({
name: `${firstLetter(name).upper}Style`,
tag: "div"
});
writeFileRecursive(_styleTemplate, (0, import_path.resolve)(_componentPath, `styles/${name}.ts`));
indexAppend((0, import_path.resolve)(_componentPath, `styles`), name);
}
writeFileRecursive(_template, (0, import_path.resolve)(_componentPath, `${name}.tsx`));
indexAppend(_componentPath, `${name}`);
}
static pageWriter(name, rootPath, hasStyle = false) {
const _path = (0, import_path.resolve)(rootPath, "src", "pages", caseTransform(name), `index.tsx`);
const definitionName = firstLetter(name).upper;
if (!checkExists(_path)) {
const componentName = `${firstLetter(name).upper}Page`;
const moduleName = `${caseTransform(name)}`;
const styleName = `${firstLetter(name).upper}Style`;
const _pageTemplate = createPageTemplate({
name: componentName,
moduleName
});
const _componentTemplate = createComponentTemplate({
hasStyle,
name: componentName,
definitionName,
isComponent: false,
styleName,
tag: "div"
});
const _defFiles = createDefinitionTemplate({ name: definitionName });
const _modulePath = (0, import_path.resolve)(rootPath, "src", "modules", moduleName);
writeFileRecursive(_pageTemplate, _path);
writeFileRecursive(
_defFiles,
(0, import_path.resolve)(_modulePath, "entities", `I${definitionName}Page.d.ts`)
);
writeFileRecursive(
_componentTemplate,
(0, import_path.resolve)(_modulePath, "pages", `${firstLetter(name).upper}Page.tsx`)
);
if (hasStyle) {
const _styleTemplate = createStyleTemplate({ name: styleName, tag: "div" });
writeFileRecursive(_styleTemplate, (0, import_path.resolve)(_modulePath, "pages/styles", `${name}.ts`));
indexAppend((0, import_path.resolve)(_modulePath, "pages/styles"), name);
}
indexAppend((0, import_path.resolve)(_modulePath, "pages"), componentName);
indexAppend(_modulePath, "pages");
indexAppend((0, import_path.resolve)(_modulePath, "entities"), `I${definitionName}Page`);
} else {
throw new Error(`${name} page module already exists!`);
}
}
};
// src/index.ts
import_inquirer.default.registerPrompt("fuzzypath", import_inquirer_fuzzy_path.default);
console.clear();
console.log((0, import_chalk.default)(import_figlet.default.textSync("Onramplab CLI Boilerplate")));
import_inquirer.default.prompt;
import_commander.default.command("addFile").alias("a").description("Add a file").action(() => __async(exports, null, function* () {
const answers = yield import_inquirer.default.prompt(Common.commonQuestion);
if (answers.isPage) {
TemplateCreator.pageWriter(answers.name, process.cwd(), answers.hasStyle);
if (answers.hasCustomRoute) {
const routeName = answers.customRouteName.replace(/^\//, "");
createCustomRoute(routeName, `${caseTransform(answers.name)}`);
}
} else if (answers.name !== "") {
TemplateCreator.component(answers.name, answers.componentBasedOnModuleName, answers.hasStyle);
}
}));
import_commander.default.parse(process.argv);
//# sourceMappingURL=index.js.map
{"version":3,"sources":["../src/index.ts","../src/commonQuestion.ts","../src/helper.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\nimport program from 'commander';\nimport figlet from 'figlet';\nimport inquirer from 'inquirer';\nimport inquirerFuzzyPath from 'inquirer-fuzzy-path';\nimport { Common } from './commonQuestion';\nimport { caseTransform, createCustomRoute, TemplateCreator } from './helper';\n\ninquirer.registerPrompt('fuzzypath', inquirerFuzzyPath);\nconsole.clear();\n\nconsole.log(chalk(figlet.textSync('Onramplab CLI Boilerplate')));\n\ninquirer.prompt;\n\nprogram\n .command('addFile')\n .alias('a')\n .description('Add a file')\n .action(async () => {\n const answers = await inquirer.prompt(Common.commonQuestion);\n if (answers.isPage) {\n TemplateCreator.pageWriter(answers.name, process.cwd(), answers.hasStyle);\n if (answers.hasCustomRoute) {\n const routeName = answers.customRouteName.replace(/^\\//, '');\n createCustomRoute(routeName, `${caseTransform(answers.name)}`);\n }\n } else if (answers.name !== '') {\n TemplateCreator.component(answers.name, answers.componentBasedOnModuleName, answers.hasStyle);\n }\n });\n\nprogram.parse(process.argv);\n","import * as inquirer from 'inquirer';\nimport { CliQuestion } from './interfaces/question';\n\nconst defaultValue = {\n hasStyle: false,\n isPage: false,\n name: '',\n componentBasedOnModuleName: '',\n hasCustomRoute: false,\n};\n\nexport namespace Common {\n export const commonQuestion: inquirer.QuestionCollection<CliQuestion.Common> = [\n {\n default: defaultValue.hasStyle,\n message: 'Do you want to add style file?',\n name: 'hasStyle',\n type: 'confirm',\n },\n {\n default: defaultValue.isPage,\n message: 'Is a page module?',\n name: 'isPage',\n type: 'confirm',\n },\n {\n when(val) {\n return !val.isPage;\n },\n message: 'Where should the component be placed?',\n type: 'fuzzypath',\n name: 'componentBasedOnModuleName',\n excludePath: (nodePath: string) => nodePath.startsWith('node_modules'),\n excludeFilter: (nodePath: string) => nodePath === '.',\n itemType: 'directory',\n depth: 7,\n suggestOnly: true,\n rootPath: './src/modules',\n },\n {\n default: defaultValue.name,\n message: val => `What is ${val.isPage ? 'page' : 'component'} name?`,\n type: 'input',\n name: 'name',\n },\n {\n default: defaultValue.hasCustomRoute,\n message: 'Enable the custom route?',\n type: 'confirm',\n name: 'hasCustomRoute',\n when(val) {\n return val.isPage;\n },\n },\n {\n default: '',\n message: 'What is the custom route path?',\n type: 'input',\n name: 'customRouteName',\n when(val) {\n return val.hasCustomRoute;\n },\n },\n ];\n}\n","import { readFileSync, existsSync, writeFileSync, mkdirSync, appendFileSync } from 'fs';\nimport { resolve, dirname } from 'path';\nimport * as mustache from 'mustache';\n\nfunction createComponentTemplate(props: {\n name: string;\n hasStyle: boolean;\n styleName: string;\n tag: string;\n isComponent: boolean;\n definitionName: string;\n}) {\n const template = readFileSync(\n resolve(__dirname, './templates/functional/fc.component.mustache'),\n 'utf8',\n );\n const result = mustache.render(template, props);\n return result;\n}\n\nfunction createPageTemplate(props: { name: string; moduleName: string }) {\n const template = readFileSync(\n resolve(__dirname, './templates/functional/pages.mustache'),\n 'utf8',\n );\n const result = mustache.render(template, props);\n return result;\n}\n\nfunction createDefinitionTemplate(props: { name: string }) {\n const template = readFileSync(\n resolve(__dirname, './templates/functional/fc.d.ts.mustache'),\n 'utf8',\n );\n const result = mustache.render(template, props);\n return result;\n}\n\nfunction createStyleTemplate(props: { name: string; tag: string }) {\n const template = readFileSync(\n resolve(__dirname, './templates/functional/style.component.mustache'),\n 'utf8',\n );\n const result = mustache.render(template, props);\n return result;\n}\n\nfunction checkExists(absPath: string) {\n return existsSync(absPath);\n}\n\nfunction writeFileRecursive(data: string, absPath: string) {\n mkdirSync(dirname(absPath), { recursive: true });\n writeFileSync(absPath, data);\n return true;\n}\n\nfunction indexAppend(folderPath: string, nameOfFile: string) {\n appendFileSync(resolve(folderPath, 'index.ts'), `export * from './${nameOfFile}';\\n`);\n}\n\nfunction caseTransform(str: string) {\n return str.replace(/([A-Z0-9])/g, $1 => `-${$1.toLowerCase()}`).replace(/^\\-/, '');\n}\n\nfunction firstLetter(str: string) {\n return {\n upper: `${str[0].toUpperCase()}${str.slice(1)}`,\n lower: `${str[0].toLowerCase()}${str.slice(1)}`,\n };\n}\n\nfunction createCustomRoute(routePath: string, targetPath: string) {\n const regex = /^(?:[\\t ]*(?:\\r?\\n|\\r))+module.exports = routes;/gm;\n const content = readFileSync('./src/server/routes.js', 'utf8');\n const replaceTemplate = mustache.render(\n readFileSync(resolve(__dirname, './templates/functional/routes.mustache'), 'utf8'),\n { routePath, targetPath },\n );\n const replaceContent = content.replace(regex, replaceTemplate);\n writeFileSync('./src/server/routes.js', replaceContent, { encoding: 'utf8' });\n}\n\nclass TemplateCreator {\n static component(name: string, rootPath: string, hasStyle: boolean) {\n const styleName = `${firstLetter(name).upper}Style`;\n const _template = createComponentTemplate({\n name,\n hasStyle,\n styleName,\n definitionName: firstLetter(name).upper,\n isComponent: true,\n tag: 'div',\n });\n const _componentPath = rootPath;\n\n if (hasStyle) {\n const _styleTemplate = createStyleTemplate({\n name: `${firstLetter(name).upper}Style`,\n tag: 'div',\n });\n writeFileRecursive(_styleTemplate, resolve(_componentPath, `styles/${name}.ts`));\n indexAppend(resolve(_componentPath, `styles`), name);\n }\n writeFileRecursive(_template, resolve(_componentPath, `${name}.tsx`));\n indexAppend(_componentPath, `${name}`);\n }\n\n static pageWriter(name: string, rootPath: string, hasStyle = false) {\n const _path = resolve(rootPath, 'src', 'pages', caseTransform(name), `index.tsx`);\n const definitionName = firstLetter(name).upper;\n if (!checkExists(_path)) {\n const componentName = `${firstLetter(name).upper}Page`;\n const moduleName = `${caseTransform(name)}`;\n const styleName = `${firstLetter(name).upper}Style`;\n const _pageTemplate = createPageTemplate({\n name: componentName,\n moduleName,\n });\n const _componentTemplate = createComponentTemplate({\n hasStyle,\n name: componentName,\n definitionName,\n isComponent: false,\n styleName,\n tag: 'div',\n });\n const _defFiles = createDefinitionTemplate({ name: definitionName });\n\n const _modulePath = resolve(rootPath, 'src', 'modules', moduleName);\n // Write page\n writeFileRecursive(_pageTemplate, _path);\n // Write definition\n writeFileRecursive(\n _defFiles,\n resolve(_modulePath, 'entities', `I${definitionName}Page.d.ts`),\n );\n // Write Component\n writeFileRecursive(\n _componentTemplate,\n resolve(_modulePath, 'pages', `${firstLetter(name).upper}Page.tsx`),\n );\n\n if (hasStyle) {\n const _styleTemplate = createStyleTemplate({ name: styleName, tag: 'div' });\n writeFileRecursive(_styleTemplate, resolve(_modulePath, 'pages/styles', `${name}.ts`));\n indexAppend(resolve(_modulePath, 'pages/styles'), name);\n }\n\n // pages index append\n indexAppend(resolve(_modulePath, 'pages'), componentName);\n // module index append\n indexAppend(_modulePath, 'pages');\n // entities index append\n indexAppend(resolve(_modulePath, 'entities'), `I${definitionName}Page`);\n } else {\n throw new Error(`${name} page module already exists!`);\n }\n }\n}\n\nexport { TemplateCreator, createCustomRoute, caseTransform };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mBAAkB;AAClB,uBAAoB;AACpB,oBAAmB;AACnB,sBAAqB;AACrB,iCAA8B;;;ACF9B,IAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,4BAA4B;AAAA,EAC5B,gBAAgB;AAClB;AAEO,IAAU;AAAA,CAAV,CAAUA,YAAV;AACE,EAAMA,QAAA,iBAAkE;AAAA,IAC7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M,YAAY,QAAQ,gBAAgB,QAAQ,OAAO,EAAE;AAC3D,wBAAkB,WAAW,GAAG,cAAc,QAAQ,IAAI,CAAC,EAAE;AAAA,IAC/D;AAAA,EACF,WAAW,QAAQ,SAAS,IAAI;AAC9B,oBAAgB,UAAU,QAAQ,MAAM,QAAQ,4BAA4B,QAAQ,QAAQ;AAAA,EAC9F;AACF,EAAC;AAEH,iBAAAI,QAAQ,MAAM,QAAQ,IAAI;","names":["Common","inquirer","inquirerFuzzyPath","chalk","figlet","program"]}
#!/usr/bin/env node
var __getOwnPropNames = Object.getOwnPropertyNames;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve2, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/commonQuestion.ts
var defaultValue, Common;
var init_commonQuestion = __esm({
"src/commonQuestion.ts"() {
"use strict";
defaultValue = {
hasStyle: false,
isPage: false,
name: "",
componentBasedOnModuleName: "",
hasCustomRoute: false
};
((Common2) => {
Common2.commonQuestion = [
{
default: defaultValue.hasStyle,
message: "Do you want to add style file?",
name: "hasStyle",
type: "confirm"
},
{
default: defaultValue.isPage,
message: "Is a page module?",
name: "isPage",
type: "confirm"
},
{
when(val) {
return !val.isPage;
},
message: "Where should the component be placed?",
type: "fuzzypath",
name: "componentBasedOnModuleName",
excludePath: (nodePath) => nodePath.startsWith("node_modules"),
excludeFilter: (nodePath) => nodePath === ".",
itemType: "directory",
depth: 7,
suggestOnly: true,
rootPath: "./src/modules"
},
{
default: defaultValue.name,
message: (val) => `What is ${val.isPage ? "page" : "component"} name?`,
type: "input",
name: "name"
},
{
default: defaultValue.hasCustomRoute,
message: "Enable the custom route?",
type: "confirm",
name: "hasCustomRoute",
when(val) {
return val.isPage;
}
},
{
default: "",
message: "What is the custom route path?",
type: "input",
name: "customRouteName",
when(val) {
return val.hasCustomRoute;
}
}
];
})(Common || (Common = {}));
}
});
// src/helper.ts
import { readFileSync, existsSync, writeFileSync, mkdirSync, appendFileSync } from "fs";
import { resolve, dirname } from "path";
import * as mustache from "mustache";
function createComponentTemplate(props) {
const template = readFileSync(
resolve(__dirname, "./templates/functional/fc.component.mustache"),
"utf8"
);
const result = mustache.render(template, props);
return result;
}
function createPageTemplate(props) {
const template = readFileSync(
resolve(__dirname, "./templates/functional/pages.mustache"),
"utf8"
);
const result = mustache.render(template, props);
return result;
}
function createDefinitionTemplate(props) {
const template = readFileSync(
resolve(__dirname, "./templates/functional/fc.d.ts.mustache"),
"utf8"
);
const result = mustache.render(template, props);
return result;
}
function createStyleTemplate(props) {
const template = readFileSync(
resolve(__dirname, "./templates/functional/style.component.mustache"),
"utf8"
);
const result = mustache.render(template, props);
return result;
}
function checkExists(absPath) {
return existsSync(absPath);
}
function writeFileRecursive(data, absPath) {
mkdirSync(dirname(absPath), { recursive: true });
writeFileSync(absPath, data);
return true;
}
function indexAppend(folderPath, nameOfFile) {
appendFileSync(resolve(folderPath, "index.ts"), `export * from './${nameOfFile}';
`);
}
function caseTransform(str) {
return str.replace(/([A-Z0-9])/g, ($1) => `-${$1.toLowerCase()}`).replace(/^\-/, "");
}
function firstLetter(str) {
return {
upper: `${str[0].toUpperCase()}${str.slice(1)}`,
lower: `${str[0].toLowerCase()}${str.slice(1)}`
};
}
function createCustomRoute(routePath, targetPath) {
const regex = /^(?:[\t ]*(?:\r?\n|\r))+module.exports = routes;/gm;
const content = readFileSync("./src/server/routes.js", "utf8");
const replaceTemplate = mustache.render(
readFileSync(resolve(__dirname, "./templates/functional/routes.mustache"), "utf8"),
{ routePath, targetPath }
);
const replaceContent = content.replace(regex, replaceTemplate);
writeFileSync("./src/server/routes.js", replaceContent, { encoding: "utf8" });
}
var TemplateCreator;
var init_helper = __esm({
"src/helper.ts"() {
"use strict";
TemplateCreator = class {
static component(name, rootPath, hasStyle) {
const styleName = `${firstLetter(name).upper}Style`;
const _template = createComponentTemplate({
name,
hasStyle,
styleName,
definitionName: firstLetter(name).upper,
isComponent: true,
tag: "div"
});
const _componentPath = rootPath;
if (hasStyle) {
const _styleTemplate = createStyleTemplate({
name: `${firstLetter(name).upper}Style`,
tag: "div"
});
writeFileRecursive(_styleTemplate, resolve(_componentPath, `styles/${name}.ts`));
indexAppend(resolve(_componentPath, `styles`), name);
}
writeFileRecursive(_template, resolve(_componentPath, `${name}.tsx`));
indexAppend(_componentPath, `${name}`);
}
static pageWriter(name, rootPath, hasStyle = false) {
const _path = resolve(rootPath, "src", "pages", caseTransform(name), `index.tsx`);
const definitionName = firstLetter(name).upper;
if (!checkExists(_path)) {
const componentName = `${firstLetter(name).upper}Page`;
const moduleName = `${caseTransform(name)}`;
const styleName = `${firstLetter(name).upper}Style`;
const _pageTemplate = createPageTemplate({
name: componentName,
moduleName
});
const _componentTemplate = createComponentTemplate({
hasStyle,
name: componentName,
definitionName,
isComponent: false,
styleName,
tag: "div"
});
const _defFiles = createDefinitionTemplate({ name: definitionName });
const _modulePath = resolve(rootPath, "src", "modules", moduleName);
writeFileRecursive(_pageTemplate, _path);
writeFileRecursive(
_defFiles,
resolve(_modulePath, "entities", `I${definitionName}Page.d.ts`)
);
writeFileRecursive(
_componentTemplate,
resolve(_modulePath, "pages", `${firstLetter(name).upper}Page.tsx`)
);
if (hasStyle) {
const _styleTemplate = createStyleTemplate({ name: styleName, tag: "div" });
writeFileRecursive(_styleTemplate, resolve(_modulePath, "pages/styles", `${name}.ts`));
indexAppend(resolve(_modulePath, "pages/styles"), name);
}
indexAppend(resolve(_modulePath, "pages"), componentName);
indexAppend(_modulePath, "pages");
indexAppend(resolve(_modulePath, "entities"), `I${definitionName}Page`);
} else {
throw new Error(`${name} page module already exists!`);
}
}
};
}
});
// src/index.ts
import chalk from "chalk";
import program from "commander";
import figlet from "figlet";
import inquirer from "inquirer";
import inquirerFuzzyPath from "inquirer-fuzzy-path";
var require_src = __commonJS({
"src/index.ts"(exports) {
init_commonQuestion();
init_helper();
inquirer.registerPrompt("fuzzypath", inquirerFuzzyPath);
console.clear();
console.log(chalk(figlet.textSync("Onramplab CLI Boilerplate")));
inquirer.prompt;
program.command("addFile").alias("a").description("Add a file").action(() => __async(exports, null, function* () {
const answers = yield inquirer.prompt(Common.commonQuestion);
if (answers.isPage) {
TemplateCreator.pageWriter(answers.name, process.cwd(), answers.hasStyle);
if (answers.hasCustomRoute) {
const routeName = answers.customRouteName.replace(/^\//, "");
createCustomRoute(routeName, `${caseTransform(answers.name)}`);
}
} else if (answers.name !== "") {
TemplateCreator.component(answers.name, answers.componentBasedOnModuleName, answers.hasStyle);
}
}));
program.parse(process.argv);
}
});
export default require_src();
//# sourceMappingURL=index.mjs.map
{"version":3,"sources":["../src/commonQuestion.ts","../src/helper.ts","../src/index.ts"],"sourcesContent":["import * as inquirer from 'inquirer';\nimport { CliQuestion } from './interfaces/question';\n\nconst defaultValue = {\n hasStyle: false,\n isPage: false,\n name: '',\n componentBasedOnModuleName: '',\n hasCustomRoute: false,\n};\n\nexport namespace Common {\n export const commonQuestion: inquirer.QuestionCollection<CliQuestion.Common> = [\n {\n default: defaultValue.hasStyle,\n message: 'Do you want to add style file?',\n name: 'hasStyle',\n type: 'confirm',\n },\n {\n default: defaultValue.isPage,\n message: 'Is a page module?',\n name: 'isPage',\n type: 'confirm',\n },\n {\n when(val) {\n return !val.isPage;\n },\n message: 'Where should the component be placed?',\n type: 'fuzzypath',\n name: 'componentBasedOnModuleName',\n excludePath: (nodePath: string) => nodePath.startsWith('node_modules'),\n excludeFilter: (nodePath: string) => nodePath === '.',\n itemType: 'directory',\n depth: 7,\n suggestOnly: true,\n rootPath: './src/modules',\n },\n {\n default: defaultValue.name,\n message: val => `What is ${val.isPage ? 'page' : 'component'} name?`,\n type: 'input',\n name: 'name',\n },\n {\n default: defaultValue.hasCustomRoute,\n message: 'Enable the custom route?',\n type: 'confirm',\n name: 'hasCustomRoute',\n when(val) {\n return val.isPage;\n },\n },\n {\n default: '',\n message: 'What is the custom route path?',\n type: 'input',\n name: 'customRouteName',\n when(val) {\n return val.hasCustomRoute;\n },\n },\n ];\n}\n","import { readFileSync, existsSync, writeFileSync, mkdirSync, appendFileSync } from 'fs';\nimport { resolve, dirname } from 'path';\nimport * as mustache from 'mustache';\n\nfunction createComponentTemplate(props: {\n name: string;\n hasStyle: boolean;\n styleName: string;\n tag: string;\n isComponent: boolean;\n definitionName: string;\n}) {\n const template = readFileSync(\n resolve(__dirname, './templates/functional/fc.component.mustache'),\n 'utf8',\n );\n const result = mustache.render(template, props);\n return result;\n}\n\nfunction createPageTemplate(props: { name: string; moduleName: string }) {\n const template = readFileSync(\n resolve(__dirname, './templates/functional/pages.mustache'),\n 'utf8',\n );\n const result = mustache.render(template, props);\n return result;\n}\n\nfunction createDefinitionTemplate(props: { name: string }) {\n const template = readFileSync(\n resolve(__dirname, './templates/functional/fc.d.ts.mustache'),\n 'utf8',\n );\n const result = mustache.render(template, props);\n return result;\n}\n\nfunction createStyleTemplate(props: { name: string; tag: string }) {\n const template = readFileSync(\n resolve(__dirname, './templates/functional/style.component.mustache'),\n 'utf8',\n );\n const result = mustache.render(template, props);\n return result;\n}\n\nfunction checkExists(absPath: string) {\n return existsSync(absPath);\n}\n\nfunction writeFileRecursive(data: string, absPath: string) {\n mkdirSync(dirname(absPath), { recursive: true });\n writeFileSync(absPath, data);\n return true;\n}\n\nfunction indexAppend(folderPath: string, nameOfFile: string) {\n appendFileSync(resolve(folderPath, 'index.ts'), `export * from './${nameOfFile}';\\n`);\n}\n\nfunction caseTransform(str: string) {\n return str.replace(/([A-Z0-9])/g, $1 => `-${$1.toLowerCase()}`).replace(/^\\-/, '');\n}\n\nfunction firstLetter(str: string) {\n return {\n upper: `${str[0].toUpperCase()}${str.slice(1)}`,\n lower: `${str[0].toLowerCase()}${str.slice(1)}`,\n };\n}\n\nfunction createCustomRoute(routePath: string, targetPath: string) {\n const regex = /^(?:[\\t ]*(?:\\r?\\n|\\r))+module.exports = routes;/gm;\n const content = readFileSync('./src/server/routes.js', 'utf8');\n const replaceTemplate = mustache.render(\n readFileSync(resolve(__dirname, './templates/functional/routes.mustache'), 'utf8'),\n { routePath, targetPath },\n );\n const replaceContent = content.replace(regex, replaceTemplate);\n writeFileSync('./src/server/routes.js', replaceContent, { encoding: 'utf8' });\n}\n\nclass TemplateCreator {\n static component(name: string, rootPath: string, hasStyle: boolean) {\n const styleName = `${firstLetter(name).upper}Style`;\n const _template = createComponentTemplate({\n name,\n hasStyle,\n styleName,\n definitionName: firstLetter(name).upper,\n isComponent: true,\n tag: 'div',\n });\n const _componentPath = rootPath;\n\n if (hasStyle) {\n const _styleTemplate = createStyleTemplate({\n name: `${firstLetter(name).upper}Style`,\n tag: 'div',\n });\n writeFileRecursive(_styleTemplate, resolve(_componentPath, `styles/${name}.ts`));\n indexAppend(resolve(_componentPath, `styles`), name);\n }\n writeFileRecursive(_template, resolve(_componentPath, `${name}.tsx`));\n indexAppend(_componentPath, `${name}`);\n }\n\n static pageWriter(name: string, rootPath: string, hasStyle = false) {\n const _path = resolve(rootPath, 'src', 'pages', caseTransform(name), `index.tsx`);\n const definitionName = firstLetter(name).upper;\n if (!checkExists(_path)) {\n const componentName = `${firstLetter(name).upper}Page`;\n const moduleName = `${caseTransform(name)}`;\n const styleName = `${firstLetter(name).upper}Style`;\n const _pageTemplate = createPageTemplate({\n name: componentName,\n moduleName,\n });\n const _componentTemplate = createComponentTemplate({\n hasStyle,\n name: componentName,\n definitionName,\n isComponent: false,\n styleName,\n tag: 'div',\n });\n const _defFiles = createDefinitionTemplate({ name: definitionName });\n\n const _modulePath = resolve(rootPath, 'src', 'modules', moduleName);\n // Write page\n writeFileRecursive(_pageTemplate, _path);\n // Write definition\n writeFileRecursive(\n _defFiles,\n resolve(_modulePath, 'entities', `I${definitionName}Page.d.ts`),\n );\n // Write Component\n writeFileRecursive(\n _componentTemplate,\n resolve(_modulePath, 'pages', `${firstLetter(name).upper}Page.tsx`),\n );\n\n if (hasStyle) {\n const _styleTemplate = createStyleTemplate({ name: styleName, tag: 'div' });\n writeFileRecursive(_styleTemplate, resolve(_modulePath, 'pages/styles', `${name}.ts`));\n indexAppend(resolve(_modulePath, 'pages/styles'), name);\n }\n\n // pages index append\n indexAppend(resolve(_modulePath, 'pages'), componentName);\n // module index append\n indexAppend(_modulePath, 'pages');\n // entities index append\n indexAppend(resolve(_modulePath, 'entities'), `I${definitionName}Page`);\n } else {\n throw new Error(`${name} page module already exists!`);\n }\n }\n}\n\nexport { TemplateCreator, createCustomRoute, caseTransform };\n","#!/usr/bin/env node\nimport chalk from 'chalk';\nimport program from 'commander';\nimport figlet from 'figlet';\nimport inquirer from 'inquirer';\nimport inquirerFuzzyPath from 'inquirer-fuzzy-path';\nimport { Common } from './commonQuestion';\nimport { caseTransform, createCustomRoute, TemplateCreator } from './helper';\n\ninquirer.registerPrompt('fuzzypath', inquirerFuzzyPath);\nconsole.clear();\n\nconsole.log(chalk(figlet.textSync('Onramplab CLI Boilerplate')));\n\ninquirer.prompt;\n\nprogram\n .command('addFile')\n .alias('a')\n .description('Add a file')\n .action(async () => {\n const answers = await inquirer.prompt(Common.commonQuestion);\n if (answers.isPage) {\n TemplateCreator.pageWriter(answers.name, process.cwd(), answers.hasStyle);\n if (answers.hasCustomRoute) {\n const routeName = answers.customRouteName.replace(/^\\//, '');\n createCustomRoute(routeName, `${caseTransform(answers.name)}`);\n }\n } else if (answers.name !== '') {\n TemplateCreator.component(answers.name, answers.componentBasedOnModuleName, answers.hasStyle);\n }\n });\n\nprogram.parse(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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