htmv 0.0.18 → 0.0.25

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.
@@ -0,0 +1,24 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Setup Bun
16
+ uses: oven-sh/setup-bun@v1
17
+ with:
18
+ bun-version: latest
19
+
20
+ - name: Install dependencies
21
+ run: bun install
22
+
23
+ - name: Run TypeScript build
24
+ run: npm run build
@@ -0,0 +1,39 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ id-token: write # Required for OIDC
10
+ contents: read
11
+
12
+ jobs:
13
+ publish:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: actions/setup-node@v4
20
+ with:
21
+ node-version: '20'
22
+ registry-url: 'https://registry.npmjs.org'
23
+
24
+ - name: Update npm
25
+ run: npm install -g npm@latest
26
+
27
+ - name: Setup Bun
28
+ uses: oven-sh/setup-bun@v1
29
+ with:
30
+ bun-version: latest
31
+
32
+ - name: Install dependencies
33
+ run: bun install
34
+
35
+ - name: Build (tsc)
36
+ run: npm run build
37
+
38
+ - name: Publish to npm
39
+ run: npm publish --provenance
package/README.md CHANGED
@@ -77,5 +77,24 @@ Supported methods currently are:
77
77
  - DELETE
78
78
  - ALL (add `default` keyword)
79
79
 
80
+ # Code generation
81
+ Do you often forget how to write boilerplate code? Why not just let HTMV do it for you?
82
+ As you know, HTMV comes with the CLI tool you used when creating the project. But it also has the command `htmv gen` which allows you to generate a basic template for a view or route.
83
+
84
+ The syntax is as follows:
85
+ ```bash
86
+ bunx htmv@latest gen {TYPE} {NAME} {OPTIONS}
87
+ ```
88
+ For example, to create a view called MyCoolView:
89
+ ```bash
90
+ bunx htmv@latest gen view MyCoolView
91
+ ```
92
+ Running this will generate a view in the `views` directory of your project. The other remaining type is `route` which works the same way but creates the route in your `routes` directory.
93
+
94
+ However, note that if you have changed the name of your folders HTMV will be unable to find them and you'll have to manually specify the folder you wish for the generated file to be placed in as follows:
95
+ ```bash
96
+ bunx htmv@latest gen view MyCoolView --path cool_stuff/my_custom_views_folder
97
+ ```
98
+
80
99
  # Hot reloading
81
100
  Having to restart the server every time you make a change can be quite tedious. HTMV takes care of this thanks to Bun. Just develop with `bun dev` and it should work out of the box! Note that this does not include hot reloading in the browser. As of now, you have to refresh the page to see new changes. It doesn't update in real time.
package/bun.lock CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "lockfileVersion": 1,
3
+ "configVersion": 0,
3
4
  "workspaces": {
4
5
  "": {
5
6
  "name": "htmv",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "htmv",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.18",
5
+ "version": "0.0.25",
6
6
  "devDependencies": {
7
7
  "@biomejs/biome": "2.3.3",
8
8
  "@types/bun": "latest"
@@ -17,5 +17,13 @@
17
17
  },
18
18
  "bin": {
19
19
  "htmv": "dist/cli/cli.js"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/Fabrisdev/htmv"
20
28
  }
21
29
  }