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:
Dmitry Gozman 2021-06-02 14:01:05 -07:00 committed by GitHub
parent 254ec155eb
commit 33c2f6c31e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 22 deletions

1
.gitignore vendored
View File

@ -14,5 +14,4 @@ drivers/
.android-sdk/
.gradle/
nohup.out
api.json
.trace

View File

@ -113,9 +113,6 @@ if (!args.some(arg => arg === '--no-cleanup')) {
for (const file of package.files)
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
const pwInternalJSON = require(path.join(ROOT_PATH, 'package.json'));
await writeToPackage('package.json', JSON.stringify({

View File

@ -32,9 +32,6 @@ lib/**/injected/
!README.md
!LICENSE
!NOTICE
# Include protocol and api docs, so that dependent packages can consume them.
!api.json
!protocol.yml
# Include browser descriptors.
!browsers.json
# Include commit info

View File

@ -17,7 +17,6 @@
/* eslint-disable no-console */
import fs from 'fs';
import path from 'path';
import * as playwright from '../..';
import { BrowserType } from '../client/browserType';
import { LaunchServerOptions } from '../client/types';
@ -31,13 +30,10 @@ import { gracefullyCloseAll } from '../server/processLauncher';
import { BrowserName } from '../utils/registry';
export function printApiJson() {
// Note: this file is generated by build-playwright-driver.sh
console.log(JSON.stringify(require('../../api.json')));
}
export function printProtocol() {
console.log(fs.readFileSync(path.join(__dirname, '..', '..', 'protocol.yml'), 'utf8'));
}
export function runDriver() {
const dispatcherConnection = new DispatcherConnection();
const transport = new Transport(process.stdout, process.stdin);

View File

@ -13,6 +13,10 @@ mkdir -p ./output
echo "Building playwright package"
../../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 {
NODE_DIR=$1
SUFFIX=$2
@ -45,6 +49,8 @@ function build {
fi
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
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 node "../../${NODE_DIR}/${NPM_PATH}" install --production
rm package-lock.json

View File

@ -91,15 +91,6 @@ steps.push({
shell: true,
});
// Generate api.json.
onChanges.push({
committed: false,
inputs: [
'docs/src/api/',
],
script: 'utils/doclint/generateApiJson.js',
});
// Generate channels.
onChanges.push({
committed: false,

View File

@ -35,7 +35,7 @@ const PROJECT_DIR = path.join(__dirname, '..', '..');
});
documentation.generateSourceCodeComments();
const result = serialize(documentation);
fs.writeFileSync(path.join(PROJECT_DIR, 'api.json'), JSON.stringify(result));
console.log(JSON.stringify(result));
}
/**