Skip to content

Commit

Permalink
feat: update generated css data to include more nesting solutions as …
Browse files Browse the repository at this point in the history
…well as new exports for property, syntax and types lists (microsoft#4125)
  • Loading branch information
janechu authored Nov 17, 2020
1 parent e903bfa commit b814aed
Show file tree
Hide file tree
Showing 7 changed files with 17,166 additions and 16,470 deletions.
44 changes: 43 additions & 1 deletion packages/tooling/fast-tooling/build/generate-mdn-data-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { properties } from "../src/css-data";
import { isEqual } from "lodash-es";

const outFilePath = path.resolve(__dirname, "../src/css-data.js");
const propertiesOutFilePath = path.resolve(__dirname, "../src/css-data.properties.ts");
const syntaxOutFilePath = path.resolve(__dirname, "../src/css-data.syntax.ts");
const typesOutFilePath = path.resolve(__dirname, "../src/css-data.types.ts");
const today = new Date();
const comment = `/**
* This file is generated from build/generate-mdn-data-files.js
Expand All @@ -18,7 +21,7 @@ const comment = `/**
`;

/**
* This file generates the file src/css-data.ts
* This function generates the file src/css-data.ts
*/

(function () {
Expand Down Expand Up @@ -59,5 +62,44 @@ const comment = `/**
chalk.red(error);
}
);

fs.writeFile(
propertiesOutFilePath,
`${comment}export type Property = ${Object.keys(mdnCSS.properties)
.map(propertyItem => {
return `"<'${propertyItem}'>"`;
})
.join(" | ")};`,
{},
error => {
chalk.red(error);
}
);

fs.writeFile(
syntaxOutFilePath,
`${comment}export type Syntax = ${Object.keys(mdnCSS.syntaxes)
.map(syntaxItem => {
return `"<${syntaxItem}>"`;
})
.join(" | ")};`,
{},
error => {
chalk.red(error);
}
);

fs.writeFile(
typesOutFilePath,
`${comment}export type Type = ${Object.keys(mdnCSS.types)
.map(typeItem => {
return `"<${typeItem}>"`;
})
.join(" | ")};`,
{},
error => {
chalk.red(error);
}
);
}
})();
Loading

0 comments on commit b814aed

Please sign in to comment.