Skip to content

Commit 6545876

Browse files
committed
move source to ESM
1 parent e7f52a5 commit 6545876

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

.github/actions/surge-preview-tools/src/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import core from "@actions/core";
22
import github from "@actions/github";
3-
4-
const {checkLogin, getDeploys} = require("./surge-utils");
3+
import {checkLogin, getDeploys} from "./surge-utils"
54

65
try {
76
const payload = github.context.payload;

.github/actions/surge-preview-tools/src/surge-utils.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ import {execSync} from 'node:child_process'
55

66
const surgeCli = 'npx surge';
77

8-
function executeCmd(command) {
8+
const executeCmd = command => {
99
const result = execSync(command);
1010
return stripAnsi(result.toString()).trim();
11-
}
11+
};
1212

13-
const checkLogin = (surgeToken) => {
13+
export const checkLogin = (surgeToken) => {
1414
try {
15-
executeCmd(`${surgeCli} list --token ${surgeToken}`);
16-
return true;
15+
executeCmd(`${surgeCli} list --token ${surgeToken}`);
16+
return true;
1717
} catch (e) {
1818
return false;
1919
}
20-
}
20+
};
2121

2222
// Adapted here to pass the surge token
23-
function getDeploys(surgeToken) {
23+
export const getDeploys = surgeToken => {
2424
const surgeListOutput = executeCmd(`${surgeCli} list --token ${surgeToken}`);
2525
const lines =
2626
surgeListOutput
@@ -40,7 +40,5 @@ function getDeploys(surgeToken) {
4040
line
4141
};
4242
});
43-
}
43+
};
4444

45-
exports.getDeploys = getDeploys;
46-
exports.checkLogin = checkLogin;

0 commit comments

Comments
 (0)