chore: use wireit from workspace scripts (#9659)

This commit is contained in:
jrandolf 2023-02-13 06:50:44 -08:00 committed by GitHub
parent b50e43bc17
commit 78a302174e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 102 additions and 304 deletions

224
package-lock.json generated
View File

@ -70,7 +70,6 @@
"prettier": "2.8.1",
"puppeteer": "file:packages/puppeteer",
"rollup": "3.12.1",
"rollup-plugin-copy": "3.4.0",
"semver": "7.3.8",
"sinon": "15.0.1",
"source-map-support": "0.5.21",
@ -1735,15 +1734,6 @@
"integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==",
"dev": true
},
"node_modules/@types/fs-extra": {
"version": "8.1.2",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.2.tgz",
"integrity": "sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/glob": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.0.0.tgz",
@ -2750,12 +2740,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/colorette": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz",
"integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==",
"dev": true
},
"node_modules/colors": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz",
@ -5295,15 +5279,6 @@
"node": ">=0.10.0"
}
},
"node_modules/is-plain-object": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz",
"integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-reference": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz",
@ -7391,103 +7366,6 @@
"fsevents": "~2.3.2"
}
},
"node_modules/rollup-plugin-copy": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz",
"integrity": "sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ==",
"dev": true,
"dependencies": {
"@types/fs-extra": "^8.0.1",
"colorette": "^1.1.0",
"fs-extra": "^8.1.0",
"globby": "10.0.1",
"is-plain-object": "^3.0.0"
},
"engines": {
"node": ">=8.3"
}
},
"node_modules/rollup-plugin-copy/node_modules/@types/glob": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
"integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==",
"dev": true,
"dependencies": {
"@types/minimatch": "*",
"@types/node": "*"
}
},
"node_modules/rollup-plugin-copy/node_modules/fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
"dev": true,
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
},
"engines": {
"node": ">=6 <7 || >=8"
}
},
"node_modules/rollup-plugin-copy/node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/rollup-plugin-copy/node_modules/globby": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz",
"integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==",
"dev": true,
"dependencies": {
"@types/glob": "^7.1.1",
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.0.3",
"glob": "^7.1.3",
"ignore": "^5.1.1",
"merge2": "^1.2.3",
"slash": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/rollup-plugin-copy/node_modules/jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
"dev": true,
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/rollup-plugin-copy/node_modules/universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"dev": true,
"engines": {
"node": ">= 4.0.0"
}
},
"node_modules/run-async": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
@ -10421,15 +10299,6 @@
"integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==",
"dev": true
},
"@types/fs-extra": {
"version": "8.1.2",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.2.tgz",
"integrity": "sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/glob": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.0.0.tgz",
@ -11171,12 +11040,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"colorette": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz",
"integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==",
"dev": true
},
"colors": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz",
@ -12935,12 +12798,6 @@
"integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==",
"dev": true
},
"is-plain-object": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz",
"integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==",
"dev": true
},
"is-reference": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz",
@ -14563,87 +14420,6 @@
"fsevents": "~2.3.2"
}
},
"rollup-plugin-copy": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz",
"integrity": "sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ==",
"dev": true,
"requires": {
"@types/fs-extra": "^8.0.1",
"colorette": "^1.1.0",
"fs-extra": "^8.1.0",
"globby": "10.0.1",
"is-plain-object": "^3.0.0"
},
"dependencies": {
"@types/glob": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
"integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==",
"dev": true,
"requires": {
"@types/minimatch": "*",
"@types/node": "*"
}
},
"fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
"dev": true,
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"globby": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz",
"integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==",
"dev": true,
"requires": {
"@types/glob": "^7.1.1",
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.0.3",
"glob": "^7.1.3",
"ignore": "^5.1.1",
"merge2": "^1.2.3",
"slash": "^3.0.0"
}
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6"
}
},
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"dev": true
}
}
},
"run-async": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",

View File

