mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
build: convert cjs to esm
This commit is contained in:
parent
0be42a4b66
commit
778c469b6d
2 changed files with 21 additions and 22 deletions
|
@ -1,9 +1,11 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const glob = require("glob");
|
||||
const pkg = require("../package.json");
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import glob from "glob";
|
||||
|
||||
const pkg = JSON.parse(
|
||||
fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
||||
);
|
||||
|
||||
function buildApi() {
|
||||
const components = {};
|
||||
|
||||
glob.sync("src/**/*.svelte").forEach((file) => {
|
||||
|
@ -15,6 +17,3 @@ function buildApi() {
|
|||
"preprocess/api.json",
|
||||
JSON.stringify({ version: pkg.version, components }, null, 2)
|
||||
);
|
||||
}
|
||||
|
||||
buildApi();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const fs = require("fs");
|
||||
const sass = require("sass");
|
||||
const autoprefixer = require("autoprefixer");
|
||||
const postcss = require("postcss");
|
||||
const path = require("path");
|
||||
import fs from "fs";
|
||||
import sass from "sass";
|
||||
import autoprefixer from "autoprefixer";
|
||||
import postcss from "postcss";
|
||||
import path from "path";
|
||||
|
||||
(async () => {
|
||||
const scss = fs
|
||||
|
@ -10,7 +10,7 @@ const path = require("path");
|
|||
.filter((file) => file.endsWith(".scss"))
|
||||
.map((file) => path.parse(file));
|
||||
|
||||
for (const { name, base } of scss) {
|
||||
for await (const { name, base } of scss) {
|
||||
const file = `css/${base}`;
|
||||
const outFile = `css/${name}.css`;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue