Skip to content

Commit 8db82a9

Browse files
committed
migrate from deprecated snowpack to vite
1 parent 4b5e38f commit 8db82a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+570
-8130
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,9 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v3
13-
14-
- name: Setup Node
15-
uses: actions/setup-node@v3
13+
- uses: actions/setup-node@v3
1614
with:
17-
node-version: '16'
18-
cache: "npm"
19-
registry-url: https://npm.pkg.github.com/
20-
15+
node-version: 16
16+
cache: 'npm'
2117
- run: npm ci
22-
env:
23-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
25-
- run: npx snowpack build
18+
- run: npm run build

.github/workflows/publish.yaml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
1-
name: Deploy to GitHub Pages
1+
name: Deploy
22

33
on:
4+
# Runs on pushes targeting the default branch
45
push:
5-
branches:
6-
- main
6+
branches: ['main']
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow one concurrent deployment
18+
concurrency:
19+
group: 'pages'
20+
cancel-in-progress: true
721

822
jobs:
9-
build-deploy:
23+
# Single deploy job since we're just deploying
24+
deploy:
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
1028
runs-on: ubuntu-latest
1129
steps:
1230
- uses: actions/checkout@v3
13-
14-
- name: Setup Node
15-
uses: actions/setup-node@v3
31+
- uses: actions/setup-node@v3
1632
with:
17-
node-version: '16'
33+
node-version: 16
1834
cache: 'npm'
19-
registry-url: https://npm.pkg.github.com/
20-
2135
- run: npm ci
22-
env:
23-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
25-
- run: npx snowpack build
26-
27-
- name: Deploy
28-
uses: peaceiris/actions-gh-pages@v3
36+
- run: npm run build
37+
- uses: peaceiris/actions-gh-pages@v3
2938
with:
3039
github_token: ${{ secrets.GITHUB_TOKEN }}
31-
publish_dir: ./build
40+
publish_dir: './dist'
3241
cname: code.circuitpython.org

.gitignore

Lines changed: 2 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,8 @@ yarn-error.log*
77
lerna-debug.log*
88
.pnpm-debug.log*
99

10-
# Diagnostic reports (https://nodejs.org/api/report.html)
11-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12-
13-
# Runtime data
14-
pids
15-
*.pid
16-
*.seed
17-
*.pid.lock
18-
19-
# Directory for instrumented libs generated by jscoverage/JSCover
20-
lib-cov
21-
22-
# Coverage directory used by tools like istanbul
23-
coverage
24-
*.lcov
25-
26-
# nyc test coverage
27-
.nyc_output
28-
29-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30-
.grunt
31-
32-
# Bower dependency directory (https://bower.io/)
33-
bower_components
34-
35-
# node-waf configuration
36-
.lock-wscript
37-
38-
# Compiled binary addons (https://nodejs.org/api/addons.html)
39-
build/Release
40-
4110
# Dependency directories
4211
node_modules/
43-
jspm_packages/
44-
45-
# Snowpack dependency directory (https://snowpack.dev/)
46-
web_modules/
4712

4813
# TypeScript cache
4914
*.tsbuildinfo
@@ -54,82 +19,15 @@ web_modules/
5419
# Optional eslint cache
5520
.eslintcache
5621

57-
# Microbundle cache
58-
.rpt2_cache/
59-
.rts2_cache_cjs/
60-
.rts2_cache_es/
61-
.rts2_cache_umd/
62-
63-
# Optional REPL history
64-
.node_repl_history
65-
66-
# Output of 'npm pack'
67-
*.tgz
68-
69-
# Yarn Integrity file
70-
.yarn-integrity
71-
72-
# dotenv environment variables file
73-
.env
74-
.env.test
75-
.env.production
76-
77-
# parcel-bundler cache (https://parceljs.org/)
78-
.cache
79-
.parcel-cache
80-
81-
# Next.js build output
82-
.next
83-
out
84-
85-
# Nuxt.js build / generate output
86-
.nuxt
87-
dist
88-
89-
# Gatsby files
90-
.cache/
91-
# Comment in the public line in if your project uses Gatsby and not Next.js
92-
# https://nextjs.org/blog/next-9-1#public-directory-support
93-
# public
94-
95-
# vuepress build output
96-
.vuepress/dist
97-
98-
# Serverless directories
99-
.serverless/
100-
101-
# FuseBox cache
102-
.fusebox/
103-
104-
# DynamoDB Local files
105-
.dynamodb/
106-
107-
# TernJS port file
108-
.tern-port
109-
11022
# Stores VSCode versions used for testing VSCode extensions
11123
.vscode-test
11224

113-
# yarn v2
114-
.yarn/cache
115-
.yarn/unplugged
116-
.yarn/build-state.yml
117-
.yarn/install-state.gz
118-
.pnp.*
119-
120-
# SnowPack output
121-
build
122-
123-
.DS_Store
25+
# Vite output
26+
dist/
12427

12528
# Local SSL
12629
localhost.cert
12730
localhost.key
128-
snowpack.crt
129-
snowpack.key
13031

13132
# Testing folder
13233
code/
133-
134-
# generated and compiled files
135-
assets/css/

Makefile

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,15 @@ A live copy of the tool is hosted here: https://code.circuitpython.org
66

77
## Environment Setup
88

9-
1. Make sure NPM Version 16 is installed
10-
2. Copy Files from the Repo to your Web Server Root.
11-
3. Run npm install
12-
4. Run npx snowpack dev to continuously update on file changes (or npx snowpack build for one time)
9+
1. Copy files from the repo to your web server root.
10+
2. Run `npm install`
11+
3. Run `npm run dev` or `npx vite` to continuously update on file changes
12+
1. Debug with `npx vite -d`
1313

14-
## Running locally as with SSL
14+
## Production Build
1515

16-
There are 2 ways to do this.
17-
18-
### Using devcert (No installation required)
19-
20-
This is a quick way to get up and running.
21-
22-
1. Generate the certificates by running: npx devcert-cli generate localhost
23-
2. In snowpack.config.mjs, uncomment any lines with the words "cert" and "key"
24-
25-
### Using mkcert (Installation required)
26-
27-
This way requires installing mkcert, but it's much easier to switch back and forth between https and http.
28-
29-
1. Install [mkcert](https://github.com/FiloSottile/mkcert) on your system
30-
2. Generate the certificates by running: mkcert -install && mkcert -key-file snowpack.key -cert-file snowpack.crt localhost
31-
3. Start snowpack in secure mode by --secure to the command: npx snowpack dev --secure
16+
1. Run `npm run build` or `npx vite build` to generate a static website.
17+
2. Copy and deploy all files and folders in `./dist/` to your webserver.
3218

3319
## License
3420

assets/js/header_mobile.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

assets/sass/fontawesome.scss

Lines changed: 0 additions & 7 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)