diff --git a/packages/svelte/scripts/appendBlockComments.mts b/packages/svelte/scripts/appendBlockComments.mts
index 531454352..83278b803 100644
--- a/packages/svelte/scripts/appendBlockComments.mts
+++ b/packages/svelte/scripts/appendBlockComments.mts
@@ -7,6 +7,8 @@ import { getJSBanner } from './license.mts';
const currentDir = getCurrentDirPath(import.meta.url);
const targetDirectory = path.join(currentDir, '../dist');
+const jsBanner = getJSBanner();
+
const files = await readdir(targetDirectory, {
recursive: true,
encoding: 'utf-8',
@@ -22,43 +24,10 @@ for (const file of files) {
// eslint-disable-next-line no-await-in-loop
const contents = (await readFile(filepath, { encoding: 'utf-8' })) as unknown as string;
- let newContents = contents;
const ext = path.extname(filepath);
- let license;
if (/\.(js|mjs|cjs|ts)/.test(ext)) {
- license = getJSBanner();
- }
-
- if (license) {
- newContents = license + contents;
- }
-
- // Places icon block comment at the top of the Svelte component class
- if (/icons\/(.*?)\.svelte\.d\.ts/.test(filepath)) {
- const svelteFilepath = filepath.replace('.d.ts', '');
// eslint-disable-next-line no-await-in-loop
- const svelteFileContents = (await readFile(svelteFilepath, { encoding: 'utf-8' })) as unknown as string;;
-
- const blockCommentRegex = /\/\*\*\n\s\*\s(@component\s@name)[\s\S]*?\*\//;
- const blockCommentMatch = blockCommentRegex.exec(svelteFileContents);
-
- if (blockCommentMatch !== null) {
- const blockComment = blockCommentMatch[0];
-
- const exportClassRegex = /export default class (\w+) extends SvelteComponentTyped<(.*?)> {/;
-
- if (exportClassRegex.test(newContents)) {
- newContents = newContents.replace(
- exportClassRegex,
- `${blockComment}\nexport default class $1 extends SvelteComponentTyped<$2> {`,
- );
- }
- }
- }
-
- if (newContents !== contents) {
- // eslint-disable-next-line no-await-in-loop
- await writeFile(filepath, newContents, { encoding: 'utf-8' });
+ await writeFile(filepath, jsBanner + contents, { encoding: 'utf-8' });
}
}
diff --git a/packages/svelte/scripts/exportTemplate.mts b/packages/svelte/scripts/exportTemplate.mts
index 0a3734bd1..a01d30286 100644
--- a/packages/svelte/scripts/exportTemplate.mts
+++ b/packages/svelte/scripts/exportTemplate.mts
@@ -1,41 +1,34 @@
import base64SVG from '@lucide/build-icons/utils/base64SVG';
-import { getJSBanner } from './license.mts';
+import { getHTMLBanner } from './license.mts';
import defineExportTemplate from '@lucide/build-icons/utils/defineExportTemplate';
-export default defineExportTemplate(async ({
- iconName,
- children,
- componentName,
- getSvg,
- deprecated,
- deprecationReason,
-}) => {
- const svgContents = await getSvg();
- const svgBase64 = base64SVG(svgContents);
+export default defineExportTemplate(
+ async ({ iconName, children, getSvg, deprecated, deprecationReason }) => {
+ const svgContents = await getSvg();
+ const svgBase64 = base64SVG(svgContents);
- return `\
+ return `\
+${getHTMLBanner()}
+
+
`;
-});
+ },
+);
diff --git a/packages/svelte/scripts/license.mts b/packages/svelte/scripts/license.mts
index 3f12b02c8..5b80c69f7 100644
--- a/packages/svelte/scripts/license.mts
+++ b/packages/svelte/scripts/license.mts
@@ -3,11 +3,26 @@ import pkg from '../package.json' with { type: 'json' };
const license = fs.readFileSync('LICENSE', 'utf-8');
+export function getHTMLBanner() {
+ return `\
+
+
+`;
+}
+
export function getJSBanner() {
- return `/**
+ return `\
+/**
+ * @file
* @license ${pkg.name} v${pkg.version} - ${pkg.license}
*
- * ${license.split('\n').join('\n * ')}
+ * This source code is licensed under the ${pkg.license} license.
+ * See the LICENSE file in the root directory of this source tree.
*/
`;
}