Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix windows build #11975

Merged
merged 1 commit into from
Feb 22, 2024
Merged
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
24 changes: 15 additions & 9 deletions packages/puppeteer-core/Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/
import {mkdir, readFile, readdir, writeFile} from 'fs/promises';
import Module from 'node:module';
import {join, dirname} from 'path/posix';
import path from 'path';
import posixPath from 'path/posix';

import esbuild from 'esbuild';
import {execa} from 'execa';
Expand Down Expand Up @@ -99,13 +100,13 @@ export const buildTask = task({
});
const builders = [];
for (const format of formats) {
const folder = join('lib', format, 'third_party');
const folder = posixPath.join('lib', format, 'third_party');
for (const name of packages) {
const path = join(folder, name, `${name}.js`);
const entrypoint = posixPath.join(folder, name, `${name}.js`);
builders.push(
await esbuild.build({
entryPoints: [path],
outfile: path,
entryPoints: [entrypoint],
outfile: entrypoint,
bundle: true,
allowOverwrite: true,
format,
Expand All @@ -118,22 +119,27 @@ export const buildTask = task({
switch (name) {
case 'rxjs':
license = await readFile(
`${dirname(require.resolve('rxjs'))}/../../LICENSE.txt`,
path.join(
path.dirname(require.resolve('rxjs')),
'..',
'..',
'LICENSE.txt'
),
'utf-8'
);
break;
case 'mitt':
license = await readFile(
`${dirname(require.resolve('mitt'))}/../LICENSE`,
path.join(path.dirname(require.resolve('mitt')), '..', 'LICENSE'),
'utf-8'
);
break;
default:
throw new Error(`Add license handling for ${path}`);
}
const content = await readFile(path, 'utf-8');
const content = await readFile(entrypoint, 'utf-8');
await writeFile(
path,
entrypoint,
`/**
${license}
*/
Expand Down
Loading