From feda3d95c50c642d85aa0e626ad0aa911548beee Mon Sep 17 00:00:00 2001 From: PythonCoderAS <13932583+PythonCoderAS@users.noreply.github.com> Date: Tue, 28 Jun 2022 22:42:33 -0400 Subject: [PATCH] Correctly make executable when not on windows --- package.json | 2 +- src/templates/cp.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a5681cd..75972a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-run-script", - "version": "1.1.2", + "version": "1.1.3", "description": "Run a script on multiple repositories, cloning them if needed.", "main": "dist/index.js", "type": "commonjs", diff --git a/src/templates/cp.ts b/src/templates/cp.ts index 8974e7a..b0c5228 100644 --- a/src/templates/cp.ts +++ b/src/templates/cp.ts @@ -1,4 +1,4 @@ -import { writeFile } from "fs/promises"; +import { chmod, writeFile } from "fs/promises"; import { GenerateTemplateCliFlags, Template } from "../types"; import { getOutputPath } from "../utils"; @@ -34,8 +34,7 @@ export default class CpTemplate implements Template { commit_message: string, flags: GenerateTemplateCliFlags ) => { - const templateString = ` -#!/bin/bash + const templateString = `#!/bin/bash $FILE="${source_file}" $RELATIVE_DEST="${dest_path}" $COMMIT_MESSAGE="${commit_message}" @@ -47,6 +46,9 @@ git push `; const outputPath = await getOutputPath(this, flags); await writeFile(outputPath, templateString); + if (process.platform !== "win32") { + await chmod(outputPath, "755"); + } console.log(`Output log written to: ${outputPath}`); }; }