Skip to content

Commit b5f8d1d

Browse files
committed
build: ship THIRD-PARTY-LICENSES.md at the package root
1 parent 04f5267 commit b5f8d1d

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ dist
135135
dist
136136
node_modules
137137
src/wwwroot/
138+
src/THIRD-PARTY-LICENSES.md
138139
bin
139140
obj
140141

src/IgniteUI.Blazor.Lite.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@
8181
<Pack>True</Pack>
8282
<PackagePath>\</PackagePath>
8383
</None>
84+
<!-- Written by `npm run build` (vite build.license): every bundled JS dependency's license. Pack runs in the
85+
outer multi-target build, where the SDK's default None glob is not evaluated, so the file is added explicitly. -->
86+
<None Remove="THIRD-PARTY-LICENSES.md" />
87+
<None Include="THIRD-PARTY-LICENSES.md" Condition="Exists('THIRD-PARTY-LICENSES.md')">
88+
<Pack>True</Pack>
89+
<PackagePath>\</PackagePath>
90+
</None>
8491
</ItemGroup>
8592

8693
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

tests/js/static-web-assets.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ test('no free `global` references (webpack polyfilled it; ESM does not)', () =>
7878
});
7979

8080
test('legal notices survive: in-source ones inline, dependencies via the license manifest', () => {
81-
assert.ok(existsSync(join(wwwroot, 'THIRD-PARTY-LICENSES.md')), 'build.license manifest missing');
81+
assert.ok(existsSync('src/THIRD-PARTY-LICENSES.md'), 'build.license manifest missing next to the csproj');
8282
// Notices inside our own sources (e.g. vendored snippets) are invisible to build.license, so they must stay inline.
8383
const emitted = jsFiles.map(read).join('\n');
8484
const walk = (dir) => {

vite.config.mts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { cpSync } from 'node:fs';
1+
import { cpSync, renameSync } from 'node:fs';
22
import { resolve } from 'node:path';
33
import { defineConfig, type Plugin } from 'vite';
44

55
const outDir = 'src/wwwroot';
66
const initializer = 'IgniteUI.Blazor.Lite.lib.module.js';
7+
const licenseManifest = 'THIRD-PARTY-LICENSES.md';
78
/** Public modules keep fixed names so apps can import them and/or import maps can override them. */
89
const fixedNames: Record<string, string> = { api: 'api.js', 'lit-html': 'lit-html.js', legacyStub: 'app.bundle.js' };
910
const entries = { app: 'src/src/index.ts', api: 'src/src/api.ts', legacyStub: 'src/src/app.bundle.ts' };
@@ -39,12 +40,14 @@ function emitInitializer(): Plugin {
3940
};
4041
}
4142

42-
/** Copy igniteui-webcomponents themes to wwwroot */
43+
/** Copy igniteui-webcomponents themes to wwwroot & move the license manifest */
4344
function copyThemes(): Plugin {
4445
return {
4546
name: 'ig-copy-themes',
4647
closeBundle() {
4748
cpSync('node_modules/igniteui-webcomponents/themes', `${outDir}/themes`, { recursive: true });
49+
// move out of wwwroot since it's not a web asset (rolldown only emits inside outDir)
50+
renameSync(`${outDir}/${licenseManifest}`, `src/${licenseManifest}`);
4851
},
4952
};
5053
}
@@ -61,7 +64,7 @@ export default defineConfig(({ mode }) => {
6164
outDir,
6265
emptyOutDir: true,
6366
// One manifest of every bundled dependency's license; does not include inlined ones from rolldownOptions.output.comments.legal
64-
license: { fileName: 'THIRD-PARTY-LICENSES.md' },
67+
license: { fileName: licenseManifest },
6568
sourcemap: isDev,
6669
// Lib mode keeps the lazy imports free of vite's preload helper (import.meta.url-based — wrong under _content/).
6770
lib: { formats: ['es'] },

0 commit comments

Comments
 (0)