create-lunet 0.0.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/bun/index.html +12 -0
- package/bun/package.json +16 -0
- package/dist/index.mjs +72 -0
- package/node/index.html +12 -0
- package/node/package.json +17 -0
- package/node/vite.config.js +13 -0
- package/package.json +18 -0
package/bun/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>lunet</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
package/bun/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lunet-template-app",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"alien-signals": "^3.1.1",
|
|
7
|
+
"lunet": "^0.0.8"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"lunet-transpiler": "^0.0.7"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "bun run --hot ./index.html",
|
|
14
|
+
"build": "bun run ./build.ts"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
import { readdir } from "fs/promises";
|
|
6
|
+
import { cp } from "fs/promises";
|
|
7
|
+
import { dirname, resolve } from "path";
|
|
8
|
+
import { createInterface } from "readline/promises";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
var path = resolve(process.cwd(), process.argv[2] ?? ".");
|
|
11
|
+
var _dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
var rl = createInterface({
|
|
13
|
+
input: process.stdin,
|
|
14
|
+
output: process.stdout,
|
|
15
|
+
prompt: ""
|
|
16
|
+
});
|
|
17
|
+
console.log(`Template destination: ${path}`);
|
|
18
|
+
if ((await readdir(path)).length) {
|
|
19
|
+
const do_continue = await rl.question(`Destination directory is not empty.
|
|
20
|
+
Do you continue? (y/N)
|
|
21
|
+
> `);
|
|
22
|
+
if (do_continue !== "Y" && do_continue !== "y") {
|
|
23
|
+
process.exit();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
var template = await rl.question(`Select template:
|
|
27
|
+
bun ) Install packages with Bun, Language is TSX, Build page with Bun
|
|
28
|
+
node) Install packages with npm, Language is JSX, Build page with Vite
|
|
29
|
+
> `);
|
|
30
|
+
rl.close();
|
|
31
|
+
switch (template) {
|
|
32
|
+
case "bun":
|
|
33
|
+
await cp(resolve(_dirname, "..", "bun"), path, {
|
|
34
|
+
recursive: true
|
|
35
|
+
});
|
|
36
|
+
execSync("bun install", {
|
|
37
|
+
cwd: path,
|
|
38
|
+
stdio: "inherit"
|
|
39
|
+
});
|
|
40
|
+
console.log(`
|
|
41
|
+
To start development server:
|
|
42
|
+
npm run dev
|
|
43
|
+
|
|
44
|
+
To build page:
|
|
45
|
+
npm run build
|
|
46
|
+
|
|
47
|
+
Happy bunning! \uD83D\uDC07`);
|
|
48
|
+
break;
|
|
49
|
+
case "node":
|
|
50
|
+
await cp(resolve(_dirname, "..", "node"), path, {
|
|
51
|
+
recursive: true
|
|
52
|
+
});
|
|
53
|
+
execSync("npm install", {
|
|
54
|
+
cwd: path,
|
|
55
|
+
stdio: "inherit"
|
|
56
|
+
});
|
|
57
|
+
console.log(`
|
|
58
|
+
To start development server:
|
|
59
|
+
npm run dev
|
|
60
|
+
|
|
61
|
+
To build page:
|
|
62
|
+
npm run build
|
|
63
|
+
|
|
64
|
+
Happy development life!`);
|
|
65
|
+
break;
|
|
66
|
+
case "deno":
|
|
67
|
+
console.log("Deno not implemented.");
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
console.log("Invalid template.");
|
|
71
|
+
break;
|
|
72
|
+
}
|
package/node/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>lunet</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lunet-template-app",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"alien-signals": "^3.1.1",
|
|
7
|
+
"lunet": "^0.0.8"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"lunet-transpiler": "^0.0.7",
|
|
11
|
+
"vite": "^7.2.4"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "vite",
|
|
15
|
+
"build": "vite build"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import { rollup_lunet } from 'lunet-transpiler';
|
|
3
|
+
|
|
4
|
+
// https://vite.dev/config/
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [rollup_lunet()],
|
|
7
|
+
esbuild: {
|
|
8
|
+
jsx: 'transform',
|
|
9
|
+
jsxFactory: 'h',
|
|
10
|
+
jsxFragment: 'fragment',
|
|
11
|
+
jsxInject: `import { h, fragment } from 'lunet'`,
|
|
12
|
+
},
|
|
13
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-lunet",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"author": "TNTSuperMan",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "瞬時にlunetプロジェクトを立ち上げます。",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/TNTSuperMan/lunet.git"
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"create-lunet": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "bun build.ts"
|
|
17
|
+
}
|
|
18
|
+
}
|