create-rari-app 0.3.7 → 0.3.8
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/dist/index.mjs +41 -10
- package/package.json +2 -3
package/dist/index.mjs
CHANGED
|
@@ -5,8 +5,39 @@ import { dirname, join } from "node:path";
|
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { cancel, confirm, intro, isCancel, outro, select, spinner, text } from "@clack/prompts";
|
|
8
|
-
import pc from "picocolors";
|
|
9
8
|
|
|
9
|
+
//#region src/utils/colors.ts
|
|
10
|
+
const isColorSupported = !(process.env.NO_COLOR || process.argv.includes("--no-color")) && (process.env.FORCE_COLOR || process.argv.includes("--color") || process.platform === "win32" || process.stdout?.isTTY && process.env.TERM !== "dumb" || process.env.CI);
|
|
11
|
+
function formatter(open, close, replace = open) {
|
|
12
|
+
return (input) => {
|
|
13
|
+
const string = String(input);
|
|
14
|
+
const index = string.indexOf(close, open.length);
|
|
15
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function replaceClose(string, close, replace, index) {
|
|
19
|
+
let result = "";
|
|
20
|
+
let cursor = 0;
|
|
21
|
+
do {
|
|
22
|
+
result += string.substring(cursor, index) + replace;
|
|
23
|
+
cursor = index + close.length;
|
|
24
|
+
index = string.indexOf(close, cursor);
|
|
25
|
+
} while (~index);
|
|
26
|
+
return result + string.substring(cursor);
|
|
27
|
+
}
|
|
28
|
+
const f = isColorSupported ? formatter : () => String;
|
|
29
|
+
const colors = {
|
|
30
|
+
isColorSupported,
|
|
31
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
32
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
33
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
34
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
35
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
36
|
+
bgCyan: f("\x1B[46m", "\x1B[49m")
|
|
37
|
+
};
|
|
38
|
+
var colors_default = colors;
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
10
41
|
//#region src/index.ts
|
|
11
42
|
const templates = { default: {
|
|
12
43
|
name: "Default",
|
|
@@ -19,15 +50,15 @@ const packageManagers = {
|
|
|
19
50
|
bun: "bun"
|
|
20
51
|
};
|
|
21
52
|
async function main() {
|
|
22
|
-
intro(
|
|
53
|
+
intro(colors_default.bgCyan(colors_default.black(" create-rari-app ")));
|
|
23
54
|
let projectName = process.argv.slice(2)[0];
|
|
24
55
|
if (projectName) {
|
|
25
56
|
if (projectName.includes(" ")) {
|
|
26
|
-
console.error(
|
|
57
|
+
console.error(colors_default.red("Error: Project name cannot contain spaces."));
|
|
27
58
|
process.exit(1);
|
|
28
59
|
}
|
|
29
60
|
if (!/^[@\w/-]+$/.test(projectName)) {
|
|
30
|
-
console.error(
|
|
61
|
+
console.error(colors_default.red("Error: Project name can only contain letters, numbers, hyphens, underscores, slashes, and @ symbol."));
|
|
31
62
|
process.exit(1);
|
|
32
63
|
}
|
|
33
64
|
} else {
|
|
@@ -84,12 +115,12 @@ async function main() {
|
|
|
84
115
|
installDeps
|
|
85
116
|
};
|
|
86
117
|
await createProject(options);
|
|
87
|
-
outro(
|
|
118
|
+
outro(colors_default.green("🎉 Project created successfully!"));
|
|
88
119
|
console.warn();
|
|
89
|
-
console.warn(
|
|
90
|
-
console.warn(
|
|
91
|
-
if (!options.installDeps) console.warn(
|
|
92
|
-
console.warn(
|
|
120
|
+
console.warn(colors_default.cyan("Next steps:"));
|
|
121
|
+
console.warn(colors_default.gray(` cd ${options.name}`));
|
|
122
|
+
if (!options.installDeps) console.warn(colors_default.gray(` ${options.packageManager} install`));
|
|
123
|
+
console.warn(colors_default.gray(` ${options.packageManager} run dev`));
|
|
93
124
|
console.warn();
|
|
94
125
|
}
|
|
95
126
|
async function createProject(options) {
|
|
@@ -156,7 +187,7 @@ async function installDependencies(projectPath, packageManager) {
|
|
|
156
187
|
});
|
|
157
188
|
}
|
|
158
189
|
main().catch((error) => {
|
|
159
|
-
console.error(
|
|
190
|
+
console.error(colors_default.red("Error:"), error.message);
|
|
160
191
|
process.exit(1);
|
|
161
192
|
});
|
|
162
193
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rari-app",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.8",
|
|
5
5
|
"description": "Create Runtime Accelerated Rendering Infrastructure (rari) applications with no build configuration",
|
|
6
6
|
"author": "Ryan Skinner",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,8 +46,7 @@
|
|
|
46
46
|
"lint:fix": "oxlint --fix"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@clack/prompts": "^0.11.0"
|
|
50
|
-
"picocolors": "^1.1.1"
|
|
49
|
+
"@clack/prompts": "^0.11.0"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
52
|
"@types/node": "^25.0.10",
|