-
Notifications
You must be signed in to change notification settings - Fork 5
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 package.json version when building npm packages #179
Conversation
c = c.WithExec([]string{"mkdir", "npm-packages"}). | ||
WithExec([]string{"yarn", "install", "--immutable"}). | ||
WithExec([]string{"yarn", "run", "packages:build"}). | ||
// TODO: We should probably start reusing the yarn pnp map if we can figure that out isntead of rerunning yarn install everywhere. | ||
// TODO: We should probably start reusing the yarn pnp map if we can figure that out instead of rerunning yarn install everywhere. | ||
WithExec([]string{"yarn", "run", "lerna", "version", ersion, "--exact", "--no-git-tag-version", "--no-push", "--force-publish", "-y"}). |
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 have to do a yarn install to update the lockfile at this point I believe, because if you don't, then later steps that do yarn install --immutable
will fail
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 think there are any later steps that do yarn install --immutable
, should we run yarn install --mode=update-lockfile
after updating the version anyway, just to be sure?
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.
hmmmmm. Since it's containerized and not using a shared volume I actually don't know if doing that would update it for everything afterwards without exporting that file so maybe for now we should just leave it?
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.
if it becomes a problem later then i guess we can resolve it at that point
c := NodeContainer(d, NodeImage(nodeVersion), platform). | ||
WithDirectory("/src", src). | ||
WithWorkdir("/src") | ||
|
||
c = WithYarnCache(c, opts) | ||
|
||
ersion := strings.TrimPrefix(version, "v") |
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.
ersion := strings.TrimPrefix(version, "v") | |
version := strings.TrimPrefix(version, "v") |
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 think that's intentional because it's "version" without the "v" ;)
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.
lol, maybe trimmedVersion
is better 😂
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 know that this is not a big deal but I actually think ersion
is pretty descriptive. It does look like a typo but it more concisely describes how the version is trimmed. Essentially, it is the exact same as version
just with the v
removed. Plus we have been using it in a lot of different places so it's probably good to keep it here for consistency.
// Get the node version from the 'src' directories '.nvmrc' file. | ||
public := c. | ||
WithExec([]string{"yarn", "install", "--immutable"}). | ||
WithExec([]string{"npm", "version", ersion, "--no-git-tag-version"}). |
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.
WithExec([]string{"npm", "version", ersion, "--no-git-tag-version"}). | |
WithExec([]string{"npm", "version", version, "--no-git-tag-version"}). |
@@ -14,10 +15,13 @@ func NPMPackages(d *dagger.Client, platform dagger.Platform, src *dagger.Directo | |||
|
|||
c = WithYarnCache(c, opts) | |||
|
|||
ersion := strings.TrimPrefix(version, "v") |
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.
ersion := strings.TrimPrefix(version, "v") | |
version := strings.TrimPrefix(version, "v") |
c = c.WithExec([]string{"mkdir", "npm-packages"}). | ||
WithExec([]string{"yarn", "install", "--immutable"}). | ||
WithExec([]string{"yarn", "run", "packages:build"}). | ||
// TODO: We should probably start reusing the yarn pnp map if we can figure that out isntead of rerunning yarn install everywhere. | ||
// TODO: We should probably start reusing the yarn pnp map if we can figure that out instead of rerunning yarn install everywhere. | ||
WithExec([]string{"yarn", "run", "lerna", "version", ersion, "--exact", "--no-git-tag-version", "--no-push", "--force-publish", "-y"}). |
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.
WithExec([]string{"yarn", "run", "lerna", "version", ersion, "--exact", "--no-git-tag-version", "--no-push", "--force-publish", "-y"}). | |
WithExec([]string{"yarn", "run", "lerna", "version", version, "--exact", "--no-git-tag-version", "--no-push", "--force-publish", "-y"}). |
also, unsure what's going to happen with the |
Added more information on the PR, the |
|
I think when this is merged we can just remove that we don't want the pre suffix 😂 but this changes those package.json versions depending on what is given in the |
After generating a package with:
dagger run go run ./cmd package --version 10.2.0-pre.ab12c34d
Before this change:
After this change: