feat: lighthouse integration, pnpm workspace setup, and CI optimization - #243
feat: lighthouse integration, pnpm workspace setup, and CI optimization#243Tarektouati wants to merge 20 commits into
Conversation
|
8524702 to
ed3a649
Compare
ed3a649 to
cb9977b
Compare
9e9cfe2 to
eac49bc
Compare
7f41196 to
cac80d1
Compare
ed9388e to
e20354d
Compare
e793398 to
60ed862
Compare
| STEP_WEIGHTS | ||
| ) | ||
|
|
||
| console.log({ globalScore }) |
There was a problem hiding this comment.
next step is to publish this score in PRs
60ed862 to
6826ef3
Compare
| defaultBranch: "main" | ||
| syncHooks: true | ||
| hooks: | ||
| # HACK: unset GIT_INDEX_FILE is needed to prevent git from locking the index file during a commit before running the moon tasks. This forces moon to use the standard repository index, which prevents the conflict. |
There was a problem hiding this comment.
important: this why git-hooks weren't working since moon migration from husky
| import lighthouse from 'lighthouse' | ||
|
|
||
| // HACK: we rely on mock instead of spy as this is the only way to spy on the default export https://vitest.dev/guide/browser/#spying-on-module-exports | ||
| vi.mock('lighthouse', { spy: true }) |
There was a problem hiding this comment.
important: This ain't mock it's a more of spy for packages that have default export
| const config = { | ||
| test: { | ||
| environment: "node", | ||
| setupFiles: "./vitest.setupFiles.ts", | ||
| include: ["**/*.test.?(c|m)[jt]s?(x)"], | ||
| exclude: ["**/node_modules/**", "**/tests/**"], | ||
| sequence: { shuffle: true }, | ||
| passWithNoTests: false, | ||
| coverage: { | ||
| reporter: ["text"], | ||
| exclude: [...coverageConfigDefaults.exclude], | ||
| }, | ||
| restoreMocks: true, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Config could be common with app
| on: | ||
| schedule: | ||
| - cron: "0 8 * * *" |
There was a problem hiding this comment.
remove cron, usless as we run e2e on new commits on main + PR
6826ef3 to
b114178
Compare
bengeois
left a comment
There was a problem hiding this comment.
suggestion: should we rename commit to keep conventional commit ?
| syncHooks: true | ||
| hooks: | ||
| # HACK: unset GIT_INDEX_FILE is needed to prevent git from locking the index file during a commit before running the moon tasks. This forces moon to use the standard repository index, which prevents the conflict. | ||
| pre-commit: |
There was a problem hiding this comment.
question: I'm wondering why there are theses two commands here and also in .moon/hooks/pre-commit.sh ? Can we have it in one place ?
| @@ -0,0 +1,14 @@ | |||
| { | |||
| "name": "tracksy", | |||
| "version": "0.0.0", | |||
There was a problem hiding this comment.
| "version": "0.0.0", | |
| "version": "0.4.0", |
Maybe ? 🎉
b114178 to
96adc35
Compare
https://pnpm.io/workspaces The core idea is to have shared node_modules between JS apps and avoid re-installing X times dependencies Also if any patch or overrides needed in case of CVE, it would easily apply for all
This workflow will be trigger with workflow_dispatch and cron (everyday at 8 AM)
96adc35 to
b06fb39
Compare
setup-toolchain's auto-install runs pnpm outside of moon's task context, where moon's managed pnpm isn't in PATH yet. Disabling it lets moon inject pnpm into PATH properly when tasks run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
auto-setup: true runs moon setup inside the action's Node.js process which does not update $GITHUB_PATH, so moon can't find its managed pnpm when tasks run. Running moon setup as an explicit shell step correctly exports the tool paths to the environment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
moon setup installs pnpm via proto to ~/.proto/tools/ and creates shims in ~/.proto/shims/, but this directory is never added to $GITHUB_PATH. Subsequent steps (including moon's own auto-install before tasks) can't resolve pnpm by name. Exporting the shims and bin dirs keeps pnpm coming from moon's toolchain without any external action. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
moon setup installs Node but does not create the pnpm shim at ~/.proto/shims/pnpm. Adding the shims dir to PATH is useless if the shim file never exists. proto install pnpm 9 explicitly downloads pnpm and writes the shim, which moon then finds when auto-installing project deps before tasks run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
proto refuses to install pnpm if it cannot confirm node is installed. When moon setup skips toolchains due to cache hits, the proto store may have no record of node, causing proto install pnpm to fail with requirements_not_met. Installing node first satisfies the check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
proto's pnpm installer requires node to be declared in .prototools, not just present in the binary store. Without it, proto install pnpm fails with requirements_not_met even after proto install node. Adding .prototools with node=24/pnpm=9 and running proto use lets proto resolve the dependency chain and create the pnpm shim. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In pnpm workspace mode, overrides in member package.json files are silently ignored — they must be in the root package.json. The yaml override (yaml@>=2.0.0 <2.8.3: >=2.8.3) was in app/package.json only, leaving yaml@2.7.1 vulnerable in the astrojs/check dep chain. Moves both overrides (lodash, yaml) to root package.json and removes the now-redundant pnpm.overrides block from app/package.json. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The untracked .npmrc was lost, leaving no explicit config for autoInstallPeers. pnpm 9 in CI defaults to true while the lockfile recorded false, causing ERR_PNPM_LOCKFILE_CONFIG_MISMATCH on frozen installs. Commits .npmrc with auto-install-peers=true and regenerates the lockfile to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1️⃣ First
🔇 Problem
pnpm-lock.ymlbetweenappande2e(node.js apps) for consolidationCI/CDoptimization around moon setup🎹 Proposal
Lighthouse & E2E:
black-box-test.ymlto run e2e tests against arbitrary URLs.computeJourneyScore,runLighthouseStep) with full unit test coverage usingvitest.Workspace & Architecture:
pnpm-workspace.yamlandpackage.jsonto manage app and e2e packages.base.prettier.mjsfor consistent code style across the monorepo and applied it to the e2e package.pnpm-lock.yaml.CI/CD:
moonsetupwith auto-install and caching for faster builds.Testing Strategy:
moon run e2e:testto verify new Lighthouse helpers.moon run e2e:runto verify the user journey and performance scoring.black-box-testGH workflow and existing build/deploy pipelines.🎶 Comments
This PR address multiple problems, it could be split in multiple stacked PRs