create-korlix 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +506 -16
  2. package/bin/create-korlix.js +35 -38
  3. package/package.json +54 -18
package/README.md CHANGED
@@ -1,33 +1,523 @@
1
- # create-korlix
1
+ <div align="center">
2
2
 
3
- Create a new Korlix app.
3
+ <img src="https://raw.githubusercontent.com/korlix-lang/korlix/main/assets/korlix-logo.svg" alt="Korlix Logo" width="80" height="80" />
4
4
 
5
- Usage:
5
+ # korlix
6
6
 
7
+ **Create a new Korlix app in seconds.**
8
+
9
+ [![npm version](https://img.shields.io/npm/v/create-korlix?color=%236366f1\&label=npm\&style=flat-square)](https://www.npmjs.com/package/create-korlix)
10
+ [![npm downloads](https://img.shields.io/npm/dm/create-korlix?color=%2310b981\&style=flat-square)](https://www.npmjs.com/package/create-korlix)
11
+ [![license](https://img.shields.io/npm/l/create-korlix?color=%23f59e0b\&style=flat-square)](https://github.com/korlix-lang/korlix/blob/main/LICENSE)
12
+ [![GitHub stars](https://img.shields.io/github/stars/korlix-lang/korlix?color=%236366f1\&style=flat-square)](https://github.com/korlix-lang/korlix)
13
+
14
+ **Korlix = Kor + Lix = The Core Matrix**
15
+
16
+ Build frontend apps with a clean `.klx` language — no React setup, no router setup, no Tailwind setup, no heavy framework boilerplate.
17
+
18
+ [Documentation](https://github.com/korlix-lang/korlix/tree/main/docs) · [Examples](https://github.com/korlix-lang/korlix/tree/main/examples) · [Report Bug](https://github.com/korlix-lang/korlix/issues) · [NPM Package](https://www.npmjs.com/package/create-korlix)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## What is Korlix?
25
+
26
+ **Korlix** is a frontend-first programming language that compiles `.klx` source files into optimized **HTML**, **CSS**, and **JavaScript**.
27
+
28
+ It is designed for developers who want a simpler frontend workflow without manually wiring together React, Vite, React Router, Tailwind, toast libraries, modal libraries, and state boilerplate.
29
+
30
+ ```text
31
+ Korlix = syntax + compiler + styling engine + component system + frontend runtime
32
+ ```
33
+
34
+ With Korlix, you write clean `.klx` files and the compiler generates the frontend output for you.
35
+
36
+ ---
37
+
38
+ ## Why create-korlix?
39
+
40
+ `create-korlix` is the official project scaffolder for Korlix.
41
+
42
+ It gives you a React/Vite-like project creation flow:
43
+
44
+ ```bash
45
+ npm create korlix@latest my-app
46
+ ```
47
+
48
+ or, without a folder name:
49
+
50
+ ```bash
51
+ npm create korlix@latest
52
+ ```
53
+
54
+ If no folder name is provided, Korlix asks:
55
+
56
+ ```text
57
+ Project name (my-korlix-app):
58
+ ```
59
+
60
+ After that, it automatically:
61
+
62
+ ```text
63
+ creates the project
64
+ sets SPA mode
65
+ installs dependencies
66
+ starts the dev server
67
+ ```
68
+
69
+ No extra setup is required.
70
+
71
+ ---
72
+
73
+ ## Quick Start
74
+
75
+ ### Create with a folder name
76
+
77
+ ```bash
78
+ npm create korlix@latest my-app
79
+ ```
80
+
81
+ The creator will scaffold the project, install dependencies, and start the dev server.
82
+
83
+ Open:
84
+
85
+ ```text
86
+ http://localhost:3000
87
+ ```
88
+
89
+ ---
90
+
91
+ ### Create without a folder name
92
+
93
+ ```bash
94
+ npm create korlix@latest
95
+ ```
96
+
97
+ Korlix will ask for the project name:
98
+
99
+ ```text
100
+ Project name (my-korlix-app):
101
+ ```
102
+
103
+ Then it creates the project, installs dependencies, and starts the dev server.
104
+
105
+ ---
106
+
107
+ ## Other package managers
108
+
109
+ ```bash
110
+ # npm
111
+ npm create korlix@latest my-app
112
+
113
+ # yarn
114
+ yarn create korlix my-app
115
+
116
+ # pnpm
117
+ pnpm create korlix my-app
118
+
119
+ # bun
120
+ bun create korlix my-app
121
+ ```
122
+
123
+ ---
124
+
125
+ ## What gets created?
126
+
127
+ Running:
128
+
129
+ ```bash
130
+ npm create korlix@latest my-app
131
+ ```
132
+
133
+ creates a ready-to-run Korlix project:
134
+
135
+ ```text
136
+ my-app/
137
+ ├── korlix.config.json
138
+ ├── package.json
139
+ ├── public/
140
+ │ └── index.html
141
+ ├── src/
142
+ │ ├── main.klx
143
+ │ ├── app.klx
144
+ │ ├── pages/
145
+ │ │ └── index.klx
146
+ │ └── theme/
147
+ │ └── tokens.klx
148
+ └── dist/
149
+ ```
150
+
151
+ The project is created in **SPA mode by default**.
152
+
153
+ ---
154
+
155
+ ## Generated npm scripts
156
+
157
+ Inside the generated project:
158
+
159
+ ```bash
160
+ npm run dev
161
+ npm run build
162
+ npm run preview
163
+ npm run check
164
+ ```
165
+
166
+ These map to the Korlix CLI:
167
+
168
+ ```bash
169
+ korlix dev
170
+ korlix build
171
+ korlix preview
172
+ korlix check
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Example Korlix syntax
178
+
179
+ ```klx
180
+ page home route "/":
181
+
182
+ state count: int = 0
183
+
184
+ section .min-h-screen .center .bg-dark:
185
+
186
+ h1 .text-6xl .font-black .text-primary count
187
+
188
+ div .flex .gap-4:
189
+
190
+ btn .primary "+" on:click:
191
+ count = count + 1
192
+ toast success "Updated"
193
+
194
+ btn .danger "Reset" on:click:
195
+ count = 0
196
+ ```
197
+
198
+ This defines a complete interactive page with:
199
+
200
+ ```text
201
+ routing
202
+ state
203
+ events
204
+ buttons
205
+ toast interaction
206
+ utility styling
207
+ ```
208
+
209
+ No JSX. No `useState`. No external router setup.
210
+
211
+ ---
212
+
213
+ ## Korlix language features
214
+
215
+ Korlix is built around a simple frontend syntax.
216
+
217
+ ### Pages and routing
218
+
219
+ ```klx
220
+ page about route "/about":
221
+
222
+ meta:
223
+ title "About"
224
+ description "About this app"
225
+
226
+ section .py-20 .px-8:
227
+ h1 .text-4xl .font-bold "About"
228
+ ```
229
+
230
+ ### State and events
231
+
232
+ ```klx
233
+ page counter route "/counter":
234
+
235
+ state count: int = 0
236
+
237
+ btn .primary "Increment" on:click:
238
+ count = count + 1
239
+
240
+ p "Count: " count
241
+ ```
242
+
243
+ ### Components
244
+
245
+ ```klx
246
+ component feature-card:
247
+
248
+ prop title: string
249
+ prop description: string
250
+
251
+ card .p-6 .rounded-xl .bg-surface:
252
+ h3 .text-xl .font-bold title
253
+ p .text-muted description
254
+ ```
255
+
256
+ ### Layout-ready structure
257
+
258
+ ```klx
259
+ layout main:
260
+
261
+ navbar:
262
+ link href="/" "Home"
263
+ link href="/about" "About"
264
+
265
+ slot
266
+
267
+ footer:
268
+ p "Built with Korlix"
269
+ ```
270
+
271
+ ---
272
+
273
+ ## Built-in frontend workflow
274
+
275
+ Korlix is designed to reduce repeated frontend setup.
276
+
277
+ | Need | Traditional setup | Korlix approach |
278
+ | ------------ | --------------------- | -------------------------- |
279
+ | App creation | Vite/React setup | `npm create korlix@latest` |
280
+ | Routing | Router package | Korlix pages/routes |
281
+ | Styling | Tailwind setup/config | Built-in utility classes |
282
+ | State | Hooks/boilerplate | `state count: int = 0` |
283
+ | Toasts | Toast library | `toast success "Saved"` |
284
+ | Modals | Modal library | Built-in modal syntax |
285
+ | Build | Bundler config | `korlix build` |
286
+ | Dev server | Tooling setup | `korlix dev` |
287
+
288
+ ---
289
+
290
+ ## Styling system
291
+
292
+ Korlix includes a utility-first styling system.
293
+
294
+ Example:
295
+
296
+ ```klx
297
+ section .min-h-screen .bg-background .text-foreground .flex .items-center .justify-center:
298
+
299
+ div .max-w-5xl .text-center:
300
+ h1 .text-6xl .font-black .text-primary "Hello Korlix"
301
+ p .text-xl .text-muted "Build faster with less setup."
302
+ ```
303
+
304
+ Common utility groups include:
305
+
306
+ ```text
307
+ layout
308
+ spacing
309
+ typography
310
+ colors
311
+ borders
312
+ radius
313
+ shadow
314
+ responsive variants
315
+ hover/focus states
316
+ dark mode utilities
317
+ ```
318
+
319
+ ---
320
+
321
+ ## Hot Drop development
322
+
323
+ The Korlix dev server supports fast local development.
324
+
325
+ ```bash
326
+ npm run dev
327
+ ```
328
+
329
+ or:
330
+
331
+ ```bash
332
+ korlix dev
333
+ ```
334
+
335
+ The dev server starts at:
336
+
337
+ ```text
338
+ http://localhost:3000
339
+ ```
340
+
341
+ During development, Korlix watches your `.klx` files and updates the browser.
342
+
343
+ ---
344
+
345
+ ## Platform support
346
+
347
+ The Korlix npm package currently includes binaries for:
348
+
349
+ ```text
350
+ Linux x64
351
+ Windows x64
352
+ ```
353
+
354
+ macOS support is planned.
355
+
356
+ ---
357
+
358
+ ## Requirements
359
+
360
+ For `create-korlix`:
361
+
362
+ ```text
363
+ Node.js 18+
364
+ npm, yarn, pnpm, or bun
365
+ ```
366
+
367
+ You do **not** need to install Rust separately when using the npm package.
368
+
369
+ The Rust compiler binary is included through the `korlix` npm package.
370
+
371
+ ---
372
+
373
+ ## CLI reference
374
+
375
+ After the project is created, you can use:
376
+
377
+ ```bash
378
+ korlix dev
379
+ korlix build
380
+ korlix preview
381
+ korlix check
382
+ ```
383
+
384
+ Or through npm scripts:
385
+
386
+ ```bash
387
+ npm run dev
388
+ npm run build
389
+ npm run preview
390
+ npm run check
391
+ ```
392
+
393
+ ---
394
+
395
+ ## Project creation flow
396
+
397
+ With name:
398
+
399
+ ```bash
7
400
  npm create korlix@latest my-app
401
+ ```
8
402
 
9
- Or without a folder name:
403
+ Without name:
10
404
 
405
+ ```bash
11
406
  npm create korlix@latest
407
+ ```
408
+
409
+ Korlix asks for the project name, creates the app, installs dependencies, and starts the dev server.
410
+
411
+ ---
412
+
413
+ ## Why Korlix?
414
+
415
+ Korlix is for developers who want:
416
+
417
+ ```text
418
+ a frontend-first language
419
+ less boilerplate
420
+ built-in routing
421
+ built-in styling
422
+ built-in UI interactions
423
+ simple state syntax
424
+ fast app creation
425
+ clean HTML/CSS/JS output
426
+ a lightweight alternative to heavy frontend setup
427
+ ```
12
428
 
13
- If no folder name is provided, Korlix asks for the project name.
429
+ It is not trying to be React with different syntax. It is a compiler-first frontend language.
14
430
 
15
- Korlix apps are created in SPA mode by default.
431
+ ---
16
432
 
17
- Publish:
433
+ ## Publishing notes for maintainers
18
434
 
19
- ```sh
435
+ Publish the main compiler package first:
436
+
437
+ ```bash
438
+ cd npm/korlix
439
+ npm publish
440
+ ```
441
+
442
+ Then publish the creator package:
443
+
444
+ ```bash
20
445
  cd npm/create-korlix
21
- npm login
22
- npm run publish:dry
23
- npm run publish:public
446
+ npm publish
24
447
  ```
25
448
 
26
- If your npm account has two-factor authentication enabled, pass the current
27
- 6-digit authenticator code:
449
+ Reason:
28
450
 
29
- ```sh
30
- npm run publish:public -- --otp=123456
451
+ ```text
452
+ create-korlix depends on korlix
31
453
  ```
32
454
 
33
- Publish `korlix` first, then publish `create-korlix`.
455
+ If a version is already published, bump the version before publishing again.
456
+
457
+ Example:
458
+
459
+ ```text
460
+ 0.1.0 → 0.1.1
461
+ ```
462
+
463
+ ---
464
+
465
+ ## Contributing
466
+
467
+ Contributions are welcome.
468
+
469
+ ```bash
470
+ git clone https://github.com/korlix-lang/korlix
471
+ cd korlix
472
+ cargo build --release
473
+ ```
474
+
475
+ Project areas:
476
+
477
+ ```text
478
+ compiler
479
+ lexer
480
+ parser
481
+ codegen
482
+ style engine
483
+ runtime
484
+ CLI
485
+ dev server
486
+ templates
487
+ documentation
488
+ ```
489
+
490
+ Open issues and pull requests on GitHub:
491
+
492
+ ```text
493
+ https://github.com/korlix-lang/korlix
494
+ ```
495
+
496
+ ---
497
+
498
+ ## Roadmap
499
+
500
+ Current direction:
501
+
502
+ ```text
503
+ Phase 1: Compiler core, SPA mode, starter app, dev server
504
+ Phase 2: More diagnostics, stronger validation, macOS binary support
505
+ Phase 3: VS Code extension, docs website, templates
506
+ Phase 4: Stable language spec
507
+ ```
508
+
509
+ ---
510
+
511
+ ## License
512
+
513
+ MIT
514
+
515
+ ---
516
+
517
+ <div align="center">
518
+
519
+ **Korlix = Kor + Lix = The Core Matrix**
520
+
521
+ *Build the frontend. Without the complexity.*
522
+
523
+ </div>
@@ -19,11 +19,11 @@ function askProjectName(defaultValue = "my-korlix-app") {
19
19
  });
20
20
  }
21
21
 
22
- function run(command, args, cwd = process.cwd()) {
23
- const result = spawnSync(command, args, {
22
+ function runNodeScript(scriptPath, args, cwd = process.cwd()) {
23
+ const result = spawnSync(process.execPath, [scriptPath, ...args], {
24
24
  cwd,
25
25
  stdio: "inherit",
26
- shell: process.platform === "win32"
26
+ shell: false
27
27
  });
28
28
 
29
29
  if (result.status !== 0) {
@@ -31,42 +31,32 @@ function run(command, args, cwd = process.cwd()) {
31
31
  }
32
32
  }
33
33
 
34
- function korlixCommand() {
35
- const localCli = path.resolve(__dirname, "../../korlix/bin/korlix.js");
36
- if (fs.existsSync(localCli)) {
37
- return {
38
- command: process.execPath,
39
- args: [localCli]
40
- };
41
- }
42
-
43
- try {
44
- return {
45
- command: process.execPath,
46
- args: [require.resolve("korlix/bin/korlix.js")]
47
- };
48
- } catch {
49
- return { command: "korlix", args: [] };
50
- }
51
- }
34
+ function runNpm(args, cwd = process.cwd()) {
35
+ const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
52
36
 
53
- function korlixPackageSpec() {
54
- if (process.env.KORLIX_PACKAGE) {
55
- return process.env.KORLIX_PACKAGE;
56
- }
37
+ const result = spawnSync(npmCommand, args, {
38
+ cwd,
39
+ stdio: "inherit",
40
+ shell: process.platform === "win32"
41
+ });
57
42
 
58
- const localPackage = path.resolve(__dirname, "../../korlix");
59
- if (fs.existsSync(path.join(localPackage, "package.json"))) {
60
- return `file:${localPackage}`;
43
+ if (result.status !== 0) {
44
+ process.exit(result.status ?? 1);
61
45
  }
62
-
63
- return "^0.1.0";
64
46
  }
65
47
 
66
48
  function writeJson(filePath, data) {
67
49
  fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
68
50
  }
69
51
 
52
+ function findKorlixCliScript() {
53
+ const packageJsonPath = require.resolve("korlix/package.json", {
54
+ paths: [path.resolve(__dirname, "..")]
55
+ });
56
+
57
+ return path.join(path.dirname(packageJsonPath), "bin", "korlix.js");
58
+ }
59
+
70
60
  async function main() {
71
61
  console.log("");
72
62
  console.log("Korlix - frontend-first language");
@@ -89,8 +79,9 @@ async function main() {
89
79
  console.log(`Creating Korlix app: ${projectName}`);
90
80
  console.log("");
91
81
 
92
- const korlix = korlixCommand();
93
- run(korlix.command, [...korlix.args, "new", projectName]);
82
+ const korlixCliScript = findKorlixCliScript();
83
+
84
+ runNodeScript(korlixCliScript, ["new", projectName]);
94
85
 
95
86
  const configPath = path.join(projectPath, "korlix.config.json");
96
87
 
@@ -114,7 +105,7 @@ async function main() {
114
105
 
115
106
  pkg.devDependencies = {
116
107
  ...(pkg.devDependencies || {}),
117
- korlix: korlixPackageSpec()
108
+ korlix: process.env.KORLIX_PACKAGE || "^0.1.1"
118
109
  };
119
110
 
120
111
  writeJson(packagePath, pkg);
@@ -123,13 +114,19 @@ async function main() {
123
114
  console.log("");
124
115
  console.log("Korlix app created");
125
116
  console.log("");
126
- console.log("Next steps:");
127
- console.log(` cd ${projectName}`);
128
- console.log(" npm install");
129
- console.log(" npm run dev");
117
+ console.log("Installing dependencies...");
118
+ console.log("");
119
+
120
+ runNpm(["install"], projectPath);
121
+
122
+ console.log("");
123
+ console.log("Starting dev server...");
124
+ console.log("");
125
+
126
+ runNpm(["run", "dev"], projectPath);
130
127
  }
131
128
 
132
129
  main().catch((err) => {
133
130
  console.error(err);
134
131
  process.exit(1);
135
- });
132
+ });
package/package.json CHANGED
@@ -1,37 +1,73 @@
1
1
  {
2
2
  "name": "create-korlix",
3
- "version": "0.1.0",
4
- "description": "Create a new Korlix app",
3
+ "version": "0.1.1",
4
+ "description": "Create a new Korlix app — a frontend-first language for building SPA apps with less setup",
5
5
  "license": "MIT",
6
- "type": "commonjs",
7
- "dependencies": {
8
- "korlix": "^0.1.0"
6
+ "author": "Sachin Ramasamy",
7
+ "homepage": "https://github.com/SachinRamasamy-cloud/korlix#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/SachinRamasamy-cloud/korlix.git",
11
+ "directory": "npm/create-korlix"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/SachinRamasamy-cloud/korlix/issues"
9
15
  },
16
+ "type": "commonjs",
10
17
  "bin": {
11
- "create-korlix": "bin/create-korlix.js"
18
+ "create-korlix": "./bin/create-korlix.js"
19
+ },
20
+ "files": [
21
+ "bin/create-korlix.js",
22
+ "README.md"
23
+ ],
24
+ "engines": {
25
+ "node": ">=18"
26
+ },
27
+ "dependencies": {
28
+ "korlix": "^0.1.1"
12
29
  },
13
30
  "scripts": {
14
31
  "verify": "node --check ./bin/create-korlix.js",
15
32
  "prepack": "npm run verify",
16
33
  "pack:dry": "npm pack --dry-run",
17
- "publish:dry": "npm publish --dry-run --access public",
18
- "publish:public": "npm publish --access public"
34
+ "publish:dry": "npm publish --dry-run",
35
+ "publish:public": "npm publish"
19
36
  },
20
37
  "publishConfig": {
21
38
  "access": "public"
22
39
  },
23
- "files": [
24
- "bin",
25
- "README.md"
26
- ],
27
- "engines": {
28
- "node": ">=18"
29
- },
30
40
  "keywords": [
31
41
  "korlix",
32
42
  "create-korlix",
43
+ "create-app",
44
+ "scaffold",
45
+ "starter",
46
+ "template",
33
47
  "frontend",
34
- "language",
35
- "spa"
48
+ "frontend-language",
49
+ "programming-language",
50
+ "klx",
51
+ "compiler",
52
+ "rust-compiler",
53
+ "spa",
54
+ "single-page-app",
55
+ "web-development",
56
+ "ui",
57
+ "ui-components",
58
+ "hot-reload",
59
+ "hot-drop",
60
+ "jit-css",
61
+ "utility-css",
62
+ "routing",
63
+ "state-management",
64
+ "no-framework",
65
+ "lightweight-frontend",
66
+ "react-alternative",
67
+ "tailwind-alternative",
68
+ "frontend-without-react",
69
+ "zero-config",
70
+ "zero-boilerplate",
71
+ "core-matrix"
36
72
  ]
37
- }
73
+ }