Skip to content
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/**
build/**
coverage/**
test/json/**
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
node: [20, 22]
node: [22, 24]
name: Node ${{ matrix.node }} ${{ matrix.os }} Test
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node }}
cache: "npm"
Expand Down
6 changes: 0 additions & 6 deletions .mocharc.json

This file was deleted.

23 changes: 17 additions & 6 deletions lib/spawnpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,26 @@
* Spawnpoint can be configured to manage the entire application life-cycle or standalone as a utility library.
* @class
*/
class spawnpoint extends EventEmitter {

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 windows-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 ubuntu-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 macOS-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 ubuntu-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 windows-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 macOS-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 windows-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 windows-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 ubuntu-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 macOS-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 macOS-latest Test

Prefer `EventTarget` over `EventEmitter`

Check warning on line 26 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 ubuntu-latest Test

Prefer `EventTarget` over `EventEmitter`
/**
* Creates new instance of spawnpoint
* @param {string} [configFile] Sets the JSON file spawnpoint uses to setup the framework.
* @param {string|Object} [configFile] Sets the JSON file spawnpoint uses to setup the framework, or an options object.
* @param {string} [configFile.configFile='/config/app.json'] Path to the config file when using options object.
* @param {string} [configFile.cwd=process.cwd()] Working directory for the applicationndash avoids needing process.chdir().
* @return {this}
*/
constructor(configFile = '/config/app.json') {
// init EventEmitter
super();

if (typeof(configFile) !== 'string') {
// Support options object for more flexibility
let options = {};
if (typeof configFile === 'object' && configFile !== null && !Array.isArray(configFile)) {
options = configFile;
configFile = options.configFile || '/config/app.json';
}

if (typeof configFile !== 'string') {
throw new TypeError('`configFile` must be a path string to a Spawnpoint config file.');
}
if (!configFile.endsWith('.json') && !configFile.endsWith('.js')) {
Expand All @@ -51,8 +60,8 @@
stopAttempts: 0, // how many attempts to stop have been triggered
};

// app CWD
this.cwd = process.cwd();
// app CWD - can be passed via options to avoid process.chdir()
this.cwd = options.cwd || process.cwd();

// detect if we are in a container (lazy-loaded on first access)
this._containerized = null;
Expand Down Expand Up @@ -283,6 +292,8 @@
if (typeof(exts) === 'string') {
exts = [exts];
}
// normalize path separators for cross-platform support
dir = dir.replaceAll('\\', '/');
const list = [];
let stat;
try {
Expand All @@ -293,8 +304,8 @@
if (!stat || !stat.isDirectory()) {
return list;
}
// ensure proper trailing slash and normalize path separators
dir = String(dir + '/').replaceAll('\\', '/');
// ensure proper trailing slash
dir = String(dir + '/');

// Use withFileTypes to avoid a stat for every entry (significantly faster)
const stack = [dir];
Expand Down Expand Up @@ -636,7 +647,7 @@
* @private
*/
initConfig(configFile = null) {
const self = this;

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 windows-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 ubuntu-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 macOS-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 ubuntu-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 windows-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 macOS-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 windows-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 windows-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 ubuntu-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 macOS-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 macOS-latest Test

Do not assign `this` to `self`

Check warning on line 650 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 ubuntu-latest Test

Do not assign `this` to `self`
if (configFile) {
this.configFile = configFile;
}
Expand Down Expand Up @@ -1101,7 +1112,7 @@
* @private
*/
initLimitListeners() {
const self = this;

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 windows-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 ubuntu-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 macOS-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 ubuntu-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 windows-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 macOS-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 windows-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 windows-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 ubuntu-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 24 macOS-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 macOS-latest Test

Do not assign `this` to `self`

Check warning on line 1115 in lib/spawnpoint.js

View workflow job for this annotation

GitHub Actions / Node 22 ubuntu-latest Test

Do not assign `this` to `self`
if (!this.config.trackErrors) { return this; }
const issues = {
errorCode: {},
Expand Down
Loading
Loading