update to deno

This commit is contained in:
2025-12-13 13:27:51 +00:00
parent dba2e2ae68
commit 9ad5222b95
25 changed files with 196 additions and 225 deletions

View File

@@ -7,9 +7,9 @@ import * as paths from './szci.paths.ts';
*/
export let nvmAvailable = plugins.smartpromise.defer<boolean>();
/**
* the smartshell instance for npmci
* the smartshell instance for szci
*/
const npmciSmartshell = new plugins.smartshell.Smartshell({
const szciSmartshell = new plugins.smartshell.Smartshell({
executor: 'bash',
sourceFilePaths: [],
});
@@ -19,16 +19,16 @@ const npmciSmartshell = new plugins.smartshell.Smartshell({
*/
const checkToolsAvailable = async () => {
// check for nvm
if (!Deno.env.get('NPMTS_TEST')) {
if (!Deno.env.get('SZCI_TEST')) {
if (
(await npmciSmartshell.execSilent(`bash -c "source /usr/local/nvm/nvm.sh"`)).exitCode === 0
(await szciSmartshell.execSilent(`bash -c "source /usr/local/nvm/nvm.sh"`)).exitCode === 0
) {
npmciSmartshell.shellEnv.addSourceFiles([`/usr/local/nvm/nvm.sh`]);
szciSmartshell.shellEnv.addSourceFiles([`/usr/local/nvm/nvm.sh`]);
nvmAvailable.resolve(true);
} else if (
(await npmciSmartshell.execSilent(`bash -c "source ~/.nvm/nvm.sh"`)).exitCode === 0
(await szciSmartshell.execSilent(`bash -c "source ~/.nvm/nvm.sh"`)).exitCode === 0
) {
npmciSmartshell.shellEnv.addSourceFiles([`~/.nvm/nvm.sh`]);
szciSmartshell.shellEnv.addSourceFiles([`~/.nvm/nvm.sh`]);
nvmAvailable.resolve(true);
} else {
nvmAvailable.resolve(false);
@@ -46,7 +46,7 @@ checkToolsAvailable();
*/
export let bash = async (commandArg: string, retryArg: number = 2): Promise<string> => {
await nvmAvailable.promise; // make sure nvm check has run
let execResult: plugins.smartshell.IExecResult;
let execResult!: plugins.smartshell.IExecResult;
// determine if we fail
let failOnError: boolean = true;
@@ -55,13 +55,13 @@ export let bash = async (commandArg: string, retryArg: number = 2): Promise<stri
retryArg = 0;
}
if (!Deno.env.get('NPMTS_TEST')) {
// NPMTS_TEST is used during testing
if (!Deno.env.get('SZCI_TEST')) {
// SZCI_TEST is used during testing
for (let i = 0; i <= retryArg; i++) {
if (Deno.env.get('DEBUG_NPMCI') === 'true') {
if (Deno.env.get('DEBUG_SZCI') === 'true') {
console.log(commandArg);
}
execResult = await npmciSmartshell.exec(commandArg);
execResult = await szciSmartshell.exec(commandArg);
// determine how bash reacts to error and success
if (execResult.exitCode !== 0 && i === retryArg) {