create-elemix-app 0.9.0-dev.23
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 +21 -0
- package/README.md +27 -0
- package/dist/index.js +89 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 brownhounds
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<img src="https://raw.githubusercontent.com/neuralfog/elemix/main/.readme/elemix-banner.svg" alt="elemix - Reactive Elements" width="100%" />
|
|
2
|
+
|
|
3
|
+
# create-elemix-app
|
|
4
|
+
|
|
5
|
+
Scaffold a new elemix app from the [official template](https://github.com/neuralfog/elemix-template).
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm create elemix-app
|
|
9
|
+
# or
|
|
10
|
+
pnpm create elemix-app
|
|
11
|
+
# or
|
|
12
|
+
npx create-elemix-app my-app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Pass a directory name to skip the prompt:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm create elemix-app my-app
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
cd my-app
|
|
25
|
+
pnpm install
|
|
26
|
+
pnpm dev
|
|
27
|
+
```
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { execFileSync } from "node:child_process";
|
|
5
|
+
import { existsSync, readdirSync, readFileSync, rmSync } from "node:fs";
|
|
6
|
+
import { dirname, join, resolve } from "node:path";
|
|
7
|
+
import { createInterface } from "node:readline";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
var TEMPLATE = "https://github.com/neuralfog/elemix-template.git";
|
|
10
|
+
var c = {
|
|
11
|
+
reset: "\x1B[0m",
|
|
12
|
+
bold: "\x1B[1m",
|
|
13
|
+
dim: "\x1B[2m",
|
|
14
|
+
red: "\x1B[31m",
|
|
15
|
+
green: "\x1B[32m",
|
|
16
|
+
magenta: "\x1B[35m"
|
|
17
|
+
};
|
|
18
|
+
var mark = `${c.magenta}\u2590\u258C${c.reset}`;
|
|
19
|
+
var version = () => {
|
|
20
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const pkg = JSON.parse(
|
|
22
|
+
readFileSync(join(here, "..", "package.json"), "utf8")
|
|
23
|
+
);
|
|
24
|
+
return pkg.version;
|
|
25
|
+
};
|
|
26
|
+
var banner = () => {
|
|
27
|
+
process.stderr.write("\n");
|
|
28
|
+
process.stderr.write(` ${mark} ${c.bold}elemix${c.reset} ${c.dim}\xB7${c.reset} create app
|
|
29
|
+
`);
|
|
30
|
+
process.stderr.write(` ${mark} ${c.dim}v${version()}${c.reset}
|
|
31
|
+
`);
|
|
32
|
+
process.stderr.write("\n");
|
|
33
|
+
};
|
|
34
|
+
var die = (message) => {
|
|
35
|
+
process.stderr.write(` ${c.red}error${c.reset} ${message}
|
|
36
|
+
|
|
37
|
+
`);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
};
|
|
40
|
+
var ask = (question, fallback) => {
|
|
41
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
42
|
+
return new Promise((res) => {
|
|
43
|
+
rl.question(` ${mark} ${question} ${c.dim}(${fallback})${c.reset} `, (answer) => {
|
|
44
|
+
rl.close();
|
|
45
|
+
res(answer.trim() || fallback);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var hasGit = () => {
|
|
50
|
+
try {
|
|
51
|
+
execFileSync("git", ["--version"], { stdio: "ignore" });
|
|
52
|
+
return true;
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var main = async () => {
|
|
58
|
+
banner();
|
|
59
|
+
if (!hasGit()) {
|
|
60
|
+
die("git is required but was not found on your PATH.");
|
|
61
|
+
}
|
|
62
|
+
const arg = process.argv[2];
|
|
63
|
+
const name = arg ?? await ask("Project directory", "elemix-app");
|
|
64
|
+
const dir = resolve(process.cwd(), name);
|
|
65
|
+
if (existsSync(dir) && readdirSync(dir).length > 0) {
|
|
66
|
+
die(`${name} already exists and is not empty.`);
|
|
67
|
+
}
|
|
68
|
+
process.stderr.write(` ${mark} cloning template into ${c.bold}${name}${c.reset}
|
|
69
|
+
`);
|
|
70
|
+
try {
|
|
71
|
+
execFileSync("git", ["clone", "--depth", "1", TEMPLATE, dir], {
|
|
72
|
+
stdio: "ignore"
|
|
73
|
+
});
|
|
74
|
+
} catch {
|
|
75
|
+
die(`failed to clone ${TEMPLATE}`);
|
|
76
|
+
}
|
|
77
|
+
rmSync(join(dir, ".git"), { recursive: true, force: true });
|
|
78
|
+
process.stderr.write(`
|
|
79
|
+
${c.green}\u2713${c.reset} ${c.bold}${name}${c.reset} is ready
|
|
80
|
+
|
|
81
|
+
`);
|
|
82
|
+
process.stderr.write(` ${c.dim}next steps${c.reset}
|
|
83
|
+
`);
|
|
84
|
+
process.stderr.write(` cd ${name}
|
|
85
|
+
`);
|
|
86
|
+
process.stderr.write(" pnpm install\n");
|
|
87
|
+
process.stderr.write(" pnpm dev\n\n");
|
|
88
|
+
};
|
|
89
|
+
main().catch((err) => die(err instanceof Error ? err.message : String(err)));
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-elemix-app",
|
|
3
|
+
"version": "0.9.0-dev.23",
|
|
4
|
+
"description": "Scaffold a new elemix app from the official template.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "brownhounds",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/neuralfog/elemix.git",
|
|
10
|
+
"directory": "packages/create-app"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"bin": {
|
|
14
|
+
"create-elemix-app": "dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"./dist/**/*",
|
|
18
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"elemix",
|
|
22
|
+
"create",
|
|
23
|
+
"scaffold",
|
|
24
|
+
"template",
|
|
25
|
+
"starter"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"clean": "rm -rf ./dist",
|
|
29
|
+
"build": "npm run clean && esbuild src/index.ts --bundle --platform=node --format=esm --target=node18 --outfile=dist/index.js --banner:js='#!/usr/bin/env node' && chmod +x dist/index.js",
|
|
30
|
+
"lint": "tsc --noEmit && biome format && biome lint --error-on-warnings",
|
|
31
|
+
"lint:fix": "biome format --write . && biome lint --write . --error-on-warnings && tsc --noEmit"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@biomejs/biome": "2.5.3",
|
|
35
|
+
"@neuralfog/biome-config": "0.1.2",
|
|
36
|
+
"@types/node": "26.1.1",
|
|
37
|
+
"esbuild": "0.28.1",
|
|
38
|
+
"typescript": "7.0.2"
|
|
39
|
+
}
|
|
40
|
+
}
|