Skip to content

Commit

Permalink
Add stale-while-loading feature (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospassos authored Oct 8, 2024
1 parent cde3c2c commit e910f59
Show file tree
Hide file tree
Showing 14 changed files with 1,236 additions and 806 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/branch-csr-example-validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -47,7 +47,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -74,7 +74,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -101,7 +101,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/branch-next-csr-example-validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -47,7 +47,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -74,7 +74,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -101,7 +101,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/branch-next-ssr-example-validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -47,7 +47,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -74,7 +74,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -101,7 +101,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/branch-validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -65,7 +65,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand All @@ -89,7 +89,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-published-releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Cache dependencies
id: cache-dependencies
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/publish-pr-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish PR preview

on:
pull_request:
types:
- synchronize
- opened

jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |-
npm ci
rm -rf ~/.npmrc
- name: Build package
run: npm run build

- name: Prepare release
run: |-
cp package.json LICENSE README.md build/
cd build
find . -type f -path '*/*\.js.map' -exec sed -i -e "s~../src~src~" {} +
sed -i -e "s~\"version\": \"0.0.0-dev\"~\"version\": \"${GITHUB_REF##*/}\"~" package.json
sed -i -e "s~\./build~.~" package.json
sed -i -e "s~./src~.~" package.json
cp -r ../src src
- name: Publish preview
run: |-
npx pkg-pr-new publish \
--compact --comment=update \
./build
Loading

0 comments on commit e910f59

Please sign in to comment.