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

c3 add final commit to pages projects #3769

Closed

Conversation

dario-piotrowicz
Copy link
Member

@dario-piotrowicz dario-piotrowicz commented Aug 15, 2023

TODO:

  • add --commit-message to wrangler pages deploy in case we aren't in a repository
  • add git = <git version> in the commit message
  • add wrangler = wrangler@<wrangler version> in the commit message
  • add e2e tests for the commit message

TODO after merging this PR:

  • create issue to track the monorepo edge case
    (mentioning that the potential solution is to check before committing if there are unstaged changes outside
    the current directory and in that case notify the user ask the user and ask them if they are ok with C3 generating
    the commit)

Fixes # [insert GH or internal issue number(s)].

What this PR solves / how to test:

Associated docs issue(s)/PR(s):

  • [insert associated docs issue(s)/PR(s)]

Author has included the following, where applicable:

Reviewer is to perform the following, as applicable:

  • Checked for inclusion of relevant tests
  • Checked for inclusion of a relevant changeset
  • Checked for creation of associated docs updates
  • Manually pulled down the changes and spot-tested

Note for PR author:

We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label highlight pr review so future reviewers can take inspiration and learn from it.

@dario-piotrowicz dario-piotrowicz requested review from a team as code owners August 15, 2023 17:16
@github-actions
Copy link
Contributor

github-actions bot commented Aug 15, 2023

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5892511639/npm-package-wrangler-3769

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5892511639/npm-package-wrangler-3769

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5892511639/npm-package-wrangler-3769 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5892511639/npm-package-cloudflare-pages-shared-3769

Note that these links will no longer work once the GitHub Actions artifact expires.

@changeset-bot
Copy link

changeset-bot bot commented Aug 15, 2023

🦋 Changeset detected

Latest commit: 70c9312

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

This PR includes changesets to release 1 package
Name Type
create-cloudflare 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

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #3769 (f86af28) into main (478bed3) will not change coverage.
Report is 1 commits behind head on main.
The diff coverage is n/a.

❗ Current head f86af28 differs from pull request most recent head 70c9312. Consider uploading reports for the commit 70c9312 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3769   +/-   ##
=======================================
  Coverage   75.17%   75.17%           
=======================================
  Files         194      194           
  Lines       11410    11410           
  Branches     3013     3013           
=======================================
  Hits         8577     8577           
  Misses       2833     2833           

@dario-piotrowicz
Copy link
Member Author

Converted to draft as I need to tweak the details in the commit message and figure out how we want to handle monorepos

Copy link
Contributor

@jculvey jculvey left a comment

Choose a reason for hiding this comment

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

It would be nice to have some test coverage for this if it's easy.

The one hurdle thats been on the backlog is fixing git commits in e2e which fails silently atm since there isn't a git user and email configured inside of the newly created project folder. It would be nice if we could somehow add this config in tests mode and then verify the commit was made via git at the end of a test run.

@@ -61,7 +66,7 @@ export const runPagesGenerator = async (args: C3Args) => {
}
await updatePackageScripts(ctx);
await offerGit(ctx);
await gitCommit(ctx);
await gitCommit(ctx, generatePagesCommitMessage(ctx));
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency and to accommodate some changes I'd like to make later, it would be better if we kept the signature as is, and did some branching logic inside gitCommit function itself to generate the commit one way or the other depending on if it's pages or workers.

You can check this condition by evaluating the truthiness of ctx.framework -- it will be defined for pages apps but not for workers. Ideally, we'd have a dedicated field that gets set early on in the process (i.e. ctx.projectType = 'workers') which we could key off of, but we can use ctx.framework as a close enough proxy for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah ok thanks, I'll move the change in the function sorry about that 🙂:+1:

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated: 68474ca

Please have a look and let me know if this looks ok to you 🙂

packages/create-cloudflare/src/pages.ts Outdated Show resolved Hide resolved
@dario-piotrowicz
Copy link
Member Author

@jculvey yes, I was wondering of the testing situation... I wasn't sure if the tests are ready for covering this, it sounds like they're not completely there, I don't mind having a look and if it doesn't make this PR go hugely out of scope I don't mind adding them here 🙂👍

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

this is looking good, leaving a few comments...

packages/create-cloudflare/src/common.ts Show resolved Hide resolved
packages/create-cloudflare/src/frameworks/cliMap.json Outdated Show resolved Hide resolved
packages/create-cloudflare/src/common.ts Outdated Show resolved Hide resolved
packages/create-cloudflare/src/common.ts Outdated Show resolved Hide resolved
@IgorMinar IgorMinar self-requested a review August 16, 2023 15:54
Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

once more nit, but the rest looks great. please adjust and go ahead and merge

packages/create-cloudflare/src/frameworks/package.json Outdated Show resolved Hide resolved
@dario-piotrowicz
Copy link
Member Author

dario-piotrowicz commented Aug 16, 2023

please adjust and go ahead and merge

sorry I've still got a few items todo (I've noted them in the PRs description) 🙇


Also... the C3 tests cleanup workflow is failing... it's probably not ok to merge with it is failing 😓 (seems like its missing the CLOUDFLARE_API_TOKEN) I might need to look at this separately 🤔

@dario-piotrowicz
Copy link
Member Author

dario-piotrowicz commented Aug 17, 2023

I don't think that the e2e tests can run on this PR since I created it from a forked repo, you can see the tests running in this other temporary PR I created just in order to test those: #3776


To keep things simple maybe is easier to just close this PR in favour of #3776 ?

@dario-piotrowicz
Copy link
Member Author

Closing this in favour of #3776 (which is practically the same PR but created from an internal branch)

Sorry for the inconvenience 🙇

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