-
Notifications
You must be signed in to change notification settings - Fork 18
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
Documentation #722
Merged
Merged
Documentation #722
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fc2ee07
doc:prePublish
mathieuLivebardon 8af9e3e
doc:jsdoc.js
mathieuLivebardon 876499f
doc:update ReleasePublish.md
mathieuLivebardon e53a3bb
upate(Developper):nvm par
mathieuLivebardon 636c0c6
delete w
mathieuLivebardon c09f5d9
doc:update comments of bin scripts
mathieuLivebardon b43509d
update(prepublish):fix syntax comments
mathieuLivebardon 22b09f0
update(Developers): rephrase nvm part
mathieuLivebardon d591b5f
doc(prepublish):RUN -> EXEC
mathieuLivebardon df85e00
doc(backend): add ref to process.env and cross-env
mathieuLivebardon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
/** | ||
* @file Performs version management tasks within a monorepo: | ||
* - Updates package.json files and dependencies to the provided version | ||
* - Formats code with prettier | ||
* - Executes reset and generates changelog diffs | ||
* @param {string} version - The version to update to. | ||
*/ | ||
|
||
const fs = require('fs'); | ||
const exec = require('child-process-promise').exec; | ||
|
||
/** | ||
* The version argument provided from the command line. | ||
* | ||
* @type {string} | ||
*/ | ||
const version = process.argv[2]; | ||
if (!version) throw new Error('no version argument found'); | ||
|
||
/** | ||
* The version split into segments. | ||
* | ||
* @type {string[]} | ||
*/ | ||
const subStringVersion = version.split('.'); | ||
|
||
/** Check the provided version argument. */ | ||
if (subStringVersion.length != 3) | ||
throw new Error('Version format length error'); | ||
subStringVersion.forEach((digit) => { | ||
|
@@ -16,22 +36,29 @@ subStringVersion.forEach((digit) => { | |
console.log('Change ud-viz-monorepo version to ', version); | ||
|
||
/** | ||
* It prints the stdout and stderr of a result object | ||
* Prints the stdout and stderr of a command execution result. | ||
* | ||
* @param {{stdout:string,stderr:string}} result - The result of the command execution. | ||
* @param {{stdout: string, stderr: string}} result - The result of the command execution. | ||
*/ | ||
const printExec = function (result) { | ||
console.log('stdout: \n', result.stdout); | ||
console.log('stderr: \n', result.stderr); | ||
console.log('stdout:\n', result.stdout); | ||
console.log('stderr:\n', result.stderr); | ||
}; | ||
|
||
/** | ||
* Updates the version number in a package.json file and updates the dependencies | ||
* that start with "@ud-viz/" to the same version number. | ||
* | ||
* @param {string} path - The file path to the `package.json` file to update. | ||
* @returns {Promise<void>} A Promise that resolves when the update is complete. | ||
*/ | ||
const changeVersionPackageJSON = function (path) { | ||
return new Promise((resolve) => { | ||
console.log(path, '[x]'); | ||
const content = JSON.parse(fs.readFileSync(path)); | ||
content.version = version; | ||
|
||
// update dependencie | ||
// Update dependencies | ||
for (const key in content.dependencies) { | ||
if (key.startsWith('@ud-viz/')) { | ||
content.dependencies[key] = version; | ||
|
@@ -45,17 +72,23 @@ const changeVersionPackageJSON = function (path) { | |
}); | ||
}; | ||
|
||
// Update version and dependencies for multiple package.json files | ||
changeVersionPackageJSON('./packages/shared/package.json').then(() => { | ||
changeVersionPackageJSON('./packages/browser/package.json').then(() => { | ||
changeVersionPackageJSON('./packages/node/package.json').then(() => { | ||
changeVersionPackageJSON('./package.json').then(() => { | ||
console.log('Start reset'); | ||
exec('npm run reset') | ||
const commandReset = `npm run reset`; | ||
console.log('RUN', commandReset); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of "RUN" "exec" seems more appropiate |
||
|
||
// Execute reset command | ||
exec(commandReset) | ||
.then(printExec) | ||
.then(() => { | ||
exec( | ||
`git describe --tags --match v* --abbrev=0 | xargs -I tag sh -c 'git log tag..HEAD --pretty=format:%s > ./docs/static/ChangelogDiff.txt'` | ||
).then(() => { | ||
const commandGenerateChangelog = `git describe --tags --match v* --abbrev=0 | xargs -I tag sh -c 'git log tag..HEAD --pretty=format:%s > ./docs/static/ChangelogDiff.txt'`; | ||
console.log('RUN', commandGenerateChangelog); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idem |
||
|
||
// Generate changelog diffs | ||
exec(commandGenerateChangelog).then(() => { | ||
console.log( | ||
'PrePublish done, you have to update ./docs/static/Changelog.md with ./docs/static/ChangelogDiff.txt' | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
maybe you could refer to cross-env to explain the environment mode like => see cross-env