// Add the browser regression to an already-installed check-package consumer. // Installation/tarball preparation stays exclusively in check-package.mjs. import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; const root = path.resolve(import.meta.dirname, ".."); const consumer = path.resolve(process.argv[2] ?? ""); if ( !process.argv[2] || consumer === root || !fs.existsSync(path.join(consumer, "check-client.mjs")) || !fs.existsSync( path.join(consumer, "node_modules/@heroui-vue/components/package.json"), ) ) throw Error( "Pass the independent consumer directory printed by node scripts/check-package.mjs handbook-styles", ); fs.copyFileSync( path.join(root, "tests/fixtures/field-placeholder.vue"), path.join(consumer, "field-placeholder.vue"), ); fs.writeFileSync( path.join(consumer, "main.js"), 'import {createApp} from "vue";\nimport App from "./field-placeholder.vue";\nimport "@heroui-vue/styles/css";\ncreateApp(App).mount("#app");\n', ); fs.writeFileSync( path.join(consumer, "index.html"), 'Published field placeholder regression
', ); const plugin = fileURLToPath(import.meta.resolve("@vitejs/plugin-vue")); fs.writeFileSync( path.join(consumer, "vite.config.js"), `import vue from ${JSON.stringify(plugin)};\nexport default { plugins:[vue()], resolve:{dedupe:["vue"]} };\n`, ); console.log( `Browser fixture prepared at ${consumer}. Components/styles resolve only from installed tarballs; Vite/Vue compilation tooling is shared.`, ); console.log( `Run the workspace Vite CLI with this directory as cwd, host 127.0.0.1 and an unused explicit port.`, );