mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: move create-playwright build to build.js infra (#9687)
Co-authored-by: Joel Einbinder <joel.einbinder@gmail.com>
This commit is contained in:
parent
ea7a294924
commit
94d1fcf835
@ -11,9 +11,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: packages/create-playwright/
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
@ -23,6 +20,6 @@ jobs:
|
|||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- run: npm i -g npm@7
|
- run: npm i -g npm@7
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm i --no-save @playwright/test
|
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run test
|
- run: npm run test
|
||||||
|
working-directory: packages/create-playwright/
|
||||||
|
|||||||
29
package-lock.json
generated
29
package-lock.json
generated
@ -39,6 +39,7 @@
|
|||||||
"@types/yazl": "^2.4.2",
|
"@types/yazl": "^2.4.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.31.2",
|
"@typescript-eslint/eslint-plugin": "^4.31.2",
|
||||||
"@typescript-eslint/parser": "^4.31.2",
|
"@typescript-eslint/parser": "^4.31.2",
|
||||||
|
"@vercel/ncc": "^0.31.1",
|
||||||
"@zip.js/zip.js": "^2.3.17",
|
"@zip.js/zip.js": "^2.3.17",
|
||||||
"ansi-to-html": "^0.7.1",
|
"ansi-to-html": "^0.7.1",
|
||||||
"babel-loader": "^8.2.2",
|
"babel-loader": "^8.2.2",
|
||||||
@ -50,6 +51,7 @@
|
|||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.2",
|
||||||
"css-loader": "^6.4.0",
|
"css-loader": "^6.4.0",
|
||||||
"electron": "^12.2.1",
|
"electron": "^12.2.1",
|
||||||
|
"enquirer": "^2.3.6",
|
||||||
"eslint": "^7.31.0",
|
"eslint": "^7.31.0",
|
||||||
"eslint-plugin-notice": "^0.9.10",
|
"eslint-plugin-notice": "^0.9.10",
|
||||||
"eslint-plugin-react-hooks": "^4.2.0",
|
"eslint-plugin-react-hooks": "^4.2.0",
|
||||||
@ -1653,9 +1655,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vercel/ncc": {
|
"node_modules/@vercel/ncc": {
|
||||||
"version": "0.30.0",
|
"version": "0.31.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.30.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.31.1.tgz",
|
||||||
"integrity": "sha512-16ePj2GkwjomvE0HLL5ny+d+sudOwvZNYW8vjpMh3cyWdFxoMI8KSQiolVxeHBULbU1C5mVxLK5nL9NtnnpIew==",
|
"integrity": "sha512-g0FAxwdViI6UzsiVz5HssIHqjcPa1EHL6h+2dcJD893SoCJaGdqqgUF09xnMW6goWnnhbLvgiKlgJWrJa+7qYA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"ncc": "dist/ncc/cli.js"
|
"ncc": "dist/ncc/cli.js"
|
||||||
@ -9307,6 +9309,15 @@
|
|||||||
"integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==",
|
"integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"packages/create-playwright/node_modules/@vercel/ncc": {
|
||||||
|
"version": "0.30.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.30.0.tgz",
|
||||||
|
"integrity": "sha512-16ePj2GkwjomvE0HLL5ny+d+sudOwvZNYW8vjpMh3cyWdFxoMI8KSQiolVxeHBULbU1C5mVxLK5nL9NtnnpIew==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"ncc": "dist/ncc/cli.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"packages/playwright": {
|
"packages/playwright": {
|
||||||
"version": "1.17.0-next",
|
"version": "1.17.0-next",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
@ -10705,9 +10716,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@vercel/ncc": {
|
"@vercel/ncc": {
|
||||||
"version": "0.30.0",
|
"version": "0.31.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.30.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.31.1.tgz",
|
||||||
"integrity": "sha512-16ePj2GkwjomvE0HLL5ny+d+sudOwvZNYW8vjpMh3cyWdFxoMI8KSQiolVxeHBULbU1C5mVxLK5nL9NtnnpIew==",
|
"integrity": "sha512-g0FAxwdViI6UzsiVz5HssIHqjcPa1EHL6h+2dcJD893SoCJaGdqqgUF09xnMW6goWnnhbLvgiKlgJWrJa+7qYA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@webassemblyjs/ast": {
|
"@webassemblyjs/ast": {
|
||||||
@ -11816,6 +11827,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz",
|
||||||
"integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==",
|
"integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"@vercel/ncc": {
|
||||||
|
"version": "0.30.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.30.0.tgz",
|
||||||
|
"integrity": "sha512-16ePj2GkwjomvE0HLL5ny+d+sudOwvZNYW8vjpMh3cyWdFxoMI8KSQiolVxeHBULbU1C5mVxLK5nL9NtnnpIew==",
|
||||||
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -68,6 +68,7 @@
|
|||||||
"@types/yazl": "^2.4.2",
|
"@types/yazl": "^2.4.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.31.2",
|
"@typescript-eslint/eslint-plugin": "^4.31.2",
|
||||||
"@typescript-eslint/parser": "^4.31.2",
|
"@typescript-eslint/parser": "^4.31.2",
|
||||||
|
"@vercel/ncc": "^0.31.1",
|
||||||
"@zip.js/zip.js": "^2.3.17",
|
"@zip.js/zip.js": "^2.3.17",
|
||||||
"ansi-to-html": "^0.7.1",
|
"ansi-to-html": "^0.7.1",
|
||||||
"babel-loader": "^8.2.2",
|
"babel-loader": "^8.2.2",
|
||||||
@ -79,6 +80,7 @@
|
|||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.2",
|
||||||
"css-loader": "^6.4.0",
|
"css-loader": "^6.4.0",
|
||||||
"electron": "^12.2.1",
|
"electron": "^12.2.1",
|
||||||
|
"enquirer": "^2.3.6",
|
||||||
"eslint": "^7.31.0",
|
"eslint": "^7.31.0",
|
||||||
"eslint-plugin-notice": "^0.9.10",
|
"eslint-plugin-notice": "^0.9.10",
|
||||||
"eslint-plugin-react-hooks": "^4.2.0",
|
"eslint-plugin-react-hooks": "^4.2.0",
|
||||||
|
|||||||
183
packages/create-playwright/package-lock.json
generated
183
packages/create-playwright/package-lock.json
generated
@ -1,183 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "create-playwright",
|
|
||||||
"version": "0.1.7",
|
|
||||||
"lockfileVersion": 2,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"version": "0.1.7",
|
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
|
||||||
"create-playwright": "index.js"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@playwright/test": "file:../playwright-test",
|
|
||||||
"@types/node": "^16.9.0",
|
|
||||||
"@vercel/ncc": "^0.30.0",
|
|
||||||
"enquirer": "^2.3.6",
|
|
||||||
"typescript": "^4.4.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"../playwright-test": {
|
|
||||||
"name": "@playwright/test",
|
|
||||||
"version": "1.17.0-next",
|
|
||||||
"dev": true,
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/code-frame": "^7.14.5",
|
|
||||||
"@babel/core": "^7.14.8",
|
|
||||||
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-dynamic-import": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-export-namespace-from": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-logical-assignment-operators": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-numeric-separator": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-private-methods": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-private-property-in-object": "^7.14.5",
|
|
||||||
"@babel/plugin-syntax-async-generators": "^7.8.4",
|
|
||||||
"@babel/plugin-syntax-json-strings": "^7.8.3",
|
|
||||||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
|
|
||||||
"@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
|
|
||||||
"@babel/plugin-transform-modules-commonjs": "^7.14.5",
|
|
||||||
"@babel/preset-typescript": "^7.14.5",
|
|
||||||
"colors": "^1.4.0",
|
|
||||||
"expect": "^27.2.5",
|
|
||||||
"jest-matcher-utils": "^27.2.5",
|
|
||||||
"minimatch": "^3.0.3",
|
|
||||||
"ms": "^2.1.2",
|
|
||||||
"open": "^8.3.0",
|
|
||||||
"pirates": "^4.0.1",
|
|
||||||
"pixelmatch": "^5.2.1",
|
|
||||||
"playwright-core": "=1.17.0-next",
|
|
||||||
"source-map-support": "^0.4.18"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@playwright/test": {
|
|
||||||
"resolved": "../playwright-test",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/@types/node": {
|
|
||||||
"version": "16.9.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.0.tgz",
|
|
||||||
"integrity": "sha512-nmP+VR4oT0pJUPFbKE4SXj3Yb4Q/kz3M9dSAO1GGMebRKWHQxLfDNmU/yh3xxCJha3N60nQ/JwXWwOE/ZSEVag==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@vercel/ncc": {
|
|
||||||
"version": "0.30.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.30.0.tgz",
|
|
||||||
"integrity": "sha512-16ePj2GkwjomvE0HLL5ny+d+sudOwvZNYW8vjpMh3cyWdFxoMI8KSQiolVxeHBULbU1C5mVxLK5nL9NtnnpIew==",
|
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
|
||||||
"ncc": "dist/ncc/cli.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ansi-colors": {
|
|
||||||
"version": "4.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
|
|
||||||
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/enquirer": {
|
|
||||||
"version": "2.3.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
|
|
||||||
"integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-colors": "^4.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/typescript": {
|
|
||||||
"version": "4.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
|
||||||
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
|
||||||
"tsc": "bin/tsc",
|
|
||||||
"tsserver": "bin/tsserver"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4.2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@playwright/test": {
|
|
||||||
"version": "file:../playwright-test",
|
|
||||||
"requires": {
|
|
||||||
"@babel/code-frame": "^7.14.5",
|
|
||||||
"@babel/core": "^7.14.8",
|
|
||||||
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-dynamic-import": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-export-namespace-from": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-logical-assignment-operators": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-numeric-separator": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-private-methods": "^7.14.5",
|
|
||||||
"@babel/plugin-proposal-private-property-in-object": "^7.14.5",
|
|
||||||
"@babel/plugin-syntax-async-generators": "^7.8.4",
|
|
||||||
"@babel/plugin-syntax-json-strings": "^7.8.3",
|
|
||||||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
|
|
||||||
"@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
|
|
||||||
"@babel/plugin-transform-modules-commonjs": "^7.14.5",
|
|
||||||
"@babel/preset-typescript": "^7.14.5",
|
|
||||||
"colors": "^1.4.0",
|
|
||||||
"expect": "^27.2.5",
|
|
||||||
"jest-matcher-utils": "^27.2.5",
|
|
||||||
"minimatch": "^3.0.3",
|
|
||||||
"ms": "^2.1.2",
|
|
||||||
"open": "^8.3.0",
|
|
||||||
"pirates": "^4.0.1",
|
|
||||||
"pixelmatch": "^5.2.1",
|
|
||||||
"playwright-core": "=1.17.0-next",
|
|
||||||
"source-map-support": "^0.4.18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@types/node": {
|
|
||||||
"version": "16.9.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.0.tgz",
|
|
||||||
"integrity": "sha512-nmP+VR4oT0pJUPFbKE4SXj3Yb4Q/kz3M9dSAO1GGMebRKWHQxLfDNmU/yh3xxCJha3N60nQ/JwXWwOE/ZSEVag==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@vercel/ncc": {
|
|
||||||
"version": "0.30.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.30.0.tgz",
|
|
||||||
"integrity": "sha512-16ePj2GkwjomvE0HLL5ny+d+sudOwvZNYW8vjpMh3cyWdFxoMI8KSQiolVxeHBULbU1C5mVxLK5nL9NtnnpIew==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"ansi-colors": {
|
|
||||||
"version": "4.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
|
|
||||||
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"enquirer": {
|
|
||||||
"version": "2.3.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
|
|
||||||
"integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"ansi-colors": "^4.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typescript": {
|
|
||||||
"version": "4.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
|
||||||
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -14,15 +14,6 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": "npm run build",
|
|
||||||
"watch": "cd src && ncc build cli.ts --watch --out ../lib && cd ..",
|
|
||||||
"build": "cd src && ncc build cli.ts --minify --out ../lib && cd ..",
|
|
||||||
"test": "npx playwright test"
|
"test": "npx playwright test"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^16.9.0",
|
|
||||||
"@vercel/ncc": "^0.30.0",
|
|
||||||
"enquirer": "^2.3.6",
|
|
||||||
"typescript": "^4.4.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,20 +28,43 @@ const { packages } = require('../list_packages');
|
|||||||
* args: string[],
|
* args: string[],
|
||||||
* shell: boolean,
|
* shell: boolean,
|
||||||
* env?: NodeJS.ProcessEnv,
|
* env?: NodeJS.ProcessEnv,
|
||||||
|
* cwd?: string,
|
||||||
* }} Step
|
* }} Step
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Step[]}
|
* @typedef {{
|
||||||
|
* files: string,
|
||||||
|
* from: string,
|
||||||
|
* to: string,
|
||||||
|
* ignored?: string[],
|
||||||
|
* }} CopyFile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{
|
||||||
|
* committed: boolean,
|
||||||
|
* inputs: string[],
|
||||||
|
* mustExist?: string[],
|
||||||
|
* script: string,
|
||||||
|
* }} OnChange
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {Step[]} */
|
||||||
const steps = [];
|
const steps = [];
|
||||||
|
/** @type {OnChange[]} */
|
||||||
const onChanges = [];
|
const onChanges = [];
|
||||||
|
/** @type {CopyFile[]} */
|
||||||
const copyFiles = [];
|
const copyFiles = [];
|
||||||
|
|
||||||
const watchMode = process.argv.slice(2).includes('--watch');
|
const watchMode = process.argv.slice(2).includes('--watch');
|
||||||
const lintMode = process.argv.slice(2).includes('--lint');
|
const lintMode = process.argv.slice(2).includes('--lint');
|
||||||
const ROOT = path.join(__dirname, '..', '..');
|
const ROOT = path.join(__dirname, '..', '..');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} relative
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
function filePath(relative) {
|
function filePath(relative) {
|
||||||
return path.join(ROOT, ...relative.split('/'));
|
return path.join(ROOT, ...relative.split('/'));
|
||||||
}
|
}
|
||||||
@ -66,13 +89,17 @@ async function runWatch() {
|
|||||||
copyFile(file, from, to);
|
copyFile(file, from, to);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/** @type{import('child_process').ChildProcess[]} */
|
||||||
const spawns = [];
|
const spawns = [];
|
||||||
for (const step of steps)
|
for (const step of steps)
|
||||||
spawns.push(child_process.spawn(step.command, step.args, {
|
spawns.push(child_process.spawn(step.command, step.args, {
|
||||||
stdio: 'inherit', shell: step.shell, env: {
|
stdio: 'inherit',
|
||||||
|
shell: step.shell,
|
||||||
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
...step.env,
|
...step.env,
|
||||||
}
|
},
|
||||||
|
cwd: step.cwd,
|
||||||
}));
|
}));
|
||||||
process.on('exit', () => spawns.forEach(s => s.kill()));
|
process.on('exit', () => spawns.forEach(s => s.kill()));
|
||||||
for (const onChange of onChanges)
|
for (const onChange of onChanges)
|
||||||
@ -85,10 +112,13 @@ async function runBuild() {
|
|||||||
*/
|
*/
|
||||||
function runStep(step) {
|
function runStep(step) {
|
||||||
const out = child_process.spawnSync(step.command, step.args, {
|
const out = child_process.spawnSync(step.command, step.args, {
|
||||||
stdio: 'inherit', shell: step.shell, env: {
|
stdio: 'inherit',
|
||||||
|
shell: step.shell,
|
||||||
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
...step.env
|
...step.env
|
||||||
}
|
},
|
||||||
|
cwd: step.cwd,
|
||||||
});
|
});
|
||||||
if (out.status)
|
if (out.status)
|
||||||
process.exit(out.status);
|
process.exit(out.status);
|
||||||
@ -112,6 +142,11 @@ async function runBuild() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} file
|
||||||
|
* @param {string} from
|
||||||
|
* @param {string} to
|
||||||
|
*/
|
||||||
function copyFile(file, from, to) {
|
function copyFile(file, from, to) {
|
||||||
const destination = path.resolve(filePath(to), path.relative(filePath(from), file));
|
const destination = path.resolve(filePath(to), path.relative(filePath(from), file));
|
||||||
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
||||||
@ -141,6 +176,8 @@ for (const file of webPackFiles) {
|
|||||||
for (const packageDir of packages) {
|
for (const packageDir of packages) {
|
||||||
if (!fs.existsSync(path.join(packageDir, 'src')))
|
if (!fs.existsSync(path.join(packageDir, 'src')))
|
||||||
continue;
|
continue;
|
||||||
|
if (path.basename(packageDir) === 'create-playwright')
|
||||||
|
continue;
|
||||||
steps.push({
|
steps.push({
|
||||||
command: 'npx',
|
command: 'npx',
|
||||||
args: [
|
args: [
|
||||||
@ -148,7 +185,7 @@ for (const packageDir of packages) {
|
|||||||
...(watchMode ? ['-w', '--source-maps'] : []),
|
...(watchMode ? ['-w', '--source-maps'] : []),
|
||||||
'--extensions', '.ts',
|
'--extensions', '.ts',
|
||||||
'--out-dir', path.join(packageDir, 'lib'),
|
'--out-dir', path.join(packageDir, 'lib'),
|
||||||
'--ignore', 'packages/playwright-core/src/server/injected/**/*',
|
'--ignore', '"packages/playwright-core/src/server/injected/**/*","packages/create-playwright/**/*"',
|
||||||
path.join(packageDir, 'src')],
|
path.join(packageDir, 'src')],
|
||||||
shell: true,
|
shell: true,
|
||||||
});
|
});
|
||||||
@ -225,4 +262,12 @@ if (lintMode) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create-playwright package
|
||||||
|
steps.push({
|
||||||
|
command: 'npx',
|
||||||
|
args: ['ncc', 'build', 'cli.ts', (watchMode ? '--watch' : '--minify'), '--out', '../lib'],
|
||||||
|
shell: true,
|
||||||
|
cwd: 'packages/create-playwright/src'
|
||||||
|
});
|
||||||
|
|
||||||
watchMode ? runWatch() : runBuild();
|
watchMode ? runWatch() : runBuild();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user