Skip to content
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

feat: added a JSON file output upon completing the changeset #171

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: write to home instead
  • Loading branch information
Mees van Dongen committed Mar 5, 2024
commit f9dc3e9af19be40e70f5649546583f2f7d5251dd
6 changes: 2 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@ export const main = async ({
})

if (result.published) {
fs.writeJsonSync(
'./changesets-gitlab.output.json',
result.publishedPackages,
)
const filePath = `${HOME}/published-packages.json`
fs.writeJsonSync(filePath, result.publishedPackages)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the content is different with the issue's proposal? I think object is more reasonable and flexible for the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was that if we modified the code in 2 places,

in main before the publish

setOutput('published', false)
setOutput('publishedPackages', [])

and in main if publish is successful,

setOutput('published', true)
setOutput('publishedPackages', result.publishedPackages)

it would be problematic since the first one (published false) will create a file in the directory that will be added to git in the version command if people will just upgrade their version. When I removed that it didn't really make sense anymore to have a published true either since it is implicitly true by the file being there.

So, I can make it an object of course, but should the object still contain published? And if so, at which points do we want to create this file; should the user be able to assume the file will always be there; also with the version command?

Copy link
Member

@JounQin JounQin Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be problematic since the first one (published false) will create a file in the directory that will be added to git in the version command if people will just upgrade their version. When I removed that it didn't really make sense anymore to have a published true either since it is implicitly true by the file being there.

That's why I sad that this file should not be included in the project, instead, $HOME for example.

So, I can make it an object of course, but should the object still contain published? And if so, at which points do we want to create this file; should the user be able to assume the file will always be there; also with the version command?

I'd prefer to keep the same structure as GitHub outputs.


if (published) {
execSync(published)
Expand Down