@nimbuslab/cli 0.2.7 → 0.3.0

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.
@@ -0,0 +1,43 @@
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: "20"
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: Configure npm auth
40
+ run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
41
+
42
+ - name: Publish to npm
43
+ 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/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 templateRepo = TEMPLATES[config.type];
1213
- s.start(`Clonando template ${config.type}...`);
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 ${config.type} clonado`);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbuslab/cli",
3
- "version": "0.2.7",
3
+ "version": "0.3.0",
4
4
  "description": "CLI para criar projetos nimbuslab",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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 templateRepo = TEMPLATES[config.type]
464
- s.start(`Clonando template ${config.type}...`)
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 ${config.type} clonado`)
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.`)