@react-consulting/rc-kit 0.14.2 → 0.14.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/devkit/commands/build.ts
CHANGED
|
@@ -61,7 +61,7 @@ export const sentrySourcemaps: Command = {
|
|
|
61
61
|
"rc sentry:sourcemaps --app <app> --directory <sortie> [--directory <sortie>] [--delete-maps]",
|
|
62
62
|
summary: "envoie les source maps d'un build à Sentry (release = commit)",
|
|
63
63
|
details:
|
|
64
|
-
"À la fin de build:cloudflare, depuis le dossier de l'app. Lit sentry.org, sentry.url et sentry.projects.<app> de rc.config.json, injecte les identifiants de débogage puis envoie les maps sous la release du commit (WORKERS_CI_COMMIT_SHA, sinon git). Sans SENTRY_AUTH_TOKEN : saute l'envoi en local, échoue dans Workers Builds. --delete-maps supprime ensuite les .map, envoyées ou non (à mettre sur les assets publics). Demande @sentry/cli dans l'app.",
|
|
64
|
+
"À la fin de build:cloudflare, depuis le dossier de l'app. Lit sentry.org, sentry.url et sentry.projects.<app> de rc.config.json, injecte les identifiants de débogage puis envoie les maps sous la release du commit (WORKERS_CI_COMMIT_SHA, sinon git). Sans SENTRY_AUTH_TOKEN : saute l'envoi en local, échoue dans Workers Builds. Un envoi refusé par Sentry n'arrête qu'un build de Workers Builds ; en local il est signalé et le build continue. --delete-maps supprime ensuite les .map, envoyées ou non (à mettre sur les assets publics). Demande @sentry/cli dans l'app.",
|
|
65
65
|
valueFlags: ["app", "directory"],
|
|
66
66
|
run(context) {
|
|
67
67
|
const loaded = loadProjectConfig(context)
|
|
@@ -104,25 +104,28 @@ export const sentrySourcemaps: Command = {
|
|
|
104
104
|
)
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
const failed = sentryCliCommands(
|
|
108
108
|
plan,
|
|
109
109
|
loaded.config.sentry?.org ?? "",
|
|
110
110
|
directories
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
).find(
|
|
112
|
+
(args) =>
|
|
113
|
+
runCommand([binary, ...args], {
|
|
114
|
+
env: { SENTRY_URL: plan.url },
|
|
115
|
+
inherit: true,
|
|
116
|
+
}).exitCode !== 0
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
if (failed && isWorkersBuild(process.env)) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
`[sourcemaps] sentry-cli ${failed[0]} ${failed[1]} a échoué.`
|
|
122
|
+
)
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
console.log(
|
|
125
|
-
|
|
126
|
+
failed
|
|
127
|
+
? `[sourcemaps] sentry-cli ${failed[0]} ${failed[1]} a échoué : envoi abandonné, le build local continue (vérifie SENTRY_AUTH_TOKEN et sentry.org).`
|
|
128
|
+
: `[sourcemaps] ${plan.project}@${plan.release} envoyé à Sentry.`
|
|
126
129
|
)
|
|
127
130
|
}
|
|
128
131
|
|
|
@@ -128,6 +128,8 @@ describe("migrateToKitPackage", () => {
|
|
|
128
128
|
devDependencies: { "@rc/kit": "link:../_rc-kit" },
|
|
129
129
|
},
|
|
130
130
|
"rc.config.json": '{ "project": "contoso-api", "kit": ">=0.10.0" }\n',
|
|
131
|
+
"vite.config.ts":
|
|
132
|
+
'import { resolveBuildCommitSha } from "./scripts/lib/build-commit-sha.ts"\n',
|
|
131
133
|
})
|
|
132
134
|
|
|
133
135
|
migrateToKitPackage({ root, kitVersion: "0.13.0" })
|
|
@@ -139,6 +141,9 @@ describe("migrateToKitPackage", () => {
|
|
|
139
141
|
expect(manifest.scripts["build:cloudflare"]).toBe(
|
|
140
142
|
"wrangler deploy --dry-run --define __RC_BUILD_SHA__:$(rc build:sha)"
|
|
141
143
|
)
|
|
144
|
+
expect(readFileSync(join(root, "vite.config.ts"), "utf8")).toBe(
|
|
145
|
+
'import { resolveBuildCommitSha } from "@react-consulting/rc-kit/build"\n'
|
|
146
|
+
)
|
|
142
147
|
})
|
|
143
148
|
|
|
144
149
|
test("moves a project from the sibling clone to the npm package", () => {
|
|
@@ -53,7 +53,7 @@ const SCRIPT_REWRITES: [RegExp, string][] = [
|
|
|
53
53
|
[/\brc op:sync\b/g, "rc secrets:pull"],
|
|
54
54
|
]
|
|
55
55
|
const BUILD_IMPORT_RE =
|
|
56
|
-
/(["'])(?:\.\.?\/)+scripts\/(?:build-commit-sha|deployed-public-env)(?:\.ts)?\1/g
|
|
56
|
+
/(["'])(?:\.\.?\/)+scripts\/(?:lib\/)?(?:build-commit-sha|deployed-public-env)(?:\.ts)?\1/g
|
|
57
57
|
const TOOL_CONFIGS = ["biome.json", "biome.jsonc", "tsconfig.json"]
|
|
58
58
|
const TOOL_IGNORE_ENTRY_RE = /"!(?:\.\/)?scripts\/[^"]+"/g
|
|
59
59
|
const SOURCE_EXTENSIONS = /\.(?:[cm]?[jt]sx?|astro|vue|svelte|jsonc)$/
|
package/package.json
CHANGED
package/rules/observability.md
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
- Le projet garde une couche mince : `packages/shared/src/observability/server-errors.ts` (`withErrorTracking(service, handler)`, `reportServerError(error, context)`) et un `initErrorReporting({ dsn, front })` côté navigateur.
|
|
10
10
|
- Variables publiques, dans les `vars` de `env.production` (vides au niveau local) : `SENTRY_DSN` (Worker), `SENTRY_TUNNEL_DSNS` (DSN de son front), `PUBLIC_SENTRY_DSN` (Astro) ou `VITE_SENTRY_DSN` (TanStack Start), injectées dans le bundle navigateur au build par `readDeployedPublicEnv` de `@react-consulting/rc-kit/build`, qui lit les `vars` de l'environnement Wrangler construit.
|
|
11
11
|
- Release = commit du build : `resolveBuildCommitSha()` de `@react-consulting/rc-kit/build` (`WORKERS_CI_COMMIT_SHA`, sinon git) injecté en `__RC_BUILD_SHA__` (`define` Vite) ou `--define __RC_BUILD_SHA__:$(rc build:sha)` pour un build Wrangler ; aucun script local de commit.
|
|
12
|
-
- Source maps : build en `sourcemap: "hidden"`, puis `rc sentry:sourcemaps --app <app> --directory <sortie> [--delete-maps]` à la fin de `build:cloudflare` (`--delete-maps` sur les assets publics). La commande lit `sentry` de `rc.config.json` ; dans Workers Builds elle échoue sans `SENTRY_AUTH_TOKEN` (voir `secrets.md`)
|
|
12
|
+
- Source maps : build en `sourcemap: "hidden"`, puis `rc sentry:sourcemaps --app <app> --directory <sortie> [--delete-maps]` à la fin de `build:cloudflare` (`--delete-maps` sur les assets publics). La commande lit `sentry` de `rc.config.json` ; dans Workers Builds elle échoue sans `SENTRY_AUTH_TOKEN` ou sur un envoi refusé (voir `secrets.md`) ; en local elle saute l'envoi sans jeton et ne fait que signaler un envoi refusé.
|
|
13
13
|
- Alertes, membres et règles de regroupement se règlent dans Sentry, pas dans le dépôt.
|