@nimbuslab/cli 0.2.8 → 0.3.4
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/.github/workflows/publish.yml +40 -0
- package/README.md +27 -0
- package/bun.lock +36 -0
- package/dist/index.js +19 -4
- package/package.json +1 -1
- package/src/commands/create.ts +21 -4
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Bun
|
|
20
|
+
uses: oven-sh/setup-bun@v2
|
|
21
|
+
with:
|
|
22
|
+
bun-version: latest
|
|
23
|
+
|
|
24
|
+
- name: Setup Node (for npm publish)
|
|
25
|
+
uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: "24"
|
|
28
|
+
registry-url: "https://registry.npmjs.org"
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: bun install
|
|
32
|
+
|
|
33
|
+
- name: Typecheck
|
|
34
|
+
run: bun run typecheck
|
|
35
|
+
|
|
36
|
+
- name: Build
|
|
37
|
+
run: bun run build
|
|
38
|
+
|
|
39
|
+
- name: Publish to npm
|
|
40
|
+
run: npm publish --access public
|
package/README.md
CHANGED
|
@@ -73,6 +73,33 @@ bun run build
|
|
|
73
73
|
bun run typecheck
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
## Versionamento
|
|
77
|
+
|
|
78
|
+
O projeto usa [Semantic Versioning](https://semver.org/). A publicacao no npm e automatica via GitHub Actions ao fazer merge na `main`.
|
|
79
|
+
|
|
80
|
+
### Avancar versao
|
|
81
|
+
|
|
82
|
+
Antes de fazer merge para `main`, atualize a versao:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Patch (0.2.9 → 0.2.10) - Bug fixes
|
|
86
|
+
npm version patch
|
|
87
|
+
|
|
88
|
+
# Minor (0.2.9 → 0.3.0) - Novas features
|
|
89
|
+
npm version minor
|
|
90
|
+
|
|
91
|
+
# Major (0.2.9 → 1.0.0) - Breaking changes
|
|
92
|
+
npm version major
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Fluxo de release
|
|
96
|
+
|
|
97
|
+
1. Desenvolva na branch `develop`
|
|
98
|
+
2. Avance a versao: `npm version patch|minor|major`
|
|
99
|
+
3. Commit e push: `git push origin develop`
|
|
100
|
+
4. Crie PR para `main`
|
|
101
|
+
5. Apos merge, GitHub Actions publica automaticamente no npm
|
|
102
|
+
|
|
76
103
|
## Stack
|
|
77
104
|
|
|
78
105
|
- **Runtime:** Bun
|
package/bun.lock
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 1,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"": {
|
|
6
|
+
"name": "nimbus-cli",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@clack/prompts": "^0.11.0",
|
|
9
|
+
"picocolors": "^1.1.1",
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@types/bun": "latest",
|
|
13
|
+
"typescript": "^5",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
"packages": {
|
|
18
|
+
"@clack/core": ["@clack/core@0.5.0", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-p3y0FIOwaYRUPRcMO7+dlmLh8PSRcrjuTndsiA0WAFbWES0mLZlrjVoBRZ9DzkPFJZG6KGkJmoEAY0ZcVWTkow=="],
|
|
19
|
+
|
|
20
|
+
"@clack/prompts": ["@clack/prompts@0.11.0", "", { "dependencies": { "@clack/core": "0.5.0", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-pMN5FcrEw9hUkZA4f+zLlzivQSeQf5dRGJjSUbvVYDLvpKCdQx5OaknvKzgbtXOizhP+SJJJjqEbOe55uKKfAw=="],
|
|
21
|
+
|
|
22
|
+
"@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="],
|
|
23
|
+
|
|
24
|
+
"@types/node": ["@types/node@25.0.10", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg=="],
|
|
25
|
+
|
|
26
|
+
"bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="],
|
|
27
|
+
|
|
28
|
+
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
|
29
|
+
|
|
30
|
+
"sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
|
|
31
|
+
|
|
32
|
+
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
33
|
+
|
|
34
|
+
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
|
35
|
+
}
|
|
36
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -848,7 +848,8 @@ import { rm } from "fs/promises";
|
|
|
848
848
|
import { join } from "path";
|
|
849
849
|
var TEMPLATES = {
|
|
850
850
|
fast: "nimbuslab-templates/fast-template",
|
|
851
|
-
"fast+": "nimbuslab-templates/fastplus-template"
|
|
851
|
+
"fast+": "nimbuslab-templates/fastplus-template",
|
|
852
|
+
"fast+-monorepo": "nimbuslab-templates/fastplus-monorepo-template"
|
|
852
853
|
};
|
|
853
854
|
async function ensureRailwayCli() {
|
|
854
855
|
const checkCmd = process.platform === "win32" ? "where" : "which";
|
|
@@ -946,6 +947,7 @@ async function create(args) {
|
|
|
946
947
|
config = {
|
|
947
948
|
name: projectName,
|
|
948
949
|
type: "fast",
|
|
950
|
+
monorepo: false,
|
|
949
951
|
git: true,
|
|
950
952
|
install: true,
|
|
951
953
|
github: false,
|
|
@@ -1011,6 +1013,16 @@ async function promptConfig(initialName) {
|
|
|
1011
1013
|
});
|
|
1012
1014
|
if (pD(type))
|
|
1013
1015
|
return type;
|
|
1016
|
+
let monorepo = false;
|
|
1017
|
+
if (type === "fast+") {
|
|
1018
|
+
const useMonorepo = await ye({
|
|
1019
|
+
message: "Usar monorepo (Turborepo)?",
|
|
1020
|
+
initialValue: false
|
|
1021
|
+
});
|
|
1022
|
+
if (pD(useMonorepo))
|
|
1023
|
+
return useMonorepo;
|
|
1024
|
+
monorepo = useMonorepo;
|
|
1025
|
+
}
|
|
1014
1026
|
const git = await ye({
|
|
1015
1027
|
message: "Inicializar repositorio Git?",
|
|
1016
1028
|
initialValue: true
|
|
@@ -1192,6 +1204,7 @@ async function promptConfig(initialName) {
|
|
|
1192
1204
|
return {
|
|
1193
1205
|
name,
|
|
1194
1206
|
type,
|
|
1207
|
+
monorepo,
|
|
1195
1208
|
git,
|
|
1196
1209
|
install,
|
|
1197
1210
|
github,
|
|
@@ -1209,12 +1222,14 @@ async function promptConfig(initialName) {
|
|
|
1209
1222
|
}
|
|
1210
1223
|
async function createProject(config) {
|
|
1211
1224
|
const s = Y2();
|
|
1212
|
-
const
|
|
1213
|
-
|
|
1225
|
+
const templateKey = config.type === "fast+" && config.monorepo ? "fast+-monorepo" : config.type;
|
|
1226
|
+
const templateRepo = TEMPLATES[templateKey];
|
|
1227
|
+
const templateLabel = config.monorepo ? `${config.type} (monorepo)` : config.type;
|
|
1228
|
+
s.start(`Clonando template ${templateLabel}...`);
|
|
1214
1229
|
try {
|
|
1215
1230
|
await $2`gh repo clone ${templateRepo} ${config.name} -- --depth 1`.quiet();
|
|
1216
1231
|
await rm(join(config.name, ".git"), { recursive: true, force: true });
|
|
1217
|
-
s.stop(`Template ${
|
|
1232
|
+
s.stop(`Template ${templateLabel} clonado`);
|
|
1218
1233
|
} catch (error) {
|
|
1219
1234
|
s.stop("Erro ao clonar template");
|
|
1220
1235
|
throw new Error(`Falha ao clonar template ${templateRepo}. Verifique se tem acesso ao repositorio.`);
|
package/package.json
CHANGED
package/src/commands/create.ts
CHANGED
|
@@ -8,11 +8,13 @@ import { join } from "node:path"
|
|
|
8
8
|
const TEMPLATES = {
|
|
9
9
|
"fast": "nimbuslab-templates/fast-template",
|
|
10
10
|
"fast+": "nimbuslab-templates/fastplus-template",
|
|
11
|
+
"fast+-monorepo": "nimbuslab-templates/fastplus-monorepo-template",
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
interface ProjectConfig {
|
|
14
15
|
name: string
|
|
15
16
|
type: "fast" | "fast+"
|
|
17
|
+
monorepo: boolean
|
|
16
18
|
git: boolean
|
|
17
19
|
install: boolean
|
|
18
20
|
github: boolean
|
|
@@ -149,6 +151,7 @@ export async function create(args: string[]) {
|
|
|
149
151
|
config = {
|
|
150
152
|
name: projectName,
|
|
151
153
|
type: "fast",
|
|
154
|
+
monorepo: false,
|
|
152
155
|
git: true,
|
|
153
156
|
install: true,
|
|
154
157
|
github: false,
|
|
@@ -220,6 +223,17 @@ async function promptConfig(initialName?: string): Promise<ProjectConfig | symbo
|
|
|
220
223
|
|
|
221
224
|
if (p.isCancel(type)) return type
|
|
222
225
|
|
|
226
|
+
// Pergunta sobre monorepo apenas para fast+
|
|
227
|
+
let monorepo = false
|
|
228
|
+
if (type === "fast+") {
|
|
229
|
+
const useMonorepo = await p.confirm({
|
|
230
|
+
message: "Usar monorepo (Turborepo)?",
|
|
231
|
+
initialValue: false,
|
|
232
|
+
})
|
|
233
|
+
if (p.isCancel(useMonorepo)) return useMonorepo
|
|
234
|
+
monorepo = useMonorepo as boolean
|
|
235
|
+
}
|
|
236
|
+
|
|
223
237
|
const git = await p.confirm({
|
|
224
238
|
message: "Inicializar repositorio Git?",
|
|
225
239
|
initialValue: true,
|
|
@@ -440,6 +454,7 @@ async function promptConfig(initialName?: string): Promise<ProjectConfig | symbo
|
|
|
440
454
|
return {
|
|
441
455
|
name: name as string,
|
|
442
456
|
type: type as "fast" | "fast+",
|
|
457
|
+
monorepo,
|
|
443
458
|
git: git as boolean,
|
|
444
459
|
install: install as boolean,
|
|
445
460
|
github,
|
|
@@ -459,13 +474,15 @@ async function promptConfig(initialName?: string): Promise<ProjectConfig | symbo
|
|
|
459
474
|
async function createProject(config: ProjectConfig) {
|
|
460
475
|
const s = p.spinner()
|
|
461
476
|
|
|
462
|
-
// Clone template baseado no tipo (fast ou fast+)
|
|
463
|
-
const
|
|
464
|
-
|
|
477
|
+
// Clone template baseado no tipo (fast ou fast+) e monorepo
|
|
478
|
+
const templateKey = config.type === "fast+" && config.monorepo ? "fast+-monorepo" : config.type
|
|
479
|
+
const templateRepo = TEMPLATES[templateKey]
|
|
480
|
+
const templateLabel = config.monorepo ? `${config.type} (monorepo)` : config.type
|
|
481
|
+
s.start(`Clonando template ${templateLabel}...`)
|
|
465
482
|
try {
|
|
466
483
|
await $`gh repo clone ${templateRepo} ${config.name} -- --depth 1`.quiet()
|
|
467
484
|
await rm(join(config.name, ".git"), { recursive: true, force: true })
|
|
468
|
-
s.stop(`Template ${
|
|
485
|
+
s.stop(`Template ${templateLabel} clonado`)
|
|
469
486
|
} catch (error) {
|
|
470
487
|
s.stop("Erro ao clonar template")
|
|
471
488
|
throw new Error(`Falha ao clonar template ${templateRepo}. Verifique se tem acesso ao repositorio.`)
|