next-accelerate 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Clodoaldo Brito
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # โšก Next Accelerate
2
+
3
+ A **CLI to accelerate the development of Next.js applications** following a pre-configured pattern of folders, settings, and best practices.
4
+
5
+ The idea is simple: **less repetitive setup, more product code**.
6
+
7
+ ## ๐Ÿš€ What is Next Accelerate?
8
+
9
+ **Next-accelerate** is a command-line tool (CLI) that automates repetitive tasks during the development of Next.js projects, already implementing part of the architecture with ready-to-use templates, provided that:
10
+
11
+ ## Requirements
12
+
13
+ > The Next.js project already exists following the (App Router) pattern.
14
+ > Your project follows the standardized folder structure using (Nested Layouts or Layout Composition) and Route Groups.
15
+
16
+ ## ๐Ÿ“ฆ Installation
17
+
18
+ You can run the CLI **without installing anything globally** using `npx`:
19
+
20
+ ```bash
21
+ npx next-accelerate
22
+
23
+ ```
24
+
25
+ Or install globally:
26
+
27
+ ```bash
28
+ npm install -g next-accelerate
29
+
30
+ ```
31
+
32
+ ## โ–ถ๏ธ How to use
33
+
34
+ After installing (or via `npx`), go to your next app project folder and run:
35
+
36
+ ```bash
37
+ next-accelerate singular_resource_name
38
+
39
+ ```
40
+
41
+ ### For now, the CLI only offers the following features
42
+
43
+ 1. Create default folders for resources.
44
+
45
+ At the end, you can run:
46
+
47
+ ```bash
48
+ npm run dev
49
+ ```
50
+
51
+ And see your project more structured and faster.
52
+
53
+ Let's develop! ๐Ÿš€
54
+
55
+ ## ๐Ÿ“ Generated structure (example)
56
+
57
+ ```txt
58
+ src/
59
+ โ”œโ”€ app/
60
+ | โ””โ”€โ”€ (publics)/
61
+ | โ””โ”€โ”€โ”€(privates)/ _resources_dirs_
62
+ โ”œโ”€ components/
63
+ โ”œโ”€ hooks/
64
+ โ”œโ”€ lib/
65
+ โ”œโ”€ services/
66
+ โ””โ”€ utils/
67
+
68
+ ```
69
+
70
+ > The structure can evolve with new versions of the CLI.
71
+
72
+ ## ๐Ÿง  Why use it?
73
+
74
+ * โฑ๏ธ Saves setup time
75
+ * ๐Ÿ“ Maintains consistency across projects
76
+ * ๐Ÿงน Avoids repetitive boilerplate code
77
+ * ๐Ÿ” Ideal for freelancers, squads, and studies
78
+
79
+ ## ๐Ÿ›  Technologies
80
+
81
+ * Node.js
82
+ * Next.js
83
+ * TypeScript
84
+
85
+ ---
86
+
87
+ ## ๐Ÿ“„ License
88
+
89
+ This project is licensed under the **MIT** license.
90
+
91
+ ## ๐Ÿค Contributing
92
+
93
+ Contributions are welcome!
94
+
95
+ 1. Fork the repository
96
+ 2. Create a branch: `git checkout -b feature/my-feature`
97
+ 3. Commit your changes
98
+ 4. Open a Pull Request
99
+
100
+ ## โœจ Author
101
+
102
+ Dveloped by **Neto** ๐Ÿ’™
103
+ If this project helped you, leave a โญ on the repository!
@@ -0,0 +1,31 @@
1
+ import path from "path";
2
+ import fs from "fs";
3
+ import pluralize from "pluralize";
4
+ import { createDir, createFile } from "../utils/fs.js";
5
+ import { capitalize } from "../utils/string.js";
6
+ import { listPageTemplate } from "../templates/list-page.js";
7
+ import { detailPageTemplate } from "../templates/detail-page.js";
8
+ import { newPageTemplate } from "../templates/new-page.js";
9
+ export function createResource(inputName) {
10
+ if (!inputName) {
11
+ console.error("\x1b[32mโœ” Sucesso\x1b[0m" + "Informe o nome do recurso. Ex: user");
12
+ process.exit(1);
13
+ }
14
+ const appDir = path.join(process.cwd(), "src/app");
15
+ if (!fs.existsSync(appDir)) {
16
+ console.error("\x1b[31mโœ– Erro\x1b[0m" + "Execute dentro de um projeto Next.js");
17
+ process.exit(1);
18
+ }
19
+ const resource = pluralize(inputName.toLowerCase());
20
+ const singular = pluralize.singular(resource);
21
+ const BASE_PATH = path.join(process.cwd(), "src/app/(privates)", resource);
22
+ createDir(BASE_PATH);
23
+ createFile(path.join(BASE_PATH, "page.tsx"), listPageTemplate(capitalize(resource)));
24
+ const detailDir = path.join(BASE_PATH, `[${singular}Id]`);
25
+ createDir(detailDir);
26
+ createFile(path.join(detailDir, "page.tsx"), detailPageTemplate(capitalize(singular)));
27
+ const newDir = path.join(BASE_PATH, "new");
28
+ createDir(newDir);
29
+ createFile(path.join(newDir, "page.tsx"), newPageTemplate(capitalize(singular)));
30
+ console.log(`Recurso "${resource}" criado com sucesso` + "\x1b[32mโœ” Sucesso\x1b[0m");
31
+ }
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createResource } from "./commands/create-resource.js";
3
+ const inputName = process.argv[2];
4
+ createResource(inputName);
@@ -0,0 +1,17 @@
1
+ export const detailPageTemplate = (singular) => `
2
+ interface PageProps {
3
+ params: {
4
+ ${singular}Id: string;
5
+ };
6
+ }
7
+
8
+ export default function ${singular}DetailPage({ params }: PageProps) {
9
+ const { ${singular}Id } = params;
10
+
11
+ return (
12
+ <div className="w-full min-h-screen flex flex-col bg-(--bg-section-100) p-10 transition-colors duration-500">
13
+ ${singular} detail: {${singular}Id}
14
+ </div>
15
+ );
16
+ }
17
+ `;
@@ -0,0 +1,9 @@
1
+ export const listPageTemplate = (resource) => `
2
+ export default function ${resource}Page() {
3
+ return (
4
+ <div className="w-full min-h-screen flex flex-col bg-(--bg-section-100) p-10 transition-colors duration-500">
5
+ ${resource} list page
6
+ </div>
7
+ );
8
+ }
9
+ `;
@@ -0,0 +1,9 @@
1
+ export const newPageTemplate = (singular) => `
2
+ export default function New${singular}Page() {
3
+ return (
4
+ <div className="w-full min-h-screen flex flex-col bg-(--bg-section-100) p-10 transition-colors duration-500">
5
+ create new ${singular}
6
+ </div>
7
+ );
8
+ }
9
+ `;
@@ -0,0 +1,12 @@
1
+ import fs from "fs";
2
+ export const createDir = (dirPath) => {
3
+ if (!fs.existsSync(dirPath)) {
4
+ fs.mkdirSync(dirPath, { recursive: true });
5
+ }
6
+ ;
7
+ };
8
+ export const createFile = (filePath, content) => {
9
+ if (!fs.existsSync(filePath)) {
10
+ fs.writeFileSync(filePath, content.trimStart());
11
+ }
12
+ };
@@ -0,0 +1 @@
1
+ export const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "next-accelerate",
3
+ "version": "0.0.1",
4
+ "description": "cli to speed up feature creation in Next.js",
5
+ "bin": {
6
+ "next-accelerate": "dist/index.js"
7
+ },
8
+ "type": "module",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc && chmod +x dist/index.js",
14
+ "dev": "tsc -w"
15
+ },
16
+ "keywords": [],
17
+ "author": "Clodoaldo Neto",
18
+ "license": "ISC",
19
+ "devDependencies": {
20
+ "@types/node": "^20.11.0",
21
+ "@types/pluralize": "^0.0.33",
22
+ "typescript": "^5.9.3"
23
+ },
24
+ "dependencies": {
25
+ "pluralize": "^8.0.0"
26
+ }
27
+ }