@theholocron/vite-config 6.0.1 → 6.1.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/README.md +3 -1
- package/package.json +1 -1
- package/presets/get-package-name.js +5 -1
- package/presets/library.js +6 -1
package/README.md
CHANGED
|
@@ -20,7 +20,9 @@ Outputs ESM only; externalises `react` and `react-dom` by default. Returns a `Pr
|
|
|
20
20
|
import { defineConfig } from "vite";
|
|
21
21
|
import { library } from "@theholocron/vite-config/library";
|
|
22
22
|
|
|
23
|
-
export default defineConfig(
|
|
23
|
+
export default defineConfig(
|
|
24
|
+
await library({ entry: "src/index.ts", name: "MyLib" }),
|
|
25
|
+
);
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
### React single-page application
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/vite-config",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Vite configuration presets for libraries, React apps, and Node tools within the Galaxy.",
|
|
5
5
|
"homepage": "https://github.com/theholocron/configs/tree/main/packages/vite-config#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/configs/issues",
|
|
@@ -3,7 +3,11 @@ import { resolve } from "node:path";
|
|
|
3
3
|
|
|
4
4
|
export function getPackageName() {
|
|
5
5
|
try {
|
|
6
|
-
return
|
|
6
|
+
return (
|
|
7
|
+
JSON.parse(
|
|
8
|
+
readFileSync(resolve(process.cwd(), "package.json"), "utf-8"),
|
|
9
|
+
).name ?? "unknown"
|
|
10
|
+
);
|
|
7
11
|
} catch {
|
|
8
12
|
return "unknown";
|
|
9
13
|
}
|
package/presets/library.js
CHANGED
|
@@ -13,7 +13,12 @@ import { getPackageName } from "./get-package-name.js";
|
|
|
13
13
|
* @param {import('vite').UserConfig} [options.overrides={}] Merged last
|
|
14
14
|
* @returns {Promise<import('vite').UserConfig>}
|
|
15
15
|
*/
|
|
16
|
-
export async function library({
|
|
16
|
+
export async function library({
|
|
17
|
+
entry = "src/index.ts",
|
|
18
|
+
name,
|
|
19
|
+
external = [],
|
|
20
|
+
overrides = {},
|
|
21
|
+
} = {}) {
|
|
17
22
|
const plugins = [];
|
|
18
23
|
try {
|
|
19
24
|
const { codecovVitePlugin } = await import("@codecov/vite-plugin");
|