Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ jobs:
path: ./packages/cli/skills
if-no-files-found: error

- name: Upload LICENSE files
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
with:
name: licenses
path: |
./packages/core/LICENSE
./packages/cli/LICENSE
if-no-files-found: error

Release:
runs-on: ubuntu-latest
needs: [prepare, build-rust]
Expand Down Expand Up @@ -212,6 +222,13 @@ jobs:
pattern: core
merge-multiple: true

- name: Download LICENSE files
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages
pattern: licenses
merge-multiple: true

- uses: ./.github/actions/download-rolldown-binaries
with:
github-token: ${{ github.token }}
Expand Down
1 change: 0 additions & 1 deletion packages/core/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/LICENSE
/LICENSE.md
13 changes: 3 additions & 10 deletions packages/core/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ await bundleVitepress();
generateLicenseFile({
title: 'Vite-Plus core license',
packageName: 'Vite-Plus',
outputPath: join(projectDir, 'LICENSE.md'),
outputPath: join(projectDir, 'LICENSE'),
coreLicensePath: join(projectDir, '..', '..', 'LICENSE'),
bundledPaths: [join(projectDir, 'dist')],
resolveFrom: [
Expand Down Expand Up @@ -84,11 +84,10 @@ generateLicenseFile({
},
],
});
if (!existsSync(join(projectDir, 'LICENSE.md'))) {
throw new Error('LICENSE.md was not generated during build');
if (!existsSync(join(projectDir, 'LICENSE'))) {
throw new Error('LICENSE was not generated during build');
}
await mergePackageJson();
await syncLicenseFromRoot();

async function buildVite() {
const newViteRolldownConfig = viteRolldownConfig.map((config) => {
Expand Down Expand Up @@ -670,9 +669,3 @@ async function mergePackageJson() {
}
await writeFile(destPkgPath, code);
}

async function syncLicenseFromRoot() {
const rootLicensePath = join(projectDir, '..', '..', 'LICENSE');
const packageLicensePath = join(projectDir, 'LICENSE');
await copyFile(rootLicensePath, packageLicensePath);
}
14 changes: 4 additions & 10 deletions packages/test/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ await mergePackageJson(pluginExports);
generateLicenseFile({
title: 'Vite-Plus test license',
packageName: 'Vite-Plus',
outputPath: join(projectDir, 'LICENSE.md'),
outputPath: join(projectDir, 'LICENSE'),
coreLicensePath: join(projectDir, '..', '..', 'LICENSE'),
bundledPaths: [distDir],
resolveFrom: [projectDir, join(projectDir, '..', '..')],
Expand All @@ -242,10 +242,9 @@ generateLicenseFile({
})),
],
});
if (!existsSync(join(projectDir, 'LICENSE.md'))) {
throw new Error('LICENSE.md was not generated during build');
if (!existsSync(join(projectDir, 'LICENSE'))) {
throw new Error('LICENSE was not generated during build');
}
await syncLicenseFromRoot();
await validateExternalDeps();

async function mergePackageJson(pluginExports: Array<{ exportPath: string; shimFile: string }>) {
Expand Down Expand Up @@ -434,12 +433,6 @@ async function mergePackageJson(pluginExports: Array<{ exportPath: string; shimF
await writeFile(destPackageJsonPath, code);
}

async function syncLicenseFromRoot() {
const rootLicensePath = join(projectDir, '..', '..', 'LICENSE');
const packageLicensePath = join(projectDir, 'LICENSE');
await copyFile(rootLicensePath, packageLicensePath);
}

async function bundleVitest() {
const vitestDestDir = projectDir;

Expand All @@ -451,6 +444,7 @@ async function bundleVitest() {
join(vitestSourceDir, 'node_modules/**'),
join(vitestSourceDir, 'package.json'),
join(vitestSourceDir, 'README.md'),
join(vitestSourceDir, 'LICENSE.md'),
],
});

Expand Down
5 changes: 4 additions & 1 deletion scripts/generate-license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ export function generateLicenseFile(options: GenerateLicenseFileOptions) {

if (existingContent !== licenseFileContent) {
fs.writeFileSync(options.outputPath, licenseFileContent);
console.error('\x1b[33m\nLICENSE.md updated. You should commit the updated file.\n\x1b[0m');
const outputFileName = path.basename(options.outputPath);
console.error(
`\x1b[33m\n${outputFileName} updated. You should commit the updated file.\n\x1b[0m`,
);
}
}

Expand Down
Loading