chore: support npm run build -- --sourcemap (#24529)
This commit is contained in:
parent
786cb4019d
commit
57ab732fb8
|
|
@ -62,6 +62,7 @@ const copyFiles = [];
|
||||||
|
|
||||||
const watchMode = process.argv.slice(2).includes('--watch');
|
const watchMode = process.argv.slice(2).includes('--watch');
|
||||||
const lintMode = process.argv.slice(2).includes('--lint');
|
const lintMode = process.argv.slice(2).includes('--lint');
|
||||||
|
const withSourceMaps = process.argv.slice(2).includes('--sourcemap') || watchMode;
|
||||||
const ROOT = path.join(__dirname, '..', '..');
|
const ROOT = path.join(__dirname, '..', '..');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -238,11 +239,13 @@ for (const pkg of workspace.packages()) {
|
||||||
command: 'npx',
|
command: 'npx',
|
||||||
args: [
|
args: [
|
||||||
'babel',
|
'babel',
|
||||||
...(watchMode ? ['-w', '--source-maps'] : []),
|
...(watchMode ? ['-w'] : []),
|
||||||
|
...(withSourceMaps ? ['--source-maps'] : []),
|
||||||
'--extensions', '.ts',
|
'--extensions', '.ts',
|
||||||
'--out-dir', quotePath(path.join(pkg.path, 'lib')),
|
'--out-dir', quotePath(path.join(pkg.path, 'lib')),
|
||||||
'--ignore', '"packages/playwright-core/src/server/injected/**/*"',
|
'--ignore', '"packages/playwright-core/src/server/injected/**/*"',
|
||||||
quotePath(path.join(pkg.path, 'src'))],
|
quotePath(path.join(pkg.path, 'src')),
|
||||||
|
],
|
||||||
shell: true,
|
shell: true,
|
||||||
concurrent: true,
|
concurrent: true,
|
||||||
});
|
});
|
||||||
|
|
@ -252,7 +255,11 @@ for (const pkg of workspace.packages()) {
|
||||||
for (const bundle of bundles) {
|
for (const bundle of bundles) {
|
||||||
steps.push({
|
steps.push({
|
||||||
command: 'npm',
|
command: 'npm',
|
||||||
args: ['run', watchMode ? 'watch' : 'build'],
|
args: [
|
||||||
|
'run',
|
||||||
|
watchMode ? 'watch' : 'build',
|
||||||
|
...(withSourceMaps ? ['--', '--sourcemap'] : [])
|
||||||
|
],
|
||||||
shell: true,
|
shell: true,
|
||||||
cwd: bundle,
|
cwd: bundle,
|
||||||
concurrent: true,
|
concurrent: true,
|
||||||
|
|
@ -263,7 +270,12 @@ for (const bundle of bundles) {
|
||||||
for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {
|
for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {
|
||||||
steps.push({
|
steps.push({
|
||||||
command: 'npx',
|
command: 'npx',
|
||||||
args: ['vite', 'build', ...(watchMode ? ['--watch', '--sourcemap', '--minify=false'] : [])],
|
args: [
|
||||||
|
'vite',
|
||||||
|
'build',
|
||||||
|
...(watchMode ? ['--watch', '--minify=false'] : []),
|
||||||
|
...(withSourceMaps ? ['--sourcemap'] : []),
|
||||||
|
],
|
||||||
shell: true,
|
shell: true,
|
||||||
cwd: path.join(__dirname, '..', '..', 'packages', webPackage),
|
cwd: path.join(__dirname, '..', '..', 'packages', webPackage),
|
||||||
concurrent: true,
|
concurrent: true,
|
||||||
|
|
@ -272,7 +284,14 @@ for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {
|
||||||
// Build/watch trace viewer service worker.
|
// Build/watch trace viewer service worker.
|
||||||
steps.push({
|
steps.push({
|
||||||
command: 'npx',
|
command: 'npx',
|
||||||
args: ['vite', '--config', 'vite.sw.config.ts', 'build', ...(watchMode ? ['--watch', '--sourcemap', '--minify=false'] : [])],
|
args: [
|
||||||
|
'vite',
|
||||||
|
'--config',
|
||||||
|
'vite.sw.config.ts',
|
||||||
|
'build',
|
||||||
|
...(watchMode ? ['--watch', '--minify=false'] : []),
|
||||||
|
...(withSourceMaps ? ['--sourcemap'] : []),
|
||||||
|
],
|
||||||
shell: true,
|
shell: true,
|
||||||
cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),
|
cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),
|
||||||
concurrent: true,
|
concurrent: true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue