@theholocron/vite-config 8.9.0-alpha.1 → 8.9.0-alpha.15

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/README.md CHANGED
@@ -77,7 +77,7 @@ export default nodeApp({ entry: "src/index.ts" });
77
77
 
78
78
  ## Codecov bundle analysis
79
79
 
80
- All presets automatically include [`@codecov/vite-plugin`](https://www.npmjs.com/package/@codecov/vite-plugin) when `@codecov/vite-plugin` is installed and `CODECOV_TOKEN` is set in the environment. No extra configuration in `vite.config.ts` is needed — bundle stats are uploaded to Codecov on every build.
80
+ All presets automatically include [`@codecov/vite-plugin`](https://www.npmjs.com/package/@codecov/vite-plugin) when `@codecov/vite-plugin` is installed and `HOLOCRON_CODECOV_TOKEN` (or `CODECOV_TOKEN`) is set in the environment. No extra configuration in `vite.config.ts` is needed — bundle stats are uploaded to Codecov on every build.
81
81
 
82
82
  Install the peer dependency:
83
83
 
@@ -85,7 +85,7 @@ Install the peer dependency:
85
85
  pnpm add -D @codecov/vite-plugin
86
86
  ```
87
87
 
88
- Set `CODECOV_TOKEN` as a CI secret, then add the following to your `codecov.yml` to control when Codecov posts bundle size comments on PRs:
88
+ Set `CODECOV_TOKEN` (or `HOLOCRON_CODECOV_TOKEN`) as a CI secret, then add the following to your `codecov.yml` to control when Codecov posts bundle size comments on PRs:
89
89
 
90
90
  ```yaml
91
91
  comment:
@@ -0,0 +1,24 @@
1
+ import { holocronEnv } from "@theholocron/env-utils/lookup";
2
+ import { readFileSync } from "node:fs";
3
+ import { resolve } from "node:path";
4
+ // presets/codecov-token/codecov-token.ts
5
+ /**
6
+ * The Codecov upload token the bundle-analysis plugin uses, read through `@theholocron/env-utils/lookup` rather than
7
+ * `process.env`. `HOLOCRON_CODECOV_TOKEN` wins; the bare `CODECOV_TOKEN` (the name the Codecov uploader reads itself) is
8
+ * the fallback.
9
+ *
10
+ * @param env - The environment to read. Default `process.env`, read when called; a test passes its own.
11
+ * @returns The `HOLOCRON_CODECOV_TOKEN` or `CODECOV_TOKEN` value, or `undefined` when neither is set or both are empty.
12
+ */
13
+ function codecovToken(env) {
14
+ return holocronEnv(env).get("CODECOV_TOKEN");
15
+ }
16
+ // presets/get-package-name.ts
17
+ function getPackageName() {
18
+ try {
19
+ return JSON.parse(readFileSync(resolve(process.cwd(), "package.json"), "utf-8")).name ?? "unknown";
20
+ } catch {
21
+ return "unknown";
22
+ }
23
+ }
24
+ export { codecovToken as n, getPackageName as t };
@@ -1,4 +1,4 @@
1
- import { t as getPackageName } from "../get-package-name-C6AE0pNO.js";
1
+ import { n as codecovToken, t as getPackageName } from "../get-package-name-DWqVTm5i.js";
2
2
  import { mergeConfig } from "vite";
3
3
  // presets/library.ts
4
4
  /**
@@ -11,9 +11,9 @@ async function library({ entry = "src/index.ts", name, external = [], overrides
11
11
  try {
12
12
  const { codecovVitePlugin } = await import("@codecov/vite-plugin");
13
13
  plugins.push(codecovVitePlugin({
14
- enableBundleAnalysis: !!process.env.CODECOV_TOKEN,
14
+ enableBundleAnalysis: !!codecovToken(),
15
15
  bundleName: getPackageName(),
16
- uploadToken: process.env.CODECOV_TOKEN
16
+ uploadToken: codecovToken()
17
17
  }));
18
18
  } catch {}
19
19
  return mergeConfig({
@@ -1,4 +1,4 @@
1
- import { t as getPackageName } from "../get-package-name-C6AE0pNO.js";
1
+ import { n as codecovToken, t as getPackageName } from "../get-package-name-DWqVTm5i.js";
2
2
  import { mergeConfig } from "vite";
3
3
  // presets/node-app.ts
4
4
  /**
@@ -11,9 +11,9 @@ async function nodeApp({ entry = "src/index.ts", overrides = {} } = {}) {
11
11
  try {
12
12
  const { codecovVitePlugin } = await import("@codecov/vite-plugin");
13
13
  plugins.push(codecovVitePlugin({
14
- enableBundleAnalysis: !!process.env.CODECOV_TOKEN,
14
+ enableBundleAnalysis: !!codecovToken(),
15
15
  bundleName: getPackageName(),
16
- uploadToken: process.env.CODECOV_TOKEN
16
+ uploadToken: codecovToken()
17
17
  }));
18
18
  } catch {}
19
19
  return mergeConfig({
@@ -1,4 +1,4 @@
1
- import { t as getPackageName } from "../get-package-name-C6AE0pNO.js";
1
+ import { n as codecovToken, t as getPackageName } from "../get-package-name-DWqVTm5i.js";
2
2
  import { mergeConfig } from "vite";
3
3
  // presets/react-app.ts
4
4
  /**
@@ -13,9 +13,9 @@ async function reactApp(overrides = {}) {
13
13
  try {
14
14
  const { codecovVitePlugin } = await import("@codecov/vite-plugin");
15
15
  plugins.push(codecovVitePlugin({
16
- enableBundleAnalysis: !!process.env.CODECOV_TOKEN,
16
+ enableBundleAnalysis: !!codecovToken(),
17
17
  bundleName: getPackageName(),
18
- uploadToken: process.env.CODECOV_TOKEN
18
+ uploadToken: codecovToken()
19
19
  }));
20
20
  } catch {}
21
21
  return mergeConfig({
@@ -1,4 +1,4 @@
1
- import { t as getPackageName } from "../get-package-name-C6AE0pNO.js";
1
+ import { n as codecovToken, t as getPackageName } from "../get-package-name-DWqVTm5i.js";
2
2
  import { mergeConfig } from "vite";
3
3
  import { resolve } from "node:path";
4
4
  // presets/react-library.ts
@@ -14,9 +14,9 @@ async function reactLibrary({ entry = "src/index.ts", name, formats = ["es", "cj
14
14
  try {
15
15
  const { codecovVitePlugin } = await import("@codecov/vite-plugin");
16
16
  plugins.push(codecovVitePlugin({
17
- enableBundleAnalysis: !!process.env.CODECOV_TOKEN,
17
+ enableBundleAnalysis: !!codecovToken(),
18
18
  bundleName: resolvedName,
19
- uploadToken: process.env.CODECOV_TOKEN
19
+ uploadToken: codecovToken()
20
20
  }));
21
21
  } catch {}
22
22
  return mergeConfig({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/vite-config",
3
- "version": "8.9.0-alpha.1",
3
+ "version": "8.9.0-alpha.15",
4
4
  "description": "Vite configuration presets for libraries, React apps, and Node tools within the Galaxy.",
5
5
  "keywords": [
6
6
  "vite",
@@ -52,15 +52,18 @@
52
52
  "files": [
53
53
  "dist/"
54
54
  ],
55
+ "dependencies": {
56
+ "@theholocron/env-utils": "^1.17.0-alpha.3"
57
+ },
55
58
  "devDependencies": {
56
59
  "@codecov/vite-plugin": "^2.0.0",
57
- "@vitest/coverage-v8": "^5.0.5",
58
- "tsdown": "^0.23.3",
60
+ "@vitest/coverage-v8": "^5.1.0",
61
+ "tsdown": "^0.23.5",
59
62
  "typescript": "^5.9.3",
60
- "vite": "^8.2.1",
61
- "vitest": "^5.0.5",
62
- "@theholocron/tsconfig": "8.9.0-alpha.1",
63
- "@theholocron/vitest-config": "8.9.0-alpha.1"
63
+ "vite": "^8.3.6",
64
+ "vitest": "^5.1.0",
65
+ "@theholocron/tsconfig": "8.9.0-alpha.15",
66
+ "@theholocron/vitest-config": "8.9.0-alpha.15"
64
67
  },
65
68
  "peerDependencies": {
66
69
  "@codecov/vite-plugin": "^2",
@@ -86,10 +89,10 @@
86
89
  "access": "public"
87
90
  },
88
91
  "scripts": {
89
- "delivery.build": "tsdown",
90
- "sourceQuality.staticAnalysis": "eslint .",
92
+ "build": "tsdown",
93
+ "lint:code": "eslint .",
94
+ "test:unit": "vitest run --coverage",
91
95
  "test:watch": "vitest",
92
- "verification.typeSafety": "tsc --noEmit",
93
- "verification.unitTests": "vitest run"
96
+ "typecheck": "tsc --noEmit"
94
97
  }
95
98
  }
@@ -1,11 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { resolve } from "node:path";
3
- // presets/get-package-name.ts
4
- function getPackageName() {
5
- try {
6
- return JSON.parse(readFileSync(resolve(process.cwd(), "package.json"), "utf-8")).name ?? "unknown";
7
- } catch {
8
- return "unknown";
9
- }
10
- }
11
- export { getPackageName as t };