Skip to content

Commit e16fe3b

Browse files
Merge pull request #116 from developmentseed/feature/v8
Version 8
2 parents 2fc4e47 + 30de37f commit e16fe3b

29 files changed

+7324
-12098
lines changed

.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
APP_TITLE=Project Seed
2-
APP_DESCRIPTION=Starter application by Development Seed
1+
VITE_APP_TITLE=Project Seed
2+
VITE_APP_DESCRIPTION=Starter application by Development Seed
33

44
# If the app is being served in from a subfolder, the domain url must be set.
55
# For example, if the app is served from /mysite:
6-
# PUBLIC_URL=http://example.com/mysite
6+
# BASE_URL=http://example.com/mysite

.github/_workflow-samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This workflow gets triggered with every push to the main branch, and doesn't ver
1212
```
1313
- create an IAM with a policy that provides it with programmatic access to the bucket
1414
- add the AWS Access Key and Secret from the IAM [as encrypted secrets to the project repository](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository). Use `AWS_ACCESS_KEY_ID` & `AWS_SECRET_ACCESS_KEY`
15-
- add the bucket name as an evironemnt variable (`DEPLOY_BUCKET`) to the deploy workflow. Omit `s3://` from the bucket name.
15+
- add the bucket name as an environment variable (`DEPLOY_BUCKET`) to the deploy workflow. Omit `s3://` from the bucket name.
1616

1717
## Serving site from sub-path
1818
This workflow assumes that the site is served from the root of the URL (eg. devseed.com). To support a URL served from a sub-path (eg. devseed.com/explorer), add the following step:

.github/_workflow-samples/deploy-gh.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,34 @@ jobs:
2323
- name: Checkout
2424
uses: actions/checkout@v4
2525

26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v4
28+
2629
- name: Use Node.js
27-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
2831
with:
2932
node-version-file: '.nvmrc'
33+
cache: 'pnpm'
3034

3135
- name: Cache node_modules
32-
uses: actions/cache@v3
36+
uses: actions/cache@v4
3337
id: cache-node-modules
3438
with:
3539
path: node_modules
3640
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
3741

3842
- name: Cache dist
39-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4044
id: cache-dist
4145
with:
4246
path: dist
4347
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
4448

4549
- name: Install
46-
run: npm install
50+
run: pnpm install
4751

4852
- name: Build
49-
run: npm run all:build
53+
run: pnpm build
5054

5155
deploy:
5256
runs-on: ubuntu-latest
@@ -57,7 +61,7 @@ jobs:
5761
uses: actions/checkout@v4
5862

5963
- name: Restore dist cache
60-
uses: actions/cache@v3
64+
uses: actions/cache@v4
6165
id: cache-dist
6266
with:
6367
path: dist

.github/_workflow-samples/deploy-s3.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,75 @@ on:
88
branches:
99
- 'main'
1010

11-
env:
12-
NODE: 18
13-
DEPLOY_BUCKET:
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
1414

1515
jobs:
1616
build:
1717
runs-on: ubuntu-latest
18+
env:
19+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
20+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1821

1922
steps:
20-
- name: Cancel Previous Runs
21-
uses: styfle/[email protected]
22-
with:
23-
access_token: ${{ github.token }}
24-
2523
- name: Checkout
26-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
25+
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v4
2728

2829
- name: Use Node.js ${{ env.NODE }}
29-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
3031
with:
31-
node-version: ${{ env.NODE }}
32+
node-version-file: '.nvmrc'
33+
cache: 'pnpm'
3234

3335
- name: Cache node_modules
34-
uses: actions/cache@v3
36+
uses: actions/cache@v4
3537
id: cache-node-modules
3638
with:
3739
path: node_modules
3840
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
3941

4042
- name: Cache dist
41-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4244
id: cache-dist
4345
with:
4446
path: dist
4547
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
4648

4749
- name: Install
48-
run: yarn install
50+
run: pnpm install
4951

5052
- name: Build
51-
run: yarn build
53+
run: pnpm build
5254

5355
deploy:
5456
runs-on: ubuntu-latest
5557
needs: build
5658

5759
steps:
5860
- name: Checkout
59-
uses: actions/checkout@v3
61+
uses: actions/checkout@v4
6062

6163
- name: Restore dist cache
62-
uses: actions/cache@v3
64+
uses: actions/cache@v4
6365
id: cache-dist
6466
with:
6567
path: dist
6668
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
6769