@ -7,8 +7,8 @@
},
"scripts": {
"bisect": "tsx tools/bisect.ts",
"build": "npm run build --workspaces --if-present",
"build:docs": "npm run build:docs --workspace puppeteer --if-present",
"build": "wireit",
"build:docs": "wireit",
"check:pinned-deps": "tsx tools/ensure-pinned-deps",
"check": "npm run check --workspaces --if-present && run-p check:*",
"clean": "rimraf **/.wireit && npm run clean --workspaces --if-present",
@ -26,17 +26,92 @@
"prepare": "husky install",
"test-install": "npm run test --workspace @puppeteer-test/installation",
"test-types": "tsd -t packages/puppeteer",
"test:chrome:headful": "npm test -- --test-suite chrome-headful",
"test:chrome:new-headless": "npm test -- --test-suite chrome-new-headless",
"test:chrome:headless": "npm test -- --test-suite chrome-headless",
"test:chrome:bidi": "npm test -- --test-suite chrome-bidi",
"test:chrome": "run-s test:chrome:*",
"test:firefox:bidi": "npm test -- --test-suite firefox-bidi",
"test:firefox:headful": "npm test -- --test-suite firefox-headful",
"test:firefox:headless": "npm test -- --test-suite firefox-headless",
"test:firefox": "run-s test:firefox:*",
"test:chrome:headful": "wireit",
"test:chrome:new-headless": "wireit",
"test:chrome:headless": "wireit",
"test:chrome:bidi": "wireit",
"test:chrome": "wireit",
"test:firefox:bidi": "wireit",
"test:firefox:headful": "wireit",
"test:firefox:headless": "wireit",
"test:firefox": "wireit",
"test": "cross-env PUPPETEER_DEFERRED_PROMISE_DEBUG_TIMEOUT=20000 node tools/mochaRunner/lib/main.js"
},
"wireit": {
"build": {
"dependencies": [
"./packages/ng-schematics:build",
"./packages/puppeteer-core:build",
"./packages/puppeteer:build",
"./packages/testserver:build",
"./test:build",
"./test/installation:build"
]
},
"build:docs": {
"dependencies": [
"./packages/puppeteer:build:docs",
"./packages/puppeteer-core:build:docs"
]
},
"test:chrome:headful": {
"command": "npm test -- --test-suite chrome-headful",
"dependencies": [
"./test:build"
]
},
"test:chrome:headless": {
"command": "npm test -- --test-suite chrome-headless",
"dependencies": [
"./test:build"
]
},
"test:chrome:new-headless": {
"command": "npm test -- --test-suite chrome-new-headless",
"dependencies": [
"./test:build"
]
},
"test:chrome:bidi": {
"command": "npm test -- --test-suite chrome-bidi",
"dependencies": [
"./test:build"
]
},
"test:firefox:headful": {
"command": "npm test -- --test-suite firefox-headful",
"dependencies": [
"./test:build"
]
},
"test:firefox:headless": {
"command": "npm test -- --test-suite firefox-headless",
"dependencies": [
"./test:build"
]
},
"test:firefox:bidi": {
"command": "npm test -- --test-suite firefox-bidi",
"dependencies": [
"./test:build"
]
},
"test:chrome": {
"dependencies": [
"test:chrome:headful",
"test:chrome:headless",
"test:chrome:new-headless",
"test:chrome:bidi"
]
},
"test:firefox": {
"dependencies": [
"test:firefox:headful",
"test:firefox:headless",
"test:firefox:bidi"
]
}
},
"devDependencies": {
"@actions/core": "1.10.0",
"@commitlint/cli": "17.3.0",
@ -96,7 +171,6 @@
"prettier": "2.8.1",
"puppeteer": "file:packages/puppeteer",
"rollup": "3.12.1",
"rollup-plugin-copy": "3.4.0",
"semver": "7.3.8",
"sinon": "15.0.1",
"source-map-support": "0.5.21",

View File

@ -34,7 +34,6 @@
"node": ">=14.1.0"
},
"scripts": {
"build:third_party": "wireit",
"build:tsc": "wireit",
"build:types": "wireit",
"build:docs": "wireit",
@ -59,7 +58,6 @@
"build": {
"dependencies": [
"build:tsc",
"build:third_party",
"format:types",
"generate:package-json"
]
@ -69,28 +67,13 @@
"clean": "if-file-deleted",
"files": [
"../../versions.js",
"src/injected/**",
"src/templates/**",
"src/{injected,templates}/**",
"tools/generate_sources.ts"
],
"output": [
"src/generated/*.ts"
]
},
"build:third_party": {
"command": "rollup --config rollup.third_party.config.mjs",
"dependencies": [
"build:tsc"
],
"files": [
".wireit/third_party/**",
"rollup.third_party.config.mjs"
],
"output": [
"lib/esm/third_party/**",
"lib/cjs/third_party/**"
]
},
"generate:package-json": {
"command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json",
"dependencies": [
@ -114,8 +97,7 @@
"lib/types.d.ts"
],
"dependencies": [
"build:tsc",
"build:third_party"
"build:tsc"
]
},
"build:docs": {
@ -144,24 +126,18 @@
]
},
"build:tsc": {
"command": "tsc -b",
"command": "tsc -b && rollup --config rollup.third_party.config.mjs",
"clean": "if-file-deleted",
"dependencies": [
"generate:sources"
],
"files": [
"**/tsconfig.*.json",
"**/tsconfig.json",
"compat/**/*.ts",
"src/**/*.ts",
"third_party/**/*.ts"
"rollup.third_party.config.mjs",
"**/tsconfig{.*,}.json",
"{compat,src,third_party}/**/*.ts"
],
"output": [
".wireit/third_party/**/*.{ts,js}",
"lib/{cjs,esm}/**/*.{ts,js}",
".wireit/third_party/**/*.{ts,js}.map",
"lib/{cjs,esm}/**/*.{ts,js}.map",
"!lib/{cjs,esm}/third_party"
"lib/{cjs,esm}/**/*.{ts,js}{.map,}"
]
}
},

