@react-consulting/rc-kit 0.13.1 → 0.13.3
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/devkit/README.md +2 -2
- package/devkit/lib/kit-migrate.test.ts +23 -0
- package/devkit/lib/kit-migrate.ts +14 -8
- package/package.json +1 -1
package/devkit/README.md
CHANGED
|
@@ -208,10 +208,10 @@ Fait passer un projet de l'ancien clone voisin (`"@rc/kit": "link:../_rc-kit"`)
|
|
|
208
208
|
- `@rc/kit` devient `@react-consulting/rc-kit@^<version du kit>` dans chaque `package.json` (catalog compris), et les apps dont les scripts lancent `rc` le déclarent aussi ;
|
|
209
209
|
- imports `@rc/kit/*` → `@react-consulting/rc-kit/*` (le registre de composants `@rc/<nom>` ne change pas), import des règles de `CLAUDE.md` / `AGENTS.md`, `$schema` et clé `kit` de `rc.config.json` (commentaires gardés) ;
|
|
210
210
|
- `scripts/ensure-rc-kit.ts` et les hooks `preinstall` / `postinstall` qui le lancent sont retirés ;
|
|
211
|
-
- `bun ../../scripts/on-workers-ci.ts` → `rc ci:only`, `bun ../../scripts/upload-sourcemaps.ts` → `rc sentry:sourcemaps`, imports de `scripts/build-commit-sha` et `scripts/deployed-public-env` → `@react-consulting/rc-kit/build`, `rc op:sync` → `rc secrets:pull` (le script `op:sync` devient `secrets:pull
|
|
211
|
+
- `bun ../../scripts/on-workers-ci.ts` → `rc ci:only`, `bun ../../scripts/upload-sourcemaps.ts` → `rc sentry:sourcemaps`, imports de `scripts/build-commit-sha` et `scripts/deployed-public-env` → `@react-consulting/rc-kit/build`, `rc op:sync` → `rc secrets:pull` (le script `op:sync` devient `secrets:pull`, y compris quand un script TypeScript le lance) ; chaque ancien script est supprimé quand plus rien ne s'en sert, sinon signalé ;
|
|
212
212
|
- `--project <projet Sentry>` passe à `--app <app>` (l'app de `rc.config.json` dont `path` est le dossier du workspace) ; si `rc.config.json` n'a pas de clé `sentry`, elle est créée avec ces projets et l'organisation lue dans l'ancien `upload-sourcemaps.ts`.
|
|
213
213
|
|
|
214
|
-
Les dossiers cachés (`.worktrees`…) et les dépôts git imbriqués ne sont pas parcourus. Les workflows GitHub qui clonent encore le kit, la documentation qui
|
|
214
|
+
Les dossiers cachés (`.worktrees`…) et les dépôts git imbriqués ne sont pas parcourus. Les workflows et actions GitHub (`.github/**/*.yml`) qui clonent encore le kit, la documentation et les fichiers `*.example` qui décrivent encore l'ancien montage et les réglages Workers Builds sont signalés, pas modifiés. `--dry-run` liste les changements sans écrire. Relancer la commande ne change plus rien.
|
|
215
215
|
|
|
216
216
|
### `rc new <dossier> --name <slug> --prefix <pfx> --account <entité> --account-id <id> [--sentry-org <org>] [--no-install]`
|
|
217
217
|
|
|
@@ -178,8 +178,14 @@ describe("migrateToKitPackage", () => {
|
|
|
178
178
|
"scripts/upload-sourcemaps.ts":
|
|
179
179
|
'const SENTRY_ORG = process.env.SENTRY_ORG ?? "contoso-org"\n',
|
|
180
180
|
".worktrees/kit/src/a.ts": 'import "@rc/kit"\n',
|
|
181
|
+
".github/actions/setup/action.yml": " path: .rc-kit\n",
|
|
182
|
+
".env.example": "# secrets lus par rc op:sync\n",
|
|
183
|
+
"scripts/dev/boot.ts":
|
|
184
|
+
'spawnSync(rc, ["op:sync"])\nconsole.warn("rc op:sync a échoué")\n',
|
|
181
185
|
"vendor/other/.git": "gitdir: elsewhere\n",
|
|
182
186
|
"vendor/other/b.ts": 'import "@rc/kit"\n',
|
|
187
|
+
"CLAUDE.md": "bun dev # rc op:sync puis turbo\n",
|
|
188
|
+
"apps/api/wrangler.jsonc": "// secrets lus par `rc op:sync`\n{}\n",
|
|
183
189
|
"rc.config.json":
|
|
184
190
|
'{\n "project": "contoso-stay",\n "apps": { "api": { "path": "apps/api" } }\n}\n',
|
|
185
191
|
})
|
|
@@ -205,6 +211,23 @@ describe("migrateToKitPackage", () => {
|
|
|
205
211
|
projects: { api: "ctz-api" },
|
|
206
212
|
})
|
|
207
213
|
expect(result.manual.some((line) => line.includes("ctz-tools"))).toBe(true)
|
|
214
|
+
expect(
|
|
215
|
+
result.manual.some((line) =>
|
|
216
|
+
line.startsWith(".github/actions/setup/action.yml")
|
|
217
|
+
)
|
|
218
|
+
).toBe(true)
|
|
219
|
+
expect(result.manual.some((line) => line.includes(".env.example"))).toBe(
|
|
220
|
+
true
|
|
221
|
+
)
|
|
222
|
+
expect(readFileSync(join(root, "CLAUDE.md"), "utf8")).toContain(
|
|
223
|
+
"rc secrets:pull puis turbo"
|
|
224
|
+
)
|
|
225
|
+
expect(
|
|
226
|
+
readFileSync(join(root, "apps/api/wrangler.jsonc"), "utf8")
|
|
227
|
+
).toContain("`rc secrets:pull`")
|
|
228
|
+
expect(readFileSync(join(root, "scripts/dev/boot.ts"), "utf8")).toBe(
|
|
229
|
+
'spawnSync(rc, ["secrets:pull"])\nconsole.warn("rc secrets:pull a échoué")\n'
|
|
230
|
+
)
|
|
208
231
|
expect(result.changes.map((change) => change.file)).not.toContain(
|
|
209
232
|
".worktrees/kit/src/a.ts"
|
|
210
233
|
)
|
|
@@ -53,8 +53,8 @@ const SCRIPT_REWRITES: [RegExp, string][] = [
|
|
|
53
53
|
]
|
|
54
54
|
const BUILD_IMPORT_RE =
|
|
55
55
|
/(["'])(?:\.\.?\/)+scripts\/(?:build-commit-sha|deployed-public-env)(?:\.ts)?\1/g
|
|
56
|
-
const SOURCE_EXTENSIONS = /\.(?:[cm]?[jt]sx?|astro|vue|svelte)$/
|
|
57
|
-
const DOC_EXTENSIONS = /\.mdx
|
|
56
|
+
const SOURCE_EXTENSIONS = /\.(?:[cm]?[jt]sx?|astro|vue|svelte|jsonc)$/
|
|
57
|
+
const DOC_EXTENSIONS = /\.mdx?$|\.example$/
|
|
58
58
|
const STALE_DOC_RE =
|
|
59
59
|
/_rc-kit|@rc\/kit(?![\w-])|ensure-rc-kit|\bop:sync\b|upload-sourcemaps|on-workers-ci/
|
|
60
60
|
const SKIPPED_DIRS = new Set([
|
|
@@ -77,6 +77,8 @@ const DEPENDENCY_FIELDS = [
|
|
|
77
77
|
|
|
78
78
|
const LEGACY_SECRETS_SCRIPT = "op:sync"
|
|
79
79
|
const SECRETS_SCRIPT = "secrets:pull"
|
|
80
|
+
const LEGACY_SECRETS_LITERAL_RE = /(["'`])op:sync\1/g
|
|
81
|
+
const LEGACY_SECRETS_COMMAND_RE = /\brc op:sync\b/g
|
|
80
82
|
const SOURCEMAPS_PROJECT_RE = /rc sentry:sourcemaps --project (\S+)/g
|
|
81
83
|
const LEGACY_SENTRY_ORG_RE = /SENTRY_ORG\s*\?\?\s*["']([^"']+)["']/
|
|
82
84
|
|
|
@@ -351,9 +353,11 @@ function migrateSources(migration: Migration): void {
|
|
|
351
353
|
const next = text
|
|
352
354
|
.replace(LEGACY_IMPORT_RE, KIT_PACKAGE)
|
|
353
355
|
.replace(BUILD_IMPORT_RE, `$1${KIT_PACKAGE}/build$1`)
|
|
356
|
+
.replace(LEGACY_SECRETS_LITERAL_RE, `$1${SECRETS_SCRIPT}$1`)
|
|
357
|
+
.replace(LEGACY_SECRETS_COMMAND_RE, `rc ${SECRETS_SCRIPT}`)
|
|
354
358
|
|
|
355
359
|
if (next !== text) {
|
|
356
|
-
migration.write(file, next, `imports vers ${KIT_PACKAGE}`)
|
|
360
|
+
migration.write(file, next, `imports et appels vers ${KIT_PACKAGE}`)
|
|
357
361
|
}
|
|
358
362
|
}
|
|
359
363
|
}
|
|
@@ -378,7 +382,9 @@ function migrateAgentFiles(migration: Migration): void {
|
|
|
378
382
|
next = next.replaceAll(`@${spec}`, RULES_IMPORT)
|
|
379
383
|
}
|
|
380
384
|
|
|
381
|
-
next = next
|
|
385
|
+
next = next
|
|
386
|
+
.replace(LEGACY_IMPORT_RE, KIT_PACKAGE)
|
|
387
|
+
.replace(LEGACY_SECRETS_COMMAND_RE, `rc ${SECRETS_SCRIPT}`)
|
|
382
388
|
|
|
383
389
|
if (next !== text) {
|
|
384
390
|
migration.write(file, next, `règles importées par ${RULES_IMPORT}`)
|
|
@@ -586,18 +592,18 @@ function reportDocs(migration: Migration): void {
|
|
|
586
592
|
}
|
|
587
593
|
|
|
588
594
|
function reportWorkflows(migration: Migration): void {
|
|
589
|
-
const dir = join(migration.root, ".github"
|
|
595
|
+
const dir = join(migration.root, ".github")
|
|
590
596
|
|
|
591
597
|
if (!existsSync(dir)) {
|
|
592
598
|
return
|
|
593
599
|
}
|
|
594
600
|
|
|
595
|
-
for (const
|
|
596
|
-
const text = readFileSync(
|
|
601
|
+
for (const file of sourceFiles(dir, /\.ya?ml$/)) {
|
|
602
|
+
const text = readFileSync(file, "utf8")
|
|
597
603
|
|
|
598
604
|
if (/_rc-kit|\.rc-kit|RC_KIT_TOKEN|repository:\s*\S+\/rc-kit/.test(text)) {
|
|
599
605
|
migration.manual.push(
|
|
600
|
-
|
|
606
|
+
`${migration.rel(file)} : retire le checkout du kit, son déplacement et « bun install --cwd ../_rc-kit » ; reprends template/.github/workflows/ci.yml du kit.`
|
|
601
607
|
)
|
|
602
608
|
}
|
|
603
609
|
}
|