create-revojs 0.0.88 → 0.2.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/dist/index.js +31 -113
- package/package.json +19 -18
- package/template/AGENTS.md +11 -0
- package/{templates/ts → template}/index.html +5 -4
- package/template/package.json +17 -0
- package/template/tsconfig.json +12 -0
- package/{templates/ts → template}/vite.config.ts +1 -1
- package/templates/ts/main.tsx +0 -8
- package/templates/ts/package.json +0 -17
- package/templates/ts/tsconfig.json +0 -3
package/dist/index.js
CHANGED
|
@@ -1,118 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { basename, join, relative, resolve } from "node:path";
|
|
3
5
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
6
|
+
const root = fileURLToPath(new URL("../", import.meta.url));
|
|
7
|
+
const directory = resolve(process.argv[2] ?? "revojs-app");
|
|
8
|
+
const name = basename(directory).toLowerCase();
|
|
9
|
+
if (process.argv.length > 3 || !/^[a-z0-9][a-z0-9._-]*$/.test(name)) {
|
|
10
|
+
console.error("Usage: npm create revojs@latest [project-directory]");
|
|
11
|
+
process.exitCode = 1;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return "/";
|
|
13
|
+
else if (existsSync(directory) && readdirSync(directory).length > 0) {
|
|
14
|
+
console.error(`The destination is not empty: ${directory}`);
|
|
15
|
+
process.exitCode = 1;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let char = null;
|
|
37
|
-
for (let index = 0; index <= path.length; ++index) {
|
|
38
|
-
if (index < path.length) char = path[index];
|
|
39
|
-
else if (char === "/") break;
|
|
40
|
-
else char = "/";
|
|
41
|
-
if (char === "/") {
|
|
42
|
-
if (lastSlash === index - 1 || dots === 1);
|
|
43
|
-
else if (dots === 2) {
|
|
44
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
45
|
-
if (res.length > 2) {
|
|
46
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
47
|
-
if (lastSlashIndex === -1) {
|
|
48
|
-
res = "";
|
|
49
|
-
lastSegmentLength = 0;
|
|
50
|
-
} else {
|
|
51
|
-
res = res.slice(0, lastSlashIndex);
|
|
52
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
53
|
-
}
|
|
54
|
-
lastSlash = index;
|
|
55
|
-
dots = 0;
|
|
56
|
-
continue;
|
|
57
|
-
} else if (res.length > 0) {
|
|
58
|
-
res = "";
|
|
59
|
-
lastSegmentLength = 0;
|
|
60
|
-
lastSlash = index;
|
|
61
|
-
dots = 0;
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (allowAboveRoot) {
|
|
66
|
-
res += res.length > 0 ? "/.." : "..";
|
|
67
|
-
lastSegmentLength = 2;
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
71
|
-
else res = path.slice(lastSlash + 1, index);
|
|
72
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
73
|
-
}
|
|
74
|
-
lastSlash = index;
|
|
75
|
-
dots = 0;
|
|
76
|
-
} else if (char === "." && dots !== -1) ++dots;
|
|
77
|
-
else dots = -1;
|
|
78
|
-
}
|
|
79
|
-
return res;
|
|
17
|
+
else {
|
|
18
|
+
mkdirSync(directory, { recursive: true });
|
|
19
|
+
cpSync(join(root, "template"), directory, { recursive: true });
|
|
20
|
+
const manifest = JSON.parse(readFileSync(join(directory, "package.json"), "utf8"));
|
|
21
|
+
manifest.name = name;
|
|
22
|
+
writeFileSync(join(directory, "package.json"), `${JSON.stringify(manifest, null, 4)}\n`);
|
|
23
|
+
console.log(`Created ${name} with revojs.`);
|
|
24
|
+
console.log("Installing the revojs skill...");
|
|
25
|
+
const command = "npx skills add tellua/revojs --skill revojs";
|
|
26
|
+
const result = spawnSync(command, {
|
|
27
|
+
cwd: directory,
|
|
28
|
+
stdio: "inherit",
|
|
29
|
+
shell: true,
|
|
30
|
+
});
|
|
31
|
+
if (result.error || result.status !== 0) {
|
|
32
|
+
console.error(`Skill installation failed. Run \`${command}\` in the project.`);
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
}
|
|
35
|
+
console.log(`\n cd ${relative(process.cwd(), directory) || "."}\n npm install\n npm run dev`);
|
|
80
36
|
}
|
|
81
|
-
const isAbsolute = function(p) {
|
|
82
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region package.json
|
|
87
|
-
var name = "create-revojs";
|
|
88
|
-
var version = "0.0.88";
|
|
89
|
-
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region src/index.ts
|
|
92
|
-
const create = defineCommand({
|
|
93
|
-
args: {
|
|
94
|
-
template: {
|
|
95
|
-
type: "string",
|
|
96
|
-
default: "ts"
|
|
97
|
-
},
|
|
98
|
-
name: {
|
|
99
|
-
type: "positional",
|
|
100
|
-
default: "revojs-app"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
run: async ({ args }) => {
|
|
104
|
-
const source = resolve(fileURLToPath(import.meta.url).replace("index.js", ""), "..", "templates", args.template);
|
|
105
|
-
const destination = resolve(".", args.name);
|
|
106
|
-
await cp(source, destination, { recursive: true });
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
const main = defineCommand({
|
|
110
|
-
meta: {
|
|
111
|
-
name,
|
|
112
|
-
version
|
|
113
|
-
},
|
|
114
|
-
subCommands: { create }
|
|
115
|
-
});
|
|
116
|
-
runMain(main);
|
|
117
|
-
|
|
118
|
-
//#endregion
|
package/package.json
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-revojs",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"type": "module",
|
|
5
|
-
"repository": "coverbase/revojs",
|
|
3
|
+
"version": "0.2.0",
|
|
6
4
|
"license": "MIT",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "rolldown -c rolldown.config.ts && tsc",
|
|
13
|
-
"watch": "rolldown -w -c rolldown.config.ts && tsc --watch"
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/tellua/revojs.git",
|
|
8
|
+
"directory": "packages/create-revojs"
|
|
14
9
|
},
|
|
15
10
|
"bin": {
|
|
16
11
|
"create-revojs": "./dist/index.js"
|
|
17
12
|
},
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
13
|
+
"files": [
|
|
14
|
+
"template",
|
|
15
|
+
"dist/index.js"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.json",
|
|
20
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
21
|
+
"prepack": "npm run build"
|
|
24
22
|
},
|
|
25
23
|
"devDependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"
|
|
24
|
+
"@types/node": "^26.4.1",
|
|
25
|
+
"typescript": "^7.0.2"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
28
29
|
}
|
|
29
30
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# revojs app
|
|
2
|
+
|
|
3
|
+
This project is a revojs app. When asked to create an app or add a feature, build it here with revojs. Keep the existing `revojs` dependency and `vite.config.ts`; do not replace this starter with another framework.
|
|
4
|
+
|
|
5
|
+
Before coding, load the `revojs` skill and read the references for the modules the task needs. If the skill is missing, install it with `npx skills add tellua/revojs --skill revojs` and then load it.
|
|
6
|
+
|
|
7
|
+
Use npm packages, not framework source code: run `npm install` for this starter, check that each needed `@revojs/*` package is available with `npm view @revojs/<module> version`, and install it with `npm install @revojs/<module>`. Import only public package exports such as `@revojs/vue/module`, then register the module in `revojs({ modules: [...] })` in `vite.config.ts`. Install only modules the app needs; use revojs routing, server, storage, auth, and other infrastructure where provided.
|
|
8
|
+
|
|
9
|
+
Do not add Git submodules, `vendor/`, copied revojs source, Git dependencies, or local package links to obtain framework modules. If a required package is unavailable on npm, report the exact package and registry error and stop that integration; do not silently substitute another implementation.
|
|
10
|
+
|
|
11
|
+
Run `npm run build` and `npm run typecheck` after changes.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>
|
|
6
|
+
<title>revojs app</title>
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
|
-
<
|
|
10
|
-
|
|
9
|
+
<main>
|
|
10
|
+
<h1>Welcome to revojs</h1>
|
|
11
|
+
</main>
|
|
11
12
|
</body>
|
|
12
13
|
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "revojs-app",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"typecheck": "tsc --noEmit"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"revojs": "^0.2.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"typescript": "^7.0.2",
|
|
15
|
+
"vite": "^8.3.0"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/templates/ts/main.tsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "revojs-ts",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "vite",
|
|
7
|
-
"build": "vite build --app"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"revojs": "^0.0.59"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@revojs/tsconfig": "^0.0.59",
|
|
14
|
-
"@revojs/vite": "^0.0.59",
|
|
15
|
-
"vite": "^7.0.0"
|
|
16
|
-
}
|
|
17
|
-
}
|