diff --git a/packages/browsers/package.json b/packages/browsers/package.json index 2799fad34d6..9934bb44a96 100644 --- a/packages/browsers/package.json +++ b/packages/browsers/package.json @@ -23,7 +23,7 @@ }, "wireit": { "build": { - "command": "tsc -b && chmod a+x lib/cjs/main-cli.js lib/esm/main-cli.js", + "command": "tsc -b && tsx ../../tools/chmod.ts 755 lib/cjs/main-cli.js lib/esm/main-cli.js", "files": [ "src/**/*.ts", "tsconfig.json" diff --git a/packages/puppeteer-core/package.json b/packages/puppeteer-core/package.json index 81fdf61721b..2d62fbc69a8 100644 --- a/packages/puppeteer-core/package.json +++ b/packages/puppeteer-core/package.json @@ -46,7 +46,7 @@ }, "wireit": { "prepack": { - "command": "cp ../../README.md README.md", + "command": "tsx ../../tools/cp.ts ../../README.md README.md", "files": [ "../../README.md" ], diff --git a/packages/puppeteer/package.json b/packages/puppeteer/package.json index 3fed4478955..1157b4dca73 100644 --- a/packages/puppeteer/package.json +++ b/packages/puppeteer/package.json @@ -42,7 +42,7 @@ }, "wireit": { "prepack": { - "command": "cp ../../README.md README.md", + "command": "tsx ../../tools/cp.ts ../../README.md README.md", "files": [ "../../README.md" ], diff --git a/tools/chmod.ts b/tools/chmod.ts new file mode 100644 index 00000000000..89afe0f9e7d --- /dev/null +++ b/tools/chmod.ts @@ -0,0 +1,27 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; + +/** + * Calls chmod with the mode in argv[2] on paths in argv[3...length-1]. + */ + +const mode = process.argv[2]; + +for (let i = 3; i < process.argv.length; i++) { + fs.chmodSync(process.argv[i], mode); +} diff --git a/tools/cp.ts b/tools/cp.ts new file mode 100644 index 00000000000..438c6ccd547 --- /dev/null +++ b/tools/cp.ts @@ -0,0 +1,22 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; + +/** + * Copies single file in argv[2] to argv[3] + */ +fs.cpSync(process.argv[2], process.argv[3]);