🎥 Make videos programmatically with React
`remotion`: Include LICENSE.md in npm packages (#8747)
Igor Samokhovets9240f63d4e7d
diff --git a/packages/core/package.json b/packages/core/package.jsonindex 700d87ac02..8919eed2df 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -11,7 +11,7 @@"scripts": {"formatting": "oxfmt src --check","format": "oxfmt src",- "prepublishOnly": "bun ensure-correct-version.ts && cp ../../README.md .",+ "prepublishOnly": "bun ensure-correct-version.ts && cp ../../README.md . && cp ../../LICENSE.md .","lint": "eslint src","test": "bun test src/test","make": "tsgo -d && bun --env-file=../.env.bundle bundle.ts"diff --git a/packages/it-tests/src/monorepo/no-dev-files.test.ts b/packages/it-tests/src/monorepo/no-dev-files.test.tsindex b7deaee3e1..8c4b120a5e 100644--- a/packages/it-tests/src/monorepo/no-dev-files.test.ts+++ b/packages/it-tests/src/monorepo/no-dev-files.test.ts@@ -1,4 +1,5 @@import {test} from 'bun:test';+import {copyFileSync, existsSync, unlinkSync} from 'fs';import path from 'path';import {$} from 'bun';import {getAllPackages} from './get-all-packages';@@ -35,13 +36,30 @@ const assertNoDevFilesPublished = async (pkgPath: string) => {const dir = path.join(pkgPath, '..');const release = await acquirePackCheckSlot();+ const hasLicenseReference = packageJson.license?.includes('LICENSE.md');+ const licensePath = path.join(dir, 'LICENSE.md');+ const copiedLicense = hasLicenseReference && !existsSync(licensePath);++ if (copiedLicense) {+ copyFileSync(+ path.join(__dirname, '..', '..', '..', '..', 'LICENSE.md'),+ licensePath,+ );+ }+try {+ let hasPackedLicense = false;const files = $`bun pm pack --dry-run`.cwd(dir).lines();for await (const file of files) {- if (!file.startsWith('packed')) {+ const line = file.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, '');+ if (!line.startsWith('packed')) {continue;}- const [, , filename] = file.split(' ');+ const filename = line.split(/\s+/).at(-1) as string;+ if (filename === 'LICENSE.md' || filename.endsWith('/LICENSE.md')) {+ hasPackedLicense = true;+ }+if (filename.includes('eslint.config.mjs') ||filename.includes('tsconfig') ||@@ -58,7 +76,15 @@ const assertNoDevFilesPublished = async (pkgPath: string) => {throw new Error('Disallowed file found in ' + filename);}}++ if (hasLicenseReference && !hasPackedLicense) {+ throw new Error('LICENSE.md is not packed for ' + packageJson.name);+ }} finally {+ if (copiedLicense) {+ unlinkSync(licensePath);+ }+release();}};diff --git a/packages/player/package.json b/packages/player/package.jsonindex 5680c51590..a295f72d98 100644--- a/packages/player/package.json+++ b/packages/player/package.json@@ -14,7 +14,7 @@"lint": "eslint src","make": "tsgo -d && bun ensure-correct-version.ts && bun --env-file=../.env.bundle bundle.ts","test": "bun test src",- "prerelease": "cp ../../README.md ."+ "prerelease": "cp ../../README.md . && cp ../../LICENSE.md ."},"exports": {"./package.json": "./package.json",diff --git a/publish.ts b/publish.tsindex b1b26166ed..46cddf201b 100644--- a/publish.ts+++ b/publish.ts@@ -1,6 +1,13 @@-import {existsSync, lstatSync, readdirSync, readFileSync} from 'node:fs';-import path from 'node:path';import {$} from 'bun';+import {+ copyFileSync,+ existsSync,+ lstatSync,+ readdirSync,+ readFileSync,+ unlinkSync,+} from 'node:fs';+import path from 'node:path';import limit from 'p-limit';import {FEATURED_TEMPLATES} from './packages/create-video/src/templates';@@ -32,8 +39,22 @@ for (const dir of dirs) {}promises.push(- p(() => {- return $`bun publish --tolerate-republish`.cwd(packagePath);+ p(async () => {+ const licensePath = path.join(packagePath, 'LICENSE.md');+ const copiedLicense =+ packageJson.license?.includes('LICENSE.md') && !existsSync(licensePath);++ if (copiedLicense) {+ copyFileSync(path.join(process.cwd(), 'LICENSE.md'), licensePath);+ }++ try {+ await $`bun publish --tolerate-republish`.cwd(packagePath);+ } finally {+ if (copiedLicense) {+ unlinkSync(licensePath);+ }+ }}),);}