ui5/cli 3.* - existing script is not working
rabi84 opened this issue · 6 comments
Expected Behavior:
The below code should work.
const ui5cli = require.resolve('@ui5/cli/bin/ui5.js');
await executeScript(ui5cli, ['build', '--include-task=generateManifestBundle', 'generateCachebusterInfo']);
Current Behavior
this is not working using ui5/cli 3.* version
const ui5cli = require.resolve('@ui5/cli/bin/ui5.cjs');
await executeScript(ui5cli, ['build', '--include-task=generateManifestBundle', 'generateCachebusterInfo']);
but this is working using ui5/cli 3.* version
const ui5cli = require.resolve('@ui5/cli/bin/ui5.cjs');
await shellExecute('node ' + ui5cli, ['build', '--include-task=generateManifestBundle', 'generateCachebusterInfo']);
Steps to Reproduce the Issue
execute below command using gulp and it is not completing, it is getting hung up in cleanupjobs
await executeScript(ui5cli, ['build', '--include-task=generateManifestBundle', 'generateCachebusterInfo']);
Context
- UI5 Module Version 1.120
- Node.js Version: 18.17.1
- npm Version: 9.6.7
- OS/Platform: mac
- Browser (if relevant): chrome
- Other information regarding your environment (optional):
nothing
![image](https://private-user-images.githubusercontent.com/12803266/315983263-fc2e69c9-3289-4ad1-a917-6efca8550e07.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI4MDc2OTMsIm5iZiI6MTcyMjgwNzM5MywicGF0aCI6Ii8xMjgwMzI2Ni8zMTU5ODMyNjMtZmMyZTY5YzktMzI4OS00YWQxLWE5MTctNmVmY2E4NTUwZTA3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA0VDIxMzYzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY0YTZiYzBmMGZjM2ZmODU3NDAyOGZhZGI3MDIzOGMzODNkNmY2YTdjYzliZjMzN2UyNTQ0NjMwMjI1MzQzM2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2gMvml_Y8OlG13yToQol3zhynBnWCmcTgWqerNM_2xE)
With version 3 of @ui5/cli
, bin/ui5.js
got renamed to bin/ui5.cjs
.
From your description, it's unclear to me what the functions executeScript
and shellExecute
are doing. Would it be possible to provide a reproducible example?
You might also want to consider switching to the Node.js API instead of invoking the CLI: https://sap.github.io/ui5-tooling/stable/#nodejs-api
Also, please provide the exact version of the @ui5/cli
package you are using.
yes you are right with 3.* version it should be bin/ui5.cjs, I updated it as well.
We are using 3.9.1 version of Ui5/cli
my bad I did not add the functions, here are they
async function executeScript(script, args, cwd) {
if (typeof args === 'string') {
cwd = args;
args = undefined;
}
await run('fork', script, args, {cwd});
},
async function shellExecute(command, args, cwd) {
if (typeof args === 'string') {
cwd = args;
args = undefined;
}
await run('spawn', command, args, {cwd, shell: true});
}
Thank you for sharing some more code. However, it's still not enough for us to reproduce the behavior you are reporting.
Would it be possible for you to share a working script that shows the issue?
Hi ,
I am not allowed to share the project code, but let me give the details how it is working
inside run method, we are doing as below
function run(type, command, args, options) {
if (type === 'fork') {
commandLine = 'node ' + commandLine;
}
//we are preparing command line, argv, program and options in our private functions and then calling child process in promise
return new Promise(function (resolve, reject) {
const baseOptions = {
env: Object.assign({}, process.env),
stdio: 'inherit'
};
let child = childProcess[type](program, argv, Object.assign(baseOptions, options));
child.on('error', reject);
child.on('exit', function (code, signal) {
if (signal) {
reject(new Error(${commandLine} exited on ${signal}
));
}
else if (code) {
reject(new Error(${commandLine} failed with status ${code}
));
}
else {
resolve();
}
});
});
}
If you are an SAP customer, please feel free to raise an incident for us at https://support.sap.com/ if that allows you to share your project with us.
I'm afraid we need an example project containing your custom script in order to reliably reproduce and analyze this issue.
This issue has been automatically marked as stale because it has been open for 60 days with no activity. It will be closed in 10 days if no further activity occurs.