-
Notifications
You must be signed in to change notification settings - Fork 39
Switch to Vite from Create React App #1152
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
Merged
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
e503120
Works locally
microbit-matt-hillsdon 9223ce6
Update env var prefix
microbit-matt-hillsdon 6563b03
Fix workers
microbit-matt-hillsdon 9819a64
Hack around LZMA issue
microbit-matt-hillsdon 524c7c7
Adapt for esm
microbit-matt-hillsdon e458601
Fix the LZMA import
microbit-matt-hillsdon 12b9f1c
Change .js -> .cjs
microbit-grace 5980c74
Change deployment.js -> .cjs
microbit-grace 64439be
Upgrade TypeScript
microbit-grace 294ef72
Typecheck fixes
microbit-grace 2169ca7
Migrate jest -> vitest
microbit-matt-hillsdon da3f538
Merge branch 'vite' of github.com:microbit-foundation/python-editor-v…
microbit-matt-hillsdon a4586c5
More TS fixes
microbit-matt-hillsdon f9245e2
Works?
microbit-matt-hillsdon effb332
Update theme package
microbit-matt-hillsdon 622365f
Fix VITE_FULL_URL
microbit-matt-hillsdon 62f4dda
Fix script
microbit-matt-hillsdon c6395b3
Update deployment scripts
microbit-matt-hillsdon 49a4117
Actually fix script
microbit-matt-hillsdon b703aaf
PUBLIC_URL -> BASE_URL
microbit-matt-hillsdon f0348ea
Skip source map explorer for now
microbit-matt-hillsdon f60cecc
Disable LZMA again
microbit-matt-hillsdon 6942808
Skip tests for now
microbit-matt-hillsdon 59a2d56
Remove source map explorer
microbit-matt-hillsdon 6d08aa6
LZMA workaround as per classroom
microbit-matt-hillsdon ca1fd42
Set e2eTest environment to jsdom
microbit-grace 6799c8f
Merge branch 'main' into vite
microbit-matt-hillsdon 048bd0a
Merge branch 'vite' of github.com:microbit-foundation/python-editor-v…
microbit-matt-hillsdon 4eaab67
Update package-lock.json
microbit-grace 6f13825
Handing when currentTestName is undefined
microbit-grace fe3d9b4
Tweak E2E tests to make them less flaky
microbit-grace 8a5a4d3
Revert "Tweak E2E tests to make them less flaky"
microbit-grace a2984a5
Correct documentation spelling
microbit-grace 2b03e85
Add wait for sidebar to load before E2E tests run
microbit-grace 9a344e7
Fix pyright init issue
microbit-matt-hillsdon 260c748
Merge branch 'vite' of github.com:microbit-foundation/python-editor-v…
microbit-matt-hillsdon 35b9bb2
Template index.html
microbit-matt-hillsdon 7846276
Reinstate theme colour.
microbit-matt-hillsdon dccccd2
Fix when not defined
microbit-matt-hillsdon 1b1ad7f
Use a Worker per search language
microbit-matt-hillsdon 5899e83
Rename for clarity, tidying
microbit-matt-hillsdon 2c7efb5
Revert unintended index.html changes
microbit-matt-hillsdon f09146c
Fix URL
microbit-matt-hillsdon 2db94b1
Fix favicon path
microbit-matt-hillsdon 4b36fbf
Lint
microbit-matt-hillsdon b3b7849
Update browserlist
microbit-matt-hillsdon bb8b8a5
Update secret name
microbit-matt-hillsdon a704380
Remove .env from ignore
microbit-matt-hillsdon 2ec757a
Apply suggestions from code review
microbit-matt-hillsdon 9dc4ea0
Reviewed
microbit-matt-hillsdon f1cc2e4
Merge branch 'vite' of github.com:microbit-foundation/python-editor-v…
microbit-matt-hillsdon d4313dd
Pass ssr: false to useMediaQuery
microbit-matt-hillsdon 994c4a7
Ensure we don't index when language doesn't match
microbit-matt-hillsdon 94befff
Doc updates.
microbit-matt-hillsdon 5150443
Remove debug
microbit-matt-hillsdon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
REACT_APP_VERSION=$npm_package_version | ||
REACT_APP_NAME=$npm_package_name | ||
VITE_VERSION=$npm_package_version | ||
VITE_NAME=$npm_package_name | ||
VITE_FULL_URL=/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
"eslint:recommended", | ||
// We should switch to recommended-type-checked but there are many issues to review | ||
"plugin:@typescript-eslint/recommended", | ||
//"plugin:@typescript-eslint/recommended-type-checked", | ||
"plugin:react-hooks/recommended", | ||
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
], | ||
ignorePatterns: [ | ||
"dist", | ||
".eslintrc.cjs", | ||
"deployment.cjs", | ||
"bin/**/*.js", | ||
"bootstrap-template.js", | ||
"playwright.config.ts", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
project: ["./tsconfig.json", "./tsconfig.node.json"], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
plugins: ["react-refresh"], | ||
settings: { | ||
react: { | ||
version: "18", | ||
}, | ||
}, | ||
rules: { | ||
// More trouble than it's worth | ||
"react/no-unescaped-entities": "off", | ||
// False positives from library imports from Chakra UI | ||
"@typescript-eslint/unbound-method": "off", | ||
"@typescript-eslint/no-misused-promises": [ | ||
"error", | ||
{ | ||
checksVoidReturn: false, | ||
}, | ||
], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
args: "all", | ||
argsIgnorePattern: "^_", | ||
caughtErrors: "all", | ||
// Let's remove e from here | ||
caughtErrorsIgnorePattern: "^_|e", | ||
destructuredArrayIgnorePattern: "^_", | ||
varsIgnorePattern: "^_", | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
// Temporary, new rules on Vite migration that are widely flouted | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"prefer-const": "off", | ||
"react/display-name": "off", | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
PRODUCTION_CLOUDFRONT_DISTRIBUTION_ID: E2ELTBTA2OFPY2 | ||
STAGING_CLOUDFRONT_DISTRIBUTION_ID: E2ELTBTA2OFPY2 | ||
REVIEW_CLOUDFRONT_DISTRIBUTION_ID: E3267W09ZJHQG9 | ||
REACT_APP_FOUNDATION_BUILD: ${{ github.repository_owner == 'microbit-foundation' }} | ||
VITE_FOUNDATION_BUILD: ${{ github.repository_owner == 'microbit-foundation' }} | ||
|
||
steps: | ||
# Note: This workflow disables deployment steps and micro:bit branding installation on forks. | ||
|
@@ -36,20 +36,18 @@ jobs: | |
- run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- run: npm install --no-save @microbit-foundation/[email protected]dev.31 @microbit-foundation/website-deploy-aws@0.3.0 @microbit-foundation/website-deploy-aws-config@0.7.1 @microbit-foundation/circleci-npm-package-versioner@1 | ||
- run: npm install --no-save @microbit-foundation/[email protected]vite.35 @microbit-foundation/website-deploy-aws@0.6.0 @microbit-foundation/website-deploy-aws-config@0.9.0 @microbit-foundation/circleci-npm-package-versioner@1 | ||
if: github.repository_owner == 'microbit-foundation' | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- run: node ./bin/print-ci-env-stage.js >> $GITHUB_ENV | ||
- run: node ./bin/print-ci-env-public-url.js >> $GITHUB_ENV | ||
- run: node ./bin/print-ci-env-stage.cjs >> $GITHUB_ENV | ||
- run: node ./bin/print-ci-env-public-url.cjs >> $GITHUB_ENV | ||
- run: npm run ci:update-version | ||
if: github.repository_owner == 'microbit-foundation' | ||
- run: npm run ci | ||
env: | ||
REACT_APP_GA_COOKIE_PREFIX: ${{ secrets.REACT_APP_GA_COOKIE_PREFIX }} | ||
REACT_APP_GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }} | ||
REACT_APP_SENTRY_DSN: ${{ secrets.REACT_APP_SENTRY_DSN }} | ||
- run: mkdir -p /tmp/app${PUBLIC_URL} && cp -r build/* /tmp/app${PUBLIC_URL} && npx serve --no-clipboard -l 3000 /tmp/app & | ||
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | ||
- run: mkdir -p /tmp/app${BASE_URL} && cp -r build/* /tmp/app${BASE_URL} && npx serve --no-clipboard -l 3000 /tmp/app & | ||
if: env.STAGE == 'REVIEW' || env.STAGE == 'STAGING' | ||
- run: curl --insecure -4 --retry 7 --retry-connrefused http://localhost:3000 1>/dev/null | ||
if: env.STAGE == 'REVIEW' || env.STAGE == 'STAGING' | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env node | ||
let baseUrl; | ||
if (process.env.GITHUB_REPOSITORY_OWNER === "microbit-foundation") { | ||
// STAGE must be defined before this is imported | ||
const { bucketPrefix, bucketName } = require("../deployment.cjs"); | ||
baseUrl = `/${bucketPrefix}/`; | ||
|
||
const fullUrl = `https://${bucketName}${baseUrl}`; | ||
// This is used for og:url and similar. Not quite right for review domain but we don't really care. | ||
console.log(`VITE_FULL_URL=${fullUrl}`); | ||
} else { | ||
baseUrl = "/"; | ||
} | ||
|
||
// Two env vars as BASE_URL seems to be blank when running jest even if we set it. | ||
console.log(`BASE_URL=${baseUrl}`); | ||
console.log(`E2E_BASE_URL=${baseUrl}`); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.