chore: cleanup wireit scripts (#9662)

This commit is contained in:
jrandolf 2023-02-13 10:22:43 -08:00 committed by GitHub
parent 5c54d399bb
commit b53838682f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 83 deletions

View File

@ -34,16 +34,15 @@
"node": ">=14.1.0"
},
"scripts": {
"build:docs": "wireit",
"build:tsc": "wireit",
"build:types": "wireit",
"build:docs": "wireit",
"build": "wireit",
"check": "tsx tools/ensure-correct-devtools-protocol-package",
"format:types": "wireit",
"clean": "tsc -b --clean && rimraf lib src/generated",
"generate:package-json": "wireit",
"generate:sources": "wireit",
"prepack": "wireit",
"clean": "tsc -b --clean && rimraf lib src/generated"
"prepack": "wireit"
},
"wireit": {
"prepack": {
@ -58,8 +57,7 @@
"build": {
"dependencies": [
"build:tsc",
"format:types",
"generate:package-json"
"build:types"
]
},
"generate:sources": {
@ -76,9 +74,6 @@
},
"generate:package-json": {
"command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json",
"dependencies": [
"build:tsc"
],
"files": [
"../../tools/generate_module_package_json.ts"
],
@ -86,58 +81,46 @@
"lib/esm/package.json"
]
},
"build:types": {
"command": "api-extractor run --local",
"files": [
"tsconfig.json",
"api-extractor.json",
"lib/esm/puppeteer/types.d.ts"
],
"output": [
"lib/types.d.ts"
],
"dependencies": [
"build:tsc"
]
},
"build:docs": {
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
"files": [
"tsconfig.json",
"api-extractor.docs.json",
"lib/esm/puppeteer/puppeteer-core.d.ts"
"lib/esm/puppeteer/puppeteer-core.d.ts",
"tsconfig.json"
],
"dependencies": [
"build:tsc"
]
},
"format:types": {
"command": "eslint --cache-location .eslintcache --cache --ext=ts --no-ignore --no-eslintrc -c=../../.eslintrc.types.cjs --fix lib/types.d.ts",
"dependencies": [
"build:types"
],
"clean": false,
"files": [
"lib/types.d.ts",
"../../.eslintrc.types.cjs"
],
"output": [
"lib/types.d.ts"
]
},
"build:tsc": {
"command": "tsc -b && rollup --config rollup.third_party.config.mjs",
"clean": "if-file-deleted",
"dependencies": [
"generate:package-json",
"generate:sources"
],
"files": [
"rollup.third_party.config.mjs",
"**/tsconfig{.*,}.json",
"{compat,src,third_party}/**/*.ts"
"{compat,src,third_party}/**",
"rollup.third_party.config.mjs"
],
"output": [
"lib/{cjs,esm}/**/*.{ts,js}{.map,}"
"lib/{cjs,esm}/**",
"!lib/esm/package.json"
]
},
"build:types": {
"command": "api-extractor run --local && eslint --cache-location .eslintcache --cache --ext=ts --no-ignore --no-eslintrc -c=../../.eslintrc.types.cjs --fix lib/types.d.ts",
"files": [
"../../.eslintrc.types.cjs",
"api-extractor.json",
"lib/esm/puppeteer/types.d.ts",
"tsconfig.json"
],
"output": [
"lib/types.d.ts"
],
"dependencies": [
"build:tsc"
]
}
},

View File

@ -34,12 +34,11 @@
"node": ">=14.1.0"
},
"scripts": {
"build:docs": "wireit",
"build:tsc": "wireit",
"build:types": "wireit",
"build:docs": "wireit",
"build": "wireit",
"clean": "tsc -b --clean && rimraf lib",
"format:types": "wireit",
"generate:package-json": "wireit",
"postinstall": "node install.js",
"prepack": "wireit"
@ -57,15 +56,11 @@
"build": {
"dependencies": [
"build:tsc",
"format:types",
"generate:package-json"
"build:types"
]
},
"generate:package-json": {
"command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json",
"dependencies": [
"build:tsc"
],
"files": [
"../../tools/generate_module_package_json.ts"
],
@ -73,40 +68,17 @@
"lib/esm/package.json"
]
},
"build:types": {
"command": "api-extractor run --local",
"dependencies": [
"build:tsc"
],
"files": [
"tsconfig.json",
"api-extractor.json",
"lib/esm/puppeteer/types.d.ts"
],
"output": [
"lib/types.d.ts"
]
},
"build:docs": {
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
"files": [
"api-extractor.docs.json",
"lib/esm/puppeteer/puppeteer-core.d.ts",
"tsconfig.json"
],
"dependencies": [
"build:tsc"
]
},
"format:types": {
"command": "eslint --cache-location .eslintcache --cache --ext=ts --no-ignore --no-eslintrc -c=../../.eslintrc.types.cjs --fix lib/types.d.ts",
"dependencies": [
"build:types"
],
"clean": false,
"files": [
"lib/types.d.ts",
"../../.eslintrc.types.cjs"
],
"output": [
"lib/types.d.ts"
]
},
"build:tsc": {
"command": "tsc -b",
"clean": "if-file-deleted",
@ -114,11 +86,26 @@
"../puppeteer-core:build"
],
"files": [
"**/tsconfig{.*,}.json",
"src/**"
],
"output": [
"lib/{cjs,esm}/**/*.{ts,js}{.map,}"
"lib/{cjs,esm}/**",
"!lib/esm/package.json"
]
},
"build:types": {
"command": "api-extractor run --local && eslint --cache-location .eslintcache --cache --ext=ts --no-ignore --no-eslintrc -c=../../.eslintrc.types.cjs --fix lib/types.d.ts",
"files": [
"../../.eslintrc.types.cjs",
"api-extractor.json",
"lib/esm/puppeteer/types.d.ts",
"tsconfig.json"
],
"output": [
"lib/types.d.ts"
],
"dependencies": [
"build:tsc"
]
}
},

View File

@ -4,9 +4,22 @@
"description": "testing server",
"main": "lib/index.js",
"scripts": {
"build": "tsc -b",
"build": "wireit",
"clean": "tsc -b --clean && rimraf lib"
},
"wireit": {
"build": {
"command": "tsc -b",
"clean": "if-file-deleted",
"files": [
"src/**"
],
"output": [
"lib/**",
"tsconfig.tsbuildinfo"
]
}
},
"repository": {
"type": "git",
"url": "https://github.com/puppeteer/puppeteer/tree/main/packages/testserver"

View File

@ -14,11 +14,13 @@
* limitations under the License.
*/
import fs from 'fs';
import {mkdirSync, writeFileSync} from 'fs';
import {dirname} from 'path';
/**
* Outputs the dummy package.json file to the path specified
* by the first argument.
*/
fs.writeFileSync(process.argv[2], `{"type": "module"}`);
mkdirSync(dirname(process.argv[2]), {recursive: true});
writeFileSync(process.argv[2], `{"type": "module"}`);