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

Conversation

meesvandongen
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Mar 4, 2024

🦋 Changeset detected

Latest commit: 4141e3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
changesets-gitlab Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codesandbox-ci bot commented Mar 4, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated
exportVariable('PUBLISHED', true)
exportVariable('PUBLISHED_PACKAGES', 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.

README.md Outdated

- `PUBLISHED` - A boolean value to indicate whether a publishing is happened or not
- `PUBLISHED_PACKAGES` - A JSON array to present the published packages. The format is `[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]`
When publishing, a list of published packages is written to a file named `changesets-gitlab.output.json`.
Copy link
Member

Choose a reason for hiding this comment

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

The output location should be mentioned and would be better to be configurable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make it configurable. Another idea I had is to make the it configurable to have the output file at all, and default it to false. What do you think about that?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, opt-in configurable.

@alshdotme
Copy link

I'd be eager to see this feature pushed over the line as I'd love to make use of this output for reporting releases via a webhook.

if there's anything I can do to help please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants