Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new env variable #1957

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Variable used in script that runs all examples
NODE_COMMAND=node
7 changes: 6 additions & 1 deletion examples/run-all-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ const excludedDirectories = [
"./simple_rest_signature_provider",
];
const excludedJSFile = "run-all-examples.js";
const cmd = process.env.NODE_COMMAND;

fs.readdir(examplesDirectory, (err, files) => {
if (err) {
console.error("Error reading directory:", err);
return;
}

if (cmd === undefined) {
throw new Error("Environment variable NODE_COMMAND is required.");
}

let completed = 0;
let failed = 0;

Expand All @@ -43,7 +48,7 @@ fs.readdir(examplesDirectory, (err, files) => {
console.log(`\n⏳ ${index + 1}. Running ${file}...`);
const examplePath = path.join(examplesDirectory, file);

const result = spawnSync(process.env.NODE_COMMAND, [examplePath], {
const result = spawnSync(cmd, [examplePath], {
stdio: "ignore",
});

Expand Down