-
Notifications
You must be signed in to change notification settings - Fork 53
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
chore: @talend/scripts module #1098
Conversation
1 similar comment
packages/scripts/scripts/utils.js
Outdated
' | \'--------------\' || \'--------------\' || \'--------------\' || \'--------------\' || \'--------------\' || \'--------------\' || \'--------------\' |\n' + | ||
' \'----------------\' \'----------------\' \'----------------\' \'----------------\' \'----------------\' \'----------------\' \'----------------\' \n' + | ||
'###################################################################################################################################################################'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove that useless ascii art.
packages/scripts/scripts/utils.js
Outdated
try { | ||
pathFromWhich = fs.realpathSync(which.sync(executable)); | ||
} catch (_error) { | ||
// ignore _error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove that try/catch if you don't intend of using the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's to not throw the error from which
module call. If the command fails, the script should not fail.
packages/scripts/scripts/utils.js
Outdated
* @returns {*} The executable path | ||
*/ | ||
function resolveBin(modName, { executable = modName, cwd = process.cwd() } = {}) { | ||
let pathFromWhich; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename pathFromWhich
to something meaningful.
packages/scripts/scripts/utils.js
Outdated
@@ -0,0 +1,175 @@ | |||
/* eslint-disable global-require */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please properly rename that script into something that describes its content.
packages/scripts/scripts/utils.js
Outdated
*/ | ||
function hereRelative(dirname, p) { | ||
return path | ||
.join(dirname, p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename p
to path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path is already used by nodeJs' path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll find something
packages/scripts/scripts/utils.js
Outdated
* Create a user configuration getter | ||
* @returns {getUserConfig} The user configuration getter | ||
*/ | ||
function createUserConfigGetter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you need a getter creator. Can't you just do the call from inside the getter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to memoize the talendScriptsConfig.
It is transported in environment var, so it is serialized (JSON.stringify). To get it, I parse it (JSON.parse). This allows to parse it 1 time and then each call to get() just use it.
packages/scripts/README.md
Outdated
### Default usage | ||
|
||
1. Add @talend/scripts as dev dependency. | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use shell or
bash here
What is the problem this PR is trying to solve?
Each app has it's build/test/lint configuration, even if they are the same or almost the same.
What is the chosen solution to this problem?
Create a module
@talend/scripts
that exposes bins to run common scripts with common configuration. Those configurations can be overridden or enhanced by app custom configuration.This PR is only on build (webpack). Please refer to the README to understand how it works.
It is still on webpack 3 because there are plugins and loaders that are not ready yet :
Please check if the PR fulfills these requirements
[ ] This PR introduces a breaking change