70+
# Action: https://github.com/marketplace/actions/s3-deploy
6871
- name: Deploy to S3
69-
uses: jakejarvis/s3-sync-action@master
72+
uses: reggionick/s3-deploy@v4
7073
with:
71-
args: --acl public-read --follow-symlinks --delete
72-
env:
73-
AWS_S3_BUCKET: ${{ env.DEPLOY_BUCKET }}
74-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
75-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
76-
SOURCE_DIR: ./dist
74+
folder: dist
75+
bucket: ${{ secrets.S3_BUCKET }}
76+
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
77+
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
78+
invalidation: /
79+
delete-removed: true
80+
no-cache: true
81+
private: true
82+
files-to-include: '{.*/**,**}'

.github/workflows/checks.yml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ on:
1717
- reopened
1818
- ready_for_review
1919

20-
env:
21-
NODE: 20
22-
2320
concurrency:
2421
group: ${{ github.workflow }}-${{ github.ref }}
2522
cancel-in-progress: true
@@ -33,20 +30,24 @@ jobs:
3330
- name: Checkout
3431
uses: actions/checkout@v4
3532

33+
- name: Install pnpm
34+
uses: pnpm/action-setup@v4
35+
3636
- name: Use Node.js ${{ env.NODE }}
37-
uses: actions/setup-node@v3
37+
uses: actions/setup-node@v4
3838
with:
39-
node-version: ${{ env.NODE }}
39+
node-version-file: '.nvmrc'
40+
cache: 'pnpm'
4041

4142
- name: Cache node_modules
42-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4344
id: cache-node-modules
4445
with:
4546
path: node_modules
4647
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
4748

4849
- name: Install
49-
run: npm install
50+
run: pnpm install
5051

5152
lint:
5253
needs: prep
@@ -56,23 +57,27 @@ jobs:
5657
- name: Checkout
5758
uses: actions/checkout@v4
5859

60+
- name: Install pnpm
61+
uses: pnpm/action-setup@v4
62+
5963
- name: Use Node.js ${{ env.NODE }}
60-
uses: actions/setup-node@v3
64+
uses: actions/setup-node@v4
6165
with:
62-
node-version: ${{ env.NODE }}
66+
node-version-file: '.nvmrc'
67+
cache: 'pnpm'
6368

6469
- name: Cache node_modules
65-
uses: actions/cache@v3
70+
uses: actions/cache@v4
6671
id: cache-node-modules
6772
with:
6873
path: node_modules
6974
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
7075

7176
- name: Install
72-
run: npm install
77+
run: pnpm install
7378

7479
- name: Lint
75-
run: npm run lint
80+
run: pnpm lint
7681

7782
test:
7883
needs: prep
@@ -82,20 +87,24 @@ jobs:
8287
- name: Checkout
8388
uses: actions/checkout@v4
8489

90+
- name: Install pnpm
91+
uses: pnpm/action-setup@v4
92+
8593
- name: Use Node.js ${{ env.NODE }}
86-
uses: actions/setup-node@v3
94+
uses: actions/setup-node@v4
8795
with:
88-
node-version: ${{ env.NODE }}
96+
node-version-file: '.nvmrc'
97+
cache: 'pnpm'
8998

9099
- name: Cache node_modules
91-
uses: actions/cache@v3
100+
uses: actions/cache@v4
92101
id: cache-node-modules
93102
with:
94103
path: node_modules
95104
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
96105

97106
- name: Install
98-
run: npm install
107+
run: pnpm install
99108

100109
- name: Test
101-
run: npm run test
110+
run: pnpm run test

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20
1+
22

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# project-seed v7
1+
# project-seed v8
22

33
A basic starting point for web projects that uses parcel as a Build System.
44

@@ -18,22 +18,24 @@ Steps to follow as soon as you download this structure to start a project:
1818
It's better to do this straight away so no traces of project-seed are ever pushed to github and just looks more professional.
1919
The values that are not immediately know should be left blank and filled ASAP.
2020

21-
## Parcel for building, node to orchestrate
21+
## Vite for building
2222

