create-krispya 0.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/LICENSE +15 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +497 -0
- package/dist/constants.d.ts +33 -0
- package/dist/constants.js +110 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +394 -0
- package/dist/integrations/biome.d.ts +8 -0
- package/dist/integrations/biome.js +80 -0
- package/dist/integrations/drei.d.ts +3 -0
- package/dist/integrations/drei.js +9 -0
- package/dist/integrations/eslint.d.ts +3 -0
- package/dist/integrations/eslint.js +78 -0
- package/dist/integrations/fiber.d.ts +8 -0
- package/dist/integrations/fiber.js +35 -0
- package/dist/integrations/github-pages.d.ts +3 -0
- package/dist/integrations/github-pages.js +58 -0
- package/dist/integrations/handle.d.ts +3 -0
- package/dist/integrations/handle.js +7 -0
- package/dist/integrations/koota.d.ts +8 -0
- package/dist/integrations/koota.js +7 -0
- package/dist/integrations/leva.d.ts +3 -0
- package/dist/integrations/leva.js +7 -0
- package/dist/integrations/offscreen.d.ts +3 -0
- package/dist/integrations/offscreen.js +12 -0
- package/dist/integrations/oxfmt.d.ts +3 -0
- package/dist/integrations/oxfmt.js +27 -0
- package/dist/integrations/oxlint.d.ts +3 -0
- package/dist/integrations/oxlint.js +52 -0
- package/dist/integrations/postprocessing.d.ts +3 -0
- package/dist/integrations/postprocessing.js +12 -0
- package/dist/integrations/prettier.d.ts +3 -0
- package/dist/integrations/prettier.js +28 -0
- package/dist/integrations/rapier.d.ts +3 -0
- package/dist/integrations/rapier.js +7 -0
- package/dist/integrations/triplex.d.ts +26 -0
- package/dist/integrations/triplex.js +159 -0
- package/dist/integrations/uikit.d.ts +3 -0
- package/dist/integrations/uikit.js +7 -0
- package/dist/integrations/viverse.d.ts +3 -0
- package/dist/integrations/viverse.js +74 -0
- package/dist/integrations/xr.d.ts +5 -0
- package/dist/integrations/xr.js +51 -0
- package/dist/integrations/zustand.d.ts +8 -0
- package/dist/integrations/zustand.js +7 -0
- package/dist/lib/array.d.ts +1 -0
- package/dist/lib/array.js +9 -0
- package/dist/merge.d.ts +1 -0
- package/dist/merge.js +26 -0
- package/dist/utils.d.ts +22 -0
- package/dist/utils.js +123 -0
- package/package.json +38 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function generateXr(generator, options) {
|
|
2
|
+
if (options == null || options === false) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
if (options === true) {
|
|
6
|
+
options = {};
|
|
7
|
+
}
|
|
8
|
+
generator.addDependency("@react-three/xr", "^6.6.16");
|
|
9
|
+
generator.addDependency("@vitejs/plugin-basic-ssl", "^2.0.0");
|
|
10
|
+
generator.inject("import", "import { XR, createXRStore } from '@react-three/xr'");
|
|
11
|
+
generator.inject(`global-start`, `const store = createXRStore(${JSON.stringify(options.storeOptions ?? {})})`);
|
|
12
|
+
generator.inject("scene-start", "<XR store={store}>");
|
|
13
|
+
generator.inject("scene-end", "</XR>");
|
|
14
|
+
generator.inject("vite-config-import", "import basicSsl from '@vitejs/plugin-basic-ssl'");
|
|
15
|
+
generator.configureVite({
|
|
16
|
+
server: {
|
|
17
|
+
host: true,
|
|
18
|
+
},
|
|
19
|
+
plugins: ["$raw:basicSsl()"],
|
|
20
|
+
});
|
|
21
|
+
generator.inject("dom-start", `<div style={{
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "row",
|
|
24
|
+
gap: "1rem",
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
zIndex: 10000,
|
|
27
|
+
background: 'black',
|
|
28
|
+
borderRadius: '0.5rem',
|
|
29
|
+
border: 'none',
|
|
30
|
+
fontWeight: 'bold',
|
|
31
|
+
color: 'white',
|
|
32
|
+
cursor: 'pointer',
|
|
33
|
+
fontSize: '1.5rem',
|
|
34
|
+
bottom: '1rem',
|
|
35
|
+
left: '50%',
|
|
36
|
+
boxShadow: '0px 0px 20px rgba(0,0,0,1)',
|
|
37
|
+
transform: 'translate(-50%, 0)',
|
|
38
|
+
}}><button
|
|
39
|
+
style={{ cursor: "pointer", padding: '1rem 2rem', fontSize: "1rem", background: "none", color: "white", border: "none" }}
|
|
40
|
+
onClick={() => store.enterAR()}
|
|
41
|
+
>
|
|
42
|
+
Enter AR
|
|
43
|
+
</button>
|
|
44
|
+
<button
|
|
45
|
+
style={{ cursor: "pointer", padding: '1rem 2rem', fontSize: "1rem", background: "none", color: "white", border: "none" }}
|
|
46
|
+
onClick={() => store.enterVR()}
|
|
47
|
+
>
|
|
48
|
+
Enter VR
|
|
49
|
+
</button></div>`);
|
|
50
|
+
generator.inject("readme-libraries", `[@react-three/xr](https://pmndrs.github.io/xr/docs/) - VR/AR support for @react-three/fiber`);
|
|
51
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Generator } from "../index.js";
|
|
2
|
+
export type GenerateZustandOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* @default true
|
|
5
|
+
*/
|
|
6
|
+
addExample?: boolean;
|
|
7
|
+
} | boolean;
|
|
8
|
+
export declare function generateZustand(generator: Generator, options: GenerateZustandOptions | undefined): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function generateZustand(generator, options) {
|
|
2
|
+
if (options == null) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
generator.addDependency("zustand", "^5.0.3");
|
|
6
|
+
generator.inject("readme-libraries", `[zustand](https://zustand.docs.pmnd.rs/) - small, fast and scalable state-management solution`);
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unique<T>(...array: T[][]): T[];
|
package/dist/merge.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function merge(target: any, modification: any): any;
|
package/dist/merge.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function merge(target, modification) {
|
|
2
|
+
if (modification == null) {
|
|
3
|
+
throw new Error(`Cannot merge "${modification}" modification into target "${target}"`);
|
|
4
|
+
}
|
|
5
|
+
if (target == null) {
|
|
6
|
+
return modification;
|
|
7
|
+
}
|
|
8
|
+
if (Array.isArray(target)) {
|
|
9
|
+
if (!Array.isArray(modification)) {
|
|
10
|
+
throw new Error(`Cannot merge non-array modification "${modification}" into array target "${target}"`);
|
|
11
|
+
}
|
|
12
|
+
return [...target, ...modification];
|
|
13
|
+
}
|
|
14
|
+
if (typeof target === "object") {
|
|
15
|
+
if (typeof modification != "object") {
|
|
16
|
+
throw new Error(`Cannot merge non-object modification "${modification}" into object target "${target}"`);
|
|
17
|
+
}
|
|
18
|
+
const result = { ...target };
|
|
19
|
+
for (const modificationKey in modification) {
|
|
20
|
+
result[modificationKey] = merge(target[modificationKey], modification[modificationKey]);
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
console.warn(`target "${target}" is overwritten with modification "${modification}"`);
|
|
25
|
+
return modification;
|
|
26
|
+
}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches the latest version of an npm package from the registry
|
|
3
|
+
* @param packageName The name of the npm package
|
|
4
|
+
* @param fallback Fallback version if fetch fails
|
|
5
|
+
* @returns The latest version string (e.g., "1.0.0")
|
|
6
|
+
*/
|
|
7
|
+
export declare function getLatestNpmVersion(packageName: string, fallback: string): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Fetches the latest version of pnpm from the npm registry
|
|
10
|
+
* @returns The latest pnpm version string (e.g., "10.24.0")
|
|
11
|
+
*/
|
|
12
|
+
export declare function getLatestPnpmVersion(): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Fetches the latest LTS version of Node.js
|
|
15
|
+
* @returns The latest Node.js LTS version string (e.g., "22.13.0")
|
|
16
|
+
*/
|
|
17
|
+
export declare function getLatestNodeVersion(): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Generates a random name in the format "adjective-noun"
|
|
20
|
+
* @returns A randomly generated name string
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateRandomName(): string;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches the latest version of an npm package from the registry
|
|
3
|
+
* @param packageName The name of the npm package
|
|
4
|
+
* @param fallback Fallback version if fetch fails
|
|
5
|
+
* @returns The latest version string (e.g., "1.0.0")
|
|
6
|
+
*/
|
|
7
|
+
export async function getLatestNpmVersion(packageName, fallback) {
|
|
8
|
+
try {
|
|
9
|
+
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
|
|
10
|
+
const data = (await response.json());
|
|
11
|
+
return data.version;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return fallback;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Fetches the latest version of pnpm from the npm registry
|
|
19
|
+
* @returns The latest pnpm version string (e.g., "10.24.0")
|
|
20
|
+
*/
|
|
21
|
+
export async function getLatestPnpmVersion() {
|
|
22
|
+
return getLatestNpmVersion("pnpm", "10.11.0");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Fetches the latest LTS version of Node.js
|
|
26
|
+
* @returns The latest Node.js LTS version string (e.g., "22.13.0")
|
|
27
|
+
*/
|
|
28
|
+
export async function getLatestNodeVersion() {
|
|
29
|
+
try {
|
|
30
|
+
const response = await fetch("https://nodejs.org/dist/index.json");
|
|
31
|
+
const data = (await response.json());
|
|
32
|
+
// Find the first LTS version
|
|
33
|
+
const ltsVersion = data.find((v) => v.lts);
|
|
34
|
+
if (ltsVersion) {
|
|
35
|
+
// Remove the 'v' prefix from version string
|
|
36
|
+
return ltsVersion.version.replace(/^v/, "");
|
|
37
|
+
}
|
|
38
|
+
return "22.0.0";
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Fallback to a known recent LTS version if fetch fails
|
|
42
|
+
return "22.0.0";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Generates a random name in the format "adjective-noun"
|
|
47
|
+
* @returns A randomly generated name string
|
|
48
|
+
*/
|
|
49
|
+
export function generateRandomName() {
|
|
50
|
+
const adjectives = [
|
|
51
|
+
"red",
|
|
52
|
+
"blue",
|
|
53
|
+
"green",
|
|
54
|
+
"yellow",
|
|
55
|
+
"purple",
|
|
56
|
+
"orange",
|
|
57
|
+
"pink",
|
|
58
|
+
"black",
|
|
59
|
+
"white",
|
|
60
|
+
"tiny",
|
|
61
|
+
"big",
|
|
62
|
+
"small",
|
|
63
|
+
"large",
|
|
64
|
+
"huge",
|
|
65
|
+
"giant",
|
|
66
|
+
"mini",
|
|
67
|
+
"mega",
|
|
68
|
+
"super",
|
|
69
|
+
"happy",
|
|
70
|
+
"sad",
|
|
71
|
+
"angry",
|
|
72
|
+
"calm",
|
|
73
|
+
"quiet",
|
|
74
|
+
"loud",
|
|
75
|
+
"silent",
|
|
76
|
+
"noisy",
|
|
77
|
+
"shiny",
|
|
78
|
+
"dull",
|
|
79
|
+
"bright",
|
|
80
|
+
"dark",
|
|
81
|
+
"fuzzy",
|
|
82
|
+
"smooth",
|
|
83
|
+
"rough",
|
|
84
|
+
"soft",
|
|
85
|
+
];
|
|
86
|
+
const nouns = [
|
|
87
|
+
"apple",
|
|
88
|
+
"banana",
|
|
89
|
+
"cherry",
|
|
90
|
+
"date",
|
|
91
|
+
"elderberry",
|
|
92
|
+
"fig",
|
|
93
|
+
"grape",
|
|
94
|
+
"honeydew",
|
|
95
|
+
"cat",
|
|
96
|
+
"dog",
|
|
97
|
+
"elephant",
|
|
98
|
+
"fox",
|
|
99
|
+
"giraffe",
|
|
100
|
+
"horse",
|
|
101
|
+
"iguana",
|
|
102
|
+
"jaguar",
|
|
103
|
+
"mountain",
|
|
104
|
+
"river",
|
|
105
|
+
"ocean",
|
|
106
|
+
"desert",
|
|
107
|
+
"forest",
|
|
108
|
+
"jungle",
|
|
109
|
+
"meadow",
|
|
110
|
+
"valley",
|
|
111
|
+
"star",
|
|
112
|
+
"moon",
|
|
113
|
+
"sun",
|
|
114
|
+
"planet",
|
|
115
|
+
"comet",
|
|
116
|
+
"asteroid",
|
|
117
|
+
"galaxy",
|
|
118
|
+
"universe",
|
|
119
|
+
];
|
|
120
|
+
const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];
|
|
121
|
+
const randomNoun = nouns[Math.floor(Math.random() * nouns.length)];
|
|
122
|
+
return `${randomAdjective}-${randomNoun}`;
|
|
123
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-krispya",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "🌹 CLI for creating web projects with (my) sensible defaults",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"r3f",
|
|
8
|
+
"react",
|
|
9
|
+
"react-three-fiber",
|
|
10
|
+
"scaffold",
|
|
11
|
+
"vite"
|
|
12
|
+
],
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "Kris Baumgartner",
|
|
15
|
+
"bin": "dist/cli.js",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@clack/prompts": "^0.11.0",
|
|
24
|
+
"chalk": "^5.4.1",
|
|
25
|
+
"commander": "^13.1.0",
|
|
26
|
+
"ora": "^8.2.0",
|
|
27
|
+
"undici": "^5.28.4"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^20.17.32",
|
|
31
|
+
"tsx": "^4.20.5",
|
|
32
|
+
"typescript": "^5.8.3"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc --project ./tsconfig.build.json",
|
|
36
|
+
"dev": "tsx src/cli.ts"
|
|
37
|
+
}
|
|
38
|
+
}
|