Skip to content

Commit

Permalink
Migrate to @cross/fs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Mar 27, 2024
2 parents bd8f31f + 0443bbb commit e9f5bad
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 30 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ jobs:
uses: cross-org/workflows/.github/workflows/deno-ci.yml@main
with:
entrypoint: mod.ts
lint_docs: false
bun_ci:
uses: cross-org/workflows/.github/workflows/bun-ci.yml@main
with:
jsr_dependencies: "@cross/test @std/assert @cross/runtime @cross/utils @std/path @cross/env"
jsr_dependencies: "@cross/test @std/assert @cross/runtime @cross/utils @std/path @cross/env @cross/fs"
node_ci:
uses: cross-org/workflows/.github/workflows/node-ci.yml@main
with:
jsr_dependencies: "@cross/test @std/assert @cross/runtime @cross/utils @std/path @cross/env"
jsr_dependencies: "@cross/test @std/assert @cross/runtime @cross/utils @std/path @cross/env @cross/fs"
test_target: "test/**/*.test.ts" # Optional
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"imports": {
"@cross/env": "jsr:@cross/env@^1.0.0",
"@cross/fs": "jsr:@cross/fs@^0.0.4",
"@cross/runtime": "jsr:@cross/runtime@^1.0.0",
"@cross/test": "jsr:@cross/test@^0.0.9",
"@cross/utils": "jsr:@cross/utils@^0.8.2",
Expand Down
5 changes: 2 additions & 3 deletions lib/managers/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
* @license MIT
*/

import { exists } from "../utils/exists.ts";
import { exists, mktempdir, writeFile } from "@cross/fs";
import { InstallServiceOptions, UninstallServiceOptions } from "../service.ts";
import { getEnv } from "@cross/env";
import { join } from "@std/path";
import { mkdtemp, writeFile } from "node:fs/promises";
import { ServiceInstallResult, ServiceUninstallResult } from "../result.ts";

const initScriptTemplate = `#!/bin/sh
Expand Down Expand Up @@ -107,7 +106,7 @@ class InitService {
};
} else {
// Store temporary file
const tempFilePathDir = await mkdtemp("svcinstall");
const tempFilePathDir = await mktempdir("svcinstall");
const tempFilePath = join(tempFilePathDir, "svc-init");
await writeFile(tempFilePath, initScriptContent);
let manualSteps = "";
Expand Down
3 changes: 1 addition & 2 deletions lib/managers/launchd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* @file lib/managers/launchd.ts
* @license MIT
*/
import { exists } from "../utils/exists.ts";
import { exists, mkdir, unlink, writeFile } from "@cross/fs";
import { InstallServiceOptions, UninstallServiceOptions } from "../service.ts";
import { dirname } from "@std/path";
import { cwd } from "@cross/utils";
import { mkdir, unlink, writeFile } from "node:fs/promises";
import { getEnv } from "@cross/env";
import { ServiceInstallResult, ServiceUninstallResult } from "../result.ts";

Expand Down
5 changes: 2 additions & 3 deletions lib/managers/systemd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
* @license MIT
*/

import { exists } from "../utils/exists.ts";
import { exists, mkdir, mktempdir, unlink, writeFile } from "@cross/fs";
import { InstallServiceOptions, UninstallServiceOptions } from "../service.ts";
import { dirname, join } from "@std/path";
import { cwd, spawn } from "@cross/utils";
import { mkdir, mkdtemp, unlink, writeFile } from "node:fs/promises";
import { getEnv } from "@cross/env";
import { ServiceInstallResult, ServiceUninstallResult } from "../result.ts";

Expand Down Expand Up @@ -75,7 +74,7 @@ class SystemdService {
};
} else if (config.system) {
// Store temporary file
const tempFilePath = await mkdtemp("svcinstall");
const tempFilePath = await mktempdir("svcinstall");
await writeFile(join(tempFilePath, "cfg"), serviceFileContent);
let manualSteps = "";
manualSteps += "\Service installer do not have (and should not have) root permissions, so the next steps have to be carried out manually.";
Expand Down
5 changes: 2 additions & 3 deletions lib/managers/upstart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
* @license MIT
*/

import { exists } from "../utils/exists.ts";
import { exists, mktempdir, unlink, writeFile } from "@cross/fs";
import { InstallServiceOptions, UninstallServiceOptions } from "../service.ts";
import { getEnv } from "@cross/env";
import { mkdtemp, unlink, writeFile } from "node:fs/promises";
import { join } from "@std/path";
import { ServiceInstallResult, ServiceUninstallResult } from "../result.ts";

Expand Down Expand Up @@ -89,7 +88,7 @@ class UpstartService {
};
} else {
// Store temporary file
const tempFileDir = await mkdtemp("svc-installer");
const tempFileDir = await mktempdir("svc-installer");
const tempFilePath = join(tempFileDir, "svc-upstart");
await writeFile(tempFilePath, upstartFileContent);
let manualSteps = "";
Expand Down
3 changes: 1 addition & 2 deletions lib/managers/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* @license MIT
*/

import { exists } from "../utils/exists.ts";
import { exists, mkdir, unlink, writeFile } from "@cross/fs";
import { InstallServiceOptions, UninstallServiceOptions } from "../service.ts";
import { mkdir, unlink, writeFile } from "node:fs/promises";
import { cwd, spawn } from "@cross/utils";
import { ServiceInstallResult, ServiceUninstallResult } from "../result.ts";

Expand Down
15 changes: 0 additions & 15 deletions lib/utils/exists.ts

This file was deleted.

0 comments on commit e9f5bad

Please sign in to comment.