chore: do not bundle api.json and protocol.yml (#6841)
These are only needed for the driver, so bundle them in the driver explicitly.
This commit is contained in:
parent
254ec155eb
commit
33c2f6c31e
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -14,5 +14,4 @@ drivers/
|
||||||
.android-sdk/
|
.android-sdk/
|
||||||
.gradle/
|
.gradle/
|
||||||
nohup.out
|
nohup.out
|
||||||
api.json
|
|
||||||
.trace
|
.trace
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,6 @@ if (!args.some(arg => arg === '--no-cleanup')) {
|
||||||
for (const file of package.files)
|
for (const file of package.files)
|
||||||
await copyToPackage(path.join(ROOT_PATH, file), path.join(packagePath, file));
|
await copyToPackage(path.join(ROOT_PATH, file), path.join(packagePath, file));
|
||||||
|
|
||||||
await copyToPackage(path.join(ROOT_PATH, 'api.json'), path.join(packagePath, 'api.json'));
|
|
||||||
await copyToPackage(path.join(ROOT_PATH, 'src/protocol/protocol.yml'), path.join(packagePath, 'protocol.yml'));
|
|
||||||
|
|
||||||
// 4. Generate package.json
|
// 4. Generate package.json
|
||||||
const pwInternalJSON = require(path.join(ROOT_PATH, 'package.json'));
|
const pwInternalJSON = require(path.join(ROOT_PATH, 'package.json'));
|
||||||
await writeToPackage('package.json', JSON.stringify({
|
await writeToPackage('package.json', JSON.stringify({
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ lib/**/injected/
|
||||||
!README.md
|
!README.md
|
||||||
!LICENSE
|
!LICENSE
|
||||||
!NOTICE
|
!NOTICE
|
||||||
# Include protocol and api docs, so that dependent packages can consume them.
|
|
||||||
!api.json
|
|
||||||
!protocol.yml
|
|
||||||
# Include browser descriptors.
|
# Include browser descriptors.
|
||||||
!browsers.json
|
!browsers.json
|
||||||
# Include commit info
|
# Include commit info
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
|
||||||
import * as playwright from '../..';
|
import * as playwright from '../..';
|
||||||
import { BrowserType } from '../client/browserType';
|
import { BrowserType } from '../client/browserType';
|
||||||
import { LaunchServerOptions } from '../client/types';
|
import { LaunchServerOptions } from '../client/types';
|
||||||
|
|
@ -31,13 +30,10 @@ import { gracefullyCloseAll } from '../server/processLauncher';
|
||||||
import { BrowserName } from '../utils/registry';
|
import { BrowserName } from '../utils/registry';
|
||||||
|
|
||||||
export function printApiJson() {
|
export function printApiJson() {
|
||||||
|
// Note: this file is generated by build-playwright-driver.sh
|
||||||
console.log(JSON.stringify(require('../../api.json')));
|
console.log(JSON.stringify(require('../../api.json')));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function printProtocol() {
|
|
||||||
console.log(fs.readFileSync(path.join(__dirname, '..', '..', 'protocol.yml'), 'utf8'));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function runDriver() {
|
export function runDriver() {
|
||||||
const dispatcherConnection = new DispatcherConnection();
|
const dispatcherConnection = new DispatcherConnection();
|
||||||
const transport = new Transport(process.stdout, process.stdin);
|
const transport = new Transport(process.stdout, process.stdin);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@ mkdir -p ./output
|
||||||
echo "Building playwright package"
|
echo "Building playwright package"
|
||||||
../../packages/build_package.js playwright ./output/playwright.tgz
|
../../packages/build_package.js playwright ./output/playwright.tgz
|
||||||
|
|
||||||
|
echo "Building api.json and protocol.yml"
|
||||||
|
node ../../utils/doclint/generateApiJson.js > ./output/api.json
|
||||||
|
cp ../../src/protocol/protocol.yml ./output/
|
||||||
|
|
||||||
function build {
|
function build {
|
||||||
NODE_DIR=$1
|
NODE_DIR=$1
|
||||||
SUFFIX=$2
|
SUFFIX=$2
|
||||||
|
|
@ -45,6 +49,8 @@ function build {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp ./output/${NODE_DIR}/LICENSE ./output/playwright-${SUFFIX}/
|
cp ./output/${NODE_DIR}/LICENSE ./output/playwright-${SUFFIX}/
|
||||||
|
cp ./output/api.json ./output/playwright-${SUFFIX}/package/
|
||||||
|
cp ./output/protocol.yml ./output/playwright-${SUFFIX}/package/
|
||||||
cd ./output/playwright-${SUFFIX}/package
|
cd ./output/playwright-${SUFFIX}/package
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 node "../../${NODE_DIR}/${NPM_PATH}" install --production
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 node "../../${NODE_DIR}/${NPM_PATH}" install --production
|
||||||
rm package-lock.json
|
rm package-lock.json
|
||||||
|
|
|
||||||
|
|
@ -91,15 +91,6 @@ steps.push({
|
||||||
shell: true,
|
shell: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Generate api.json.
|
|
||||||
onChanges.push({
|
|
||||||
committed: false,
|
|
||||||
inputs: [
|
|
||||||
'docs/src/api/',
|
|
||||||
],
|
|
||||||
script: 'utils/doclint/generateApiJson.js',
|
|
||||||
});
|
|
||||||
|
|
||||||
// Generate channels.
|
// Generate channels.
|
||||||
onChanges.push({
|
onChanges.push({
|
||||||
committed: false,
|
committed: false,
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ const PROJECT_DIR = path.join(__dirname, '..', '..');
|
||||||
});
|
});
|
||||||
documentation.generateSourceCodeComments();
|
documentation.generateSourceCodeComments();
|
||||||
const result = serialize(documentation);
|
const result = serialize(documentation);
|
||||||
fs.writeFileSync(path.join(PROJECT_DIR, 'api.json'), JSON.stringify(result));
|
console.log(JSON.stringify(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue