@ciridae/configs 0.3.0 → 0.4.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.
- package/CHANGELOG.md +6 -0
- package/README.md +17 -0
- package/eslint.js +0 -1
- package/package.json +24 -4
- package/vite.d.ts +8 -0
- package/vite.js +63 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ciridae/configs
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add `@ciridae/configs/vite` with `versionManifest`, which writes `version.json` for the update prompt, and `sentrySourceMaps`, which uploads production source maps to Sentry when its credentials are set.
|
|
8
|
+
|
|
3
9
|
## 0.3.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -23,3 +23,20 @@ export { default } from "@ciridae/configs/prettier" with { type: "json" }
|
|
|
23
23
|
"extends": "@ciridae/configs/tsconfig/frontend-app.json"
|
|
24
24
|
}
|
|
25
25
|
```
|
|
26
|
+
|
|
27
|
+
## Vite
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { sentrySourceMaps, versionManifest } from "@ciridae/configs/vite"
|
|
31
|
+
|
|
32
|
+
export default defineConfig(({ mode }) => ({
|
|
33
|
+
plugins: [
|
|
34
|
+
versionManifest({ buildSha: process.env.VITE_BUILD_SHA ?? "development" }),
|
|
35
|
+
sentrySourceMaps({ mode }),
|
|
36
|
+
],
|
|
37
|
+
}))
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`versionManifest` writes `version.json` beside the bundle so an open tab can
|
|
41
|
+
tell a newer build is deployed. `sentrySourceMaps` uploads production source
|
|
42
|
+
maps when `SENTRY_ORG`, `SENTRY_PROJECT`, and `SENTRY_AUTH_TOKEN` are set.
|
package/eslint.js
CHANGED
|
@@ -128,7 +128,6 @@ function createStrictReactAppConfig(
|
|
|
128
128
|
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
129
129
|
"@typescript-eslint/no-unsafe-return": "error",
|
|
130
130
|
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
131
|
-
"import-x/no-cycle": "error",
|
|
132
131
|
"import-x/no-self-import": "error",
|
|
133
132
|
"@eslint-react/no-nested-component-definitions": "error",
|
|
134
133
|
"@eslint-react/no-unstable-context-value": "error",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ciridae/configs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared ESLint, Prettier, and
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Shared ESLint, Prettier, TypeScript, and Vite configurations for Ciridae projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=22.18"
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"CHANGELOG.md",
|
|
17
17
|
"eslint.js",
|
|
18
18
|
"prettier.json",
|
|
19
|
+
"vite.js",
|
|
20
|
+
"vite.d.ts",
|
|
19
21
|
"tsconfig"
|
|
20
22
|
],
|
|
21
23
|
"exports": {
|
|
@@ -23,7 +25,11 @@
|
|
|
23
25
|
"./eslint": "./eslint.js",
|
|
24
26
|
"./prettier": "./prettier.json",
|
|
25
27
|
"./tsconfig/frontend-app.json": "./tsconfig/frontend-app.json",
|
|
26
|
-
"./tsconfig/frontend-node.json": "./tsconfig/frontend-node.json"
|
|
28
|
+
"./tsconfig/frontend-node.json": "./tsconfig/frontend-node.json",
|
|
29
|
+
"./vite": {
|
|
30
|
+
"types": "./vite.d.ts",
|
|
31
|
+
"default": "./vite.js"
|
|
32
|
+
}
|
|
27
33
|
},
|
|
28
34
|
"publishConfig": {
|
|
29
35
|
"access": "public"
|
|
@@ -39,6 +45,20 @@
|
|
|
39
45
|
"typescript-eslint": "^8.63.0"
|
|
40
46
|
},
|
|
41
47
|
"peerDependencies": {
|
|
42
|
-
"eslint": "^10.7.0"
|
|
48
|
+
"eslint": "^10.7.0",
|
|
49
|
+
"vite": ">=8",
|
|
50
|
+
"@sentry/vite-plugin": ">=5"
|
|
51
|
+
},
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"vite": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"@sentry/vite-plugin": {
|
|
57
|
+
"optional": true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@sentry/vite-plugin": "^5.2.1",
|
|
62
|
+
"vite": "catalog:frontend8"
|
|
43
63
|
}
|
|
44
64
|
}
|
package/vite.d.ts
ADDED
package/vite.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes `version.json` beside the bundle so an open tab can tell the deployment moved on
|
|
3
|
+
* without it. In development it serves the same file, and a `deployedBuildSha` other than
|
|
4
|
+
* `buildSha` exercises the update prompt.
|
|
5
|
+
*
|
|
6
|
+
* @param {{ buildSha: string, deployedBuildSha?: string }} options
|
|
7
|
+
* @returns {import("vite").Plugin[]}
|
|
8
|
+
*/
|
|
9
|
+
export function versionManifest({ buildSha, deployedBuildSha = buildSha }) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
name: "ciridae-version-manifest",
|
|
13
|
+
apply: "build",
|
|
14
|
+
generateBundle() {
|
|
15
|
+
this.emitFile({
|
|
16
|
+
type: "asset",
|
|
17
|
+
fileName: "version.json",
|
|
18
|
+
source: `${JSON.stringify({ buildSha })}\n`,
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "ciridae-dev-version-manifest",
|
|
24
|
+
apply: "serve",
|
|
25
|
+
configureServer(server) {
|
|
26
|
+
server.middlewares.use("/version.json", (_request, response) => {
|
|
27
|
+
response.setHeader("Content-Type", "application/json");
|
|
28
|
+
response.end(`${JSON.stringify({ buildSha: deployedBuildSha })}\n`);
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Uploads production source maps to Sentry, then deletes them from the output, when the build
|
|
37
|
+
* has `SENTRY_ORG`, `SENTRY_PROJECT`, and `SENTRY_AUTH_TOKEN`. Otherwise it adds nothing.
|
|
38
|
+
*
|
|
39
|
+
* @param {{ mode: string }} options
|
|
40
|
+
* @returns {import("vite").PluginOption}
|
|
41
|
+
*/
|
|
42
|
+
export function sentrySourceMaps({ mode }) {
|
|
43
|
+
const {
|
|
44
|
+
SENTRY_ORG: org,
|
|
45
|
+
SENTRY_PROJECT: project,
|
|
46
|
+
SENTRY_AUTH_TOKEN: authToken,
|
|
47
|
+
} = process.env;
|
|
48
|
+
if (mode !== "production" || !org || !project || !authToken) return [];
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
name: "ciridae-sentry-source-maps",
|
|
52
|
+
config: () => ({ build: { sourcemap: "hidden" } }),
|
|
53
|
+
},
|
|
54
|
+
import("@sentry/vite-plugin").then(({ sentryVitePlugin }) =>
|
|
55
|
+
sentryVitePlugin({
|
|
56
|
+
org,
|
|
57
|
+
project,
|
|
58
|
+
authToken,
|
|
59
|
+
sourcemaps: { filesToDeleteAfterUpload: ["dist/**/*.js.map"] },
|
|
60
|
+
}),
|
|
61
|
+
),
|
|
62
|
+
];
|
|
63
|
+
}
|