create-aeui-app 0.0.1

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/index.js ADDED
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const args = process.argv.slice(2);
8
+ const projectName = args[0];
9
+
10
+ function printUsage() {
11
+ console.error('Please specify the project name:');
12
+ console.error(' npx create-aeui-app <project-name>');
13
+ }
14
+
15
+ function isValidPackageName(name) {
16
+ if (typeof name !== 'string') return false;
17
+ if (!name || name.length > 214) return false;
18
+ if (name === 'node_modules' || name === 'favicon.ico') return false;
19
+ if (name.startsWith('.') || name.startsWith('_')) return false;
20
+ if (name.includes('/') || name.includes('\\')) return false;
21
+ return /^[a-z0-9][a-z0-9._-]*$/.test(name);
22
+ }
23
+
24
+ if (args.includes('--help') || args.includes('-h')) {
25
+ printUsage();
26
+ process.exit(0);
27
+ }
28
+
29
+ if (!projectName) {
30
+ printUsage();
31
+ process.exit(1);
32
+ }
33
+
34
+ if (args.length > 1) {
35
+ console.error('Only one project name can be provided.');
36
+ printUsage();
37
+ process.exit(1);
38
+ }
39
+
40
+ const templateDir = path.join(__dirname, 'template');
41
+ const targetDir = path.join(process.cwd(), projectName);
42
+
43
+ if (!isValidPackageName(projectName)) {
44
+ console.error(`Invalid project name: ${projectName}`);
45
+ console.error('Use a lowercase npm package name without spaces or path separators.');
46
+ process.exit(1);
47
+ }
48
+
49
+ if (fs.existsSync(targetDir)) {
50
+ console.error(`Directory ${projectName} already exists.`);
51
+ process.exit(1);
52
+ }
53
+
54
+ console.log(`Creating a new AEUI app in ${targetDir}...`);
55
+ fs.mkdirSync(targetDir, { recursive: true });
56
+
57
+ function copyDir(src, dest) {
58
+ const entries = fs.readdirSync(src, { withFileTypes: true });
59
+ fs.mkdirSync(dest, { recursive: true });
60
+
61
+ for (const entry of entries) {
62
+ const srcPath = path.join(src, entry.name);
63
+ const destName = entry.name === 'gitignore' ? '.gitignore' : entry.name;
64
+ const destPath = path.join(dest, destName);
65
+
66
+ if (entry.isDirectory()) {
67
+ copyDir(srcPath, destPath);
68
+ } else {
69
+ fs.copyFileSync(srcPath, destPath);
70
+ }
71
+ }
72
+ }
73
+
74
+ copyDir(templateDir, targetDir);
75
+
76
+ // Update package.json name
77
+ const pkgFile = path.join(targetDir, 'package.json');
78
+ const pkg = JSON.parse(fs.readFileSync(pkgFile, 'utf-8'));
79
+ pkg.name = projectName;
80
+ fs.writeFileSync(pkgFile, JSON.stringify(pkg, null, 2));
81
+
82
+ console.log(`\nDone! Now run:\n`);
83
+ console.log(` cd ${projectName}`);
84
+ console.log(` npm install`);
85
+ console.log(` npm run dev`);
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "create-aeui-app",
3
+ "version": "0.0.1",
4
+ "description": "Scaffolding tool for AEUI apps",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "create-aeui-app": "index.js"
8
+ },
9
+ "type": "module",
10
+ "files": [
11
+ "index.js",
12
+ "template"
13
+ ],
14
+ "keywords": [
15
+ "aeui",
16
+ "cli",
17
+ "scaffold"
18
+ ],
19
+ "author": "",
20
+ "license": "ISC"
21
+ }
@@ -0,0 +1,4 @@
1
+ node_modules/
2
+ dist/
3
+ .DS_Store
4
+ *.log
@@ -0,0 +1,11 @@
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>AEUI Vite Demo</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,8 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "paths": {
5
+ "@/*": ["src/*"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "aeui-app",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "engines": {
12
+ "node": "^20.19.0 || >=22.12.0"
13
+ },
14
+ "dependencies": {
15
+ "aeui": "npm:a-easy-ui@^0.0.1"
16
+ },
17
+ "devDependencies": {
18
+ "vite": "^8.0.0"
19
+ }
20
+ }
@@ -0,0 +1,9 @@
1
+ export default function AboutPage() {
2
+ return (
3
+ <main>
4
+ <h1>About</h1>
5
+ <p>일반 a 태그로 이동해도 AEUI가 내부 라우팅을 처리합니다.</p>
6
+ <a href="/">Home</a>
7
+ </main>
8
+ );
9
+ }
@@ -0,0 +1,12 @@
1
+ export default function HomePage() {
2
+ return (
3
+ <main>
4
+ <h1>AEUI App</h1>
5
+ <p>src/pages 디렉터리의 파일이 URL이 됩니다.</p>
6
+ <nav>
7
+ <a href="/about">About</a>
8
+ <a href="/products/sample">Sample Product</a>
9
+ </nav>
10
+ </main>
11
+ );
12
+ }
@@ -0,0 +1,9 @@
1
+ export default function ProductPage({ route }) {
2
+ return (
3
+ <main>
4
+ <h1>Product {route.params.id}</h1>
5
+ <p>동적 세그먼트는 route.params로 전달됩니다.</p>
6
+ <a href="/">Home</a>
7
+ </main>
8
+ );
9
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'vite';
2
+ import aeui from 'aeui/vite';
3
+
4
+ export default defineConfig({
5
+ plugins: [aeui()]
6
+ });