create-elit 3.6.5 → 3.6.7
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/README.md +32 -68
- package/dist/index.js +121 -8
- package/dist/templates/{elit.config.ts → auth-fullstack-example/elit.config.ts} +51 -0
- package/dist/templates/auth-fullstack-example/package.json +26 -0
- package/dist/templates/auth-fullstack-example/src/native-screen.ts +10 -0
- package/dist/templates/auth-fullstack-example/wapkignore +10 -0
- package/dist/templates/auth-fullstack-example/wapkpatch +1 -0
- package/dist/templates/basic-example/README.md +39 -0
- package/dist/templates/basic-example/elit.config.ts +114 -0
- package/dist/templates/basic-example/gitignore +7 -0
- package/dist/templates/basic-example/package.json +26 -0
- package/dist/templates/basic-example/public/favicon.svg +22 -0
- package/dist/templates/basic-example/public/index.html +14 -0
- package/dist/templates/basic-example/src/client.ts +15 -0
- package/dist/templates/basic-example/src/main.ts +89 -0
- package/dist/templates/basic-example/src/mobile.ts +35 -0
- package/dist/templates/basic-example/src/styles.ts +273 -0
- package/dist/templates/basic-example/tsconfig.json +24 -0
- package/dist/templates/basic-example/wapkignore +10 -0
- package/dist/templates/basic-example/wapkpatch +1 -0
- package/dist/templates/todo-fullstack-example/README.md +39 -0
- package/dist/templates/todo-fullstack-example/databases/todo.ts +41 -0
- package/dist/templates/todo-fullstack-example/elit.config.ts +123 -0
- package/dist/templates/todo-fullstack-example/gitignore +7 -0
- package/dist/templates/todo-fullstack-example/package.json +26 -0
- package/dist/templates/todo-fullstack-example/public/favicon.svg +22 -0
- package/dist/templates/todo-fullstack-example/public/index.html +14 -0
- package/dist/templates/todo-fullstack-example/src/client.ts +15 -0
- package/dist/templates/todo-fullstack-example/src/components/AppFooter.ts +16 -0
- package/dist/templates/todo-fullstack-example/src/components/AppHeader.ts +23 -0
- package/dist/templates/todo-fullstack-example/src/main.ts +7 -0
- package/dist/templates/todo-fullstack-example/src/mobile.ts +36 -0
- package/dist/templates/todo-fullstack-example/src/pages/TodoPage.ts +491 -0
- package/dist/templates/todo-fullstack-example/src/router.ts +16 -0
- package/dist/templates/todo-fullstack-example/src/server.ts +226 -0
- package/dist/templates/todo-fullstack-example/src/styles.ts +768 -0
- package/dist/templates/todo-fullstack-example/src/todo-types.ts +19 -0
- package/dist/templates/todo-fullstack-example/src/web.ts +16 -0
- package/dist/templates/todo-fullstack-example/tsconfig.json +24 -0
- package/dist/templates/todo-fullstack-example/wapkignore +10 -0
- package/dist/templates/todo-fullstack-example/wapkpatch +1 -0
- package/package.json +1 -1
- package/dist/templates/package.json +0 -17
- package/dist/templates/src/client.test.ts +0 -292
- package/dist/templates/src/components/Footer.test.ts +0 -226
- package/dist/templates/src/components/Header.test.ts +0 -493
- package/dist/templates/src/pages/ChatListPage.test.ts +0 -603
- package/dist/templates/src/pages/ChatPage.test.ts +0 -530
- package/dist/templates/src/pages/ForgotPasswordPage.test.ts +0 -484
- package/dist/templates/src/pages/HomePage.test.ts +0 -601
- package/dist/templates/src/pages/LoginPage.test.ts +0 -619
- package/dist/templates/src/pages/PrivateChatPage.test.ts +0 -556
- package/dist/templates/src/pages/ProfilePage.test.ts +0 -628
- package/dist/templates/src/pages/RegisterPage.test.ts +0 -661
- /package/dist/templates/{README.md → auth-fullstack-example/README.md} +0 -0
- /package/dist/templates/{databases → auth-fullstack-example/databases}/users.ts +0 -0
- /package/dist/templates/{gitignore → auth-fullstack-example/gitignore} +0 -0
- /package/dist/templates/{public → auth-fullstack-example/public}/favicon.svg +0 -0
- /package/dist/templates/{public → auth-fullstack-example/public}/index.html +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/client.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/components/Footer.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/components/Header.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/components/index.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/main.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/pages/ChatListPage.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/pages/ChatPage.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/pages/ForgotPasswordPage.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/pages/HomePage.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/pages/LoginPage.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/pages/PrivateChatPage.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/pages/ProfilePage.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/pages/RegisterPage.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/router.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/server.ts +0 -0
- /package/dist/templates/{src → auth-fullstack-example/src}/styles.ts +0 -0
- /package/dist/templates/{tsconfig.json → auth-fullstack-example/tsconfig.json} +0 -0
package/README.md
CHANGED
|
@@ -4,105 +4,69 @@ Scaffolding tool for creating new Elit projects.
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Default starter:
|
|
8
|
+
|
|
8
9
|
```bash
|
|
9
10
|
npm create elit@latest my-app
|
|
10
11
|
```
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
yarn create elit my-app
|
|
15
|
-
```
|
|
13
|
+
Pick a template:
|
|
16
14
|
|
|
17
|
-
With pnpm:
|
|
18
15
|
```bash
|
|
19
|
-
|
|
16
|
+
npm create elit@latest my-app -- --template basic
|
|
20
17
|
```
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
List available templates:
|
|
20
|
+
|
|
23
21
|
```bash
|
|
24
|
-
|
|
22
|
+
npm create elit@latest -- --list-templates
|
|
25
23
|
```
|
|
26
24
|
|
|
27
|
-
With
|
|
25
|
+
With other package managers:
|
|
26
|
+
|
|
28
27
|
```bash
|
|
29
|
-
|
|
28
|
+
yarn create elit my-app --template todo
|
|
29
|
+
pnpm create elit my-app --template todo
|
|
30
|
+
bun create elit my-app --template todo
|
|
31
|
+
deno run -A npm:create-elit my-app --template todo
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
## Templates
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
- `basic` - lightweight single-page starter with a reactive counter and no API setup
|
|
37
|
+
- `todo` (default) - fullstack todo workspace with persistence in `databases/todo.ts` via `elit/database`
|
|
38
|
+
- `auth` - auth and chat starter with profile and messaging flows
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
npm create elit@latest my-app --template=basic
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Available templates:
|
|
40
|
+
You can also use the full folder names:
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
42
|
+
- `basic-example`
|
|
43
|
+
- `todo-fullstack-example`
|
|
44
|
+
- `auth-fullstack-example`
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
CLI flags:
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
🚀 **Fast Setup** - Creates project in seconds
|
|
52
|
-
🎯 **Multiple Templates** - Choose the right starting point
|
|
48
|
+
- `-t`, `--template <name>` - choose a template
|
|
49
|
+
- `-l`, `--list-templates` - show available templates
|
|
50
|
+
- `-h`, `--help` - show usage and template options
|
|
53
51
|
|
|
54
|
-
## What
|
|
52
|
+
## What Each Project Includes
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
- Type-safe CSS-in-JS with `CreateStyle`
|
|
62
|
-
- Server-side rendering with `dom.renderServer`
|
|
63
|
-
- Client-side hydration with `client.ts`
|
|
64
|
-
- Example code showing best practices
|
|
65
|
-
- Auto-generated README and .gitignore
|
|
54
|
+
- TypeScript setup
|
|
55
|
+
- `package.json` with Elit scripts
|
|
56
|
+
- `elit.config.ts` for dev, build, preview, mobile, desktop, and WAPK flows
|
|
57
|
+
- Auto-generated hidden files such as `.gitignore`, `.wapkignore`, and `.wapkpatch`
|
|
58
|
+
- A ready-to-run README tailored to the selected starter
|
|
66
59
|
|
|
67
60
|
## Example
|
|
68
61
|
|
|
69
62
|
```bash
|
|
70
|
-
|
|
71
|
-
npm create elit@latest my-elit-app
|
|
72
|
-
|
|
73
|
-
# Navigate to project
|
|
63
|
+
npm create elit@latest my-elit-app -- --template basic
|
|
74
64
|
cd my-elit-app
|
|
75
|
-
|
|
76
|
-
# Install dependencies
|
|
77
65
|
npm install
|
|
78
|
-
|
|
79
|
-
# Start dev server
|
|
80
66
|
npm run dev
|
|
81
67
|
```
|
|
82
68
|
|
|
83
|
-
Visit http://localhost:3003 to see your app
|
|
84
|
-
|
|
85
|
-
## Template Details
|
|
86
|
-
|
|
87
|
-
### Basic Template
|
|
88
|
-
- Counter example with increment/decrement
|
|
89
|
-
- Beautiful gradient UI with CSS-in-JS
|
|
90
|
-
- Reactive state management demo
|
|
91
|
-
- Type-safe styling with `CreateStyle`
|
|
92
|
-
- Server-side rendering with `dom.renderServer`
|
|
93
|
-
|
|
94
|
-
### Full Template
|
|
95
|
-
- Counter and API call examples
|
|
96
|
-
- Server-side routing with middleware
|
|
97
|
-
- CORS and logging setup
|
|
98
|
-
- Client-server communication
|
|
99
|
-
- Full-stack TypeScript setup
|
|
100
|
-
|
|
101
|
-
### Minimal Template
|
|
102
|
-
- Just the essentials
|
|
103
|
-
- Simple "Hello Elit!" example
|
|
104
|
-
- Perfect for learning or prototyping
|
|
105
|
-
- Pure TypeScript - zero HTML
|
|
69
|
+
Visit http://localhost:3003 to see your app.
|
|
106
70
|
|
|
107
71
|
## Learn More
|
|
108
72
|
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { mkdir, writeFile, readFile, readdir } from "fs/promises";
|
|
5
|
-
import { join, resolve, dirname } from "path";
|
|
5
|
+
import { join, resolve, dirname, basename } from "path";
|
|
6
6
|
import { existsSync } from "fs";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
8
|
var __filename = fileURLToPath(import.meta.url);
|
|
9
9
|
var __dirname = dirname(__filename);
|
|
10
|
+
var hiddenTemplateFiles = {
|
|
11
|
+
gitignore: ".gitignore",
|
|
12
|
+
wapkignore: ".wapkignore",
|
|
13
|
+
wapkpatch: ".wapkpatch"
|
|
14
|
+
};
|
|
15
|
+
var templates = [
|
|
16
|
+
{
|
|
17
|
+
id: "todo-fullstack-example",
|
|
18
|
+
aliases: ["todo", "todo-fullstack-example"],
|
|
19
|
+
description: "Database-backed todo workspace starter"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "basic-example",
|
|
23
|
+
aliases: ["basic", "basic-example"],
|
|
24
|
+
description: "Lightweight single-page starter",
|
|
25
|
+
isDefault: true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "auth-fullstack-example",
|
|
29
|
+
aliases: ["auth", "auth-fullstack-example"],
|
|
30
|
+
description: "Authentication and chat starter"
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
var defaultTemplate = templates.find((template) => template.isDefault)?.id ?? templates[0].id;
|
|
34
|
+
var templateAliases = Object.fromEntries(
|
|
35
|
+
templates.flatMap((template) => template.aliases.map((alias) => [alias, template.id]))
|
|
36
|
+
);
|
|
10
37
|
async function getElitVersion() {
|
|
11
38
|
const packageJsonPath = resolve(__dirname, "../package.json");
|
|
12
39
|
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf-8"));
|
|
@@ -23,9 +50,80 @@ var colors = {
|
|
|
23
50
|
function log(message, color = "reset") {
|
|
24
51
|
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
25
52
|
}
|
|
26
|
-
function
|
|
53
|
+
function logAvailableTemplates() {
|
|
54
|
+
log("Available templates:", "yellow");
|
|
55
|
+
for (const template of templates) {
|
|
56
|
+
const primaryAlias = template.aliases[0];
|
|
57
|
+
const defaultSuffix = template.id === defaultTemplate ? " (default)" : "";
|
|
58
|
+
const fullName = template.aliases[1] ? ` [${template.aliases[1]}]` : "";
|
|
59
|
+
log(` ${primaryAlias}${defaultSuffix} - ${template.description}${fullName}`, "dim");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function logHelp() {
|
|
63
|
+
log("Usage:", "yellow");
|
|
64
|
+
log(" create-elit [project-name] [options]", "dim");
|
|
65
|
+
log("", "reset");
|
|
66
|
+
log("Options:", "yellow");
|
|
67
|
+
log(" -t, --template <name> Choose a template", "dim");
|
|
68
|
+
log(" -l, --list-templates Show available templates", "dim");
|
|
69
|
+
log(" -h, --help Show this help message", "dim");
|
|
70
|
+
log("", "reset");
|
|
71
|
+
logAvailableTemplates();
|
|
72
|
+
}
|
|
73
|
+
function resolveTemplateName(templateName2) {
|
|
74
|
+
const normalized = templateAliases[templateName2];
|
|
75
|
+
if (!normalized) {
|
|
76
|
+
log(`Error: Unknown template "${templateName2}".`, "red");
|
|
77
|
+
logAvailableTemplates();
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
return normalized;
|
|
81
|
+
}
|
|
82
|
+
function getCliOptions() {
|
|
27
83
|
const args = process.argv.slice(2);
|
|
28
|
-
|
|
84
|
+
let projectName2 = "my-elit-app";
|
|
85
|
+
let templateName2 = defaultTemplate;
|
|
86
|
+
let listTemplates2 = false;
|
|
87
|
+
let showHelp2 = false;
|
|
88
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
89
|
+
const arg = args[index];
|
|
90
|
+
if (arg === "--list-templates" || arg === "--list" || arg === "-l") {
|
|
91
|
+
listTemplates2 = true;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (arg === "--help" || arg === "-h") {
|
|
95
|
+
showHelp2 = true;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (arg === "--template" || arg === "-t") {
|
|
99
|
+
const nextArg = args[index + 1];
|
|
100
|
+
if (!nextArg || nextArg.startsWith("-")) {
|
|
101
|
+
log("Error: Missing value for --template.", "red");
|
|
102
|
+
logAvailableTemplates();
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
templateName2 = resolveTemplateName(nextArg);
|
|
106
|
+
index += 1;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (arg.startsWith("--template=")) {
|
|
110
|
+
templateName2 = resolveTemplateName(arg.slice("--template=".length));
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (arg.startsWith("-t=")) {
|
|
114
|
+
templateName2 = resolveTemplateName(arg.slice("-t=".length));
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (!arg.startsWith("-") && projectName2 === "my-elit-app") {
|
|
118
|
+
projectName2 = arg;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
projectName: projectName2,
|
|
123
|
+
templateName: templateName2,
|
|
124
|
+
listTemplates: listTemplates2,
|
|
125
|
+
showHelp: showHelp2
|
|
126
|
+
};
|
|
29
127
|
}
|
|
30
128
|
async function copyDirectory(src, dest, replacements) {
|
|
31
129
|
await mkdir(dest, { recursive: true });
|
|
@@ -45,17 +143,24 @@ async function copyAndReplaceFile(src, dest, replacements) {
|
|
|
45
143
|
for (const [placeholder, value] of Object.entries(replacements)) {
|
|
46
144
|
content = content.split(placeholder).join(value);
|
|
47
145
|
}
|
|
48
|
-
const
|
|
146
|
+
const hiddenFileName = hiddenTemplateFiles[basename(dest)];
|
|
147
|
+
const finalDest = hiddenFileName ? join(dirname(dest), hiddenFileName) : dest;
|
|
49
148
|
await writeFile(finalDest, content, "utf-8");
|
|
50
149
|
}
|
|
51
|
-
async function createProject(projectName2) {
|
|
150
|
+
async function createProject(projectName2, templateName2) {
|
|
52
151
|
const projectPath = resolve(process.cwd(), projectName2);
|
|
53
|
-
const templatesPath = resolve(__dirname, "templates");
|
|
152
|
+
const templatesPath = resolve(__dirname, "templates", templateName2);
|
|
54
153
|
if (existsSync(projectPath)) {
|
|
55
154
|
log(`Error: Directory "${projectName2}" already exists!`, "red");
|
|
56
155
|
process.exit(1);
|
|
57
156
|
}
|
|
157
|
+
if (!existsSync(templatesPath)) {
|
|
158
|
+
log(`Error: Template "${templateName2}" is not available in this build.`, "red");
|
|
159
|
+
logAvailableTemplates();
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
58
162
|
log(`Creating a new Elit app in ${projectPath}...`, "cyan");
|
|
163
|
+
log(`Using template: ${templateName2}`, "dim");
|
|
59
164
|
const elitVersion = await getElitVersion();
|
|
60
165
|
const replacements = {
|
|
61
166
|
"ELIT_PROJECT_NAME": projectName2,
|
|
@@ -76,9 +181,17 @@ async function createProject(projectName2) {
|
|
|
76
181
|
log(" npm run dev\n", "cyan");
|
|
77
182
|
log("Happy coding! \u{1F680}", "green");
|
|
78
183
|
}
|
|
79
|
-
var projectName =
|
|
184
|
+
var { projectName, templateName, listTemplates, showHelp } = getCliOptions();
|
|
80
185
|
log("\n\u{1F680} Create Elit App\n", "cyan");
|
|
81
|
-
|
|
186
|
+
if (showHelp) {
|
|
187
|
+
logHelp();
|
|
188
|
+
process.exit(0);
|
|
189
|
+
}
|
|
190
|
+
if (listTemplates) {
|
|
191
|
+
logAvailableTemplates();
|
|
192
|
+
process.exit(0);
|
|
193
|
+
}
|
|
194
|
+
createProject(projectName, templateName).catch((err) => {
|
|
82
195
|
log(`Error: ${err.message}`, "red");
|
|
83
196
|
process.exit(1);
|
|
84
197
|
});
|
|
@@ -7,6 +7,8 @@ export default {
|
|
|
7
7
|
host: 'localhost',
|
|
8
8
|
open: true,
|
|
9
9
|
logging: true,
|
|
10
|
+
outDir: './dev-dist',
|
|
11
|
+
outFile: 'index.js',
|
|
10
12
|
clients: [{
|
|
11
13
|
root: '.',
|
|
12
14
|
basePath: '',
|
|
@@ -68,5 +70,54 @@ export default {
|
|
|
68
70
|
include: ['**/*.ts'], // รวมทุกไฟล์ TypeScript ในโปรเจกต์
|
|
69
71
|
exclude: ['**/*.test.ts', '**/*.spec.ts', '**/node_modules/**', '**/dist/**', '**/coverage/**']
|
|
70
72
|
}
|
|
73
|
+
},
|
|
74
|
+
mobile: {
|
|
75
|
+
cwd: ".",
|
|
76
|
+
appId: "com.elit.androidnativeexample",
|
|
77
|
+
appName: "ElitAndroidNativeExample",
|
|
78
|
+
webDir: "dist",
|
|
79
|
+
mode: "hybrid", // native, webview, or hybrid
|
|
80
|
+
permissions: [
|
|
81
|
+
"android.permission.INTERNET",
|
|
82
|
+
"android.permission.ACCESS_NETWORK_STATE"
|
|
83
|
+
],
|
|
84
|
+
native: {
|
|
85
|
+
entry: "./src/native-screen.ts",
|
|
86
|
+
exportName: "screen",
|
|
87
|
+
ios: {
|
|
88
|
+
enabled: false
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
desktop: {
|
|
93
|
+
compiler: 'auto',
|
|
94
|
+
entry: './src/main.ts',
|
|
95
|
+
mode: 'hybrid',
|
|
96
|
+
outDir: './desktop-dist',
|
|
97
|
+
runtime: 'quickjs',
|
|
98
|
+
},
|
|
99
|
+
wapk: {
|
|
100
|
+
name: 'elit-example',
|
|
101
|
+
version: '1.0.0',
|
|
102
|
+
runtime: 'node',
|
|
103
|
+
entry: './dist/index.js',
|
|
104
|
+
script: {
|
|
105
|
+
start: 'node ./dist/index.js',
|
|
106
|
+
},
|
|
107
|
+
env: {
|
|
108
|
+
APP_NAME: 'Elit Example',
|
|
109
|
+
},
|
|
110
|
+
run: {
|
|
111
|
+
runtime: 'node',
|
|
112
|
+
useWatcher: true,
|
|
113
|
+
watchArchive: true,
|
|
114
|
+
syncInterval: 150,
|
|
115
|
+
archiveSyncInterval: 150,
|
|
116
|
+
},
|
|
117
|
+
// desktop: {
|
|
118
|
+
// width: 1024,
|
|
119
|
+
// height: 768,
|
|
120
|
+
// title: "WAPK Example App"
|
|
121
|
+
// }
|
|
71
122
|
}
|
|
72
123
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ELIT_PROJECT_NAME",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "elit dev",
|
|
7
|
+
"build": "elit build",
|
|
8
|
+
"preview": "elit preview",
|
|
9
|
+
"mobile:init": "elit mobile init . --app-id com.elit.mobileexample --app-name ElitMobileExample --web-dir dist",
|
|
10
|
+
"mobile:sync": "elit mobile sync --cwd . --web-dir dist",
|
|
11
|
+
"mobile:doctor": "elit mobile doctor --cwd . --json",
|
|
12
|
+
"mobile:run:android": "elit mobile run android --cwd .",
|
|
13
|
+
"mobile:run:ios": "elit mobile run ios --cwd .",
|
|
14
|
+
"mobile:build:android": "elit mobile build android --cwd .",
|
|
15
|
+
"mobile:build:ios": "elit mobile build ios --cwd .",
|
|
16
|
+
"desktop:run": "elit desktop run",
|
|
17
|
+
"desktop:build": "elit desktop build",
|
|
18
|
+
"test": "elit test",
|
|
19
|
+
"test:watch": "elit test --watch",
|
|
20
|
+
"test:coverage": "elit test --coverage"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@types/node": "^25.0.9",
|
|
24
|
+
"elit": "^ELIT_VERSION"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a, button, div, h1, input, p } from 'elit/el';
|
|
2
|
+
|
|
3
|
+
export const screen = () => div(
|
|
4
|
+
{ style: { padding: '24px' } },
|
|
5
|
+
h1('Elit Native Mobile Example'),
|
|
6
|
+
p('This screen is generated from the same Elit syntax during elit mobile sync.'),
|
|
7
|
+
input({ type: 'checkbox', checked: true }),
|
|
8
|
+
a({ href: 'https://github.com/d-osc/elit' }, 'Open project page'),
|
|
9
|
+
button({ onClick: () => undefined }, 'Native placeholder button')
|
|
10
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dist
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# ELIT_PROJECT_NAME
|
|
2
|
+
|
|
3
|
+
A lightweight Elit starter with a polished single-page app, a reactive counter, and no API setup.
|
|
4
|
+
|
|
5
|
+
## What is included
|
|
6
|
+
|
|
7
|
+
- A small web app in `src/main.ts`
|
|
8
|
+
- CSS-in-JS styling in `src/styles.ts`
|
|
9
|
+
- Build, preview, mobile, desktop, and WAPK config in `elit.config.ts`
|
|
10
|
+
- Hidden scaffold files for `.gitignore`, `.wapkignore`, and `.wapkpatch`
|
|
11
|
+
|
|
12
|
+
## Getting started
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install
|
|
16
|
+
npm run dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Open http://localhost:3003 to view your app.
|
|
20
|
+
|
|
21
|
+
## Project structure
|
|
22
|
+
|
|
23
|
+
- `src/main.ts` - main web entry with a reactive counter and starter layout
|
|
24
|
+
- `src/styles.ts` - app styling using `elit/style`
|
|
25
|
+
- `src/mobile.ts` - simple native preview entry for mobile mode
|
|
26
|
+
- `public/index.html` - browser entry document
|
|
27
|
+
|
|
28
|
+
## Useful scripts
|
|
29
|
+
|
|
30
|
+
- `npm run dev` - start the dev server with HMR
|
|
31
|
+
- `npm run build` - build the app for production
|
|
32
|
+
- `npm run preview` - preview the production build locally
|
|
33
|
+
- `npm run mobile:sync` - sync the web build into the mobile shell
|
|
34
|
+
- `npm run desktop:run` - run the desktop shell
|
|
35
|
+
|
|
36
|
+
## Learn more
|
|
37
|
+
|
|
38
|
+
- [Elit Documentation](https://d-osc.github.io/elit)
|
|
39
|
+
- [GitHub Repository](https://github.com/d-osc/elit)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { client } from './src/client';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
dev: {
|
|
5
|
+
port: 3003,
|
|
6
|
+
host: 'localhost',
|
|
7
|
+
open: true,
|
|
8
|
+
logging: true,
|
|
9
|
+
outDir: './dev-dist',
|
|
10
|
+
outFile: 'index.js',
|
|
11
|
+
clients: [{
|
|
12
|
+
root: '.',
|
|
13
|
+
basePath: '',
|
|
14
|
+
ssr: () => client
|
|
15
|
+
}]
|
|
16
|
+
},
|
|
17
|
+
build: [{
|
|
18
|
+
entry: './src/main.ts',
|
|
19
|
+
outDir: './dist',
|
|
20
|
+
outFile: 'main.js',
|
|
21
|
+
format: 'esm',
|
|
22
|
+
minify: true,
|
|
23
|
+
sourcemap: true,
|
|
24
|
+
target: 'es2020',
|
|
25
|
+
copy: [
|
|
26
|
+
{
|
|
27
|
+
from: './public/index.html', to: './index.html',
|
|
28
|
+
transform: (content: string, config: { basePath: string }) => {
|
|
29
|
+
let html = content.replace('src="../src/main.ts"', 'src="main.js"');
|
|
30
|
+
|
|
31
|
+
if (config.basePath) {
|
|
32
|
+
const baseTag = `<base href="${config.basePath}/">`;
|
|
33
|
+
html = html.replace(
|
|
34
|
+
'<meta name="viewport" content="width=device-width, initial-scale=1.0">',
|
|
35
|
+
`<meta name="viewport" content="width=device-width, initial-scale=1.0">\n ${baseTag}`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return html;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{ from: './public/favicon.svg', to: './favicon.svg' }
|
|
43
|
+
]
|
|
44
|
+
}],
|
|
45
|
+
preview: {
|
|
46
|
+
port: 3000,
|
|
47
|
+
host: 'localhost',
|
|
48
|
+
open: false,
|
|
49
|
+
logging: true,
|
|
50
|
+
root: './dist',
|
|
51
|
+
basePath: '',
|
|
52
|
+
index: './index.html'
|
|
53
|
+
},
|
|
54
|
+
test: {
|
|
55
|
+
include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
56
|
+
exclude: ['node_modules', 'dist', 'benchmark', 'docs', 'coverage'],
|
|
57
|
+
testTimeout: 5000,
|
|
58
|
+
bail: false,
|
|
59
|
+
globals: true,
|
|
60
|
+
watch: false,
|
|
61
|
+
reporter: 'verbose',
|
|
62
|
+
coverage: {
|
|
63
|
+
enabled: false,
|
|
64
|
+
provider: 'v8',
|
|
65
|
+
reporter: ['text', 'html', 'lcov', 'json', 'coverage-final.json', 'clover'],
|
|
66
|
+
include: ['**/*.ts'],
|
|
67
|
+
exclude: ['**/*.test.ts', '**/*.spec.ts', '**/node_modules/**', '**/dist/**', '**/coverage/**']
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
mobile: {
|
|
71
|
+
cwd: '.',
|
|
72
|
+
appId: 'com.elit.basicexample',
|
|
73
|
+
appName: 'ElitBasicExample',
|
|
74
|
+
webDir: 'dist',
|
|
75
|
+
mode: 'hybrid',
|
|
76
|
+
permissions: [
|
|
77
|
+
'android.permission.INTERNET',
|
|
78
|
+
'android.permission.ACCESS_NETWORK_STATE'
|
|
79
|
+
],
|
|
80
|
+
native: {
|
|
81
|
+
entry: './src/mobile.ts',
|
|
82
|
+
exportName: 'screen',
|
|
83
|
+
ios: {
|
|
84
|
+
enabled: false
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
desktop: {
|
|
89
|
+
compiler: 'auto',
|
|
90
|
+
entry: './src/main.ts',
|
|
91
|
+
mode: 'hybrid',
|
|
92
|
+
outDir: './desktop-dist',
|
|
93
|
+
runtime: 'quickjs'
|
|
94
|
+
},
|
|
95
|
+
wapk: {
|
|
96
|
+
name: 'elit-basic-example',
|
|
97
|
+
version: '1.0.0',
|
|
98
|
+
runtime: 'node',
|
|
99
|
+
entry: './dist/main.js',
|
|
100
|
+
script: {
|
|
101
|
+
start: 'node ./dist/main.js'
|
|
102
|
+
},
|
|
103
|
+
env: {
|
|
104
|
+
APP_NAME: 'Elit Basic Example'
|
|
105
|
+
},
|
|
106
|
+
run: {
|
|
107
|
+
runtime: 'node',
|
|
108
|
+
useWatcher: true,
|
|
109
|
+
watchArchive: true,
|
|
110
|
+
syncInterval: 150,
|
|
111
|
+
archiveSyncInterval: 150
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ELIT_PROJECT_NAME",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "elit dev",
|
|
7
|
+
"build": "elit build",
|
|
8
|
+
"preview": "elit preview",
|
|
9
|
+
"mobile:init": "elit mobile init . --app-id com.elit.mobileexample --app-name ElitMobileExample --web-dir dist",
|
|
10
|
+
"mobile:sync": "elit mobile sync --cwd . --web-dir dist",
|
|
11
|
+
"mobile:doctor": "elit mobile doctor --cwd . --json",
|
|
12
|
+
"mobile:run:android": "elit mobile run android --cwd .",
|
|
13
|
+
"mobile:run:ios": "elit mobile run ios --cwd .",
|
|
14
|
+
"mobile:build:android": "elit mobile build android --cwd .",
|
|
15
|
+
"mobile:build:ios": "elit mobile build ios --cwd .",
|
|
16
|
+
"desktop:run": "elit desktop run",
|
|
17
|
+
"desktop:build": "elit desktop build",
|
|
18
|
+
"test": "elit test",
|
|
19
|
+
"test:watch": "elit test --watch",
|
|
20
|
+
"test:coverage": "elit test --coverage"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@types/node": "^25.0.9",
|
|
24
|
+
"elit": "^ELIT_VERSION"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" stop-color="#6366f1"/>
|
|
5
|
+
<stop offset="100%" stop-color="#8b5cf6"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
|
|
9
|
+
<!-- Clean background -->
|
|
10
|
+
<rect width="100" height="100" rx="20" fill="url(#grad)"/>
|
|
11
|
+
|
|
12
|
+
<!-- Simple E shape - 3 horizontal bars -->
|
|
13
|
+
<rect x="28" y="25" width="44" height="8" rx="4" fill="white"/>
|
|
14
|
+
<rect x="28" y="46" width="32" height="8" rx="4" fill="white"/>
|
|
15
|
+
<rect x="28" y="67" width="44" height="8" rx="4" fill="white"/>
|
|
16
|
+
|
|
17
|
+
<!-- Vertical connector -->
|
|
18
|
+
<rect x="28" y="25" width="8" height="50" rx="4" fill="white"/>
|
|
19
|
+
|
|
20
|
+
<!-- Single accent dot -->
|
|
21
|
+
<circle cx="72" cy="50" r="6" fill="white" opacity="0.5"/>
|
|
22
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
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>ELIT_PROJECT_NAME - Basic Example</title>
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="favicon.svg">
|
|
8
|
+
<meta name="description" content="A lightweight starter built with Elit.">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="app"></div>
|
|
12
|
+
<script type="module" src="../src/main.ts"></script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { body, div, head, html, link, meta, script, title } from 'elit/el';
|
|
2
|
+
|
|
3
|
+
export const client = html(
|
|
4
|
+
head(
|
|
5
|
+
title('ELIT_PROJECT_NAME - Basic Example'),
|
|
6
|
+
link({ rel: 'icon', type: 'image/svg+xml', href: 'public/favicon.svg' }),
|
|
7
|
+
meta({ charset: 'UTF-8' }),
|
|
8
|
+
meta({ name: 'viewport', content: 'width=device-width, initial-scale=1.0' }),
|
|
9
|
+
meta({ name: 'description', content: 'A lightweight starter built with Elit.' })
|
|
10
|
+
),
|
|
11
|
+
body(
|
|
12
|
+
div({ id: 'app' }),
|
|
13
|
+
script({ type: 'module', src: '/src/main.js' })
|
|
14
|
+
)
|
|
15
|
+
);
|