@junnyontop-pixel/neo-app 1.0.1 → 1.1.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/package.json +3 -2
- package/scripts/init.js +54 -0
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junnyontop-pixel/neo-app",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "나만의 커스텀 프레임워크 Neo",
|
|
5
5
|
"main": "core/NeoCore.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"neoc": "./compiler/index.js"
|
|
8
|
+
"neoc": "./compiler/index.js",
|
|
9
|
+
"neoc-init": "./scripts/init.js"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
12
|
"prepare": "node compiler/index.js src/App.neo",
|
package/scripts/init.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
// 1. 템플릿 정의
|
|
6
|
+
const htmlContent = `<!DOCTYPE html>
|
|
7
|
+
<html>
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8">
|
|
10
|
+
<title>My Neo App</title>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="app"></div>
|
|
14
|
+
<script type="module">
|
|
15
|
+
import { NeoCore } from '@junnyontop-pixel/neo-app/core/NeoCore.js';
|
|
16
|
+
import render from './src/App.js';
|
|
17
|
+
|
|
18
|
+
const state = { title: "Hello Neo!", count: 0 };
|
|
19
|
+
new NeoCore(state, render, 'app').mount();
|
|
20
|
+
</script>
|
|
21
|
+
</body>
|
|
22
|
+
</html>`;
|
|
23
|
+
|
|
24
|
+
const neoContent = `@Script {
|
|
25
|
+
// Logic here
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Main:div {
|
|
29
|
+
Innerhtml: "🚀 $title"
|
|
30
|
+
Style(padding: 20px; text-align: center; font-family: sans-serif)
|
|
31
|
+
|
|
32
|
+
@Counter:button {
|
|
33
|
+
Innerhtml: "클릭 수: $count"
|
|
34
|
+
Style(background: #4CAF50; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer)
|
|
35
|
+
Event(click: $count++)
|
|
36
|
+
}
|
|
37
|
+
}`;
|
|
38
|
+
|
|
39
|
+
// 2. 파일 생성 로직
|
|
40
|
+
const targetDir = process.cwd(); // 명령어를 실행한 현재 폴더
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
if (!fs.existsSync(path.join(targetDir, 'src'))) {
|
|
44
|
+
fs.mkdirSync(path.join(targetDir, 'src'));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fs.writeFileSync(path.join(targetDir, 'index.html'), htmlContent);
|
|
48
|
+
fs.writeFileSync(path.join(targetDir, 'src/App.neo'), neoContent);
|
|
49
|
+
|
|
50
|
+
console.log("✅ [Neo] index.html 및 src/App.neo 생성이 완료되었습니다!");
|
|
51
|
+
console.log("👉 이제 'npx neoc src/App.neo'를 실행하여 첫 컴파일을 완료하세요.");
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.error("❌ 초기화 중 에러 발생:", err.message);
|
|
54
|
+
}
|