diff --git a/packages/icons/scripts/common.js b/packages/icons/scripts/common.js index 71bfe7a69e..bf09823343 100644 --- a/packages/icons/scripts/common.js +++ b/packages/icons/scripts/common.js @@ -16,7 +16,6 @@ const fs = require("fs"); const path = require("path"); -const COPYRIGHT_HEADER = "/*\n * Copyright 2021 Palantir Technologies, Inc. All rights reserved.\n */\n"; const RESOURCES_DIR = path.resolve(__dirname, "../../../resources/icons"); const GENERATED_SRC_DIR = path.resolve(__dirname, "../src/generated"); const NS = "bp4"; @@ -29,12 +28,11 @@ const NS = "bp4"; */ function writeLinesToFile(filename, ...lines) { const outputPath = path.join(GENERATED_SRC_DIR, filename); - const contents = [COPYRIGHT_HEADER, ...lines, ""].join("\n"); + const contents = [...lines, ""].join("\n"); fs.writeFileSync(outputPath, contents); } module.exports = { - COPYRIGHT_HEADER, RESOURCES_DIR, GENERATED_SRC_DIR, NS, diff --git a/packages/icons/scripts/generate-icon-paths.js b/packages/icons/scripts/generate-icon-paths.js index d43fd24e03..73dd8d8d9f 100644 --- a/packages/icons/scripts/generate-icon-paths.js +++ b/packages/icons/scripts/generate-icon-paths.js @@ -47,10 +47,14 @@ const ICON_NAMES = ICONS_METADATA.map(icon => icon.iconName); const iconPaths = await getIconPaths(iconSize); for (const [iconName, pathStrings] of Object.entries(iconPaths)) { + const line = pathStrings.length > 0 + ? `export default [${pathStrings.join(", ")}];` + // special case for "blank" icon - we need an explicit typedef + : `const p: string[] = []; export default p;` + writeLinesToFile( `${iconSize}px/paths/${iconName}.ts`, - `const paths: string[] = [${pathStrings.join(", ")}];`, - "export default paths;", + line, ); }