feat(preprocess): add optimizeCarbonImports preprocessor (#499)

This commit is contained in:
Eric Liu 2021-01-28 06:20:15 -08:00 committed by GitHub
commit 855381a486
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 825 additions and 6 deletions

20
scripts/build-api.js Normal file
View file

@ -0,0 +1,20 @@
const fs = require("fs");
const path = require("path");
const glob = require("glob");
const pkg = require("../package.json");
function buildApi() {
const components = {};
glob.sync("src/**/*.svelte").forEach((file) => {
const { name } = path.parse(file);
components[name] = { path: path.join(pkg.name, file) };
});
fs.writeFileSync(
"preprocess/api.json",
JSON.stringify({ version: pkg.version, components }, null, 2)
);
}
buildApi();