diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a7aed8..122e430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # 🛠️ CHANGELOG +## v2.0.0 + +- Complete refactor to Next App Directories, review new documentation + +### Notice + +**Printer v1.x.x** is compatible with the old Next patterns. You can review the documentation on the v1 website: [v1.prntr.click/docs](https://v1.prntr.click/docs) + +**Printer v2.x.x** leverages the Next App Directory pattern. This will be on the main documentation website: [prntr.click/docs](https://prntr.click/docs) + ## v1.3.40 - Hotfix to type inference diff --git a/README.md b/README.md index 825cbbc..e1dcd16 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,15 @@ ## Automation Tooling for Next, Redux and Prisma ![license](https://img.shields.io/badge/license-AGPLv3-blue.svg) -![version](https://img.shields.io/badge/version-1.3.40-blue.svg) +![version](https://img.shields.io/badge/version-2.0.0-blue.svg) [![CircleCI](https://circleci.com/gh/PrinterFramework/CLI.svg?style=svg)](https://circleci.com/gh/PrinterFramework/CLI) [![codecov](https://codecov.io/gh/PrinterFramework/CLI/branch/master/graph/badge.svg)](https://codecov.io/gh/PrinterFramework/CLI) -Learn how to use Printer at [prntr.click](https://prntr.click). +**Printer v1.x.x** is compatible with the old Next patterns. You can review the documentation on the v1 website: [v1.prntr.click/docs](https://v1.prntr.click/docs) + +**Printer v2.x.x** leverages the Next App Directory pattern. This will be on the main documentation website: [prntr.click/docs](https://prntr.click/docs) + +Review the [CHANGELOG](./CHANGELOG.md) for any updates made to the project. ## How it works @@ -36,10 +40,6 @@ cd printer-sample printer component components/component ``` -Review the documentation on [prntr.click/docs](https://prntr.click/docs). - -Review the [CHANGELOG](./CHANGELOG.md) for any updates made to the project. - ## Comments and Feedback Very open to comments and feedback. Very welcoming to people who open issues with reasonable constructive feedback. Please do not open PRs unless you're willing to commit code that matches the conventions and styles of the repository. diff --git a/dist/src/config.d.ts b/dist/src/config.d.ts old mode 100644 new mode 100755 index 8187af6..54758dc --- a/dist/src/config.d.ts +++ b/dist/src/config.d.ts @@ -1,11 +1,4 @@ export interface PrinterConfig { - componentFolder?: boolean; - component?: { - index?: boolean; - component?: boolean; - style?: boolean; - test?: boolean; - }; crud?: { create: boolean; update: boolean; diff --git a/dist/src/config.js b/dist/src/config.js old mode 100644 new mode 100755 index b168c60..089e3da --- a/dist/src/config.js +++ b/dist/src/config.js @@ -16,13 +16,6 @@ var fs_jetpack_1 = require("fs-jetpack"); var path_1 = require("path"); var log_1 = require("./helpers/log"); exports.Config = { - componentFolder: false, - component: { - index: true, - component: true, - style: false, - test: false - }, crud: { create: true, update: true, diff --git a/dist/src/config.js.map b/dist/src/config.js.map old mode 100644 new mode 100755 index 1b9321f..d8ed58a --- a/dist/src/config.js.map +++ b/dist/src/config.js.map @@ -1 +1 @@ -{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,6BAA2B;AAC3B,qCAAmC;AAmBxB,QAAA,MAAM,GAAkB;IACjC,eAAe,EAAE,KAAK;IACtB,SAAS,EAAE;QACT,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,KAAK;KACZ;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,IAAI;KACV;CACF,CAAA;AAED,SAAgB,cAAc;IAC5B,IAAI;QACF,IAAM,MAAM,GAAG,IAAA,iBAAI,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAA;QACrE,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAC/B,cAAM,GAAG,MAAM,CAAC,MAAM,CAAC,cAAM,eAAO,IAAI,EAAG,CAAA;KAC5C;IAAC,OAAO,KAAK,EAAE;QACd,IAAA,SAAG,EAAC,mCAAmC,CAAC,MAAM,CAAC,CAAA;KAChD;AACH,CAAC;AARD,wCAQC"} \ No newline at end of file +{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,6BAA2B;AAC3B,qCAAmC;AAYxB,QAAA,MAAM,GAAkB;IACjC,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,IAAI;KACV;CACF,CAAA;AAED,SAAgB,cAAc;IAC5B,IAAI;QACF,IAAM,MAAM,GAAG,IAAA,iBAAI,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAA;QACrE,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAC/B,cAAM,GAAG,MAAM,CAAC,MAAM,CAAC,cAAM,eAAO,IAAI,EAAG,CAAA;KAC5C;IAAC,OAAO,KAAK,EAAE;QACd,IAAA,SAAG,EAAC,mCAAmC,CAAC,MAAM,CAAC,CAAA;KAChD;AACH,CAAC;AARD,wCAQC"} \ No newline at end of file diff --git a/dist/src/converter.d.ts b/dist/src/converter.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/converter.js b/dist/src/converter.js old mode 100644 new mode 100755 diff --git a/dist/src/converter.js.map b/dist/src/converter.js.map old mode 100644 new mode 100755 diff --git a/dist/src/generators/api.d.ts b/dist/src/generators/api.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/api.js b/dist/src/generators/api.js old mode 100644 new mode 100755 index ceb7b53..af3b094 --- a/dist/src/generators/api.js +++ b/dist/src/generators/api.js @@ -44,15 +44,13 @@ var prompts_1 = __importDefault(require("prompts")); var path_1 = require("path"); var fs_jetpack_1 = require("fs-jetpack"); var log_1 = require("../helpers/log"); -var nomenclature_1 = require("../helpers/nomenclature"); function generateApi(path) { - var _a; return __awaiter(this, void 0, void 0, function () { - var apiPath, result, pathArray, fileName, name, apiTemplate; - return __generator(this, function (_b) { - switch (_b.label) { + var apiPath, result, apiTemplate; + return __generator(this, function (_a) { + switch (_a.label) { case 0: - apiPath = (0, path_1.join)(process.cwd(), 'pages', 'api', "".concat(path, ".tsx")); + apiPath = (0, path_1.join)(process.cwd(), 'app', 'api', "".concat(path, "/route.tsx")); if (!((0, fs_jetpack_1.exists)(apiPath) !== false)) return [3 /*break*/, 2]; return [4 /*yield*/, (0, prompts_1.default)({ type: 'confirm', @@ -60,18 +58,15 @@ function generateApi(path) { message: 'This api already exists, overwrite it?' })]; case 1: - result = _b.sent(); + result = _a.sent(); if (result.overwrite === false) { return [2 /*return*/]; } - _b.label = 2; + _a.label = 2; case 2: - pathArray = path.split('/'); - fileName = pathArray[pathArray.length - 1]; - name = (0, nomenclature_1.formatName)(fileName); - apiTemplate = (_a = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'api.template'))) === null || _a === void 0 ? void 0 : _a.replaceAll('{{name}}', name); + apiTemplate = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'api.template')); (0, fs_jetpack_1.write)(apiPath, apiTemplate || ''); - (0, log_1.Log)(" \u2705 Created pages/api/".concat(path, ".tsx").green); + (0, log_1.Log)(" \u2705 Created app/api/".concat(path, "/route.tsx").green); return [2 /*return*/]; } }); diff --git a/dist/src/generators/api.js.map b/dist/src/generators/api.js.map old mode 100644 new mode 100755 index 2b4fdab..61a8663 --- a/dist/src/generators/api.js.map +++ b/dist/src/generators/api.js.map @@ -1 +1 @@ -{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/generators/api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA6B;AAC7B,6BAA2B;AAC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C,SAAsB,WAAW,CAAE,IAAY;;;;;;oBACvC,OAAO,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAG,IAAI,eAAY,CAAC,CAAA;yBAElE,CAAA,IAAA,mBAAM,EAAC,OAAO,CAAC,KAAK,KAAK,CAAA,EAAzB,wBAAyB;oBACZ,qBAAM,IAAA,iBAAO,EAAC;4BAC3B,IAAI,EAAE,SAAS;4BACf,IAAI,EAAE,WAAW;4BACjB,OAAO,EAAE,wCAAwC;yBAClD,CAAC,EAAA;;oBAJI,MAAM,GAAG,SAIb;oBAEF,IAAI,MAAM,CAAC,SAAS,KAAK,KAAK,EAAE;wBAC9B,sBAAM;qBACP;;;oBAGG,WAAW,GAAG,IAAA,iBAAI,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC,CAAA;oBAC5E,IAAA,kBAAK,EAAC,OAAO,EAAE,WAAW,IAAI,EAAE,CAAC,CAAA;oBACjC,IAAA,SAAG,EAAC,sCAA0B,IAAI,eAAY,CAAC,KAAK,CAAC,CAAA;;;;;CACtD;AAlBD,kCAkBC"} \ No newline at end of file diff --git a/dist/src/generators/component.d.ts b/dist/src/generators/component.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/component.js b/dist/src/generators/component.js old mode 100644 new mode 100755 index c92e1b9..2e9e8d9 --- a/dist/src/generators/component.js +++ b/dist/src/generators/component.js @@ -44,14 +44,13 @@ var prompts_1 = __importDefault(require("prompts")); var path_1 = require("path"); var fs_jetpack_1 = require("fs-jetpack"); var log_1 = require("../helpers/log"); -var config_1 = require("../config"); var nomenclature_1 = require("../helpers/nomenclature"); function generateComponent(path) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; + var _a; return __awaiter(this, void 0, void 0, function () { - var result, pathArray, fileName, name, component, componentPath, style, stylePath, test_1, testPath, index, indexPath, component, componentPath; - return __generator(this, function (_m) { - switch (_m.label) { + var result, pathArray, fileName, name, component, componentPath; + return __generator(this, function (_b) { + switch (_b.label) { case 0: if (!((0, fs_jetpack_1.exists)((0, path_1.join)(process.cwd(), path)) || (0, fs_jetpack_1.exists)((0, path_1.join)(process.cwd(), "".concat(path.replace('.tsx', ''), ".tsx"))))) return [3 /*break*/, 2]; return [4 /*yield*/, (0, prompts_1.default)({ @@ -60,49 +59,19 @@ function generateComponent(path) { message: 'This component already exists, overwrite it?' })]; case 1: - result = _m.sent(); + result = _b.sent(); if (result.overwrite === false) { return [2 /*return*/]; } - _m.label = 2; + _b.label = 2; case 2: pathArray = path.replace('.tsx', '').split('/'); fileName = pathArray[pathArray.length - 1]; name = (0, nomenclature_1.formatName)(fileName); - if (config_1.Config.componentFolder === true) { - component = (_a = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'component', 'component.nostyle.template'))) === null || _a === void 0 ? void 0 : _a.replaceAll('{{name}}', name).replaceAll('{{prefix}}', fileName).replaceAll('{{path}}', path); - componentPath = (0, path_1.join)(process.cwd(), path, "".concat(fileName, ".component.tsx")); - if (((_b = config_1.Config.component) === null || _b === void 0 ? void 0 : _b.style) === true) { - component = (_c = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'component', 'component.template'))) === null || _c === void 0 ? void 0 : _c.replaceAll('{{name}}', name).replaceAll('{{prefix}}', fileName).replaceAll('{{path}}', path); - style = (_d = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'component', 'style.template'))) === null || _d === void 0 ? void 0 : _d.replaceAll('{{name}}', name).replaceAll('{{prefix}}', fileName).replaceAll('{{path}}', path); - stylePath = (0, path_1.join)(process.cwd(), path, "".concat(fileName, ".style.tsx")); - (0, fs_jetpack_1.write)(stylePath, style || ''); - (0, log_1.Log)(" \u2705 Created ".concat(fileName, ".style.tsx").green); - } - (0, fs_jetpack_1.write)(componentPath, component || ''); - (0, log_1.Log)(" \u2705 Created ".concat(fileName, ".component.tsx").green); - if ((_e = config_1.Config.component) === null || _e === void 0 ? void 0 : _e.test) { - test_1 = (_f = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'component', 'test.template'))) === null || _f === void 0 ? void 0 : _f.replaceAll('{{name}}', name).replaceAll('{{prefix}}', fileName).replaceAll('{{path}}', path); - testPath = (0, path_1.join)(process.cwd(), path, "".concat(fileName, ".test.tsx")); - (0, fs_jetpack_1.write)(testPath, test_1 || ''); - (0, log_1.Log)(" \u2705 Created ".concat(fileName, ".test.tsx").green); - } - if ((_g = config_1.Config.component) === null || _g === void 0 ? void 0 : _g.index) { - index = (_h = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'component', 'index.nostyle.template'))) === null || _h === void 0 ? void 0 : _h.replaceAll('{{name}}', name).replaceAll('{{prefix}}', fileName).replaceAll('{{path}}', path); - indexPath = (0, path_1.join)(process.cwd(), path, 'index.tsx'); - if (((_j = config_1.Config.component) === null || _j === void 0 ? void 0 : _j.style) === true) { - index = (_k = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'component', 'index.template'))) === null || _k === void 0 ? void 0 : _k.replaceAll('{{name}}', name).replaceAll('{{prefix}}', fileName).replaceAll('{{path}}', path).replaceAll('{{path}}', path); - } - (0, fs_jetpack_1.write)(indexPath, index || ''); - (0, log_1.Log)(' ✅ Created index.tsx'.green); - } - } - else { - component = (_l = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'component', 'component.nostyle.template'))) === null || _l === void 0 ? void 0 : _l.replaceAll('{{name}}', name).replaceAll('{{prefix}}', fileName).replaceAll('{{path}}', path); - componentPath = (0, path_1.join)(process.cwd(), "".concat(path.replace('.tsx', ''), ".tsx")); - (0, fs_jetpack_1.write)(componentPath, component || ''); - (0, log_1.Log)(" \u2705 Created ".concat(path.replace('.tsx', ''), ".tsx").green); - } + component = (_a = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'component', 'component.nostyle.template'))) === null || _a === void 0 ? void 0 : _a.replaceAll('{{name}}', name).replaceAll('{{prefix}}', fileName).replaceAll('{{path}}', path); + componentPath = (0, path_1.join)(process.cwd(), "".concat(path.replace('.tsx', ''), ".tsx")); + (0, fs_jetpack_1.write)(componentPath, component || ''); + (0, log_1.Log)(" \u2705 Created ".concat(path.replace('.tsx', ''), ".tsx").green); return [2 /*return*/]; } }); diff --git a/dist/src/generators/component.js.map b/dist/src/generators/component.js.map old mode 100644 new mode 100755 index 064dd2a..af63024 --- a/dist/src/generators/component.js.map +++ b/dist/src/generators/component.js.map @@ -1 +1 @@ -{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/generators/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA6B;AAC7B,6BAA2B;AAC3B,yCAAgD;AAChD,sCAAoC;AACpC,oCAAkC;AAClC,wDAAoD;AAEpD,SAAsB,iBAAiB,CAAE,IAAY;;;;;;;yBAC/C,CAAA,IAAA,mBAAM,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,IAAA,mBAAM,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAM,CAAC,CAAC,CAAA,EAAnG,wBAAmG;oBACtF,qBAAM,IAAA,iBAAO,EAAC;4BAC3B,IAAI,EAAE,SAAS;4BACf,IAAI,EAAE,WAAW;4BACjB,OAAO,EAAE,8CAA8C;yBACxD,CAAC,EAAA;;oBAJI,MAAM,GAAG,SAIb;oBAEF,IAAI,MAAM,CAAC,SAAS,KAAK,KAAK,EAAE;wBAC9B,sBAAM;qBACP;;;oBAGG,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GA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AAO,CAAC,GAAG,EAAE,EAAE,UAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAM,CAAC,CAAA;oBAE5E,IAAA,kBAAK,EAAC,aAAa,EAAE,SAAS,IAAI,EAAE,CAAC,CAAA;oBACrC,IAAA,SAAG,EAAC,8BAAkB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAM,CAAC,KAAK,CAAC,CAAA;;;;;CAC5D;AAtBD,8CAsBC"} \ No newline at end of file diff --git a/dist/src/generators/crud.d.ts b/dist/src/generators/crud.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/crud.js b/dist/src/generators/crud.js old mode 100644 new mode 100755 index 0ad73d8..fb142b7 --- a/dist/src/generators/crud.js +++ b/dist/src/generators/crud.js @@ -45,13 +45,13 @@ var path_1 = require("path"); var fs_jetpack_1 = require("fs-jetpack"); var log_1 = require("../helpers/log"); function generateCrud(model) { - var _a, _b, _c, _d, _e; + var _a; return __awaiter(this, void 0, void 0, function () { - var basePath, result, createPath, createTemplate, updatePath, updateTemplate, getPath, getTemplate, listPath, listTemplate, deletePath, deleteTemplate; - return __generator(this, function (_f) { - switch (_f.label) { + var basePath, result, routePath, routeTemplate; + return __generator(this, function (_b) { + switch (_b.label) { case 0: - basePath = (0, path_1.join)(process.cwd(), 'pages', 'api', model); + basePath = (0, path_1.join)(process.cwd(), 'app', 'api', model); if (!((0, fs_jetpack_1.exists)(basePath) !== false)) return [3 /*break*/, 2]; return [4 /*yield*/, (0, prompts_1.default)({ type: 'confirm', @@ -59,32 +59,16 @@ function generateCrud(model) { message: 'Routes already exist in this folder, overwrite it?' })]; case 1: - result = _f.sent(); + result = _b.sent(); if (result.overwrite === false) { return [2 /*return*/]; } - _f.label = 2; + _b.label = 2; case 2: - createPath = (0, path_1.join)(basePath, 'create.tsx'); - createTemplate = (_a = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'crud', 'create.template'))) === null || _a === void 0 ? void 0 : _a.replaceAll('{{model}}', model); - (0, fs_jetpack_1.write)(createPath, createTemplate || ''); - (0, log_1.Log)(" \u2705 Created pages/api/".concat(model, "/create.tsx").green); - updatePath = (0, path_1.join)(basePath, 'update.tsx'); - updateTemplate = (_b = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'crud', 'update.template'))) === null || _b === void 0 ? void 0 : _b.replaceAll('{{model}}', model); - (0, fs_jetpack_1.write)(updatePath, updateTemplate || ''); - (0, log_1.Log)(" \u2705 Created pages/api/".concat(model, "/update.tsx").green); - getPath = (0, path_1.join)(basePath, 'get.tsx'); - getTemplate = (_c = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'crud', 'get.template'))) === null || _c === void 0 ? void 0 : _c.replaceAll('{{model}}', model); - (0, fs_jetpack_1.write)(getPath, getTemplate || ''); - (0, log_1.Log)(" \u2705 Created pages/api/".concat(model, "/get.tsx").green); - listPath = (0, path_1.join)(basePath, 'list.tsx'); - listTemplate = (_d = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'crud', 'list.template'))) === null || _d === void 0 ? void 0 : _d.replaceAll('{{model}}', model); - (0, fs_jetpack_1.write)(listPath, listTemplate || ''); - (0, log_1.Log)(" \u2705 Created pages/api/".concat(model, "/list.tsx").green); - deletePath = (0, path_1.join)(basePath, 'delete.tsx'); - deleteTemplate = (_e = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'crud', 'delete.template'))) === null || _e === void 0 ? void 0 : _e.replaceAll('{{model}}', model); - (0, fs_jetpack_1.write)(deletePath, deleteTemplate || ''); - (0, log_1.Log)(" \u2705 Created pages/api/".concat(model, "/delete.tsx").green); + routePath = (0, path_1.join)(basePath, 'route.tsx'); + routeTemplate = (_a = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'crud.template'))) === null || _a === void 0 ? void 0 : _a.replaceAll('{{model}}', model); + (0, fs_jetpack_1.write)(routePath, routeTemplate || ''); + (0, log_1.Log)(" \u2705 Created pages/api/".concat(model, "/route.tsx").green); return [2 /*return*/]; } }); diff --git a/dist/src/generators/crud.js.map b/dist/src/generators/crud.js.map old mode 100644 new mode 100755 index cc89d9f..038c324 --- a/dist/src/generators/crud.js.map +++ b/dist/src/generators/crud.js.map @@ -1 +1 @@ -{"version":3,"file":"crud.js","sourceRoot":"","sources":["../../../src/generators/crud.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA6B;AAC7B,6BAA2B;AAC3B,yCAAgD;AAChD,sCAAoC;AAEpC,SAAsB,YAAY,CAAE,KAAa;;;;;;;oBACzC,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;yBAEvD,CAAA,IAAA,mBAAM,EAAC,QAAQ,CAAC,KAAK,KAAK,CAAA,EAA1B,wBAA0B;oBACb,qBAAM,IAAA,iBAAO,EAAC;4BAC3B,IAAI,EAAE,SAAS;4BACf,IAAI,EAAE,WAAW;4BACjB,OAAO,EAAE,oDAAoD;yBAC9D,CAAC,EAAA;;oBAJI,MAAM,GAAG,SAIb;oBAEF,IAAI,MAAM,CAAC,SAAS,KAAK,KAAK,EAAE;wBAC9B,sBAAM;qBACP;;;oBAGG,UAAU,GAAG,IAAA,WAAI,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;oBACzC,cAAc,GAAG,MAAA,IAAA,iBAAI,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC,0CAAE,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;oBAC1H,IAAA,kBAAK,EAAC,UAAU,EAAE,cAAc,IAAI,EAAE,CAAC,CAAA;oBACvC,IAAA,SAAG,EAAC,wCAA4B,KAAK,gBAAa,CAAC,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AE,KAAK,CAAC,CAAA;oBAC/G,IAAA,kBAAK,EAAC,SAAS,EAAE,aAAa,IAAI,EAAE,CAAC,CAAA;oBACrC,IAAA,SAAG,EAAC,wCAA4B,KAAK,eAAY,CAAC,KAAK,CAAC,CAAA;;;;;CACzD;AAnBD,oCAmBC"} \ No newline at end of file diff --git a/dist/src/generators/inject.d.ts b/dist/src/generators/inject.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/inject.js b/dist/src/generators/inject.js old mode 100644 new mode 100755 index eef5f70..818a9f2 --- a/dist/src/generators/inject.js +++ b/dist/src/generators/inject.js @@ -43,7 +43,7 @@ var log_1 = require("../helpers/log"); var match_1 = require("../helpers/match"); function inject(slice, component, opts) { return __awaiter(this, void 0, void 0, function () { - var filePath, pathArray, fileName, fileContents, fileComponentPath, slicePath, sliceContents, matches, splitFile, sliceMatch, newContents, stateInjections, actionInjections, i, index, match, decorator, typeMap, varKey, addDots, varKey, hasExistingImport, i, stateInjection, typeName, i, stateInjection, injectionLine, tempContents, typeMap, value, spreadLeft, spreadRight, typeName, injectionLine, tempContents, tempContents, fileComponentPath; + var filePath, pathArray, fileName, fileContents, fileComponentPath, slicePath, sliceContents, matches, splitFile, sliceMatch, newContents, stateInjections, actionInjections, i, index, match, decorator, typeMap, varKey, addDots, varKey, hasExistingImport, i, stateInjection, typeName, i, stateInjection, injectionLine, tempContents, value, spreadLeft, spreadRight, typeName, injectionLine, tempContents, tempContents, fileComponentPath; return __generator(this, function (_a) { component = component.replaceAll('.tsx', ''); filePath = (0, path_1.join)(process.cwd(), component); @@ -89,10 +89,10 @@ function inject(slice, component, opts) { } hasExistingImport = (0, match_1.findMatches)(newContents, match_1.ReduxOptionalMatcher); if (hasExistingImport.length > 0) { - newContents = newContents.replace(match_1.ReduxOptionalMatcher, 'import { useSelector, useDispatch } from \'react-redux\''); + newContents = newContents.replace(match_1.ReduxOptionalMatcher, 'import { useAppSelector, useAppDispatch } from \'redux/hooks\''); } else { - newContents = "import { useSelector, useDispatch } from 'react-redux'\n\n".concat(newContents); + newContents = "import { useAppSelector, useAppDispatch } from 'redux/hooks'\n\n".concat(newContents); } if (opts.state) { for (i = 0; i < stateInjections.length; i++) { @@ -112,7 +112,6 @@ function inject(slice, component, opts) { if ((0, match_1.findMatches)(newContents, (0, match_1.selectorMatcher)(stateInjection.value)).length === 0) { injectionLine = (0, match_1.findMatches)(newContents, (0, match_1.functionMatcher)(fileName))[0]; tempContents = newContents.split('\n'); - typeMap = 'any'; value = stateInjection.value; spreadLeft = '{'; spreadRight = '}'; @@ -124,9 +123,8 @@ function inject(slice, component, opts) { spreadLeft = '['; spreadRight = ']'; } - typeMap = "{ ".concat(slice, ": { ").concat(value, ": ").concat(typeName, " } }"); } - tempContents[injectionLine] = tempContents[injectionLine] + "\n const ".concat(value, " = useSelector((state: ").concat(typeMap, ") => ").concat(stateInjection.addDots ? '(' + spreadLeft + ' ' : '').concat(stateInjection.addDots ? '...' : '', "state.").concat(slice, ".").concat(value).concat(stateInjection.addDots ? ' ' + spreadRight + ')' : '', ")"); + tempContents[injectionLine] = tempContents[injectionLine] + "\n const ".concat(value, " = useAppSelector((state) => ").concat(stateInjection.addDots ? '(' + spreadLeft + ' ' : '').concat(stateInjection.addDots ? '...' : '', "state.").concat(slice, ".").concat(value).concat(stateInjection.addDots ? ' ' + spreadRight + ')' : '', ")"); if (i === 0) { tempContents[injectionLine] = tempContents[injectionLine] + '\n'; } @@ -154,6 +152,10 @@ function inject(slice, component, opts) { (0, log_1.Log)(" \u2705 ".concat(actionInjections.length, " action").concat(actionInjections.length > 1 ? 's were' : ' was', " injected into the component").green); } } + if (filePath.indexOf('app/') !== -1) { + newContents = newContents.replaceAll('\'use client\'', ''); + newContents = '\'use client\'\n' + newContents; + } if ((0, fs_jetpack_1.exists)(filePath) === 'dir') { fileComponentPath = (0, path_1.join)(process.cwd(), component, "".concat(fileName, ".component.tsx")); (0, fs_jetpack_1.write)(fileComponentPath, newContents); diff --git a/dist/src/generators/inject.js.map b/dist/src/generators/inject.js.map old mode 100644 new mode 100755 index 2b7ef08..2c68162 --- a/dist/src/generators/inject.js.map +++ b/dist/src/generators/inject.js.map @@ -1 +1 @@ -{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../../src/generators/inject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA2B;AAC3B,yCAAgD;AAChD,sCAAoC;AACpC,0CAA8L;AAO9L,SAAsB,MAAM,CAAE,KAAa,EAAE,SAAiB,EAAE,IAAc;;;;YAC5E,SAAS,GAAG,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;YACtC,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAA;YACzC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAChC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;YAC5C,YAAY,GAAG,EAAE,CAAA;YAErB,IAAI,IAAA,mBAAM,EAAC,QAAQ,CAAC,KAAK,KAAK,EAAE;gBACxB,iBAAiB,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,UAAG,QAAQ,mBAAgB,CAAC,CAAA;gBACrF,YAAY,GAAG,IAAA,iBAAI,EAAC,iBAAiB,CAAC,IAAI,EAAE,CAAA;aAC7C;iBAAM;gBACL,YAAY,GAAG,IAAA,iBAAI,EAAC,UAAG,QAAQ,SAAM,CAAC,IAAI,EAAE,CAAA;aAC7C;YAEK,SAAS,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,UAAG,KAAK,SAAM,CAAC,CAAA;YACjE,aAAa,GAAG,IAAA,iBAAI,EAAC,SAAS,CAAC,IAAI,EAAE,CAAA;YAErC,OAAO,GAAG,IAAA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,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;wBAC5C,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,qBAAc,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,kCAAwB,KAAK,MAAG,CAAA;wBAC7G,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;qBACtC;oBAED,IAAA,SAAG,EAAC,sBAAU,gBAAgB,CAAC,MAAM,oBAAU,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,iCAA8B,CAAC,KAAK,CAAC,CAAA;iBACpI;aACF;YAED,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;gBACnC,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;gBAC1D,WAAW,GAAG,kBAAkB,GAAG,WAAW,CAAA;aAC/C;YAED,IAAI,IAAA,mBAAM,EAAC,QAAQ,CAAC,KAAK,KAAK,EAAE;gBACxB,iBAAiB,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,UAAG,QAAQ,mBAAgB,CAAC,CAAA;gBACrF,IAAA,kBAAK,EAAC,iBAAiB,EAAE,WAAW,CAAC,CAAA;aACtC;iBAAM;gBACL,IAAA,kBAAK,EAAC,UAAG,QAAQ,SAAM,EAAE,WAAW,CAAC,CAAA;aACtC;;;;CACF;AA5ID,wBA4IC"} \ No newline at end of file diff --git a/dist/src/generators/new.d.ts b/dist/src/generators/new.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/new.js b/dist/src/generators/new.js old mode 100644 new mode 100755 index 2276ce0..6f4fc81 --- a/dist/src/generators/new.js +++ b/dist/src/generators/new.js @@ -35,6 +35,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; @@ -46,98 +57,157 @@ var fs_jetpack_1 = require("fs-jetpack"); var log_1 = require("../helpers/log"); var crypto_1 = require("crypto"); function generateNewProject(path) { - var _a; if (path === void 0) { path = '.'; } return __awaiter(this, void 0, void 0, function () { - var readmePath, appPath, documentPath, babelPath, gitignorePath, gitkeepPath, envdevPath, gitkeepPublicPath, indexPath, utilSessionPath, resetCssPath, printerScssPath, themeScssPath, uiScssPath, prismaClientPath, prismaSchemaPath, packagePath, wrapperPath, reducerPath, reducersPath, tsconfigPath, precommitPath, eslintrcPath, printerConfigPath, result; - return __generator(this, function (_b) { - switch (_b.label) { + var configPath, result, root, root_1, root_1_1, item, itemPath, contents, sessionPath, sessionContents, counterTypePath, counterTypeContents, scss, scss_1, scss_1_1, item, itemPath, contents, prisma, prisma_1, prisma_1_1, item, itemPath, contents, redux, redux_1, redux_1_1, item, itemPath, contents, reduxSlicePath, reduxSliceContents, app, app_1, app_1_1, item, itemPath, contents; + var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e; + return __generator(this, function (_f) { + switch (_f.label) { case 0: - readmePath = (0, path_1.join)(process.cwd(), path, 'README.md'); - appPath = (0, path_1.join)(process.cwd(), path, 'pages', '_app.tsx'); - documentPath = (0, path_1.join)(process.cwd(), path, 'pages', '_document.tsx'); - babelPath = (0, path_1.join)(process.cwd(), path, '.babelrc'); - gitignorePath = (0, path_1.join)(process.cwd(), path, '.gitignore'); - gitkeepPath = (0, path_1.join)(process.cwd(), path, '.gitkeep'); - envdevPath = (0, path_1.join)(process.cwd(), path, '.env.dev'); - gitkeepPublicPath = (0, path_1.join)(process.cwd(), path, 'public', '.gitkeep'); - indexPath = (0, path_1.join)(process.cwd(), path, 'pages', 'index.tsx'); - utilSessionPath = (0, path_1.join)(process.cwd(), path, 'util', 'session.ts'); - resetCssPath = (0, path_1.join)(process.cwd(), path, 'scss', 'reset.scss'); - printerScssPath = (0, path_1.join)(process.cwd(), path, 'scss', 'printer.scss'); - themeScssPath = (0, path_1.join)(process.cwd(), path, 'scss', 'theme.scss'); - uiScssPath = (0, path_1.join)(process.cwd(), path, 'scss', 'ui.scss'); - prismaClientPath = (0, path_1.join)(process.cwd(), path, 'prisma', 'client.ts'); - prismaSchemaPath = (0, path_1.join)(process.cwd(), path, 'prisma', 'schema.prisma'); - packagePath = (0, path_1.join)(process.cwd(), path, 'package.json'); - wrapperPath = (0, path_1.join)(process.cwd(), path, 'redux', 'wrapper.tsx'); - reducerPath = (0, path_1.join)(process.cwd(), path, 'redux', 'reducer.tsx'); - reducersPath = (0, path_1.join)(process.cwd(), path, 'redux', 'reducers.json'); - tsconfigPath = (0, path_1.join)(process.cwd(), path, 'tsconfig.json'); - precommitPath = (0, path_1.join)(process.cwd(), path, '.husky', 'pre-commit'); - eslintrcPath = (0, path_1.join)(process.cwd(), path, '.eslintrc.js'); - printerConfigPath = (0, path_1.join)(process.cwd(), path, 'printer.config.json'); - if (!((0, fs_jetpack_1.exists)(printerConfigPath) !== false)) return [3 /*break*/, 2]; + configPath = (0, path_1.join)(process.cwd(), path, 'printer.config.json'); + if (!((0, fs_jetpack_1.exists)(configPath) !== false)) return [3 /*break*/, 2]; return [4 /*yield*/, (0, prompts_1.default)({ type: 'confirm', name: 'overwrite', message: 'A project already exists here, overwrite it?' })]; case 1: - result = _b.sent(); + result = _f.sent(); if (result.overwrite === false) { return [2 /*return*/]; } - _b.label = 2; + _f.label = 2; case 2: - (0, fs_jetpack_1.write)(readmePath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'readme.template')) || ''); - (0, log_1.Log)(' ✅ Created README.md'.green); - (0, fs_jetpack_1.write)(babelPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'babelrc.template')) || ''); - (0, log_1.Log)(' ✅ Created .babelrc'.green); - (0, fs_jetpack_1.write)(gitignorePath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'gitignore.template')) || ''); - (0, log_1.Log)(' ✅ Created .gitignore'.green); - (0, fs_jetpack_1.write)(gitkeepPath, ''); - (0, log_1.Log)(' ✅ Created .gitkeep'.green); - (0, fs_jetpack_1.write)(envdevPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'env.dev.template')) || ''); - (0, log_1.Log)(' ✅ Created .env.dev'.green); - (0, fs_jetpack_1.write)(gitkeepPublicPath, ''); - (0, log_1.Log)(' ✅ Created public/.gitkeep'.green); - (0, fs_jetpack_1.write)(appPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', '_app.template')) || ''); - (0, log_1.Log)(' ✅ Created pages/_app.tsx'.green); - (0, fs_jetpack_1.write)(documentPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', '_document.template')) || ''); - (0, log_1.Log)(' ✅ Created pages/_document.tsx'.green); - (0, fs_jetpack_1.write)(indexPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'index.template')) || ''); - (0, log_1.Log)(' ✅ Created pages/index.tsx'.green); - (0, fs_jetpack_1.write)(utilSessionPath, ((_a = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'session.template'))) === null || _a === void 0 ? void 0 : _a.replaceAll('{{password}}', (0, crypto_1.randomBytes)(32).toString('hex'))) || ''); + root = [ + 'printer.config.json', + '.env.dev.local', + '.eslintrc.js', + '.gitignore', + 'middleware.tsx', + 'next.config.js', + 'package.json', + 'README.md', + 'tsconfig.json' + ]; + try { + for (root_1 = __values(root), root_1_1 = root_1.next(); !root_1_1.done; root_1_1 = root_1.next()) { + item = root_1_1.value; + itemPath = (0, path_1.join)(process.cwd(), path, item); + contents = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', "".concat(item, ".template"))) || ''; + if (item === '.env.dev.local') { + contents = contents.replaceAll('{{password}}', (0, crypto_1.randomBytes)(32).toString('hex')); + } + (0, fs_jetpack_1.write)(itemPath, contents); + (0, log_1.Log)(" \u2705 Created ".concat(item).green); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (root_1_1 && !root_1_1.done && (_a = root_1.return)) _a.call(root_1); + } + finally { if (e_1) throw e_1.error; } + } + (0, fs_jetpack_1.write)((0, path_1.join)(process.cwd(), path, 'public', '.gitkeep'), ''); + sessionPath = (0, path_1.join)(process.cwd(), path, 'util', 'session.ts'); + sessionContents = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'util', 'session.ts.template')) || ''; + sessionContents = sessionContents.replaceAll('{{password}}', (0, crypto_1.randomBytes)(32).toString('hex')); + (0, fs_jetpack_1.write)(sessionPath, sessionContents); (0, log_1.Log)(' ✅ Created util/session.ts'.green); - (0, fs_jetpack_1.write)(resetCssPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'reset.template')) || ''); - (0, log_1.Log)(' ✅ Created scss/reset.css'.green); - (0, fs_jetpack_1.write)(printerScssPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'printer.template')) || ''); - (0, log_1.Log)(' ✅ Created scss/printer.scss'.green); - (0, fs_jetpack_1.write)(themeScssPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'theme.template')) || ''); - (0, log_1.Log)(' ✅ Created scss/theme.scss'.green); - (0, fs_jetpack_1.write)(uiScssPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'ui.template')) || ''); - (0, log_1.Log)(' ✅ Created scss/ui.scss'.green); - (0, fs_jetpack_1.write)(prismaClientPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'prisma.client.template')) || ''); - (0, log_1.Log)(' ✅ Created prisma/client.ts'.green); - (0, fs_jetpack_1.write)(prismaSchemaPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'schema.prisma.template')) || ''); - (0, log_1.Log)(' ✅ Created prisma/schema.prisma'.green); - (0, fs_jetpack_1.write)(packagePath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'package.template')) || ''); - (0, log_1.Log)(' ✅ Created package.json'.green); - (0, fs_jetpack_1.write)(wrapperPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'wrapper.template')) || ''); - (0, log_1.Log)(' ✅ Created redux/wrapper.tsx'.green); - (0, fs_jetpack_1.write)(reducerPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'reducer.template')) || ''); - (0, log_1.Log)(' ✅ Created redux/reducer.tsx'.green); - (0, fs_jetpack_1.write)(reducersPath, '[]'); - (0, log_1.Log)(' ✅ Created redux/reducers.json'.green); - (0, fs_jetpack_1.write)(tsconfigPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'tsconfig.template')) || ''); - (0, log_1.Log)(' ✅ Created tsconfig.json'.green); - (0, fs_jetpack_1.write)(precommitPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'precommit.template')) || ''); - (0, log_1.Log)(' ✅ Created .husky/pre-commit'.green); - (0, fs_jetpack_1.write)(eslintrcPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'eslintrc.template')) || ''); - (0, log_1.Log)(' ✅ Created printer.config.json'.green); - (0, fs_jetpack_1.write)(printerConfigPath, (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'printer.config.template')) || ''); - (0, log_1.Log)(' ✅ Created .eslintrc.js'.green); + counterTypePath = (0, path_1.join)(process.cwd(), path, 'types', 'counter.tsx'); + counterTypeContents = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'types', 'counter.tsx.template')) || ''; + (0, fs_jetpack_1.write)(counterTypePath, counterTypeContents); + (0, log_1.Log)(' ✅ Created types/counter.tsx'.green); + scss = [ + 'printer.scss', + 'reset.scss', + 'theme.scss', + 'ui.scss', + 'index.scss' + ]; + try { + for (scss_1 = __values(scss), scss_1_1 = scss_1.next(); !scss_1_1.done; scss_1_1 = scss_1.next()) { + item = scss_1_1.value; + itemPath = (0, path_1.join)(process.cwd(), path, 'scss', item); + contents = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'scss', "".concat(item, ".template"))) || ''; + (0, fs_jetpack_1.write)(itemPath, contents); + (0, log_1.Log)(" \u2705 Created scss/".concat(item).green); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (scss_1_1 && !scss_1_1.done && (_b = scss_1.return)) _b.call(scss_1); + } + finally { if (e_2) throw e_2.error; } + } + prisma = [ + 'client.ts', + 'schema.prisma' + ]; + try { + for (prisma_1 = __values(prisma), prisma_1_1 = prisma_1.next(); !prisma_1_1.done; prisma_1_1 = prisma_1.next()) { + item = prisma_1_1.value; + itemPath = (0, path_1.join)(process.cwd(), path, 'prisma', item); + contents = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'prisma', "".concat(item, ".template"))) || ''; + (0, fs_jetpack_1.write)(itemPath, contents); + (0, log_1.Log)(" \u2705 Created prisma/".concat(item).green); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (prisma_1_1 && !prisma_1_1.done && (_c = prisma_1.return)) _c.call(prisma_1); + } + finally { if (e_3) throw e_3.error; } + } + redux = [ + 'hooks.tsx', + 'provider.tsx', + 'reducer.tsx', + 'reducers.json', + 'store.tsx' + ]; + try { + for (redux_1 = __values(redux), redux_1_1 = redux_1.next(); !redux_1_1.done; redux_1_1 = redux_1.next()) { + item = redux_1_1.value; + itemPath = (0, path_1.join)(process.cwd(), path, 'redux', item); + contents = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'redux', "".concat(item, ".template"))) || ''; + (0, fs_jetpack_1.write)(itemPath, contents); + (0, log_1.Log)(" \u2705 Created redux/".concat(item).green); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (redux_1_1 && !redux_1_1.done && (_d = redux_1.return)) _d.call(redux_1); + } + finally { if (e_4) throw e_4.error; } + } + reduxSlicePath = (0, path_1.join)(process.cwd(), path, 'redux', 'slice', 'counter.tsx'); + reduxSliceContents = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'redux', 'slice', 'counter.tsx.template')) || ''; + (0, fs_jetpack_1.write)(reduxSlicePath, reduxSliceContents); + (0, log_1.Log)(' ✅ Created redux/slice/counter.tsx'.green); + app = [ + 'layout.tsx', + 'page.tsx' + ]; + try { + for (app_1 = __values(app), app_1_1 = app_1.next(); !app_1_1.done; app_1_1 = app_1.next()) { + item = app_1_1.value; + itemPath = (0, path_1.join)(process.cwd(), path, 'app', item); + contents = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'new', 'app', "".concat(item, ".template"))) || ''; + (0, fs_jetpack_1.write)(itemPath, contents); + (0, log_1.Log)(" \u2705 Created app/".concat(item).green); + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (app_1_1 && !app_1_1.done && (_e = app_1.return)) _e.call(app_1); + } + finally { if (e_5) throw e_5.error; } + } return [2 /*return*/]; } }); diff --git a/dist/src/generators/new.js.map b/dist/src/generators/new.js.map old mode 100644 new mode 100755 index d870cad..b066477 --- a/dist/src/generators/new.js.map +++ b/dist/src/generators/new.js.map @@ -1 +1 @@ -{"version":3,"file":"new.js","sourceRoot":"","sources":["../../../src/generators/new.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA6B;AAC7B,6BAA2B;AAC3B,yCAAgD;AAChD,sCAAoC;AACpC,iCAAoC;AAEpC,SAAsB,kBAAkB,CAAE,IAAkB;;IAAlB,qBAAA,EAAA,UAAkB;;;;;;oBACpD,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;oBACnD,OAAO,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;oBACxD,YAAY,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,CAAA;oBAClE,SAAS,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;oBACjD,aAAa,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,CAAA;oBACvD,WAAW,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;oBACnD,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;oBAClD,iBAAiB,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;oBACnE,SAAS,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAA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 No newline at end of file diff --git a/dist/src/generators/page.d.ts b/dist/src/generators/page.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/page.js b/dist/src/generators/page.js old mode 100644 new mode 100755 index 4b7c0a1..39a59e1 --- a/dist/src/generators/page.js +++ b/dist/src/generators/page.js @@ -46,13 +46,13 @@ var fs_jetpack_1 = require("fs-jetpack"); var log_1 = require("../helpers/log"); var nomenclature_1 = require("../helpers/nomenclature"); function generatePage(path) { - var _a, _b; + var _a; return __awaiter(this, void 0, void 0, function () { - var pagePath, result, pathArray, fileName, urls, name, pageTemplate; - return __generator(this, function (_c) { - switch (_c.label) { + var pagePath, result, pathArray, fileName, urls, name, pageTemplate, urlInterface; + return __generator(this, function (_b) { + switch (_b.label) { case 0: - pagePath = (0, path_1.join)(process.cwd(), 'pages', "".concat(path.replace('.tsx', ''), ".tsx")); + pagePath = (0, path_1.join)(process.cwd(), 'app', "".concat(path.replace('.tsx', ''), "/page.tsx")); if (!((0, fs_jetpack_1.exists)(pagePath) !== false)) return [3 /*break*/, 2]; return [4 /*yield*/, (0, prompts_1.default)({ type: 'confirm', @@ -60,28 +60,31 @@ function generatePage(path) { message: 'This page already exists, overwrite it?' })]; case 1: - result = _c.sent(); + result = _b.sent(); if (result.overwrite === false) { return [2 /*return*/]; } - _c.label = 2; + _b.label = 2; case 2: pathArray = path.replace('.tsx', '').split('/'); fileName = pathArray[pathArray.length - 1]; urls = []; name = (0, nomenclature_1.formatName)(fileName); pageTemplate = ''; - console.log(name, path); if (path.match(/\[(.*?)\]/g)) { urls = path.match(/\[(.*?)\]/g); urls = urls.map(function (url) { return url.replace(/\[/g, '').replace(/\]/g, ''); }); - pageTemplate = ((_a = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'page.url.template'))) === null || _a === void 0 ? void 0 : _a.replaceAll('{{name}}', name).replaceAll('{{url}}', urls.join(', '))) || ''; + urlInterface = urls.map(function (url) { return "".concat(url, ": string"); }); + pageTemplate = ((0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'page.url.template')) || '') + .replaceAll('{{name}}', name) + .replaceAll('{{url_variables}}', 'params') + .replaceAll('{{url_interface}}', "params: {\n ".concat(urlInterface.join('\n'), "\n }")); } else { - pageTemplate = ((_b = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'page.template'))) === null || _b === void 0 ? void 0 : _b.replaceAll('{{name}}', name)) || ''; + pageTemplate = ((_a = (0, fs_jetpack_1.read)((0, path_1.join)(__dirname, '..', 'templates', 'page.template'))) === null || _a === void 0 ? void 0 : _a.replaceAll('{{name}}', name)) || ''; } (0, fs_jetpack_1.write)(pagePath, pageTemplate); - (0, log_1.Log)(" \u2705 Created pages/".concat(path, ".tsx").green); + (0, log_1.Log)(" \u2705 Created app/".concat(path, "/page.tsx").green); return [2 /*return*/]; } }); diff --git a/dist/src/generators/page.js.map b/dist/src/generators/page.js.map old mode 100644 new mode 100755 index 9409bae..ad0b37e --- a/dist/src/generators/page.js.map +++ b/dist/src/generators/page.js.map @@ -1 +1 @@ -{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/generators/page.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA6B;AAC7B,6BAA2B;AAC3B,yCAAgD;AAChD,sCAAoC;AACpC,wDAAoD;AAEpD,SAAsB,YAAY,CAAE,IAAY;;;;;;;oBACxC,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,UAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAM,CAAC,CAAA;yBAE5E,CAAA,IAAA,mBAAM,EAAC,QAAQ,CAAC,KAAK,KAAK,CAAA,EAA1B,wBAA0B;oBACb,qBAAM,IAAA,iBAAO,EAAC;4BAC3B,IAAI,EAAE,SAAS;4BACf,IAAI,EAAE,WAAW;4BACjB,OAAO,EAAE,yCAAy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AC5B,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAa,CAAA;wBAC3C,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAzC,CAAyC,CAAC,CAAA;wBAE3D,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,UAAG,GAAG,aAAU,EAAhB,CAAgB,CAAC,CAAA;wBAExD,YAAY,GAAG,CAAC,IAAA,iBAAI,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC,IAAI,EAAE,CAAC;6BACjF,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC;6BAC5B,UAAU,CAAC,mBAAmB,EAAE,QAAQ,CAAC;6BACzC,UAAU,CAAC,mBAAmB,EAAE,yBAAkB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,UAAO,CAAC,CAAA;qBACrF;yBAAM;wBACL,YAAY,GAAG,CAAA,MAAA,IAAA,iBAAI,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC,0CAAE,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,KAAI,EAAE,CAAA;qBAC7G;oBAED,IAAA,kBAAK,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;oBAC7B,IAAA,SAAG,EAAC,kCAAsB,IAAI,cAAW,CAAC,KAAK,CAAC,CAAA;;;;;CACjD;AArCD,oCAqCC"} \ No newline at end of file diff --git a/dist/src/generators/prisma.d.ts b/dist/src/generators/prisma.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/prisma.js b/dist/src/generators/prisma.js old mode 100644 new mode 100755 diff --git a/dist/src/generators/prisma.js.map b/dist/src/generators/prisma.js.map old mode 100644 new mode 100755 diff --git a/dist/src/generators/scss.d.ts b/dist/src/generators/scss.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/scss.js b/dist/src/generators/scss.js old mode 100644 new mode 100755 diff --git a/dist/src/generators/scss.js.map b/dist/src/generators/scss.js.map old mode 100644 new mode 100755 diff --git a/dist/src/generators/slice.d.ts b/dist/src/generators/slice.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/slice.js b/dist/src/generators/slice.js old mode 100644 new mode 100755 diff --git a/dist/src/generators/slice.js.map b/dist/src/generators/slice.js.map old mode 100644 new mode 100755 diff --git a/dist/src/generators/superagent.d.ts b/dist/src/generators/superagent.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/superagent.js b/dist/src/generators/superagent.js old mode 100644 new mode 100755 index c5e36be..7eb2d47 --- a/dist/src/generators/superagent.js +++ b/dist/src/generators/superagent.js @@ -44,24 +44,21 @@ var match_1 = require("../helpers/match"); function injectSupergent(type, component) { var _a; return __awaiter(this, void 0, void 0, function () { - var filePath, pathArray, fileName, fileContents, fileComponentPath, injectionLine, tempContents, superAgentFlow, newContents, fileComponentPath; + var filePath, pathArray, fileName, fileContents, injectionLine, tempContents, superAgentFlow, newContents, fileComponentPath; return __generator(this, function (_b) { filePath = (0, path_1.join)(process.cwd(), component); pathArray = component.split('/'); fileName = pathArray[pathArray.length - 1]; fileContents = ''; if (filePath.indexOf('.tsx') === -1) { - if ((0, fs_jetpack_1.exists)(filePath) === 'dir') { - fileComponentPath = (0, path_1.join)(process.cwd(), component, "".concat(fileName, ".component.tsx")); - fileContents = (0, fs_jetpack_1.read)(fileComponentPath) || ''; - } - else { - fileContents = (0, fs_jetpack_1.read)("".concat(filePath, ".tsx")) || ''; - } + fileContents = (0, fs_jetpack_1.read)("".concat(filePath, ".tsx")) || ''; } else { fileContents = (0, fs_jetpack_1.read)("".concat(filePath)) || ''; } + if ((0, match_1.findMatches)(fileContents, (0, match_1.stateMatcher)()).length === 0 && (0, match_1.findMatches)(fileContents, (0, match_1.effectMatcher)()).length === 0) { + fileContents = 'import { useState, useEffect } from \'react\'' + '\n' + fileContents; + } if ((0, match_1.findMatches)(fileContents, (0, match_1.stateMatcher)()).length === 0) { fileContents = 'import { useState } from \'react\'' + '\n' + fileContents; } diff --git a/dist/src/generators/superagent.js.map b/dist/src/generators/superagent.js.map old mode 100644 new mode 100755 index 527662d..d951888 --- a/dist/src/generators/superagent.js.map +++ b/dist/src/generators/superagent.js.map @@ -1 +1 @@ -{"version":3,"file":"superagent.js","sourceRoot":"","sources":["../../../src/generators/superagent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA2B;AAC3B,yCAAgD;AAChD,sCAAoC;AACpC,0CAA+G;AAI/G,SAAsB,eAAe,CAAE,IAAqB,EAAE,SAAiB;;;;;YACvE,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAA;YACzC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAChC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;YAC5C,YAAY,GAAG,EAAE,CAAA;YAErB,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;gBACnC,IAAI,IAAA,mBAAM,EAAC,QAAQ,CAAC,KAAK,KAAK,EAAE;oBACxB,iBAAiB,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,UAAG,QAAQ,mBAAgB,CAAC,CAAA;oBACrF,YAAY,GAAG,IAAA,iBAAI,EAAC,iBAAiB,CAAC,IAAI,EAAE,CAAA;iBAC7C;qBAAM;oBACL,YAAY,GAAG,IAAA,iBAAI,EAAC,UAAG,QAAQ,SAAM,CAAC,IAAI,EAAE,CAAA;iBAC7C;aACF;iBAAM;gBACL,YAAY,GAA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,aAAa,CAAC,IAAI,IAAI,GAAG,cAAc,GAAG,IAAI,CAAA;YACrD,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAE3C,IAAI,IAAA,mBAAM,EAAC,QAAQ,CAAC,KAAK,KAAK,EAAE;gBACxB,iBAAiB,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,UAAG,QAAQ,mBAAgB,CAAC,CAAA;gBACrF,IAAA,kBAAK,EAAC,iBAAiB,EAAE,WAAW,CAAC,CAAA;gBACrC,IAAA,SAAG,EAAC,8BAAkB,iBAAiB,CAAE,CAAC,KAAK,CAAC,CAAA;aACjD;iBAAM;gBACL,IAAA,kBAAK,EAAC,UAAG,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAM,EAAE,WAAW,CAAC,CAAA;gBAC1D,IAAA,SAAG,EAAC,8BAAkB,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAM,CAAC,KAAK,CAAC,CAAA;aACjE;;;;CACF;AA5CD,0CA4CC"} \ No newline at end of file diff --git a/dist/src/generators/type.d.ts b/dist/src/generators/type.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/generators/type.js b/dist/src/generators/type.js old mode 100644 new mode 100755 diff --git a/dist/src/generators/type.js.map b/dist/src/generators/type.js.map old mode 100644 new mode 100755 diff --git a/dist/src/helpers/log.d.ts b/dist/src/helpers/log.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/helpers/log.js b/dist/src/helpers/log.js old mode 100644 new mode 100755 diff --git a/dist/src/helpers/log.js.map b/dist/src/helpers/log.js.map old mode 100644 new mode 100755 diff --git a/dist/src/helpers/match.d.ts b/dist/src/helpers/match.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/helpers/match.js b/dist/src/helpers/match.js old mode 100644 new mode 100755 index ead5c94..42970bc --- a/dist/src/helpers/match.js +++ b/dist/src/helpers/match.js @@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.findMatches = exports.typeMatcher = exports.actionMatcher = exports.selectorMatcher = exports.functionMatcher = exports.effectMatcher = exports.stateMatcher = exports.superagentMatcher = exports.BraceMatcher2 = exports.BraceMatcher = exports.DispatchMatcher = exports.ReduxOptionalMatcher = exports.ReduxMatcher = exports.ImportMatcher = exports.SliceMatcher = void 0; exports.SliceMatcher = /^(?=.*export)(?=.*createSlice).*$/gmi; exports.ImportMatcher = /^(?=.*import)(?=.*from).*$/gmi; -exports.ReduxMatcher = /^(?=.*import)(?=.*from)(?=.*useSelector)(?=.*useDispatch).*$/gmi; -exports.ReduxOptionalMatcher = /^(?=.*import)(?=.*from)(?=.*useSelector|useDispatch).*$/gmi; -exports.DispatchMatcher = /^(?=.*const)(?=.*dispatch)(?=.*useDispatch).*$/gmi; +exports.ReduxMatcher = /^(?=.*import)(?=.*from)(?=.*useAppSelector)(?=.*useAppDispatch).*$/gmi; +exports.ReduxOptionalMatcher = /^(?=.*import)(?=.*from)(?=.*useAppSelector|useAppDispatch).*$/gmi; +exports.DispatchMatcher = /^(?=.*const)(?=.*dispatch)(?=.*useAppDispatch).*$/gmi; exports.BraceMatcher = /^(?=.*\[).*$/gmi; exports.BraceMatcher2 = /^(?=.*{).*$/gmi; function superagentMatcher(type) { diff --git a/dist/src/helpers/match.js.map b/dist/src/helpers/match.js.map old mode 100644 new mode 100755 index 90159b0..2616151 --- a/dist/src/helpers/match.js.map +++ b/dist/src/helpers/match.js.map @@ -1 +1 @@ -{"version":3,"file":"match.js","sourceRoot":"","sources":["../../../src/helpers/match.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,sCAAsC,CAAA;AACrD,QAAA,aAAa,GAAG,+BAA+B,CAAA;AAC/C,QAAA,YAAY,GAAG,iEAAiE,CAAA;AAChF,QAAA,oBAAoB,GAAG,4DAA4D,CAAA;AACnF,QAAA,eAAe,GAAG,mDAAmD,CAAA;AACrE,QAAA,YAAY,G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AG,CAAC,mBAAgB,EAAE,KAAK,CAAC,CAAA;AAC/E,CAAC;AAFD,sCAEC;AAED,SAAgB,WAAW,CAAE,IAAY;IACvC,OAAO,IAAI,MAAM,CAAC,4BAAqB,IAAI,mBAAgB,EAAE,KAAK,CAAC,CAAA;AACrE,CAAC;AAFD,kCAEC;AAED,SAAgB,WAAW,CAAE,IAAS,EAAE,OAAY;IAClD,IAAM,aAAa,GAAG,EAAE,CAAA;IACxB,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAEjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;YAC9B,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SACtB;KACF;IAED,OAAO,aAAa,CAAA;AACtB,CAAC;AAXD,kCAWC"} \ No newline at end of file diff --git a/dist/src/helpers/nomenclature.d.ts b/dist/src/helpers/nomenclature.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/helpers/nomenclature.js b/dist/src/helpers/nomenclature.js old mode 100644 new mode 100755 diff --git a/dist/src/helpers/nomenclature.js.map b/dist/src/helpers/nomenclature.js.map old mode 100644 new mode 100755 diff --git a/dist/src/printer.d.ts b/dist/src/printer.d.ts old mode 100644 new mode 100755 diff --git a/dist/src/printer.js b/dist/src/printer.js index a67eb4b..7237581 100755 --- a/dist/src/printer.js +++ b/dist/src/printer.js @@ -56,7 +56,7 @@ var prisma_1 = require("./generators/prisma"); var superagent_1 = require("./generators/superagent"); exports.Printer = new commander_1.Command('🖨️ Printer'); exports.Printer - .version('1.3.4') + .version('2.0.0') .description('🖨️ Printer: Automation Tooling for Next, Redux and Prisma.') .option('-a, --no-action', 'do not inject actions', false) .option('-s, --no-state', 'do not inject state', false); diff --git a/dist/src/printer.js.map b/dist/src/printer.js.map old mode 100644 new mode 100755 diff --git a/dist/src/templates/api.template b/dist/src/templates/api.template old mode 100644 new mode 100755 index b57d379..0a83588 --- a/dist/src/templates/api.template +++ b/dist/src/templates/api.template @@ -1,17 +1,26 @@ -import { NextApiRequest, NextApiResponse } from 'next' -import { withIronSessionApiRoute } from 'iron-session/next' -import { Session } from 'util/session' +import { NextRequest, NextResponse } from 'next/server' +import { getSession, createResponse } from 'util/session' -export const {{name}}Route = withIronSessionApiRoute( - async (req: NextApiRequest, res: NextApiResponse) => { - try { - res.status(200).send({ status: 'OK' }) - } catch (error) { - console.error(error) - res.status(500).send({ status: 'ERROR', error }) - } - }, - Session -) +export async function GET(req: NextRequest) { + const res = new NextResponse() + const session = await getSession(req, res) + const { searchParams } = new URL(req.url) -export default {{name}}Route + try { + return createResponse( + res, + JSON.stringify({ + status: 'OK', + session + }), + { status: 200 } + ) + } catch (error) { + console.error(error) + return createResponse( + res, + JSON.stringify({ status: 'ERROR', error }), + { status: 500 } + ) + } +} diff --git a/dist/src/templates/component/component.nostyle.template b/dist/src/templates/component/component.nostyle.template old mode 100644 new mode 100755 diff --git a/dist/src/templates/component/component.template b/dist/src/templates/component/component.template old mode 100644 new mode 100755 diff --git a/dist/src/templates/component/index.nostyle.template b/dist/src/templates/component/index.nostyle.template old mode 100644 new mode 100755 diff --git a/dist/src/templates/component/index.template b/dist/src/templates/component/index.template old mode 100644 new mode 100755 diff --git a/dist/src/templates/component/style.template b/dist/src/templates/component/style.template old mode 100644 new mode 100755 diff --git a/dist/src/templates/component/test.template b/dist/src/templates/component/test.template old mode 100644 new mode 100755 diff --git a/dist/src/templates/crud.template b/dist/src/templates/crud.template new file mode 100755 index 0000000..4b2e570 --- /dev/null +++ b/dist/src/templates/crud.template @@ -0,0 +1,138 @@ +import { NextRequest, NextResponse } from 'next/server' +import { getSession, createResponse } from 'util/session' +import prisma from 'prisma/client' + +// Creates a new record +export async function POST(req: NextRequest) { + const res = new NextResponse() + const session = await getSession(req, res) + try { + const data = await req.json() + const {{model}} = await prisma.{{model}}.create({ data }) + + return createResponse( + res, + JSON.stringify({ + status: 'OK', + {{model}} + }), + { status: 200 } + ) + } catch (error) { + console.error(error) + return createResponse( + res, + JSON.stringify({ status: 'ERROR', error }), + { status: 500 } + ) + } +} + +// Updates an existing record by its @id +export async function PATCH(req: NextRequest) { + const res = new NextResponse() + const session = await getSession(req, res) + try { + const data = await req.json() + const id = data.id + delete data.id + + const {{model}} = await prisma.{{model}}.update({ + where: { id }, + data, + }) + + return createResponse( + res, + JSON.stringify({ + status: 'OK', + {{model}} + }), + { status: 200 } + ) + } catch (error) { + console.error(error) + return createResponse( + res, + JSON.stringify({ status: 'ERROR', error }), + { status: 500 } + ) + } +} + +// Deletes a record by its @id +export async function DELETE(req: NextRequest) { + const res = new NextResponse() + const session = await getSession(req, res) + try { + const { searchParams } = new URL(req.url) + const id = searchParams.get('id') + + const {{model}} = await prisma.{{model}}.delete({ + where: { id } + }) + + return createResponse( + res, + JSON.stringify({ + status: 'OK', + {{model}} + }), + { status: 200 } + ) + } catch (error) { + console.error(error) + return createResponse( + res, + JSON.stringify({ status: 'ERROR', error }), + { status: 500 } + ) + } +} + +// Lists results or gets a specific ID +export async function GET(req: NextRequest) { + const res = new NextResponse() + const session = await getSession(req, res) + try { + const { searchParams } = new URL(req.url) + const id = searchParams.get('id') + const skip = searchParams.get('skip') + + if (id) { + const {{model}} = await prisma.{{model}}.findUnique({ + where: { id } + }) + + return createResponse( + res, + JSON.stringify({ + status: 'OK', + result: {{model}} + }), + { status: 200 } + ) + } else { + const results = await prisma.{{model}}.findMany({ + take: 10, + skip: Number(skip || '0') + }) + + return createResponse( + res, + JSON.stringify({ + status: 'OK', + results + }), + { status: 200 } + ) + } + } catch (error) { + console.error(error) + return createResponse( + res, + JSON.stringify({ status: 'ERROR', error }), + { status: 500 } + ) + } +} diff --git a/dist/src/templates/crud/create.template b/dist/src/templates/crud/create.template deleted file mode 100644 index 367b425..0000000 --- a/dist/src/templates/crud/create.template +++ /dev/null @@ -1,23 +0,0 @@ -import prisma from 'prisma/client' -import { NextApiRequest, NextApiResponse } from 'next' -import { withIronSessionApiRoute } from 'iron-session/next' -import { Session } from 'util/session' - -export const CreateRoute = withIronSessionApiRoute( - async (req: NextApiRequest, res: NextApiResponse) => { - try { - const {{model}} = await prisma.{{model}}.create({ - data: { - ...req.body - } - }) - res.status(200).send({ status: 'OK', {{model}} }) - } catch (error) { - console.error(error) - res.status(500).send({ status: 'ERROR', error }) - } - }, - Session -) - -export default CreateRoute diff --git a/dist/src/templates/crud/delete.template b/dist/src/templates/crud/delete.template deleted file mode 100644 index 2c8eb11..0000000 --- a/dist/src/templates/crud/delete.template +++ /dev/null @@ -1,23 +0,0 @@ -import prisma from 'prisma/client' -import { NextApiRequest, NextApiResponse } from 'next' -import { withIronSessionApiRoute } from 'iron-session/next' -import { Session } from 'util/session' - -export const DeleteRoute = withIronSessionApiRoute( - async (req: NextApiRequest, res: NextApiResponse) => { - try { - const {{model}} = await prisma.{{model}}.delete({ - where: { - id: req.query.id || req.body.id - } - }) - res.status(200).send({ status: 'OK', {{model}} }) - } catch (error) { - console.error(error) - res.status(500).send({ status: 'ERROR', error }) - } - }, - Session -) - -export default DeleteRoute diff --git a/dist/src/templates/crud/get.template b/dist/src/templates/crud/get.template deleted file mode 100644 index 8798c7d..0000000 --- a/dist/src/templates/crud/get.template +++ /dev/null @@ -1,23 +0,0 @@ -import prisma from 'prisma/client' -import { NextApiRequest, NextApiResponse } from 'next' -import { withIronSessionApiRoute } from 'iron-session/next' -import { Session } from 'util/session' - -export const GetRoute = withIronSessionApiRoute( - async (req: NextApiRequest, res: NextApiResponse) => { - try { - const {{model}} = await prisma.{{model}}.findUnique({ - where: { - id: req.query.id || req.body.id - } - }) - res.status(200).send({ status: 'OK', {{model}} }) - } catch (error) { - console.error(error) - res.status(500).send({ status: 'ERROR', error }) - } - }, - Session -) - -export default GetRoute diff --git a/dist/src/templates/crud/list.template b/dist/src/templates/crud/list.template deleted file mode 100644 index 6afad5a..0000000 --- a/dist/src/templates/crud/list.template +++ /dev/null @@ -1,19 +0,0 @@ -import prisma from 'prisma/client' -import { NextApiRequest, NextApiResponse } from 'next' -import { withIronSessionApiRoute } from 'iron-session/next' -import { Session } from 'util/session' - -export const ListRoute = withIronSessionApiRoute( - async (req: NextApiRequest, res: NextApiResponse) => { - try { - const results = await prisma.{{model}}.findMany() - res.status(200).send({ status: 'OK', results }) - } catch (error) { - console.error(error) - res.status(500).send({ status: 'ERROR', error }) - } - }, - Session -) - -export default ListRoute diff --git a/dist/src/templates/crud/update.template b/dist/src/templates/crud/update.template deleted file mode 100644 index 1ad606d..0000000 --- a/dist/src/templates/crud/update.template +++ /dev/null @@ -1,26 +0,0 @@ -import prisma from 'prisma/client' -import { NextApiRequest, NextApiResponse } from 'next' -import { withIronSessionApiRoute } from 'iron-session/next' -import { Session } from 'util/session' - -export const UpdateRoute = withIronSessionApiRoute( - async (req: NextApiRequest, res: NextApiResponse) => { - try { - const id = req.body.id - const data = req.body - delete data.id - - const {{model}} = await prisma.{{model}}.update({ - where: { id }, - data, - }) - res.status(200).send({ status: 'OK', {{model}} }) - } catch (error) { - console.error(error) - res.status(500).send({ status: 'ERROR', error }) - } - }, - Session -) - -export default UpdateRoute diff --git a/dist/src/templates/new/.env.dev.local.template b/dist/src/templates/new/.env.dev.local.template new file mode 100755 index 0000000..f61db17 --- /dev/null +++ b/dist/src/templates/new/.env.dev.local.template @@ -0,0 +1,2 @@ +DATABASE_URL="http://localhost:1906" +SESSION_SECRET="{{password}}" \ No newline at end of file diff --git a/src/templates/new/eslintrc.template b/dist/src/templates/new/.eslintrc.js.template old mode 100644 new mode 100755 similarity index 96% rename from src/templates/new/eslintrc.template rename to dist/src/templates/new/.eslintrc.js.template index df21694..0a1e7d6 --- a/src/templates/new/eslintrc.template +++ b/dist/src/templates/new/.eslintrc.js.template @@ -5,6 +5,7 @@ module.exports = { node: true }, extends: [ + 'next/core-web-vitals', 'plugin:react/recommended', 'standard', 'prettier', diff --git a/src/templates/new/gitignore.template b/dist/src/templates/new/.gitignore.template old mode 100644 new mode 100755 similarity index 98% rename from src/templates/new/gitignore.template rename to dist/src/templates/new/.gitignore.template index 9f2da9e..1174f79 --- a/src/templates/new/gitignore.template +++ b/dist/src/templates/new/.gitignore.template @@ -74,10 +74,9 @@ web_modules/ # dotenv environment variable files .env -.env.development.local +.env.local .env.test.local .env.production.local -.env.local # parcel-bundler cache (https://parceljs.org/) .cache diff --git a/src/templates/new/readme.template b/dist/src/templates/new/README.md.template old mode 100644 new mode 100755 similarity index 100% rename from src/templates/new/readme.template rename to dist/src/templates/new/README.md.template diff --git a/dist/src/templates/new/_app.template b/dist/src/templates/new/_app.template old mode 100644 new mode 100755 diff --git a/dist/src/templates/new/_document.template b/dist/src/templates/new/_document.template old mode 100644 new mode 100755 diff --git a/dist/src/templates/new/app/layout.tsx.template b/dist/src/templates/new/app/layout.tsx.template new file mode 100755 index 0000000..c5b62c7 --- /dev/null +++ b/dist/src/templates/new/app/layout.tsx.template @@ -0,0 +1,20 @@ +import 'scss/printer.scss' +import { ReactNode } from 'react' +import { ReduxProvider } from 'redux/provider' + +export interface LayoutI { + children: ReactNode +} + +export default function LayoutComponent({ children }: LayoutI) { + return ( + +
+{{name}} Page
+{{name}} Page
+{{name}} Page
+{{name}} Page
+