hikkaku 0.3.0 → 0.3.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.
- package/README.md +6 -6
- package/package.json +1 -1
- package/vite/index.mjs +18 -8
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ npm install hikkaku # npm
|
|
|
18
18
|
|
|
19
19
|
## Scaffold with create-hikkaku
|
|
20
20
|
|
|
21
|
-
Generate a new project from the official template (`
|
|
21
|
+
Generate a new project from the official template (`templates/base`):
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
24
|
npx create-hikkaku@latest my-hikkaku-app
|
|
@@ -141,11 +141,11 @@ https://github.com/user-attachments/assets/1ff5d190-f8ee-46c4-bc78-8dbdf2879e15
|
|
|
141
141
|
Hikkaku has a skills for AI Agents, so you can vibe code with AI such as Codex, Claude Code, OpenCode and etc.
|
|
142
142
|
|
|
143
143
|
```bash
|
|
144
|
-
bunx skills add pnsk-lab/hikkaku # Bun
|
|
145
|
-
deno run -NRWE --allow-run="git" --allow-sys="homedir" npm:skills add pnsk-lab/hikkaku # Deno
|
|
146
|
-
pnpx skills add pnsk-lab/hikkaku # pnpm
|
|
147
|
-
yarn dlx skills add pnsk-lab/hikkaku # Yarn
|
|
148
|
-
npx skills add pnsk-lab/hikkaku # npm
|
|
144
|
+
bunx skills add pnsk-lab/hikkaku/packages/skill # Bun
|
|
145
|
+
deno run -NRWE --allow-run="git" --allow-sys="homedir" npm:skills add pnsk-lab/hikkaku/packages/skill # Deno
|
|
146
|
+
pnpx skills add pnsk-lab/hikkaku/packages/skill # pnpm
|
|
147
|
+
yarn dlx skills add pnsk-lab/hikkaku/packages/skill # Yarn
|
|
148
|
+
npx skills add pnsk-lab/hikkaku/packages/skill # npm
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
### Build project
|
package/package.json
CHANGED
package/vite/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { zip } from "fflate";
|
|
2
1
|
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
2
|
import * as path from "node:path";
|
|
4
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
import { zip, zipSync } from "fflate/node";
|
|
5
5
|
import { createServerModuleRunner } from "vite";
|
|
6
6
|
import crypto from "node:crypto";
|
|
7
7
|
|
|
@@ -81,6 +81,7 @@ function hikkaku(init) {
|
|
|
81
81
|
await builder.build(env);
|
|
82
82
|
},
|
|
83
83
|
async generateBundle(_options, bundle) {
|
|
84
|
+
if (this.environment.name !== "hikkaku") return;
|
|
84
85
|
const tmpDir = path.join(process.cwd(), "dist", ".tmp");
|
|
85
86
|
for (const [filePath, file] of Object.entries(bundle)) if (file.type === "chunk") {
|
|
86
87
|
const fullPath = path.join(tmpDir, filePath);
|
|
@@ -90,13 +91,22 @@ function hikkaku(init) {
|
|
|
90
91
|
const { default: project } = await import(pathToFileURL(path.join(process.cwd(), "dist/.tmp", "project.mjs")).href);
|
|
91
92
|
const projectJSON = project.toScratch();
|
|
92
93
|
const assets = project.getAdditionalAssets();
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
const projectJSONData = new TextEncoder().encode(JSON.stringify(projectJSON));
|
|
95
|
+
const assetsToBundle = {
|
|
96
|
+
...Object.fromEntries(assets.entries()),
|
|
97
|
+
"project.json": projectJSONData
|
|
98
|
+
};
|
|
99
|
+
let has160KBAsset = false;
|
|
100
|
+
for (const data of Object.values(assetsToBundle)) if (data.length >= 16e4) {
|
|
101
|
+
has160KBAsset = true;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
const zipData = has160KBAsset && globalThis?.navigator?.userAgent.includes("Bun") ? zipSync(assetsToBundle) : await new Promise((resolve, reject) => {
|
|
105
|
+
zip(assetsToBundle, (err, data) => {
|
|
106
|
+
if (err) {
|
|
107
|
+
console.error(err);
|
|
108
|
+
reject(err);
|
|
109
|
+
} else resolve(data);
|
|
100
110
|
});
|
|
101
111
|
});
|
|
102
112
|
this.emitFile({
|