-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: dynamic import retry plugin [KM-865] #2
base: main
Are you sure you want to change the base?
Conversation
a527f90
to
77c17e6
Compare
77c17e6
to
9ddda00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left an initial review; the biggest issue is please back out the changes turning this into a mono repo.
Separately, it would be great if you could please extensively comment the code so that maintenance and future updates are easier.
package.json
Outdated
"test-build": "VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", | ||
"debug-serve": "VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: I'm not sure I understand the multiple test commands here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug-*
are not necessary, removed
playground/vitestSetup.ts
Outdated
@@ -0,0 +1,350 @@ | |||
import type * as http from 'node:http' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: I believe most of this was taken from one of the existing vite repos. Are we actually using the entirety of the config or is there any unneeded code here for our purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed most of code that I thought they were not necessary for us.
playground/vue/.gitignore
Outdated
@@ -0,0 +1,24 @@ | |||
# Logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: is there a reason this ignore logic can't be in the root .gitignore? (We wouldn't want to ignore .vscode/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
playground/vitestSetup.ts
Outdated
|
||
export const workspaceRoot = resolve(__dirname, '../') | ||
|
||
export const isBuild = !!process.env.VITE_TEST_BUILD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain the env variables used in the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments added
playground/vue/package.json
Outdated
{ | ||
"name": "@kong-vite-plugin/vue", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vue-tsc -b && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"vue": "^3.5.13", | ||
"vue-router": "^4.5.0" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^5.2.1", | ||
"@vue/tsconfig": "^0.7.0", | ||
"vue-tsc": "^2.2.0" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: why does the playground need its own package.json file? This isn't a monorepo. Please move dependencies to the root
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can create multiple projects under the playground folder, package.json for each one is necessary, otherwise, how can we manually run those demo projects from the root level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please write up how you envision the testing working?
I’m not sure it makes sense to have fully-standalone applications for testing purposes.
If we need to change to a mono repository then I’d first want to restructure things before merging this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If each package is independent and needs an entire app sandbox I’d almost rather delete this repository and just utilize public-ui-components instead; it’s already set up and would essentially just need a different build command.
For dependencies in the current structure, playground dependencies would be devDependencies in the root package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial thought was that we might need multiple applications to test different cases, similar to https://github.com/vitejs/vite-plugin-vue/tree/main/playground.
However, we can start simple by writing all use cases in a single project. If more complex scenarios arise, we can refactor it into a monorepo as needed.
playground/vue/tsconfig.json
Outdated
@@ -0,0 +1,24 @@ | |||
{ | |||
"compilerOptions": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: why does the playground need its own tsconfig? Can it just extend the one from the root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
pnpm-workspace.yaml
Outdated
packages: | ||
- 'playground/**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: this should not be a monorepo, please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
/* | ||
Copyright 2024 Carl-Erik Kopseng | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a requirement of an external lib? If yes, can you please add a link to the source?
Also, could this be extracted into its own file and imported where needed rather than inlined into our code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link added.
No, the code in this function shouldn't have external references, I put detailed reason in comments.
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV | ||
|
||
- name: Cache Playwright's binary | ||
uses: actions/cache@v4 | ||
with: | ||
key: playwright-bin-v1 | ||
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: It would be preferred to give the step an id
, output via $GITHUB_OUTPUT
, and then reference the step output below where needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
c0a326e
to
73dc74e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial feedback.
There is a large lack of comments in the code that would be helpful for review. Please thoroughly comment the code.
id: playwright-cache | ||
uses: actions/cache@v4 | ||
with: | ||
key: playwright-bin-v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we tie the cache key here to a dynamic string that includes the playwright dependency version from package.json?
@@ -20,3 +20,6 @@ dist | |||
|
|||
# Local History | |||
.history | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe some additional playwright artifact paths will need to be added
@@ -0,0 +1 @@ | |||
/// <reference types="vite/client" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can remove this file and reference the types in the tsConfig
"baseUrl": ".", | ||
"outDir": "dist", | ||
"declaration": false, | ||
"declarationDir":null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"declarationDir":null | |
"declarationDir": null |
const identity = (e: any) => e | ||
const retry = createDynamicImportWithRetry(options.retries) | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which part of this file is from the external reference? Can we move the copyright and the code into a separate file, add a URL from where the code was sourced from, and import here where needed?
Summary
KM-865