diff --git a/.changeset/twenty-tables-rhyme.md b/.changeset/twenty-tables-rhyme.md new file mode 100644 index 0000000..96e9dce --- /dev/null +++ b/.changeset/twenty-tables-rhyme.md @@ -0,0 +1,5 @@ +--- +"@sopt-makers/ui": patch +--- + +fix css module build script in buildCSSModules.js diff --git a/packages/ui/scripts/buildCssModules.js b/packages/ui/scripts/buildCssModules.js index 6eeab2c..82fca0e 100644 --- a/packages/ui/scripts/buildCssModules.js +++ b/packages/ui/scripts/buildCssModules.js @@ -1,25 +1,17 @@ /* eslint-disable no-undef -- require import 오류 */ -const fs = require("node:fs"); -const path = require("node:path"); -const allVariables = require("../dist/cssVariables"); -const outputDir = require("../tsconfig.json").compilerOptions.outDir; +const fs = require('node:fs'); +const path = require('node:path'); +const allVariables = require('../dist/cssVariables'); +const outputDir = require('../tsconfig.json').compilerOptions.outDir; Object.keys(allVariables).forEach((key) => { - const variableValues = Object.entries(allVariables).find( - ([name]) => name === key - )[1]; + const variableValues = Object.entries(allVariables).find(([name]) => name === key)[1]; - fs.writeFileSync( - path.join(outputDir, `${toFileName(key)}.css`), - `${variableValues}` - ); + fs.writeFileSync(path.join(outputDir, `${toFileName(key)}.css`), `${variableValues}`); }); function toCssCasing(str) { - return str - .replace(/(?:[a-z])/g, "$1") - .replace(/(?:[A-Z])/g, "-$1") - .toLowerCase(); + return str.replace(/(?:[a-z])(?:[A-Z])/g, (match) => `${match[0]}-${match[1]}`).toLowerCase(); } function toFileName(str) {