Skip to content

Commit 16714ff

Browse files
authored
Merge pull request #12 from FlutterGen/fix-executable
fix: executable mode
2 parents 1818ba8 + 543667e commit 16714ff

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

dist/index.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -63745,7 +63745,7 @@ var tool_cache = __toESM(require_tool_cache(), 1);
6374563745
var cache = __toESM(require_cache2(), 1);
6374663746
var import_semver = __toESM(require_semver3(), 1);
6374763747
import {existsSync, readFileSync as readFileSync3, chmodSync} from "fs";
63748-
import {join} from "path";
63748+
import {join, dirname} from "path";
6374963749
async function run() {
6375063750
try {
6375163751
checkPlatformCompatibility();
@@ -63780,7 +63780,10 @@ async function run() {
6378063780
const installedPath = await installFlutterGen(version, cacheEnabled, cacheKey, cachePath);
6378163781
core2.info(`FlutterGen installed: ${installedPath}`);
6378263782
await makeExecutable(installedPath);
63783-
await execa("fluttergen", ["--version"], { stdio: "inherit" });
63783+
const { stdout } = await execa("fluttergen", ["--version"]);
63784+
if (stdout !== `FlutterGen v${version}`) {
63785+
throw new Error(`commnad doesn't work as expected: ${stdout}`);
63786+
}
6378463787
core2.setOutput("version", version);
6378563788
} catch (error2) {
6378663789
if (error2 instanceof Error) {
@@ -63835,9 +63838,9 @@ async function installFlutterGen(version, cacheEnabled, cacheKey, cachePath) {
6383563838
}
6383663839
async function makeExecutable(installedPath) {
6383763840
const fluttergenPath = join(installedPath, "fluttergen");
63838-
chmodSync(fluttergenPath, 755);
63839-
core2.addPath(installedPath);
63841+
chmodSync(fluttergenPath, "755");
63842+
core2.addPath(dirname(fluttergenPath));
6384063843
}
6384163844
run();
6384263845

63843-
//# debugId=2ECF789E3C76642064756E2164756E21
63846+
//# debugId=882A08D3CC4BC75964756E2164756E21

dist/index.js.map

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getInput, setOutput, setFailed, info, addPath } from '@actions/core';
33
import { downloadTool, extractTar } from '@actions/tool-cache';
44
import { restoreCache, saveCache } from '@actions/cache';
55
import { existsSync, readFileSync, chmodSync } from 'fs';
6-
import { join } from 'path';
6+
import { join, dirname } from 'path';
77
import { valid } from 'semver';
88

99
async function run() {
@@ -50,7 +50,10 @@ async function run() {
5050

5151
await makeExecutable(installedPath);
5252

53-
await execa('fluttergen', ['--version'], { stdio: 'inherit' });
53+
const { stdout } = await execa('fluttergen', ['--version']);
54+
if (stdout !== `FlutterGen v${version}`) {
55+
throw new Error(`commnad doesn't work as expected: ${stdout}`);
56+
}
5457

5558
setOutput('version', version);
5659
} catch (error) {
@@ -120,8 +123,8 @@ async function installFlutterGen(
120123

121124
async function makeExecutable(installedPath: string): Promise<void> {
122125
const fluttergenPath = join(installedPath, 'fluttergen');
123-
chmodSync(fluttergenPath, 755);
124-
addPath(installedPath);
126+
chmodSync(fluttergenPath, '755');
127+
addPath(dirname(fluttergenPath));
125128
}
126129

127130
run();

0 commit comments

Comments
 (0)