Skip to content

Commit 20644c0

Browse files
committed
TypeScript/Bunへの置換え
1 parent 8aedc23 commit 20644c0

File tree

14 files changed

+239
-969
lines changed

14 files changed

+239
-969
lines changed

.github/workflows/publish_npm.yaml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,11 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v3
1616

17-
- name: Setup Node.js
18-
uses: actions/setup-node@v3
19-
with:
20-
node-version: '20'
17+
- name: Setup Bun
18+
uses: oven-sh/setup-bun@v2
2119

22-
- name: Setup Python
23-
uses: actions/setup-python@v5
24-
with:
25-
python-version: '3.11'
20+
- name: Install dependencies
21+
run: bun install
2622

27-
- name: Install Python dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install -r requirements.txt
31-
32-
- name: Install Node.js dependencies
33-
run: npm ci
34-
35-
- name: Run npm tests
36-
run: npm test
23+
- name: Run tests
24+
run: bun test

README.md

Lines changed: 41 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,32 @@
11
[![test](https://github.com/sktryo/XIV/actions/workflows/test.yml/badge.svg)](https://github.com/sktryo/XIV/actions/workflows/test.yml)
2-
[![Publish to NPM](https://github.com/sktryo/XIV/actions/workflows/publish_npm.yaml/badge.svg)](https://github.com/sktryo/XIV/actions/workflows/publish_npm.yaml)
2+
[![Publish to Bun](https://github.com/sktryo/XIV/actions/workflows/publish.yml/badge.svg)](https://github.com/sktryo/XIV/actions/workflows/publish.yml)
3+
34
# XIV
45

56
A simple, component-based template engine that evolves into a lightweight JavaScript framework.
67

7-
XIV allows you to write clean, reusable HTML components and bring them to life with minimal JavaScript, powered by a Python-based compiler.
8+
XIV allows you to write clean, reusable HTML components and bring them to life with minimal JavaScript, all powered by the Bun runtime.
89

910
## Features
1011

11-
- **Component-Based Architecture:** Use `<x-temp>` to build your UI from reusable parts.
12-
- **Props:** Pass data to components with `t-*` attributes.
12+
The compiler sets up a basic HTML structure, while the lightweight JavaScript runtime handles dynamic features directly in the browser.
13+
14+
- **Component-Based Architecture:** Build your UI from reusable parts.
15+
- **Props:** Pass data to components.
1316
- **Slots:** Inject complex HTML content into your components.
14-
- **Conditional Rendering:** Use `x-if` and `x-if="not ..."` to show or hide elements.
15-
- **List Rendering:** Loop over arrays violência `x-for="item in items"`.
17+
- **Conditional Rendering:** Use `x-if` to show or hide elements.
18+
- **List Rendering:** Loop over arrays with `x-for`.
1619
- **Reactive State:** Manage component state with `x-data`.
1720
- **Event Handling:** Listen to DOM events with `x-on:<event>`.
1821
- **Reactive Text:** Bind state properties to text content with `x-text`.
1922

2023
## Installation
2124

22-
XIV uses a Python-based compiler wrapped in a Node.js CLI. Installation is a two-step process.
23-
24-
### Step 1: Python Environment Setup
25-
26-
First, ensure you have Python 3 and `pip` installed. Then, set up the compiler's dependencies:
25+
First, ensure you have [Bun](https://bun.sh/) installed.
2726

2827
```shell
29-
# Clone the repository (or download the source)
30-
git clone https://github.com/sktryo/XIV.git
31-
cd XIV
32-
33-
# Create a virtual environment (recommended)
34-
python3 -m venv venv
35-
36-
# Install required Python packages
37-
venv/bin/pip install -r requirements.txt
38-
```
39-
40-
### Step 2: Install from npm
41-
42-
Once the Python environment is ready, you can install the `xiv-lang` command-line tool globally from npm:
43-
44-
```shell
45-
npm install -g .
46-
# (In a real scenario, this would be: npm install -g xiv-lang)
28+
# Install from the Bun package registry
29+
bun add xiv-lang
4730
```
4831

4932
## Usage
@@ -57,67 +40,51 @@ xiv <input_file> [options]
5740
**Example:**
5841

5942
```shell
60-
xiv docs/main.xiv -o dist/index.html -t docs/templates
43+
xiv docs/main.xiv -o dist/index.html
6144
```
6245

6346
**Options:**
6447

65-
- `-t, --templates_dir <path>`: Directory for template files (default: `./templates`)
6648
- `-o, --output_file <path>`: Path for the output HTML file (default: `./index.html`)
6749

68-
## Syntax Guide
69-
70-
### Components & Props
50+
## Development
7151

72-
```html
73-
<!-- main.xiv -->
74-
<x-temp x-name="greeting" t-message="Hello World" />
52+
To contribute or run the project locally:
7553

76-
<!-- templates/greeting.xiv -->
77-
<xiv type="template">
78-
<p>{{ message }}</p>
79-
</xiv>
80-
```
81-
82-
### Slots
83-
84-
```html
85-
<!-- main.xiv -->
86-
<x-temp x-name="card">
87-
<h4>Card Title</h4>
88-
</x-temp>
89-
90-
<!-- templates/card.xiv -->
91-
<xiv type="template">
92-
<div class="card">
93-
<slot />
94-
</div>
95-
</xiv>
96-
```
54+
```shell
55+
# Clone the repository
56+
git clone https://github.com/sktryo/XIV.git
57+
cd XIV
9758

98-
### Conditional & List Rendering
59+
# Install dependencies
60+
bun install
9961

100-
```html
101-
<div t-users='[{"name": "Alice", "active": true}, {"name": "Bob", "active": false}]'>
102-
<template x-for="user in users">
103-
<div x-if="user.active">
104-
<p>{{ user.name }} is active.</p>
105-
</div>
106-
</template>
107-
</div>
62+
# Run tests
63+
bun test
10864
```
10965

110-
### Interactive Components
66+
## How It Works
11167

112-
XIV injects a lightweight JavaScript runtime to handle client-side interactivity.
68+
The `xiv` compiler takes a main `.xiv` file, extracts the content from `<head>` and `<body>` tags inside a `<xiv type="main">` block, and embeds it into a standard HTML5 boilerplate. It also injects the `xiv.js` runtime, which powers all the client-side interactive features.
11369

70+
**Example `main.xiv`:**
11471
```html
115-
<div x-data='{ "count": 0 }'>
116-
<p>Count: <span x-text="count"></span></p>
117-
<button x-on:click="count++">Increment</button>
118-
</div>
72+
<xiv type="main">
73+
<head>
74+
<title>My Awesome App</title>
75+
</head>
76+
<body>
77+
<h1>Welcome to XIV!</h1>
78+
79+
<!-- Interactive component handled by the runtime -->
80+
<div x-data='{ "count": 0 }'>
81+
<p>Count: <span x-text="count"></span></p>
82+
<button x-on:click="count++">Increment</button>
83+
</div>
84+
</body>
85+
</xiv>
11986
```
12087

12188
## License
12289

123-
This project is licensed under the ISC License. See the [LICENSE](./LICENSE) file for details.
90+
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.

cli.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)