View File

@ -13,49 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import glob from 'glob';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import {dirname, join, relative} from 'path';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import glob from 'glob';
export default ['cjs', 'esm'].flatMap(outputType => {
const configs = [];
// Note we don't use path.join here. We cannot since `glob` does not support
// the backslash path separator.
const sourcePath = `.wireit/third_party/${outputType}/`;
for (const file of glob.sync(`${sourcePath}**/*.js`)) {
const typesFile = `${file.slice(0, -3)}.d.ts`;
for (const file of glob.sync(`lib/${outputType}/third_party/**/*.js`)) {
configs.push({
input: file,
output: {
file: join(
'lib',
outputType,
'third_party',
relative(sourcePath, file)
),
file,
format: outputType,
},
plugins: [
commonjs(),
nodeResolve(),
copy({
targets: [
{
src: typesFile,
dest: dirname(
join(
'lib',
outputType,
'third_party',
relative(sourcePath, typesFile)
)
),
},
],
}),
],
plugins: [commonjs(), nodeResolve()],
});
}
return configs;

View File

@ -2,7 +2,7 @@
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"declarationMap": false,
"outDir": "../.wireit/third_party/cjs",
"outDir": "../lib/cjs/third_party",
"sourceMap": false
}
}

View File

@ -2,7 +2,7 @@
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"declarationMap": false,
"outDir": "../.wireit/third_party/esm",
"outDir": "../lib/esm/third_party",
"sourceMap": false
}
}

View File

@ -114,12 +114,11 @@
"../puppeteer-core:build"
],
"files": [
"**/tsconfig.*.json",
"**/tsconfig.json",
"**/tsconfig{.*,}.json",
"src/**"
],
"output": [
"lib/**"
"lib/{cjs,esm}/**/*.{ts,js}{.map,}"
]
}
},