Conversation
| /** | ||
| * @typedef {import('../packages.mjs').PackageDefinition} PackageDefinition | ||
| */ |
There was a problem hiding this comment.
This is the JSDoc equivalent to import type { PackageDefinition } from '../packages';.
| ) | ||
| .join('\n'); | ||
| const message = `${lernaMessageSection}\n\n${updatedPackagesMessageSection}`; | ||
| await execute('git', ['commit', '--no-verify', '-m', message]); |
There was a problem hiding this comment.
I tested this, and multi-line commits work.
|
Pull Request Report PR Title ✅ Title follows the conventional commit spec. Bundle Size
|
louis-bompart
left a comment
There was a problem hiding this comment.
Nothing seems particularly wrong, tho there's too many things for me to judge/give an approve given my limited knowledge of your CI/CD
| export function updatePackageVersion( | ||
| packageName, | ||
| newVersion, | ||
| depdendenciesPackageDirs | ||
| ) { | ||
| depdendenciesPackageDirs.forEach((packageDir) => { | ||
| const fullPath = resolve('.', 'packages', packageDir, 'package.json'); | ||
| const originalContentAsText = readFileSync(fullPath).toString(); | ||
| let newContent = originalContentAsText.replace( | ||
| new RegExp(`("${packageName.replace('/', '\\/')}"\\s*:\\s*")([^"]*)`), | ||
| '$1' + newVersion | ||
| ); | ||
| if (packageName === JSON.parse(originalContentAsText).name) { | ||
| newContent = newContent.replace( | ||
| /("version"\s*:\s*\")([^"]*)/, | ||
| '$1' + newVersion | ||
| ); | ||
| } | ||
| writeFileSync(fullPath, newContent); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Why not parse, edit then, write? It'll be more maintainable than a RegExp nah?
There was a problem hiding this comment.
Ah I should've clarified this part. Unfortunately, parsing, editing then reformatting gives a pretty ugly JSON, and I wanted to maintain the current structure of the JSON.
There was a problem hiding this comment.
| * @param {readonly string[]} [args] | ||
| * @returns {Promise<string>} | ||
| */ | ||
| export function execute(command, args = []) { |
There was a problem hiding this comment.
Could we add a package to do this type of thing? I feel like it's a bit out of our scope
There was a problem hiding this comment.
I wanted to see the command & output of every command in the console while also being able to use the output, which by default isn't the case with spawn and exec (setting stdio: 'inherit' makes them return nothing). I could've tried a bunch of third-party exec libraries to do it, but it doesn't seem to be worth the time exploring them, and this is a fairly simple utility function that mostly just wraps the native spawn function.
|
Nice work! It would be nice to update the readme for upcoming pre-releases. Some nitpick: doing the refactor to modules in the same PR as adding the pre-release specific code & the migration from Lerna... it will make it hard to discern changes when looking back. These kind of things were a bit annoying when fixing something in the dep. process in the past. I'd wait for Olivier's feedback too before merging |
Agreed, I ideally would've liked to do it separately, but unfortunately I wasn't able to use the semantic monorepo tools with commonJS. |
|
What if it was
|
We can do that, but in this case PR1 may be as big as this PR (possibly bigger since we'd need to add changelogs and conventional graduating). It would be more consistent across both releases though. Is this what you prefer? |
|
PR1: cjs -> mjs |

I'm merging this in
mastersince in theory it shouldn't affect it. Changes from #2548 were copied here.New prerelease process
To start a major prerelease (e.g.,
1.2.3→2.0.0-pre.0):master.prerelease/(e.g.,prerelease/headless_atomic_v2)npm run bump:version:major-prerelease -- @coveo/package1 @coveo/package2 @coveo/package3.Updating a prerelease branch:
masterto reference a version bump.masterinto the prerelease branch.Adding new changes to the prerelease branch:
Officially releasing (e.g.,
2.0.0-pre.15→2.0.0):-pre.suffix)master.Changes in this PR
bump:version:major-prereleasescript to the rootpackage.jsonlernagives version bumps, including[skip-ci].prerelease/**branch now trigger the same CI asmaster, except:/pre\.[0-9]+$/are upgraded.prerelease/**branch now trigger the same CI asmaster, except:/pre\.[0-9]+$/are published to NPM.alphatag on NPM isn't updated.devenvironment.execSyncwere replaced with a utilityexecutefunctionexecute, in addition to returning its output, copies stdout & stderr to the console to make debugging easier. I caught some issues early thanks to this.Other details
major/minor/patchversion, the prerelease version will be ignored. Therefor,2.0.0will already be available on the dev CDN, and will be overwritten every time we update the prerelease. Out of scope packages will also update their CDN, but in theory the files should be the same anyway.https://coveord.atlassian.net/browse/KIT-2114