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

fix(script-core): fix bin resolve issue on windows #5025

Merged
merged 4 commits into from
Dec 1, 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
5 changes: 5 additions & 0 deletions .changeset/fresh-kiwis-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-core': patch
---

Fixed issue with scripts that could not resolve bin path on windows
5 changes: 2 additions & 3 deletions tools/scripts-core/src/scripts/build-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default async function build(env, presetApi, unsafeOptions) {
console.log('Compiling with babel...');
utils.process
.spawn(
new URL(import.meta.resolve('@babel/cli/bin/babel.js')).pathname,
utils.path.resolveBin('babel'),
[
'--config-file',
babelConfigPath,
Expand Down Expand Up @@ -105,8 +105,7 @@ export default async function build(env, presetApi, unsafeOptions) {
console.log('Building with tsc');
}

const tsc = new URL(import.meta.resolve('typescript/bin/tsc')).pathname;
console.log('####TSC', args);
const tsc = utils.path.resolveBin('tsc');
utils.process
.spawn(tsc, args, { stdio: 'inherit', env })
.then(tscSpawn => {
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts-core/src/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default async function build(env, _, options) {
const packageType = utils.pkg.getPackageType();
if (packageType.isApp) {
return utils.process.spawn(
new URL(import.meta.resolve('webpack/bin/webpack.js')).pathname,
utils.path.resolveBin('webpack'),
[
'--config',
utils.path.hereRelative(
Expand Down
12 changes: 4 additions & 8 deletions tools/scripts-core/src/scripts/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,10 @@ async function lintStyle(env, presetApi, options) {
}
}

return utils.process.spawn(
new URL(import.meta.resolve('stylelint/bin/stylelint.mjs')).pathname,
args,
{
stdio: 'inherit',
env,
},
);
return utils.process.spawn(utils.path.resolveBin('stylelint'), args, {
stdio: 'inherit',
env,
});
}

export default async function lint(env, presetApi, options) {
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts-core/src/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async function start(env, _, options) {

if (packageType.isApp) {
return utils.process.spawn(
new URL(import.meta.resolve('webpack/bin/webpack.js')).pathname,
utils.path.resolveBin('webpack'),
[
'serve',
'--config',
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts-core/src/scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default async function test(env, presetApi, options) {
getUserConfigFile('jest.config.js') || path.join(configPath, 'jest.config.js');

return utils.process.spawn(
new URL(import.meta.resolve('jest-cli/bin/jest')).pathname,
utils.path.resolveBin('jest'),
['--config', jestConfigPath].concat(options),
{
stdio: 'inherit',
Expand Down
Loading