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" "node": ">=14.1.0"
}, },
"scripts": { "scripts": {
"build:docs": "wireit",
"build:tsc": "wireit", "build:tsc": "wireit",
"build:types": "wireit", "build:types": "wireit",
"build:docs": "wireit",
"build": "wireit", "build": "wireit",
"check": "tsx tools/ensure-correct-devtools-protocol-package", "check": "tsx tools/ensure-correct-devtools-protocol-package",
"format:types": "wireit", "clean": "tsc -b --clean && rimraf lib src/generated",
"generate:package-json": "wireit", "generate:package-json": "wireit",
"generate:sources": "wireit", "generate:sources": "wireit",
"prepack": "wireit", "prepack": "wireit"
"clean": "tsc -b --clean && rimraf lib src/generated"
}, },
"wireit": { "wireit": {
"prepack": { "prepack": {
@ -58,8 +57,7 @@
"build": { "build": {
"dependencies": [ "dependencies": [
"build:tsc", "build:tsc",
"format:types", "build:types"
"generate:package-json"
] ]
}, },
"generate:sources": { "generate:sources": {
@ -76,9 +74,6 @@
}, },
"generate:package-json": { "generate:package-json": {
"command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json", "command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json",
"dependencies": [
"build:tsc"
],
"files": [ "files": [
"../../tools/generate_module_package_json.ts" "../../tools/generate_module_package_json.ts"
], ],
@ -86,58 +81,46 @@
"lib/esm/package.json" "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": { "build:docs": {
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"", "command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
"files": [ "files": [
"tsconfig.json",
"api-extractor.docs.json", "api-extractor.docs.json",
"lib/esm/puppeteer/puppeteer-core.d.ts" "lib/esm/puppeteer/puppeteer-core.d.ts",
"tsconfig.json"
], ],
"dependencies": [ "dependencies": [
"build:tsc" "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": { "build:tsc": {
"command": "tsc -b && rollup --config rollup.third_party.config.mjs", "command": "tsc -b && rollup --config rollup.third_party.config.mjs",
"clean": "if-file-deleted", "clean": "if-file-deleted",
"dependencies": [ "dependencies": [
"generate:package-json",
"generate:sources" "generate:sources"
], ],
"files": [ "files": [
"rollup.third_party.config.mjs", "{compat,src,third_party}/**",
"**/tsconfig{.*,}.json", "rollup.third_party.config.mjs"
"{compat,src,third_party}/**/*.ts"
], ],
"output": [ "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" "node": ">=14.1.0"
}, },
"scripts": { "scripts": {
"build:docs": "wireit",
"build:tsc": "wireit", "build:tsc": "wireit",
"build:types": "wireit", "build:types": "wireit",
"build:docs": "wireit",
"build": "wireit", "build": "wireit",
"clean": "tsc -b --clean && rimraf lib", "clean": "tsc -b --clean && rimraf lib",
"format:types": "wireit",
"generate:package-json": "wireit", "generate:package-json": "wireit",
"postinstall": "node install.js", "postinstall": "node install.js",
"prepack": "wireit" "prepack": "wireit"
@ -57,15 +56,11 @@
"build": { "build": {
"dependencies": [ "dependencies": [
"build:tsc", "build:tsc",
"format:types", "build:types"
"generate:package-json"
] ]
}, },
"generate:package-json": { "generate:package-json": {
"command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json", "command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json",
"dependencies": [
"build:tsc"
],
"files": [ "files": [
"../../tools/generate_module_package_json.ts" "../../tools/generate_module_package_json.ts"
], ],
@ -73,40 +68,17 @@
"lib/esm/package.json" "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": { "build:docs": {
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"", "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": [ "dependencies": [
"build:tsc" "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": { "build:tsc": {
"command": "tsc -b", "command": "tsc -b",
"clean": "if-file-deleted", "clean": "if-file-deleted",
@ -114,11 +86,26 @@
"../puppeteer-core:build" "../puppeteer-core:build"
], ],
"files": [ "files": [
"**/tsconfig{.*,}.json",
"src/**" "src/**"
], ],
"output": [ "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", "description": "testing server",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
"build": "tsc -b", "build": "wireit",
"clean": "tsc -b --clean && rimraf lib" "clean": "tsc -b --clean && rimraf lib"
}, },
"wireit": {
"build": {
"command": "tsc -b",
"clean": "if-file-deleted",
"files": [
"src/**"
],
"output": [
"lib/**",
"tsconfig.tsbuildinfo"
]
}
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/puppeteer/puppeteer/tree/main/packages/testserver" "url": "https://github.com/puppeteer/puppeteer/tree/main/packages/testserver"

View File

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