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

Generate citation strings from citation.cff file as part of build process #3385

Open
wants to merge 38 commits into
base: main
Choose a base branch
from

Conversation

cherriechang
Copy link
Collaborator

No description provided.

Copy link

changeset-bot bot commented Aug 27, 2024

⚠️ No Changeset found

Latest commit: 5b64a47

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

packages/config/rollup.js Outdated Show resolved Hide resolved
packages/config/rollup.js Outdated Show resolved Hide resolved
@bjoluc
Copy link
Member

bjoluc commented Sep 11, 2024

@jodeleeuw When you updated the dependencies, including esbuild from 0.15.14 to 0.23.1 in 59ce0b3, did you read the changelogs? There seem to be a lot of breaking changes in esbuild and we need to be confident that they are not breaking for @jspsych/config users (unless you are planning to release a config v4 for any other reason 🤔 ). I didn't get suspicious about this earlier because your commit message didn't make it clear to me that you were updating dependencies 🙈

"sucrase": "3.34.0",
"tslib": "2.6.2",
"typescript": "^5.2.2"
},
"overrides": {
Copy link
Member

Choose a reason for hiding this comment

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

When I last checked a few months ago, NPM did only respect overrides defined in the root package.json. Did that change in a recent NPM version? If so, we still can't rely on it until we require the new version...

Copy link
Member

@bjoluc bjoluc left a comment

Choose a reason for hiding this comment

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

esbuild has a define option to specify code replacements. I think we should be using that instead of a custom rollup plugin to keep it simple.

@bjoluc
Copy link
Member

bjoluc commented Sep 12, 2024

@jodeleeuw I double-checked and committed the rollup dependency updates in #3396 – they're all welcome and independent of the .json issue. Re that issue: Because we are using esbuild via the rollup plugin, the final bundling is performed by rollup. esbuild never sees @citation-js/core/package.json, hence can't run its JSON loader on it. Your workaround with the additional Rollup JSON loader is good for now, although the more desirable solution might be to inline the version string right in the citation-js build (like most other packages do too). I'm too busy to contribute there ATM though 😕

@jodeleeuw
Copy link
Member

@bjoluc just FYI, we ended up solving this by using @rollup/plugin-replace. We explored the esbuild define, but it required adding some declare const statements at the top of the plugin ts templates and that felt unnecessarily confusing for rookie devs.

@jodeleeuw jodeleeuw changed the title add rollup plugin for building citation Generate citation strings from citation.cff file as part of build process Oct 30, 2024
@bjoluc
Copy link
Member

bjoluc commented Oct 30, 2024

but it required adding some declare const statements at the top of the plugin ts templates and that felt unnecessarily confusing for rookie devs.

Have you thought about declaring the constants globally in a .d.ts file in @jspsych/config, referenced by the exported tsconfigs?

Also, what about replacing a single __CITATIONS__ object? That would allow to add other formats at a later point without changing all the plugins, while further reducing boilerplate.

@jodeleeuw
Copy link
Member

Have you thought about declaring the constants globally in a .d.ts file in @jspsych/config, referenced by the exported tsconfigs?

For some reason I thought this kind of strategy wouldn't work, but can't reconstruct my reasoning now. We can explore it!

Also, what about replacing a single CITATIONS object? That would allow to add other formats at a later point without changing all the plugins, while further reducing boilerplate.

This was something that crossed my mind. I was thinking that the current boilerplate makes it easier for someone building with the JS template to modify because they won't have to know the syntax, but then again we could just have a different template for plugins that aren't going to go through the build process. So that does seem better.

Base automatically changed from update-config-dependencies to main December 2, 2024 17:37
@jodeleeuw
Copy link
Member

@cherriechang I'd like to get this merged soon. We need some docs still I think.

@jadeddelta we could also include the CFF files in the v8 update for the contrib repo?

packages/plugin-preload/CITATION.cff Outdated Show resolved Hide resolved
packages/extension-mouse-tracking/CITATION.cff Outdated Show resolved Hide resolved
packages/config/generateCitations.js Show resolved Hide resolved
packages/plugin-html-keyboard-response/CITATION.cff Outdated Show resolved Hide resolved
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.

3 participants