chore: fix build on win (#10022)

This commit is contained in:
Alex Rudenko 2023-04-14 10:51:35 +02:00 committed by GitHub
parent fe0c74bd52
commit e3f8ff23c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 3 deletions

View File

@ -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"

View File

@ -46,7 +46,7 @@
},
"wireit": {
"prepack": {
"command": "cp ../../README.md README.md",
"command": "tsx ../../tools/cp.ts ../../README.md README.md",
"files": [
"../../README.md"
],

View File

@ -42,7 +42,7 @@
},
"wireit": {
"prepack": {
"command": "cp ../../README.md README.md",
"command": "tsx ../../tools/cp.ts ../../README.md README.md",
"files": [
"../../README.md"
],

27
tools/chmod.ts Normal file
View File

@ -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
tools/cp.ts Normal file
View File

@ -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]);