Skip to content

Commit 39a77ba

Browse files
committedNov 10, 2024
Add comment to generated files
1 parent 811af53 commit 39a77ba

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed
 

‎packages/knip/scripts/generate-plugin-defs.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { EOL } from 'node:os';
33
// biome-ignore lint/nursery/noRestrictedImports: script
44
import path from 'node:path';
55

6+
const HEADER = '// This file is generated (no need to edit)';
67
const cc = str => str.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (_m, char) => char.toUpperCase());
78

89
const pluginsDir = path.resolve('src/plugins');
@@ -19,11 +20,11 @@ const typeDefinition = `export type PluginName = ${pluginNames.map(name => `'${n
1920

2021
const values = `export const pluginNames = [${pluginNames.map(name => `'${name}'`).join(',')}] as const;`;
2122

22-
fs.writeFileSync(outputFileTypes, typeDefinition + EOL + EOL + values);
23+
fs.writeFileSync(outputFileTypes, HEADER + EOL + typeDefinition + EOL + EOL + values);
2324

2425
const imports = pluginNames.map(name => `import { default as ${cc(name)} } from './${name}/index.js';`).join(EOL);
2526
const pluginsObj = `export const Plugins = {${pluginNames
2627
.map(name => (name === cc(name) ? `${name},` : `'${name}': ${cc(name)},`))
2728
.join(EOL)} };`;
2829

29-
fs.writeFileSync(outputFilePlugins, imports + EOL + EOL + pluginsObj);
30+
fs.writeFileSync(outputFilePlugins, HEADER + EOL + imports + EOL + EOL + pluginsObj);

‎packages/knip/src/plugins/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// This file is generated (no need to edit)
12
import { default as angular } from './angular/index.js';
23
import { default as astro } from './astro/index.js';
34
import { default as ava } from './ava/index.js';

‎packages/knip/src/types/PluginNames.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// This file is generated (no need to edit)
12
export type PluginName =
23
| 'angular'
34
| 'astro'

0 commit comments

Comments
 (0)
Please sign in to comment.