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

Switch to Vite from Create React App #1152

Merged
merged 55 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e503120
Works locally
microbit-matt-hillsdon Mar 11, 2024
9223ce6
Update env var prefix
microbit-matt-hillsdon Mar 11, 2024
6563b03
Fix workers
microbit-matt-hillsdon Mar 11, 2024
9819a64
Hack around LZMA issue
microbit-matt-hillsdon Mar 11, 2024
524c7c7
Adapt for esm
microbit-matt-hillsdon Mar 11, 2024
e458601
Fix the LZMA import
microbit-matt-hillsdon Mar 11, 2024
12b9f1c
Change .js -> .cjs
microbit-grace Mar 12, 2024
5980c74
Change deployment.js -> .cjs
microbit-grace Mar 12, 2024
64439be
Upgrade TypeScript
microbit-grace Mar 12, 2024
294ef72
Typecheck fixes
microbit-grace Mar 12, 2024
2169ca7
Migrate jest -> vitest
microbit-matt-hillsdon Mar 12, 2024
da3f538
Merge branch 'vite' of github.com:microbit-foundation/python-editor-v…
microbit-matt-hillsdon Mar 12, 2024
a4586c5
More TS fixes
microbit-matt-hillsdon Mar 12, 2024
f9245e2
Works?
microbit-matt-hillsdon Mar 12, 2024
effb332
Update theme package
microbit-matt-hillsdon Mar 12, 2024
622365f
Fix VITE_FULL_URL
microbit-matt-hillsdon Mar 12, 2024
62f4dda
Fix script
microbit-matt-hillsdon Mar 12, 2024
c6395b3
Update deployment scripts
microbit-matt-hillsdon Mar 12, 2024
49a4117
Actually fix script
microbit-matt-hillsdon Mar 12, 2024
b703aaf
PUBLIC_URL -> BASE_URL
microbit-matt-hillsdon Mar 12, 2024
f0348ea
Skip source map explorer for now
microbit-matt-hillsdon Mar 12, 2024
f60cecc
Disable LZMA again
microbit-matt-hillsdon Mar 12, 2024
6942808
Skip tests for now
microbit-matt-hillsdon Mar 12, 2024
59a2d56
Remove source map explorer
microbit-matt-hillsdon Mar 12, 2024
6d08aa6
LZMA workaround as per classroom
microbit-matt-hillsdon Mar 12, 2024
ca1fd42
Set e2eTest environment to jsdom
microbit-grace Mar 12, 2024
6799c8f
Merge branch 'main' into vite
microbit-matt-hillsdon Mar 12, 2024
048bd0a
Merge branch 'vite' of github.com:microbit-foundation/python-editor-v…
microbit-matt-hillsdon Mar 12, 2024
4eaab67
Update package-lock.json
microbit-grace Mar 12, 2024
6f13825
Handing when currentTestName is undefined
microbit-grace Mar 12, 2024
fe3d9b4
Tweak E2E tests to make them less flaky
microbit-grace Mar 12, 2024
8a5a4d3
Revert "Tweak E2E tests to make them less flaky"
microbit-grace Mar 13, 2024
a2984a5
Correct documentation spelling
microbit-grace Mar 13, 2024
2b03e85
Add wait for sidebar to load before E2E tests run
microbit-grace Mar 13, 2024
9a344e7
Fix pyright init issue
microbit-matt-hillsdon Mar 13, 2024
260c748
Merge branch 'vite' of github.com:microbit-foundation/python-editor-v…
microbit-matt-hillsdon Mar 13, 2024
35b9bb2
Template index.html
microbit-matt-hillsdon Mar 13, 2024
7846276
Reinstate theme colour.
microbit-matt-hillsdon Mar 13, 2024
dccccd2
Fix when not defined
microbit-matt-hillsdon Mar 13, 2024
1b1ad7f
Use a Worker per search language
microbit-matt-hillsdon Mar 14, 2024
5899e83
Rename for clarity, tidying
microbit-matt-hillsdon Mar 14, 2024
2c7efb5
Revert unintended index.html changes
microbit-matt-hillsdon Mar 14, 2024
f09146c
Fix URL
microbit-matt-hillsdon Mar 14, 2024
2db94b1
Fix favicon path
microbit-matt-hillsdon Mar 14, 2024
4b36fbf
Lint
microbit-matt-hillsdon Mar 14, 2024
b3b7849
Update browserlist
microbit-matt-hillsdon Mar 14, 2024
bb8b8a5
Update secret name
microbit-matt-hillsdon Mar 14, 2024
a704380
Remove .env from ignore
microbit-matt-hillsdon Mar 14, 2024
2ec757a
Apply suggestions from code review
microbit-matt-hillsdon Mar 14, 2024
9dc4ea0
Reviewed
microbit-matt-hillsdon Mar 14, 2024
f1cc2e4
Merge branch 'vite' of github.com:microbit-foundation/python-editor-v…
microbit-matt-hillsdon Mar 14, 2024
d4313dd
Pass ssr: false to useMediaQuery
microbit-matt-hillsdon Mar 14, 2024
994c4a7
Ensure we don't index when language doesn't match
microbit-matt-hillsdon Mar 14, 2024
94befff
Doc updates.
microbit-matt-hillsdon Mar 15, 2024
5150443
Remove debug
microbit-matt-hillsdon Mar 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_VERSION=$npm_package_version
REACT_APP_NAME=$npm_package_name
VITE_VERSION=$npm_package_version
VITE_NAME=$npm_package_name
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -36,7 +36,7 @@ jobs:
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm install --no-save @microbit-foundation/[email protected]dev.31 @microbit-foundation/[email protected] @microbit-foundation/[email protected] @microbit-foundation/circleci-npm-package-versioner@1
- run: npm install --no-save @microbit-foundation/[email protected]vite.33 @microbit-foundation/[email protected] @microbit-foundation/[email protected] @microbit-foundation/circleci-npm-package-versioner@1
if: github.repository_owner == 'microbit-foundation'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -46,9 +46,9 @@ jobs:
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 }}
VITE_GA_COOKIE_PREFIX: ${{ secrets.VITE_GA_COOKIE_PREFIX }}
VITE_GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
microbit-matt-hillsdon marked this conversation as resolved.
Show resolved Hide resolved
- run: mkdir -p /tmp/app${PUBLIC_URL} && cp -r build/* /tmp/app${PUBLIC_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
Expand Down
2 changes: 1 addition & 1 deletion bin/print-ci-env-stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ if (ref === "refs/heads/main") {
}

console.log(`STAGE=${stage}`);
console.log(`REACT_APP_STAGE=${stage}`);
console.log(`VITE_STAGE=${stage}`);
55 changes: 55 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
microbit-matt-hillsdon marked this conversation as resolved.
Show resolved Hide resolved
<meta name="theme-color" content="#000000" />
microbit-matt-hillsdon marked this conversation as resolved.
Show resolved Hide resolved
<title>micro:bit Python Editor</title>
<meta property="og:title" content="micro:bit Python Editor" />
<link rel="canonical" href="%VITE_FULL_URL%" />
<meta property="og:url" content="%VITE_FULL_URL%" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@microbit_edu" />
microbit-matt-hillsdon marked this conversation as resolved.
Show resolved Hide resolved
<meta
property="og:description"
content="Built by the Micro:bit Educational Foundation and the global Python Community."
/>
<meta
name="twitter:description"
content="A Python Editor for the BBC micro:bit, built by the Micro:bit Educational Foundation and the global Python Community."
/>
<meta property="og:image" content="%VITE_FULL_URL%social.png" />
microbit-matt-hillsdon marked this conversation as resolved.
Show resolved Hide resolved
<!-- TODO: ejs support or similar likely via a tiny plugin
<% if (process.env.VITE_FOUNDATION_BUILD === 'true') { %>
<script
src="https://shared-assets.microbit.org/common/v1/common.js"
async
></script>
<link
rel="stylesheet"
href="https://shared-assets.microbit.org/common/v1/main.css"
/>
<script>
// GA config itself is via the common assets config depending on consent.
window.dataLayer = window.dataLayer || [];
window.gtag =
window.gtag ||
function () {
window.dataLayer.push(arguments);
};
</script>
<% } %>-->
microbit-matt-hillsdon marked this conversation as resolved.
Show resolved Hide resolved
<script type="module" src="/src/index.tsx"></script>
</head>
<body>
<noscript
>You need to enable JavaScript to run the Python Editor in your
browser.</noscript
>
<div id="root"></div>
</body>
</html>
Loading
Loading