Skip to content

Commit 9401830

Browse files
authored
fix: Run npm format (#42)
The linting rules were not run on a specific change. This formats things to clean up the codebase
1 parent 78f7227 commit 9401830

File tree

3 files changed

+76
-128
lines changed

3 files changed

+76
-128
lines changed

code-build.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
inputs2Parameters,
1414
githubInputs,
1515
buildSdk,
16-
logName
16+
logName,
1717
};
1818

1919
function runBuild() {
@@ -39,7 +39,7 @@ async function waitForBuildEndTime(sdk, { id, logs }, nextToken) {
3939
codeBuild,
4040
cloudWatchLogs,
4141
wait = 1000 * 30,
42-
backOff = 1000 * 15
42+
backOff = 1000 * 15,
4343
} = sdk;
4444

4545
// Get the CloudWatchLog info
@@ -56,8 +56,8 @@ async function waitForBuildEndTime(sdk, { id, logs }, nextToken) {
5656
logGroupName &&
5757
cloudWatchLogs
5858
.getLogEvents({ logGroupName, logStreamName, startFromHead, nextToken })
59-
.promise()
60-
]).catch(err => {
59+
.promise(),
60+
]).catch((err) => {
6161
errObject = err;
6262
/* Returning [] here so that the assignment above
6363
* does not throw `TypeError: undefined is not iterable`.
@@ -74,7 +74,7 @@ async function waitForBuildEndTime(sdk, { id, logs }, nextToken) {
7474
let newWait = wait + backOff;
7575

7676
//Sleep before trying again
77-
await new Promise(resolve => setTimeout(resolve, newWait));
77+
await new Promise((resolve) => setTimeout(resolve, newWait));
7878

7979
// Try again from the same token position
8080
return waitForBuildEndTime(
@@ -102,7 +102,7 @@ async function waitForBuildEndTime(sdk, { id, logs }, nextToken) {
102102
if (current.endTime && !events.length) return current;
103103

104104
// More to do: Sleep for a few seconds to avoid rate limiting
105-
await new Promise(resolve => setTimeout(resolve, wait));
105+
await new Promise((resolve) => setTimeout(resolve, wait));
106106

107107
// Try again
108108
return waitForBuildEndTime(sdk, current, nextForwardToken);
@@ -121,16 +121,16 @@ function githubInputs() {
121121
const envPassthrough = core
122122
.getInput("env-vars-for-codebuild", { required: false })
123123
.split(",")
124-
.map(i => i.trim())
125-
.filter(i => i !== "");
124+
.map((i) => i.trim())
125+
.filter((i) => i !== "");
126126

127127
return {
128128
projectName,
129129
owner,
130130
repo,
131131
sourceVersion,
132132
buildspecOverride,
133-
envPassthrough
133+
envPassthrough,
134134
};
135135
}
136136

@@ -141,7 +141,7 @@ function inputs2Parameters(inputs) {
141141
repo,
142142
sourceVersion,
143143
buildspecOverride,
144-
envPassthrough = []
144+
envPassthrough = [],
145145
} = inputs;
146146

147147
const sourceTypeOverride = "GITHUB";
@@ -161,17 +161,17 @@ function inputs2Parameters(inputs) {
161161
sourceTypeOverride,
162162
sourceLocationOverride,
163163
buildspecOverride,
164-
environmentVariablesOverride
164+
environmentVariablesOverride,
165165
};
166166
}
167167

168168
function buildSdk() {
169169
const codeBuild = new aws.CodeBuild({
170-
customUserAgent: "aws-actions/aws-codebuild-run-build"
170+
customUserAgent: "aws-actions/aws-codebuild-run-build",
171171
});
172172

173173
const cloudWatchLogs = new aws.CloudWatchLogs({
174-
customUserAgent: "aws-actions/aws-codebuild-run-build"
174+
customUserAgent: "aws-actions/aws-codebuild-run-build",
175175
});
176176

177177
assert(
@@ -189,7 +189,7 @@ function logName(Arn) {
189189
if (logGroupName === "null" || logStreamName === "null")
190190
return {
191191
logGroupName: undefined,
192-
logStreamName: undefined
192+
logStreamName: undefined,
193193
};
194194
return { logGroupName, logStreamName };
195195
}

local.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ const { projectName, buildspecOverride, envPassthrough, remote } = yargs
1313
alias: "p",
1414
describe: "AWS CodeBuild Project Name",
1515
demandOption: true,
16-
type: "string"
16+
type: "string",
1717
})
1818
.option("buildspec-override", {
1919
alias: "b",
2020
describe: "Path to buildspec file",
21-
type: "string"
21+
type: "string",
2222
})
2323
.option("env-vars-for-codebuild", {
2424
alias: "e",
2525
describe: "List of environment variables to send to CodeBuild",
26-
type: "array"
26+
type: "array",
2727
})
2828
.option("remote", {
2929
alias: "r",
3030
describe: "remote name to publish to",
3131
default: "origin",
32-
type: "string"
32+
type: "string",
3333
}).argv;
3434

3535
const BRANCH_NAME = uuid();
@@ -39,7 +39,7 @@ const params = cb.inputs2Parameters({
3939
...githubInfo(remote),
4040
sourceVersion: BRANCH_NAME,
4141
buildspecOverride,
42-
envPassthrough
42+
envPassthrough,
4343
});
4444

4545
const sdk = cb.buildSdk();
@@ -48,7 +48,7 @@ pushBranch(remote, BRANCH_NAME);
4848

4949
cb.build(sdk, params)
5050
.then(() => deleteBranch(remote, BRANCH_NAME))
51-
.catch(err => {
51+
.catch((err) => {
5252
deleteBranch(remote, BRANCH_NAME);
5353
throw err;
5454
});
@@ -79,7 +79,7 @@ function githubInfo(remote) {
7979
.execSync("git remote -v")
8080
.toString()
8181
.split("\n")
82-
.filter(line => line.trim().match(remoteMatch));
82+
.filter((line) => line.trim().match(remoteMatch));
8383
assert(gitRemote, `No remote found named ${remote}`);
8484
const [, url] = gitRemote.split(/[\t ]/);
8585
if (url.startsWith(gitHubHTTPS)) {

0 commit comments

Comments
 (0)