Skip to content

Commit

Permalink
chore: fix build on win (#10022)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Apr 14, 2023
1 parent fe0c74b commit e3f8ff2
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/browsers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"wireit": {
"prepack": {
"command": "cp ../../README.md README.md",
"command": "tsx ../../tools/cp.ts ../../README.md README.md",
"files": [
"../../README.md"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"wireit": {
"prepack": {
"command": "cp ../../README.md README.md",
"command": "tsx ../../tools/cp.ts ../../README.md README.md",
"files": [
"../../README.md"
],
Expand Down
27 changes: 27 additions & 0 deletions tools/chmod.ts
Original file line number Diff line number Diff line change
@@ -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);
}
22 changes: 22 additions & 0 deletions tools/cp.ts
Original file line number Diff line number Diff line change
@@ -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]);

0 comments on commit e3f8ff2

Please sign in to comment.