Skip to content

Conversation

@kennedybaird
Copy link
Contributor

Following up on #8462, I did a simple POC for a script that updates all the dependencies in the examples directories.

The intention is this would be triggered alongside prepare-release.js. It requires that the package versions are updated to work correctly.

scripts/update-example-dependencies.js:

  1. iterates through the packages/* directories, getting the current package version for each
  2. extracts all catalog versions from pnpm-workspace.yaml
  3. iterates (recursively) through examples/* looking for package.json, and updating with the values from 1 / 2
    • if @prisma/client is updated, it triggers rebuilding GraphQL and Prisma schemas, which will avoid issues like 5311203

To test:

  1. checkout this branch
  2. delete examples/assets-local/schema.graphql
  3. run pnpm i - this will fail due to missing file above
  4. run node scripts/update-example-dependencies.js
    • note, this will trigger generating prisma for all examples, on consequent runs it would only trigger if prisma client is updated
  5. run pnpm i - all should be fine

To improve:

  • I would solve for fixPrismaPath and example-data so that CodeSandbox works
  • I would probably look at this making its own commit

Any feedback appreciated, I like these kinds of automations, but I know they're not popular with everyone - in my books they fall inside the reducing complexity category.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 7, 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.

Latest deployment of this branch, based on commit a4c23b1:

Sandbox Source
@keystone-6/sandbox Configuration

@dcousens
Copy link
Member

dcousens commented Aug 7, 2024

We do have @changeset/cli in the repository, which manages this same automation when configured to - the problem has been misconfiguration.

Any feedback appreciated, I like these kinds of automations, but I know they're not popular with everyone - in my books they fall inside the reducing complexity category.

I think they fall in the adding of complexity category 😅 , but I see @changesets/cli in the same boat - and I'd be hesitant to use both.

@dcousens
Copy link
Member

dcousens commented Aug 7, 2024

I will verify the current behaviour of pnpm changeset version

@dcousens
Copy link
Member

dcousens commented Aug 7, 2024

See #9269 for reverting the pnpm version syntax for now, and maybe fixing this for pnpm changeset version, but we'll see how that plays out

@kennedybaird kennedybaird deleted the examples-management branch August 7, 2024 20:54
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.

2 participants