Skip to content
Merged
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
33 changes: 20 additions & 13 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,23 @@
const { detect } = await import('./util/detect.js');
const { data } = await detect(this.debugLogger, ticonfig, this, { nodejs: true, os: true });
const { node, npm, os } = data;
const info = {
os: os.name,
platform: process.platform.replace('darwin', 'osx'),
osver: os.version,
ostype: os.architecture,
oscpu: os.numcpus,
memory: os.memory,
node: node.version,
npm: npm.version
};

// deprecated - used by SDK 13.x and older
if (typeof callback === 'function') {
callback({
os: os.name,
platform: process.platform.replace('darwin', 'osx'),
osver: os.version,
ostype: os.architecture,
oscpu: os.numcpus,
memory: os.memory,
node: node.version,
npm: npm.version
});
return callback(info);
}

return info;
}
};

Expand Down Expand Up @@ -390,7 +395,7 @@
.reduce((promise, name) => promise.then(() => new Promise((resolve, reject) => {
const hook = this.createHook(name, data);
hook((err, result) => {
err ? reject(err) : resolve(result);

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 22 and macos-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 22 and ubuntu-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 24 and macos-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 24 and ubuntu-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 26 and ubuntu-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 26 and macos-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 24 and windows-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 26 and windows-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 398 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 22 and windows-latest

eslint(no-unused-expressions)

Expected expression to be used
});
})), Promise.resolve(this));

Expand Down Expand Up @@ -1464,7 +1469,7 @@
opt.validated = true;
if (opt.callback) {
var val = opt.callback(this.argv[name] || '');
val !== undefined && (this.argv[name] = val);

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 22 and macos-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 22 and ubuntu-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 24 and macos-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 24 and ubuntu-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 26 and ubuntu-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 26 and macos-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 24 and windows-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 26 and windows-latest

eslint(no-unused-expressions)

Expected expression to be used

Check warning on line 1472 in src/cli.js

View workflow job for this annotation

GitHub Actions / Test on Node.js 22 and windows-latest

eslint(no-unused-expressions)

Expected expression to be used
delete opt.callback;
}
}
Expand Down Expand Up @@ -1627,10 +1632,12 @@
const fn = this.command.module?.validate;
if (fn && typeof fn === 'function') {
this.debugLogger.trace(`Executing command's validate: ${this.command.name()}`);
const result = fn(this.logger || this.debugLogger, this.config, this);
let result = fn(this.logger || this.debugLogger, this.config, this);

// fn should always be a function for `build` and `clean` commands
if (typeof result === 'function') {
if (result instanceof Promise) {
result = await result;
} else if (typeof result === 'function') {
// fn should always be a function for `build` and `clean` commands
await new Promise(resolve => result(resolve));
} else if (result === false) {
this.command.skipRun = true;
Expand Down
Loading