Prepare Frost 1.0.0 release candidate
This commit is contained in:
@@ -17,16 +17,18 @@ for (const match of combinedCss.matchAll(/\.(frost-[A-Za-z0-9_-]+(?:\\:[A-Za-z0-
|
||||
}
|
||||
|
||||
const customProperties = new Set(combinedCss.match(/--frost-[a-z0-9-]+/g) ?? []);
|
||||
const keyframes = new Set([...combinedCss.matchAll(/@keyframes\s+([A-Za-z0-9_-]+)/g)].map((match) => match[1]));
|
||||
const entryCss = await readFile(resolve(root, "frost.css"), "utf8");
|
||||
const layerDeclaration = entryCss.match(/@layer\s+([^;]+);/);
|
||||
const layers = layerDeclaration ? layerDeclaration[1].split(",").map((layer) => layer.trim()) : [];
|
||||
const packageExports = Object.fromEntries(sortLexically(Object.keys(packageJson.exports)).map((key) => [key, packageJson.exports[key]]));
|
||||
|
||||
const currentManifest = {
|
||||
schemaVersion: 1,
|
||||
schemaVersion: 2,
|
||||
packageVersion: packageJson.version,
|
||||
classes: sortLexically(classes),
|
||||
customProperties: sortLexically(customProperties),
|
||||
keyframes: sortLexically(keyframes),
|
||||
layers,
|
||||
exports: packageExports,
|
||||
};
|
||||
@@ -50,6 +52,9 @@ const findBreakingChanges = (baseline, current) => {
|
||||
for (const property of baseline.customProperties ?? []) {
|
||||
if (!current.customProperties.includes(property)) changes.push(`removed custom property ${property}`);
|
||||
}
|
||||
for (const keyframe of baseline.keyframes ?? []) {
|
||||
if (!current.keyframes.includes(keyframe)) changes.push(`removed keyframes ${keyframe}`);
|
||||
}
|
||||
for (const [key, target] of Object.entries(baseline.exports ?? {})) {
|
||||
if (!(key in current.exports)) changes.push(`removed package export ${key}`);
|
||||
else if (current.exports[key] !== target) changes.push(`changed package export ${key}: ${target} -> ${current.exports[key]}`);
|
||||
@@ -76,7 +81,7 @@ if (!command) {
|
||||
const next = serialize(currentManifest);
|
||||
const previous = existingManifest ? serialize(existingManifest) : null;
|
||||
if (next !== previous) await writeFile(manifestPath, next);
|
||||
console.log(`Public API manifest contains ${currentManifest.classes.length} classes, ${currentManifest.customProperties.length} custom properties, and ${Object.keys(currentManifest.exports).length} exports.`);
|
||||
console.log(`Public API manifest contains ${currentManifest.classes.length} classes, ${currentManifest.customProperties.length} custom properties, ${currentManifest.keyframes.length} keyframes, and ${Object.keys(currentManifest.exports).length} exports.`);
|
||||
}
|
||||
} else if (!existingManifest) {
|
||||
console.error("public-api.json is missing. Run npm run generate:api.");
|
||||
@@ -85,11 +90,12 @@ if (!command) {
|
||||
const additions = [
|
||||
...currentManifest.classes.filter((value) => !existingManifest.classes.includes(value)).map((value) => `added class .${value}`),
|
||||
...currentManifest.customProperties.filter((value) => !existingManifest.customProperties.includes(value)).map((value) => `added custom property ${value}`),
|
||||
...currentManifest.keyframes.filter((value) => !(existingManifest.keyframes ?? []).includes(value)).map((value) => `added keyframes ${value}`),
|
||||
...Object.keys(currentManifest.exports).filter((value) => !(value in existingManifest.exports)).map((value) => `added package export ${value}`),
|
||||
];
|
||||
console.error(["public-api.json does not match the current CSS/package surface.", ...breakingChanges.map((change) => `BREAKING: ${change}`), ...additions.map((change) => `NEW: ${change}`), "Run npm run generate:api and commit the result."].join("\n"));
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(`Public API contract is current: ${currentManifest.classes.length} classes, ${currentManifest.customProperties.length} custom properties, ${Object.keys(currentManifest.exports).length} exports.`);
|
||||
console.log(`Public API contract is current: ${currentManifest.classes.length} classes, ${currentManifest.customProperties.length} custom properties, ${currentManifest.keyframes.length} keyframes, ${Object.keys(currentManifest.exports).length} exports.`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user