23-
[Parcel](https://parceljs.org/) is used to bundle all the needed assets for the application, but there are some edge cases in some projects that parcel can't handle very well. Anything that must happen outside the final bundle, parcel can't deal with properly. For example, [parcel's static file plugin](https://github.com/elwin013/parcel-reporter-static-files-copy) will just copy the files to the dist folder, [without watching them](https://github.com/elwin013/parcel-reporter-static-files-copy#flaws-and-problems) for changes.
23+
[Vite](https://vite.dev/) is used to bundle all the needed assets for the application.
24+
There are two commands, both run via `pnpm`
2425

25-
To solve this problem, some node glue code is used to orchestrate tasks. With it, tasks can be setup to do all that is needed, and then parcel is executed to bundle the app.
26+
- `pnpm build` - clean & build everything and put it into dist folder
27+
- `pnpm serve` - serve the pages and utilize live reload on changes to fonts, images, scripts and HTML.
2628

27-
There are two commands, both run via `npm`
29+
## Chakra UI for styling
2830

29-
- `npm run build` - clean & build everything and put it into dist folder
30-
- `npm run serve` - serve the pages and utilize live reload on changes to fonts, images, scripts and HTML.
31+
Project Seed uses [Chakra UI](https://chakra-ui.com/) for styling as a UI framework. It is a component library that provides a set of accessible and reusable components facilitating the development of web applications.
3132

33+
If you don't want it, you just need to remove the `@chakra-ui/react` dependency from the `package.json` and remove the import from the `main.tsx` file.
3234

3335
### Configurations and environment variables
3436

3537
At times, it may be necessary to include options/variables specific to `production`, `staging` or `local` in the code. To handle this, there you can use `.env` files.
36-
See Parcel documentation on [env variables](https://parceljs.org/features/node-emulation/#environment-variables).
38+
See Vite's documentation on [env variables](https://vite.dev/guide/env-and-mode.html#env-variables-and-modes).
3739

3840
## Github Actions for CI
3941
Testing and deployment is taken care of by Github Actions. It is set up to:

_README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ The steps below will walk you through setting up your own instance of the projec
88
### Install Project Dependencies
99
To set up the development environment for this website, you'll need to install the following on your system:
1010

11-
- [Node](http://nodejs.org/) v20 (To manage multiple node versions we recommend [nvm](https://github.com/creationix/nvm))
11+
- [Node](http://nodejs.org/) v22 (To manage multiple node versions we recommend [nvm](https://github.com/creationix/nvm))
12+
- [pnpm](https://pnpm.io/) Install using corepack (`corepack enable pnpm`)
1213

1314
### Install Application Dependencies
1415

@@ -21,7 +22,7 @@ nvm install
2122
Install Node modules:
2223

2324
```
24-
npm install
25+
pnpm install
2526
```
2627

2728
## Usage
@@ -40,7 +41,7 @@ Run the project locally by copying the `.env` to `.env.local` and setting the fo
4041
### Starting the app
4142

4243
```
43-
yarn serve
44+
pnpm serve
4445
```
4546
Compiles the sass files, javascript, and launches the server making the site available at `http://localhost:9000/`
4647
The system will watch files and execute tasks whenever one of them changes.
@@ -50,18 +51,13 @@ The site will automatically refresh since it is bundled with livereload.
5051
To prepare the app for deployment run:
5152

5253
```
53-
npm run build
54+
pnpm build
5455
```
5556
or
5657
```
57-
npm run stage
58+
pnpm stage
5859
```
5960
This will package the app and place all the contents in the `dist` directory.
6061
The app can then be run by any web server.
6162

62-
**When building the site for deployment provide the base url trough the `PUBLIC_URL` environment variable. Omit the leading slash. (E.g. https://example.com)**
63-
64-
If you want to use any other parcel feature it is also possible. Example:
65-
```
66-
PARCEL_BUNDLE_ANALYZER=true npm run parcel build app/index.html
67-
```
63+
**When building the site for deployment provide the base url trough the `BASE_URL` environment variable. Omit the leading slash. (E.g. https://example.com)**

app/scripts/main.tsx renamed to app/main.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import { ChakraProvider } from '@chakra-ui/react';
12
import React, { useEffect } from 'react';
23
import { createRoot } from 'react-dom/client';
34

5+
import system from './styles/theme';
6+
47
// If using a router add the public url to the base path.
5-
// const publicUrl = process.env.PUBLIC_URL || '';
8+
// const publicUrl = process.env.BASE_URL || '';
69

710
// Root component.
811
function Root() {
@@ -13,7 +16,11 @@ function Root() {
1316
setTimeout(() => banner.remove(), 500);
1417
}, []);
1518

16-
return <p>Hello from Starter</p>;
19+
return (
20+
<ChakraProvider value={system}>
21+
<p>Hello World</p>
22+
</ChakraProvider>
23+
);
1724
}
1825

1926
const rootNode = document.querySelector('#app-container')!;

0 commit comments

Comments
 (0)