Skip to content

Commit

Permalink
fix(script-core): fix bin resolve issue on windows (#5025)
Browse files Browse the repository at this point in the history
* fix(script-core): fix bin resolve issue on windows

* fix on jest also

* even more
  • Loading branch information
Gbacc authored Dec 1, 2023
1 parent 6c2df2b commit f69c72b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
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

0 comments on commit f69c72b

Please sign in to comment.