create-codeverse 0.0.0-stage → 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/ReadMe.MD +457 -0
- package/bin/cli.js +280 -0
- package/lib/apply/front.js +122 -0
- package/lib/apply/test.js +67 -0
- package/lib/copyTemplate.js +73 -0
- package/lib/desktop.js +13 -0
- package/lib/installDependencies.js +37 -0
- package/lib/openInEditor.js +14 -0
- package/lib/packageJson.js +19 -0
- package/lib/paths.js +4 -0
- package/lib/prompts.js +68 -0
- package/lib/runCommand.js +40 -0
- package/lib/secret.js +80 -0
- package/lib/templates.js +79 -0
- package/lib/validateProjectName.js +24 -0
- package/lib/versions.js +50 -0
- package/package.json +46 -6
- package/templates/codeskills.enc +0 -0
- package/templates/extras/test-componentes/cypress/component/Login.cy.jsx +120 -0
- package/templates/extras/test-componentes/cypress/fixtures/example.json +5 -0
- package/templates/extras/test-componentes/cypress/support/commands.js +25 -0
- package/templates/extras/test-componentes/cypress/support/component-index.html +14 -0
- package/templates/extras/test-componentes/cypress/support/component.js +24 -0
- package/templates/extras/test-componentes/cypress.config.js +10 -0
- package/templates/extras/test-componentes/src/app/page.jsx +5 -0
- package/templates/extras/test-componentes/src/components/Login.jsx +47 -0
- package/templates/extras/test-dependencias/tests/nome-do-script.test.js +79 -0
- package/templates/front/.env.example +0 -0
- package/templates/front/ReadMe.MD +36 -0
- package/templates/front/_gitignore +42 -0
- package/templates/front/biome.json +42 -0
- package/templates/front/jsconfig.json +8 -0
- package/templates/front/next.config.mjs +11 -0
- package/templates/front/package.template.json +41 -0
- package/templates/front/public/fonts/gitkeep +0 -0
- package/templates/front/public/icons/gitkeep +0 -0
- package/templates/front/public/images/gitkeep +0 -0
- package/templates/front/public/media/gitkeep +0 -0
- package/templates/front/public/sounds/gitkeep +0 -0
- package/templates/front/src/app/favicon.ico +0 -0
- package/templates/front/src/app/globals.css +9 -0
- package/templates/front/src/app/layout.js +14 -0
- package/templates/front/src/app/nome-da-rota/nome-da-rota.module.css +0 -0
- package/templates/front/src/app/nome-da-rota/page.jsx +5 -0
- package/templates/front/src/app/page.jsx +39 -0
- package/templates/front/src/app/page.module.css +98 -0
- package/templates/front/src/components/Nome-do-componente.jsx +5 -0
- package/templates/front/src/components/Nome-do-componente.module.css +0 -0
- package/templates/integracao/cypress/e2e/meu-teste.cy.js +75 -0
- package/templates/integracao/cypress/fixtures/example.json +5 -0
- package/templates/integracao/cypress/support/commands.js +25 -0
- package/templates/integracao/cypress/support/e2e.js +17 -0
- package/templates/integracao/cypress.config.js +7 -0
- package/templates/integracao/package.template.json +37 -0
- package/templates/test/.env.example +0 -0
- package/templates/test/_gitignore +25 -0
- package/templates/test/jest.reporters.config.mjs +14 -0
- package/templates/test/package.template.json +42 -0
- package/templates/test/src/nome-do-seu-script.js +4 -0
- package/templates/test/tests/nome-do-script.test.js +40 -0
- package/templates/versions.json +81 -0
- package/README.md +0 -3
package/ReadMe.MD
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
# create-codeverse
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/create-codeverse)
|
|
4
|
+
[](https://www.npmjs.com/package/create-codeverse)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
|
|
7
|
+
The official scaffolding CLI for **CodeVerse** students. Run one command, answer a few questions
|
|
8
|
+
and get a ready-to-code project: a Next.js front end or an automated-testing project with Jest or
|
|
9
|
+
Cypress. The CLI copies the template, installs the dependencies and opens the project in VS Code.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx create-codeverse@latest
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> [!NOTE]
|
|
16
|
+
> The interactive prompts are in **Brazilian Portuguese**, because the CLI is built for CodeVerse
|
|
17
|
+
> classes.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Table of contents
|
|
22
|
+
|
|
23
|
+
- [Quick start](#quick-start)
|
|
24
|
+
- [Requirements](#requirements)
|
|
25
|
+
- [How it works](#how-it-works)
|
|
26
|
+
- [The wizard](#the-wizard)
|
|
27
|
+
- [Templates](#templates)
|
|
28
|
+
- [FrontEnd — Next.js App Router](#frontend--nextjs-app-router)
|
|
29
|
+
- [Test — Unit (Jest)](#test--unit-jest)
|
|
30
|
+
- [Test — Dependencies (Jest)](#test--dependencies-jest)
|
|
31
|
+
- [Test — Component Testing (Cypress)](#test--component-testing-cypress)
|
|
32
|
+
- [Test — E2E Integration (Cypress)](#test--e2e-integration-cypress)
|
|
33
|
+
- [Coming soon](#coming-soon)
|
|
34
|
+
- [Dependency versions](#dependency-versions)
|
|
35
|
+
- [Where the project is created](#where-the-project-is-created)
|
|
36
|
+
- [Opening in VS Code](#opening-in-vs-code)
|
|
37
|
+
- [Safety and guarantees](#safety-and-guarantees)
|
|
38
|
+
- [Exit codes](#exit-codes)
|
|
39
|
+
- [Troubleshooting](#troubleshooting)
|
|
40
|
+
- [License](#license)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Quick start
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx create-codeverse@latest
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You don't need a global install. `npm create codeverse@latest` also works.
|
|
51
|
+
|
|
52
|
+
The CLI is fully interactive and takes no command-line arguments or flags.
|
|
53
|
+
|
|
54
|
+
## Requirements
|
|
55
|
+
|
|
56
|
+
| Requirement | Notes |
|
|
57
|
+
|---|---|
|
|
58
|
+
| **Node.js** `>= 20` | Check with `node -v` |
|
|
59
|
+
| **npm** | Comes with Node.js |
|
|
60
|
+
| **Windows** (PowerShell or cmd) | The generated npm scripts start with `cls` (clear screen), which only exists on Windows shells. See [Troubleshooting](#troubleshooting). |
|
|
61
|
+
| **VS Code** with `code` on your `PATH` | Optional. Without it, the CLI prints the project path so you can open it manually. |
|
|
62
|
+
| **Internet connection** | Needed for `npm install` (and to download the Cypress binary for the Cypress templates) |
|
|
63
|
+
|
|
64
|
+
## How it works
|
|
65
|
+
|
|
66
|
+
1. **Asks the questions**: your name, the project name, the template, and then the extras (FrontEnd) or the test type (Test). See [The wizard](#the-wizard).
|
|
67
|
+
2. **Creates the project folder** on your Desktop (`<home>\Desktop\<project-name>`). It never overwrites an existing folder.
|
|
68
|
+
3. **Copies the template** exactly as published:
|
|
69
|
+
- empty folders (marked with a `gitkeep` file) are created without the marker file
|
|
70
|
+
- `_gitignore` is renamed to `.gitignore`
|
|
71
|
+
- `node_modules`, `.next` and `package-lock.json` are never copied
|
|
72
|
+
4. **Generates `package.json`** from the template's `package.template.json` and sets:
|
|
73
|
+
- `name` to your project name
|
|
74
|
+
- `author.name` to your name
|
|
75
|
+
5. **Applies the code changes** for the extras or test type you chose (e.g. Tailwind setup, Ant Design registry, Cypress files).
|
|
76
|
+
6. **Installs the dependencies** inside the new folder with `npm install` (see [Dependency versions](#dependency-versions)).
|
|
77
|
+
7. **Shows the next step** and counts down 5 seconds, so you have time to read the messages.
|
|
78
|
+
8. **Opens the project in VS Code** (see [Opening in VS Code](#opening-in-vs-code)).
|
|
79
|
+
|
|
80
|
+
The CLI doesn't initialize a Git repository, run your project or run your tests. Its only job is
|
|
81
|
+
to create a ready-to-use starting point.
|
|
82
|
+
|
|
83
|
+
## The wizard
|
|
84
|
+
|
|
85
|
+
| # | Prompt (pt-BR) | Meaning | Rules |
|
|
86
|
+
|---|---|---|---|
|
|
87
|
+
| 1 | `Qual é o seu nome, DEV?` | Your name | Required. Saved as `author.name` in `package.json`. |
|
|
88
|
+
| 2 | `Qual é o nome do seu projeto/app?` | Project name | Lowercase letters, digits and hyphens only. No spaces, can't start or end with a hyphen, max 214 characters. A folder with that name can't already exist in the destination. |
|
|
89
|
+
| 3 | `Continuar e salvar aqui?` | Save in the current folder? | Only shown when the Desktop folder doesn't exist. See [Where the project is created](#where-the-project-is-created). |
|
|
90
|
+
| 4 | `O que vamos construir hoje? ...` | Main menu: pick **one** template | `BackEnd`, `FrontEnd`, `Mobile`, `Test` |
|
|
91
|
+
| 5a | `Quais extras vão turbinar seu projeto? (opcional)` | FrontEnd extras (multi-select) | Optional. Select none, one or several. |
|
|
92
|
+
| 5b | `Que tipo de teste você vai fazer?` | Test type (single select) | `Unitário`, `Dependências`, `Component Testing`, `Integração E2E` |
|
|
93
|
+
|
|
94
|
+
**Keys:** `↑`/`↓` to move, `Space` to check or uncheck (multi-select), `Enter` to confirm,
|
|
95
|
+
`Ctrl+C` to cancel at any prompt. Nothing is written to disk until every question has been
|
|
96
|
+
answered.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Templates
|
|
101
|
+
|
|
102
|
+
### FrontEnd — Next.js App Router
|
|
103
|
+
|
|
104
|
+
A Next.js project with the App Router, a `src/` folder, the React Compiler and Biome.
|
|
105
|
+
|
|
106
|
+
**Installed packages**
|
|
107
|
+
|
|
108
|
+
| Type | Packages |
|
|
109
|
+
|---|---|
|
|
110
|
+
| dependencies | `next`, `react`, `react-dom` |
|
|
111
|
+
| devDependencies | `@biomejs/biome`, `babel-plugin-react-compiler` |
|
|
112
|
+
|
|
113
|
+
**What's configured**
|
|
114
|
+
|
|
115
|
+
- `next.config.mjs`: `reactCompiler: true` and `turbopack.root` set to the project folder
|
|
116
|
+
- `jsconfig.json`: import aliases `@/*` → `src/*` and `@components/*` → `src/components/*`
|
|
117
|
+
- `biome.json`: 4-space indentation, single quotes, recommended rules plus the `next` and `react`
|
|
118
|
+
domains, organize imports on
|
|
119
|
+
- `layout.js`: `<html lang="pt-BR">` and imports `globals.css` (a minimal CSS reset)
|
|
120
|
+
- `page.jsx`: a CodeVerse landing page styled with CSS Modules
|
|
121
|
+
- Example route (`src/app/nome-da-rota/`) and example component (`src/components/`), ready to rename
|
|
122
|
+
|
|
123
|
+
**Project structure**
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
my-app/
|
|
127
|
+
├── public/
|
|
128
|
+
│ ├── fonts/ (empty)
|
|
129
|
+
│ ├── icons/ (empty)
|
|
130
|
+
│ ├── images/ (empty)
|
|
131
|
+
│ ├── media/ (empty)
|
|
132
|
+
│ └── sounds/ (empty)
|
|
133
|
+
├── src/
|
|
134
|
+
│ ├── app/
|
|
135
|
+
│ │ ├── nome-da-rota/
|
|
136
|
+
│ │ │ ├── nome-da-rota.module.css
|
|
137
|
+
│ │ │ └── page.jsx
|
|
138
|
+
│ │ ├── favicon.ico
|
|
139
|
+
│ │ ├── globals.css
|
|
140
|
+
│ │ ├── layout.js
|
|
141
|
+
│ │ ├── page.jsx
|
|
142
|
+
│ │ └── page.module.css
|
|
143
|
+
│ └── components/
|
|
144
|
+
│ ├── Nome-do-componente.jsx
|
|
145
|
+
│ └── Nome-do-componente.module.css
|
|
146
|
+
├── .env.example
|
|
147
|
+
├── .gitignore
|
|
148
|
+
├── biome.json
|
|
149
|
+
├── jsconfig.json
|
|
150
|
+
├── next.config.mjs
|
|
151
|
+
├── package.json
|
|
152
|
+
└── ReadMe.MD
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Scripts**
|
|
156
|
+
|
|
157
|
+
| Script | Command | Purpose |
|
|
158
|
+
|---|---|---|
|
|
159
|
+
| `npm run dev` | `cls && next dev` | Starts the development server at `http://localhost:3000` |
|
|
160
|
+
| `npm run lint` | `biome check` | Lints the project and checks the formatting |
|
|
161
|
+
| `npm run format` | `biome format --write` | Formats all files |
|
|
162
|
+
|
|
163
|
+
**Extras**
|
|
164
|
+
|
|
165
|
+
Extras are optional and can be combined.
|
|
166
|
+
|
|
167
|
+
| Extra | Installs | Code changes |
|
|
168
|
+
|---|---|---|
|
|
169
|
+
| **Ant Design** | `antd`, `@ant-design/nextjs-registry` | Wraps `{children}` in `<AntdRegistry>` in `layout.js`, needed for correct SSR styles in the App Router |
|
|
170
|
+
| **Axios** | `axios` | None: import it where you need it |
|
|
171
|
+
| **Lucide Icons** | `lucide-react` | None: import the icons where you need them |
|
|
172
|
+
| **TailwindCss** | `tailwindcss`, `@tailwindcss/postcss` (dev) | Creates `postcss.config.mjs`, replaces `globals.css` with `@import "tailwindcss";`, rewrites `page.jsx` with Tailwind classes, removes the three `.module.css` files and adds `className="min-h-screen antialiased"` to `<body>` |
|
|
173
|
+
| **Toast-Hot** | `react-hot-toast` | Adds `<Toaster />` to `layout.js`, so `toast(...)` calls have somewhere to render |
|
|
174
|
+
|
|
175
|
+
With **Ant Design** and **Toast-Hot**, the `<body>` in `layout.js` becomes:
|
|
176
|
+
|
|
177
|
+
```jsx
|
|
178
|
+
<body>
|
|
179
|
+
<AntdRegistry>{children}</AntdRegistry>
|
|
180
|
+
<Toaster />
|
|
181
|
+
</body>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
With no extras selected, you get the plain template: Next.js, React and CSS Modules.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### Test — Unit (Jest)
|
|
189
|
+
|
|
190
|
+
A JavaScript (ES Modules) project for unit tests with Jest: functions, classes, scenarios,
|
|
191
|
+
negative cases, boundary values and business rules.
|
|
192
|
+
|
|
193
|
+
| Type | Packages |
|
|
194
|
+
|---|---|
|
|
195
|
+
| devDependencies | `jest`, `jest-html-reporters` |
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
my-tests/
|
|
199
|
+
├── src/
|
|
200
|
+
│ └── nome-do-seu-script.js sample function to replace
|
|
201
|
+
├── tests/
|
|
202
|
+
│ └── nome-do-script.test.js teaching suite with the core matchers
|
|
203
|
+
├── .env.example
|
|
204
|
+
├── .gitignore
|
|
205
|
+
├── jest.reporters.config.mjs Jest config with the HTML reporter
|
|
206
|
+
└── package.json "type": "module"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The test suite shows `describe`/`it`/`expect` and the matchers `toBe`, `toEqual`, `toContain`,
|
|
210
|
+
`toBeTruthy`, `toBeFalsy`, `toHaveLength` and `toBeCloseTo`.
|
|
211
|
+
|
|
212
|
+
**Scripts**
|
|
213
|
+
|
|
214
|
+
| Script | Command | Purpose |
|
|
215
|
+
|---|---|---|
|
|
216
|
+
| `npm test` | `cls && node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --verbose` | Runs the whole suite, one test file at a time, with per-test output (ES Modules support) |
|
|
217
|
+
| `npm run report` | `npm test -- --coverage --json --outputFile=coverage/relatorio.json` | Runs with coverage and writes a JSON report to `coverage/relatorio.json` |
|
|
218
|
+
| `npm run dashboard` | `npm test -- --config jest.reporters.config.mjs` | Generates an HTML report at `_html-report/index.html` and opens it |
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
### Test — Dependencies (Jest)
|
|
223
|
+
|
|
224
|
+
Everything in [Unit](#test--unit-jest), plus examples of testing code that depends on external
|
|
225
|
+
resources (APIs, Promises) using mocks.
|
|
226
|
+
|
|
227
|
+
| Type | Packages |
|
|
228
|
+
|---|---|
|
|
229
|
+
| dependencies | `axios` |
|
|
230
|
+
| devDependencies | `jest`, `jest-html-reporters` |
|
|
231
|
+
|
|
232
|
+
The file `tests/nome-do-script.test.js` is replaced by a version that also contains a
|
|
233
|
+
`describe('Mocks com jest.fn()')` block, covering `mockReturnValue`, `mockResolvedValue`,
|
|
234
|
+
`mockRejectedValue`, `toHaveBeenCalled`, `toHaveBeenCalledTimes` and `toHaveBeenCalledWith`. Axios
|
|
235
|
+
is included as the HTTP client for real or mocked API scenarios.
|
|
236
|
+
|
|
237
|
+
It has the same scripts as Unit.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### Test — Component Testing (Cypress)
|
|
242
|
+
|
|
243
|
+
The [FrontEnd](#frontend--nextjs-app-router) template, without extras, plus Cypress Component
|
|
244
|
+
Testing for React components.
|
|
245
|
+
|
|
246
|
+
| Type | Packages |
|
|
247
|
+
|---|---|
|
|
248
|
+
| dependencies | `next`, `react`, `react-dom` |
|
|
249
|
+
| devDependencies | `@biomejs/biome`, `babel-plugin-react-compiler`, `cypress` |
|
|
250
|
+
|
|
251
|
+
**Changes on top of FrontEnd**
|
|
252
|
+
|
|
253
|
+
- Adds a `Login` component (`src/components/Login.jsx`), and `page.jsx` renders only it
|
|
254
|
+
- Adds `cypress.config.js` (component testing with the `next` framework and the `webpack` bundler)
|
|
255
|
+
- Adds a teaching spec, `cypress/component/Login.cy.jsx`, with assertions such as `exist`,
|
|
256
|
+
`be.visible`, `have.text`, `have.attr`, `have.value`, `have.focus` and `deep.equal`, plus typing,
|
|
257
|
+
clearing and submitting with `{enter}`
|
|
258
|
+
- Removes the files that don't belong to this exercise: `.env.example`, the example route, the
|
|
259
|
+
example component, the CSS Modules files and the `public/` subfolders
|
|
260
|
+
- Appends `cypress/screenshots/`, `cypress/videos/` and `cypress/downloads/` to `.gitignore`
|
|
261
|
+
- Adds the `test` script and sets a project-specific `description` and `keywords` in `package.json`
|
|
262
|
+
|
|
263
|
+
```text
|
|
264
|
+
my-app/
|
|
265
|
+
├── cypress/
|
|
266
|
+
│ ├── component/
|
|
267
|
+
│ │ └── Login.cy.jsx
|
|
268
|
+
│ ├── fixtures/
|
|
269
|
+
│ │ └── example.json
|
|
270
|
+
│ └── support/
|
|
271
|
+
│ ├── commands.js
|
|
272
|
+
│ ├── component-index.html
|
|
273
|
+
│ └── component.js
|
|
274
|
+
├── public/
|
|
275
|
+
├── src/
|
|
276
|
+
│ ├── app/
|
|
277
|
+
│ │ ├── favicon.ico
|
|
278
|
+
│ │ ├── globals.css
|
|
279
|
+
│ │ ├── layout.js
|
|
280
|
+
│ │ └── page.jsx
|
|
281
|
+
│ └── components/
|
|
282
|
+
│ └── Login.jsx
|
|
283
|
+
├── .gitignore
|
|
284
|
+
├── biome.json
|
|
285
|
+
├── cypress.config.js
|
|
286
|
+
├── jsconfig.json
|
|
287
|
+
├── next.config.mjs
|
|
288
|
+
├── package.json
|
|
289
|
+
└── ReadMe.MD
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Scripts**
|
|
293
|
+
|
|
294
|
+
| Script | Command | Purpose |
|
|
295
|
+
|---|---|---|
|
|
296
|
+
| `npm run dev` | `cls && next dev` | Starts the development server |
|
|
297
|
+
| `npm test` | `cls && cypress open` | Opens Cypress; choose **Component Testing** |
|
|
298
|
+
| `npm run lint` | `biome check` | Lints the project |
|
|
299
|
+
| `npm run format` | `biome format --write` | Formats all files |
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
### Test — E2E Integration (Cypress)
|
|
304
|
+
|
|
305
|
+
A standalone Cypress project for End-to-End tests: Cypress opens a real website in the browser and
|
|
306
|
+
interacts with it the way a user would.
|
|
307
|
+
|
|
308
|
+
| Type | Packages |
|
|
309
|
+
|---|---|
|
|
310
|
+
| devDependencies | `cypress` |
|
|
311
|
+
|
|
312
|
+
```text
|
|
313
|
+
my-e2e/
|
|
314
|
+
├── cypress/
|
|
315
|
+
│ ├── e2e/
|
|
316
|
+
│ │ └── meu-teste.cy.js teaching spec, one example of each assertion type
|
|
317
|
+
│ ├── fixtures/
|
|
318
|
+
│ │ └── example.json
|
|
319
|
+
│ └── support/
|
|
320
|
+
│ ├── commands.js
|
|
321
|
+
│ └── e2e.js
|
|
322
|
+
├── cypress.config.js e2e.baseUrl = http://localhost:3000
|
|
323
|
+
└── package.json
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
The spec `meu-teste.cy.js` visits `/` before each test and covers URL and title, elements, attributes
|
|
327
|
+
and styles, forms and click navigation. Its selectors and texts are **placeholders**: adjust them
|
|
328
|
+
to the website you're testing. Change `baseUrl` in `cypress.config.js` to test another address.
|
|
329
|
+
|
|
330
|
+
| Script | Command | Purpose |
|
|
331
|
+
|---|---|---|
|
|
332
|
+
| `npm test` | `cls && cypress open` | Opens Cypress; choose **E2E Testing** |
|
|
333
|
+
|
|
334
|
+
> [!NOTE]
|
|
335
|
+
> When you install `cypress`, it also downloads the Cypress app (about 200 MB). The CLI warns you
|
|
336
|
+
> that this step can take a few minutes.
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
### Coming soon
|
|
341
|
+
|
|
342
|
+
| Template | Stack |
|
|
343
|
+
|---|---|
|
|
344
|
+
| **BackEnd** | NodeJS Express |
|
|
345
|
+
| **Mobile** | Expo + Native |
|
|
346
|
+
|
|
347
|
+
These entries already show up in the menu, marked as `em breve` ("coming soon"). Picking one shows a
|
|
348
|
+
notice and exits without creating anything.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Dependency versions
|
|
353
|
+
|
|
354
|
+
The versions of every template's packages are kept in one file inside this package,
|
|
355
|
+
`templates/versions.json`, organized in reusable blocks (for example `front.base` or
|
|
356
|
+
`test.cypress.base`).
|
|
357
|
+
|
|
358
|
+
| Value in `versions.json` | What the CLI does |
|
|
359
|
+
|---|---|
|
|
360
|
+
| `"latest"` | Runs `npm install <pkg>@latest` (or `npm install -D <pkg>@latest`). npm saves the resolved version as `^X.Y.Z`. |
|
|
361
|
+
| Exact version (e.g. `"6.19.3"`) | Writes it to `package.json` as is and runs `npm install` |
|
|
362
|
+
|
|
363
|
+
All the templates listed above use `"latest"`, so every new project starts with the current
|
|
364
|
+
version of each package on the day you scaffold it.
|
|
365
|
+
|
|
366
|
+
The installation runs in this order, and only the steps that apply run:
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
npm install # packages with an exact version
|
|
370
|
+
npm install <deps>@latest # dependencies marked "latest"
|
|
371
|
+
npm install -D <devDeps>@latest # devDependencies marked "latest"
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
If one of these commands fails (no internet, npm registry down, etc.), the CLI:
|
|
375
|
+
|
|
376
|
+
- **keeps** the project folder and all the copied files
|
|
377
|
+
- shows the error and the exact commands left to run:
|
|
378
|
+
|
|
379
|
+
```text
|
|
380
|
+
cd "C:\Users\you\Desktop\my-app"
|
|
381
|
+
npm install -D jest@latest jest-html-reporters@latest
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
- still opens VS Code and exits with code `1`
|
|
385
|
+
|
|
386
|
+
## Where the project is created
|
|
387
|
+
|
|
388
|
+
| Situation | Destination |
|
|
389
|
+
|---|---|
|
|
390
|
+
| `<home>\Desktop` exists (Windows: `%USERPROFILE%\Desktop`) | `<home>\Desktop\<project-name>`, **wherever you ran the command from** |
|
|
391
|
+
| `<home>\Desktop` doesn't exist | The current terminal folder, after asking `Continuar e salvar aqui?` (`Enter` = yes). Answering no exits without creating anything. |
|
|
392
|
+
|
|
393
|
+
> [!IMPORTANT]
|
|
394
|
+
> The CLI always uses the `Desktop` folder inside your user profile. It doesn't follow Desktop
|
|
395
|
+
> redirection (for example, OneDrive). If your visible Desktop is in OneDrive and
|
|
396
|
+
> `%USERPROFILE%\Desktop` also exists, the project is created in `%USERPROFILE%\Desktop`.
|
|
397
|
+
|
|
398
|
+
## Opening in VS Code
|
|
399
|
+
|
|
400
|
+
After a 5-second countdown, the CLI runs:
|
|
401
|
+
|
|
402
|
+
| Where you ran the CLI | Command | Result |
|
|
403
|
+
|---|---|---|
|
|
404
|
+
| A regular terminal (PowerShell, cmd, Windows Terminal) | `code .` | Opens the project in a new VS Code window |
|
|
405
|
+
| The VS Code integrated terminal | `code -r .` | Opens the project in the **current** window. The terminal that ran the CLI closes. |
|
|
406
|
+
|
|
407
|
+
If the `code` command isn't found, the CLI prints the project path so you can open it manually. In
|
|
408
|
+
VS Code you can add it with **Command Palette → `Shell Command: Install 'code' command in PATH`**.
|
|
409
|
+
|
|
410
|
+
Then open the integrated terminal (`` Ctrl + ` ``) and run the template's scripts.
|
|
411
|
+
|
|
412
|
+
## Safety and guarantees
|
|
413
|
+
|
|
414
|
+
- **Never overwrites anything.** The project name is rejected if the folder already exists, and
|
|
415
|
+
this is checked again right before writing.
|
|
416
|
+
- **Nothing is created until the last question is answered.** Cancelling with `Ctrl+C` at any
|
|
417
|
+
prompt leaves your disk untouched.
|
|
418
|
+
- **Only writes inside the new project folder.** It never touches the folder you ran the command
|
|
419
|
+
from (unless that's the destination) or any global configuration.
|
|
420
|
+
- **No global installs, no telemetry, no Git operations.** The only external commands are
|
|
421
|
+
`npm install` inside the new folder and `code` to open VS Code.
|
|
422
|
+
- **Fixed commands only.** The arguments of every external command come from the CLI itself and
|
|
423
|
+
from `templates/versions.json`, never from what you type. Your project name is only used as a
|
|
424
|
+
validated folder name.
|
|
425
|
+
- **A single runtime dependency**, [`@clack/prompts`](https://www.npmjs.com/package/@clack/prompts),
|
|
426
|
+
pinned to an exact version.
|
|
427
|
+
|
|
428
|
+
## Exit codes
|
|
429
|
+
|
|
430
|
+
| Code | Meaning |
|
|
431
|
+
|---|---|
|
|
432
|
+
| `0` | Project created and dependencies installed; or you picked a "coming soon" template; or you declined saving in the current folder |
|
|
433
|
+
| `1` | Something failed while creating the project, or the dependency installation is incomplete (the commands left to run are shown) |
|
|
434
|
+
| `130` | Cancelled with `Ctrl+C` |
|
|
435
|
+
|
|
436
|
+
## Troubleshooting
|
|
437
|
+
|
|
438
|
+
| Problem | Solution |
|
|
439
|
+
|---|---|
|
|
440
|
+
| `'cls' is not recognized` / `cls: command not found` | The generated scripts are made for Windows. On macOS or Linux, remove `cls && ` from the scripts in `package.json`. |
|
|
441
|
+
| `Já existe uma pasta com esse nome...` | A folder with that name already exists in the destination. Pick another name, or remove the old folder yourself. |
|
|
442
|
+
| `Nome inválido...` | Use only lowercase letters, digits and hyphens, e.g. `my-first-app`. |
|
|
443
|
+
| `Falta instalar as dependências...` | The installation failed. Check your internet connection and run the commands shown, in the project folder. |
|
|
444
|
+
| The project didn't appear on my Desktop | Your Desktop is probably redirected (e.g. OneDrive). Look in `%USERPROFILE%\Desktop`. See [Where the project is created](#where-the-project-is-created). |
|
|
445
|
+
| `VS Code não encontrado...` | Install the `code` command in your `PATH` (see [Opening in VS Code](#opening-in-vs-code)), or open the printed folder manually. |
|
|
446
|
+
| Cypress takes a long time to install | Downloading the Cypress app is expected the first time. Wait for it to finish. |
|
|
447
|
+
| You want the newest CLI version | Always run with `@latest`: `npx create-codeverse@latest` |
|
|
448
|
+
|
|
449
|
+
## License
|
|
450
|
+
|
|
451
|
+
MIT © CodeVerse
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
<p align="center">
|
|
456
|
+
<a href="https://codeverse.dev.br">codeverse.dev.br</a>
|
|
457
|
+
</p>
|