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

The latest Vite is not used for ecosystem-ci #1213

Closed
sapphi-red opened this issue Feb 5, 2025 · 8 comments · Fixed by #1218
Closed

The latest Vite is not used for ecosystem-ci #1213

sapphi-red opened this issue Feb 5, 2025 · 8 comments · Fixed by #1218

Comments

@sapphi-red
Copy link

Because waku is packed here and the package.json in the standalone directory does not derive overrides from the root package.json, the latest Vite is not used there.

waku/e2e/utils.ts

Lines 169 to 185 in b9031fe

standaloneDir = mkdtempSync(join(tmpDir, fixtureName));
cpSync(fixtureDir, standaloneDir, {
filter: (src) => {
return !src.includes('node_modules') && !src.includes('dist');
},
recursive: true,
});
execSync(`pnpm pack --pack-destination ${standaloneDir}`, {
cwd: wakuDir,
});
const wakuPackageTgz = join(standaloneDir, `waku-${version}.tgz`);
const installScript = PACKAGE_INSTALL[packageManager](wakuPackageTgz);
execSync(installScript, { cwd: standaloneDir });
execSync(
`npm install --force ${join(standaloneDir, `waku-${version}.tgz`)}`,
{ cwd: standaloneDir },
);

An example package.json generated:

{
  "name": "broken-links",
  "version": "0.1.0",
  "type": "module",
  "private": true,
  "scripts": {
    "dev": "waku dev",
    "build": "waku build",
    "start": "waku start"
  },
  "dependencies": {
    "react": "19.0.0",
    "react-dom": "19.0.0",
    "react-server-dom-webpack": "19.0.0",
    "serve": "^14.2.4",
    "waku": "file:./waku-version.tgz"
  },
  "devDependencies": {
    "@types/react": "^19.0.8",
    "@types/react-dom": "^19.0.3",
    "typescript": "^5.7.3"
  }
}

(Since it's not part of the monorepo, the pnpm.overrides field that is injected by ecosystem-ci does not get applied to this package.json)


BTW the install process seems to be duplicated.

waku/e2e/utils.ts

Lines 181 to 185 in b9031fe

execSync(installScript, { cwd: standaloneDir });
execSync(
`npm install --force ${join(standaloneDir, `waku-${version}.tgz`)}`,
{ cwd: standaloneDir },
);

@dai-shi
Copy link
Owner

dai-shi commented Feb 5, 2025

@tylersayshi @rmarscher @himself65 @Aslemammad
Does anyone have any ideas for a solution?

@himself65
Copy link
Contributor

does this work?

https://docs.npmjs.com/cli/v8/configuring-npm/package-json/#overrides

@sapphi-red
Copy link
Author

Yeah, injecting overrides field would work. Something like:

const pkg = JSON.parse(readFileSync(join(standaloneDir, 'package.json'), 'utf-8'));
pkg.overrides = {
  vite: pnpmOverrides.vite,
};
writeFileSync(
  join(standaloneDir, 'package.json'),
  JSON.stringify(pkg, null, 2),
  'utf-8',
);

You'll also have to add a resolutions field if you need to support yarn and pnpm.

packageManager: 'npm' | 'pnpm' | 'yarn' = 'npm',

@dai-shi
Copy link
Owner

dai-shi commented Feb 7, 2025

@himself65 Would you be able to send a PR?

@himself65
Copy link
Contributor

sure

@himself65
Copy link
Contributor

well, do we have overwrites now? I cannot see it

@sapphi-red
Copy link
Author

pnpm.overrides is injected by ecosystem-ci automatically.
The modified package.json looks like this:

{
  "name": "waku-monorepo",
  "version": "0.1.0",
  "type": "module",
  "packageManager": "pnpm@9.4.0",
  "private": true,
  "scripts": {
    "dev": "pnpm -r --filter='./packages/*' run dev",
    "compile": "pnpm -r --filter='./packages/*' run compile",
    "csb-install-FIXME": "pnpm install --no-frozen-lockfile",
    "test": "prettier -c . && eslint . && tsc -b && tsc -b --noEmit `find examples -mindepth 1 -maxdepth 1 -type d ! -name '*_js'` && pnpm run --filter waku test",
    "test-vite-ecosystem-ci": "VITE_EXPERIMENTAL_WAKU_ROUTER=true pnpm run --filter waku test && VITE_EXPERIMENTAL_WAKU_ROUTER=true playwright test --project=chromium",
    "e2e": "playwright test",
    "website:dev": "pnpm -F waku-website dev",
    "website:build": "VITE_EXPERIMENTAL_WAKU_ROUTER=true pnpm -F waku-website build",
    "website:vercel": "pnpm run compile && pnpm run website:build --with-vercel-static && mv packages/website/.vercel/output .vercel/",
    "website:prd": "pnpm run website:build && pnpm -F waku-website start"
  },
  "prettier": {
    "singleQuote": true,
    "plugins": [
      "prettier-plugin-tailwindcss"
    ],
    "tailwindConfig": "./packages/website/tailwind.config.js",
    "tailwindFunctions": [
      "cx"
    ]
  },
  "devDependencies": {
    "@actions/core": "^1.11.1",
    "@eslint/js": "^9.19.0",
    "@playwright/test": "^1.50.1",
    "@types/babel__core": "^7.20.5",
    "@types/node": "^22.13.0",
    "@types/react": "^19.0.8",
    "@types/react-dom": "^19.0.3",
    "eslint": "^9.19.0",
    "eslint-import-resolver-typescript": "^3.7.0",
    "eslint-plugin-import": "^2.31.0",
    "eslint-plugin-react": "^7.37.4",
    "eslint-plugin-react-hooks": "^5.1.0",
    "prettier": "^3.4.2",
    "prettier-plugin-tailwindcss": "^0.6.11",
    "terminate": "^2.8.0",
    "typescript": "^5.7.3",
    "typescript-eslint": "^8.22.0",
    "wait-port": "^1.1.0",
    "waku": "workspace:*",
    "vite": "file:/home/green/workspace/vite-ecosystem-ci/workspace/vite/packages/vite",
    "@vitejs/plugin-legacy": "file:/home/green/workspace/vite-ecosystem-ci/workspace/vite/packages/plugin-legacy"
  },
  "pnpm": {
    "overrides": {
      "vite": "file:/home/green/workspace/vite-ecosystem-ci/workspace/vite/packages/vite",
      "@vitejs/plugin-legacy": "file:/home/green/workspace/vite-ecosystem-ci/workspace/vite/packages/plugin-legacy"
    }
  }
}

@himself65
Copy link
Contributor

Ok thanks

@dai-shi dai-shi closed this as completed in 06577a0 Feb 8, 2025
yokos2 added a commit to yokos2/react-yoko-portfolio that referenced this issue Feb 8, 2025
Fixes: dai-shi/waku#1213

---------

Co-authored-by: daishi <daishi@axlight.com>
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 a pull request may close this issue.

3 participants