Skip to content

Commit

Permalink
refactor: use process module instead of global variable (#784)
Browse files Browse the repository at this point in the history
* refactor: use `process` module instead of global variable

* ci: use npm@9 instead of npm@10
  • Loading branch information
ybiquitous committed Sep 2, 2023
1 parent ccf82df commit 4732c19
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
node-version-file: .node-version
cache: npm
- run: npm --global install npm@latest
- run: npm install --global npm@9
- run: npm ci
- run: git diff --exit-code # check dist/
- run: npm test --ignore-scripts
Expand Down
9 changes: 6 additions & 3 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10495,6 +10495,7 @@ var require_github = __commonJS({
});

// lib/index.js
var import_node_process3 = __toESM(require("node:process"), 1);
var core2 = __toESM(require_core(), 1);
var import_exec7 = __toESM(require_exec(), 1);

Expand Down Expand Up @@ -10892,9 +10893,10 @@ async function getDefaultBranch({ token, repository }) {
}

// lib/listPackages.js
var import_node_process = __toESM(require("node:process"), 1);
var import_exec5 = __toESM(require_exec(), 1);
async function listPackages(options = {}) {
const cwd = options.cwd || process.cwd();
const cwd = options.cwd || import_node_process.default.cwd();
const { exitCode, stdout, stderr } = await (0, import_exec5.getExecOutput)(
"npm",
npmArgs("ls", "--parseable", "--long", "--all", "--package-lock-only"),
Expand All @@ -10921,6 +10923,7 @@ async function listPackages(options = {}) {
}

// lib/updateNpm.js
var import_node_process2 = __toESM(require("node:process"), 1);
var core = __toESM(require_core(), 1);
var import_exec6 = __toESM(require_exec(), 1);
async function updateNpm(version2) {
Expand All @@ -10932,7 +10935,7 @@ async function updateNpm(version2) {
await (0, import_exec6.exec)("sudo", ["npm", ...cmdArgs]);
}
const { stdout: actualVersion } = await (0, import_exec6.getExecOutput)("npm", ["--version"]);
await (0, import_exec6.exec)("sudo", ["chown", "-R", `${process.env["USER"]}:`, `${process.env["HOME"]}/.config`]);
await (0, import_exec6.exec)("sudo", ["chown", "-R", `${import_node_process2.default.env["USER"]}:`, `${import_node_process2.default.env["HOME"]}/.config`]);
return actualVersion.trim();
}

Expand All @@ -10951,7 +10954,7 @@ async function filesChanged() {
}
}
function getFromEnv(name) {
const value = process.env[name];
const value = import_node_process3.default.env[name];
if (value) {
return value;
}
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from "node:process";
import * as core from "@actions/core";
import { exec } from "@actions/exec";
import aggregateReport from "./aggregateReport.js";
Expand Down
1 change: 1 addition & 0 deletions lib/listPackages.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from "node:process";
import { getExecOutput } from "@actions/exec";
import npmArgs from "./npmArgs.js";

Expand Down
1 change: 1 addition & 0 deletions lib/updateNpm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from "node:process";
import * as core from "@actions/core";
import { exec, getExecOutput } from "@actions/exec";
import npmArgs from "./npmArgs.js";
Expand Down

0 comments on commit 4732c19

Please sign in to comment.