Prepare Frost 1.0.0 release candidate
This commit is contained in:
@@ -5,12 +5,13 @@ import { basename, join, resolve, sep } from "node:path";
|
||||
import { createRequire } from "node:module";
|
||||
import { promisify } from "node:util";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import postcss from "postcss";
|
||||
import postcssImport from "postcss-import";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const packageJson = JSON.parse(await readFile(resolve(root, "package.json"), "utf8"));
|
||||
const temporaryRoot = await mkdtemp(join(tmpdir(), "frost-consumer-"));
|
||||
const fixture = join(temporaryRoot, "fixture");
|
||||
const npmCli = process.env.npm_execpath;
|
||||
|
||||
const runNpm = async (arguments_, options = {}) => {
|
||||
@@ -29,7 +30,7 @@ try {
|
||||
const path = target.replace(/^\.\//, "");
|
||||
if (!packedPaths.has(path)) throw new Error(`Tarball is missing export target ${target}`);
|
||||
}
|
||||
for (const required of ["public-api.json", "dist/frost.css", "dist/frost.min.css", "dist/utility-layer.css", "dist/component-layer.css"]) {
|
||||
for (const required of ["public-api.json", "SUPPORT.md", "MIGRATION.md", "dist/frost.css", "dist/frost.min.css", "dist/utility-layer.css", "dist/component-layer.css"]) {
|
||||
if (!packedPaths.has(required)) throw new Error(`Tarball is missing required file ${required}`);
|
||||
}
|
||||
const forbidden = [...packedPaths].filter((path) => /^(?:examples|tests|\.gitea|node_modules)\//.test(path));
|
||||
@@ -52,8 +53,20 @@ try {
|
||||
if (!metadata.isFile() || metadata.size === 0) throw new Error(`${specifier} resolved to an empty or non-file target`);
|
||||
}
|
||||
|
||||
const consumerCss = join(temporaryRoot, "consumer.css");
|
||||
await writeFile(consumerCss, `@import "${packageJson.name}";\n.consumer-smoke { color: var(--frost-color-text); }\n`);
|
||||
const bundledConsumer = await postcss([
|
||||
postcssImport({
|
||||
resolve: (specifier) => requireFromFixture.resolve(specifier),
|
||||
}),
|
||||
]).process(await readFile(consumerCss, "utf8"), { from: consumerCss });
|
||||
if (/@import\b/.test(bundledConsumer.css)) throw new Error("Bundled default export left unresolved CSS imports in the consumer build");
|
||||
for (const marker of [".frost-button", "@layer frost.forced-colors", "@media (forced-colors: active)", ".consumer-smoke"]) {
|
||||
if (!bundledConsumer.css.includes(marker)) throw new Error(`Bundled consumer output is missing ${marker}`);
|
||||
}
|
||||
|
||||
const tarballMetadata = await stat(tarball);
|
||||
console.log(`Installed ${basename(tarball)} (${tarballMetadata.size} bytes) and resolved all ${Object.keys(packageJson.exports).length} package exports from an isolated consumer.`);
|
||||
console.log(`Installed ${basename(tarball)} (${tarballMetadata.size} bytes), resolved all ${Object.keys(packageJson.exports).length} exports, and bundled the default CSS from an isolated consumer.`);
|
||||
} finally {
|
||||
if (!resolve(temporaryRoot).startsWith(resolve(tmpdir()) + sep)) throw new Error("Refusing to remove a temporary directory outside the system temp root");
|
||||
await rm(temporaryRoot, { recursive: true, force: true });
|
||||
|
||||
Reference in New Issue
Block a user