Skip to content

Commit

Permalink
run eslint --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ueokande committed Sep 17, 2023
1 parent a23296e commit 6e7dab8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions __test__/edge_api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("EdgeUpdates", () => {
beforeEach(async () => {
const content = await fs.promises.readFile(
path.join(__dirname, "./testdata.json"),
"utf-8"
"utf-8",
);
updates = new EdgeUpdates(JSON.parse(content));
});
Expand All @@ -28,7 +28,7 @@ describe("EdgeUpdatesProduct", () => {
beforeEach(async () => {
const content = await fs.promises.readFile(
path.join(__dirname, "./testdata.json"),
"utf-8"
"utf-8",
);
updates = new EdgeUpdates(JSON.parse(content));
});
Expand Down Expand Up @@ -62,7 +62,7 @@ describe("EdgeUpdatesProductRelease", () => {
beforeEach(async () => {
const content = await fs.promises.readFile(
path.join(__dirname, "./testdata.json"),
"utf-8"
"utf-8",
);
updates = new EdgeUpdates(JSON.parse(content));
});
Expand Down
6 changes: 3 additions & 3 deletions src/edge_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class EdgeUpdatesProduct {
const release = this.json.Releases.find(
(r) =>
r.Platform === platformValue &&
(r.Architecture == "universal" || r.Architecture === archValue)
(r.Architecture == "universal" || r.Architecture === archValue),
);
if (release) {
return new EdgeUpdatesProductRelease(release);
Expand Down Expand Up @@ -113,12 +113,12 @@ export class EdgeUpdatesClient {
const resp = await http.getJson<EdgeUpdatesJSON>(url);
if (resp.statusCode !== httpm.HttpCodes.OK) {
throw new Error(
`Failed to get latest version: server returns ${resp.statusCode}`
`Failed to get latest version: server returns ${resp.statusCode}`,
);
}
if (resp.result === null) {
throw new Error(
"Failed to get latest version: server returns empty body"
"Failed to get latest version: server returns empty body",
);
}
return new EdgeUpdates(resp.result);
Expand Down
10 changes: 5 additions & 5 deletions src/installer_linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class LinuxInstaller implements Installer {
constructor(private readonly platform: Platform) {}

async checkInstalled(
version: versions.Version
version: versions.Version,
): Promise<InstallResult | undefined> {
const root = tc.find("msedge", version);
if (root) {
Expand All @@ -33,17 +33,17 @@ export class LinuxInstaller implements Installer {
const product = productVersions.getReleaseByPlatform(this.platform);
if (!product) {
throw new Error(
`Unsupported platform: ${this.platform.os} ${this.platform.arch}`
`Unsupported platform: ${this.platform.os} ${this.platform.arch}`,
);
}
const artifact = product.getPreferredArtifact();
if (!artifact) {
throw new Error(
`Artifact not found of Edge ${version} for platform ${this.platform.os} ${this.platform.arch}`
`Artifact not found of Edge ${version} for platform ${this.platform.os} ${this.platform.arch}`,
);
}
core.info(
`Acquiring ${version} (${product.ProductVersion}) from ${artifact.Location}`
`Acquiring ${version} (${product.ProductVersion}) from ${artifact.Location}`,
);
const archive = await tc.downloadTool(artifact.Location);

Expand All @@ -52,7 +52,7 @@ export class LinuxInstaller implements Installer {

async install(
version: versions.Version,
archive: string
archive: string,
): Promise<InstallResult> {
const tmpdir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "deb-"));
const extdir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "msedge-"));
Expand Down
14 changes: 7 additions & 7 deletions src/installer_mac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class MacInstaller implements Installer {
constructor(private readonly platform: Platform) {}

async checkInstalled(
version: versions.Version
version: versions.Version,
): Promise<InstallResult | undefined> {
const root = tc.find("msedge", version);
if (root) {
Expand All @@ -34,19 +34,19 @@ export class MacInstaller implements Installer {
const product = productVersions.getReleaseByPlatform(this.platform);
if (!product) {
throw new Error(
`Unsupported platform: ${this.platform.os} ${this.platform.arch}`
`Unsupported platform: ${this.platform.os} ${this.platform.arch}`,
);
}
const artifact = product.getPreferredArtifact();
if (!artifact) {
throw new Error(
`Artifact not found of Edge ${version} for platform ${this.platform.os} ${this.platform.arch}`
`Artifact not found of Edge ${version} for platform ${this.platform.os} ${this.platform.arch}`,
);
}
artifact.Location;

core.info(
`Acquiring ${version} (${product.ProductVersion}) from ${artifact.Location}`
`Acquiring ${version} (${product.ProductVersion}) from ${artifact.Location}`,
);
const archive = await tc.downloadTool(artifact.Location);

Expand All @@ -55,14 +55,14 @@ export class MacInstaller implements Installer {

async install(
version: versions.Version,
archive: string
archive: string,
): Promise<InstallResult> {
const extdir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "msedge-")); // /tmp/msedge-xxxxxx/

await exec.exec("xar", ["-xf", archive], { cwd: extdir });

const pkgdir = (await fs.promises.readdir(extdir)).filter(
(e) => e.startsWith("MicrosoftEdge") && e.endsWith(".pkg")
(e) => e.startsWith("MicrosoftEdge") && e.endsWith(".pkg"),
)[0];
if (!pkgdir) {
throw new Error('"MicrosoftEdge*.pkg" not found in extracted archive');
Expand All @@ -71,7 +71,7 @@ export class MacInstaller implements Installer {

await fs.promises.rename(
path.join(pkgroot, "Payload"),
path.join(pkgroot, "App.gz")
path.join(pkgroot, "App.gz"),
);
await exec.exec("gzip", ["--decompress", "App.gz"], { cwd: pkgroot });
await exec.exec("cpio", ["--extract", "--file", "App"], { cwd: pkgroot });
Expand Down
10 changes: 5 additions & 5 deletions src/installer_windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class WindowsInstaller implements Installer {
constructor(private readonly platform: Platform) {}

async checkInstalled(
version: versions.Version
version: versions.Version,
): Promise<InstallResult | undefined> {
const root = this.rootDir(version);
try {
Expand All @@ -48,15 +48,15 @@ export class WindowsInstaller implements Installer {

async install(
version: versions.Version,
archive: string
archive: string,
): Promise<InstallResult> {
// Use a native API to kill the process.
const p = cp.spawn(archive);
p.stdout.on("data", (data: Buffer) =>
process.stdout.write(data.toString())
process.stdout.write(data.toString()),
);
p.stderr.on("data", (data: Buffer) =>
process.stderr.write(data.toString())
process.stderr.write(data.toString()),
);

// Do not wait for the installer, as an installer for windows requires an
Expand Down Expand Up @@ -94,7 +94,7 @@ export class WindowsInstaller implements Installer {
case versions.CanaryVersion:
return path.join(
os.homedir(),
"AppData\\Local\\Microsoft\\Edge SxS\\Application"
"AppData\\Local\\Microsoft\\Edge SxS\\Application",
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from "fs";
export const waitInstall = (
path: string,
timeoutSec: number = 10 * 60,
checkIntervalSec = 5
checkIntervalSec = 5,
): Promise<void> => {
return new Promise((resolve, reject) => {
const resetTimers = () => {
Expand Down

0 comments on commit 6e7dab8

Please sign in to comment.