mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-25 10:08:29 +02:00
Run oxfmt across repo, add format script and docs
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
const { execSync } = require('node:child_process');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { execSync } = require("node:child_process");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
|
||||
if (process.env.SKIP_WASM_BUILD === '1') {
|
||||
console.log('Skipping wasm-pack build (SKIP_WASM_BUILD=1)');
|
||||
if (process.env.SKIP_WASM_BUILD === "1") {
|
||||
console.log("Skipping wasm-pack build (SKIP_WASM_BUILD=1)");
|
||||
return;
|
||||
}
|
||||
|
||||
execSync('wasm-pack build --target bundler', { stdio: 'inherit' });
|
||||
execSync("wasm-pack build --target bundler", { stdio: "inherit" });
|
||||
|
||||
// Rewrite the generated entry to use Vite's ?init import style instead of
|
||||
// the ES Module Integration style that wasm-pack generates, which Vite/rolldown
|
||||
// does not support in production builds.
|
||||
const entry = path.join(__dirname, 'pkg', 'yaak_templates.js');
|
||||
const entry = path.join(__dirname, "pkg", "yaak_templates.js");
|
||||
fs.writeFileSync(
|
||||
entry,
|
||||
[
|
||||
@@ -20,8 +20,8 @@ fs.writeFileSync(
|
||||
'export * from "./yaak_templates_bg.js";',
|
||||
'import * as bg from "./yaak_templates_bg.js";',
|
||||
'const instance = await init({ "./yaak_templates_bg.js": bg });',
|
||||
'bg.__wbg_set_wasm(instance.exports);',
|
||||
'instance.exports.__wbindgen_start();',
|
||||
'',
|
||||
].join('\n'),
|
||||
"bg.__wbg_set_wasm(instance.exports);",
|
||||
"instance.exports.__wbindgen_start();",
|
||||
"",
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export * from './bindings/parser';
|
||||
import { Tokens } from './bindings/parser';
|
||||
import { escape_template, parse_template, unescape_template } from './pkg';
|
||||
export * from "./bindings/parser";
|
||||
import { Tokens } from "./bindings/parser";
|
||||
import { escape_template, parse_template, unescape_template } from "./pkg";
|
||||
|
||||
export function parseTemplate(template: string) {
|
||||
return parse_template(template) as Tokens;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@yaakapp-internal/templates",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"bootstrap": "npm run build",
|
||||
|
||||
Reference in New Issue
Block a user