Skip to content

Commit 475c6c7

Browse files
authored
Fix example deploy GitHub action (#395)
* ⚗️ Run action on push * ⚗️ Update action to use yarn * 🔧 Update to build both library and example * 🐛 Add base path in vite.config.js * ✨ Add asset prefix only in production * 👷 Run action only on push to main
1 parent 124e489 commit 475c6c7

File tree

6 files changed

+14
-6
lines changed

6 files changed

+14
-6
lines changed

.github/workflows/github-page.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ jobs:
1313
with:
1414
persist-credentials: false
1515

16+
- name: ⬢ Use Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 16.14.2
20+
1621
- name: Install and Build 🔧
17-
run: |
18-
cd example
19-
npm install
20-
npm run build
22+
run: yarn && yarn example:build
2123

2224
- name: Deploy 🚀
2325
uses: JamesIves/[email protected]

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"react-dom": "^18.2.0"
1414
},
1515
"devDependencies": {
16+
"@types/node": "^18.16.0",
1617
"@types/react": "^18.0.28",
1718
"@types/react-dom": "^18.0.11",
1819
"@vitejs/plugin-react": "^3.1.0",

example/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import react from '@vitejs/plugin-react';
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7+
base: process.env.NODE_ENV === 'production' ? '/react-otp-input/' : undefined,
78
});

example/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,11 @@
360360
"@jridgewell/resolve-uri" "3.1.0"
361361
"@jridgewell/sourcemap-codec" "1.4.14"
362362

363+
"@types/node@^18.16.0":
364+
version "18.16.0"
365+
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.0.tgz#4668bc392bb6938637b47e98b1f2ed5426f33316"
366+
integrity sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==
367+
363368
"@types/prop-types@*":
364369
version "15.7.5"
365370
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lint": "eslint 'src/**/*.{js,jsx}' --quiet",
1212
"lint:fix": "eslint 'src/**/*.{js,jsx}' --fix",
1313
"prepublishOnly": "rm -rf dist && npm run build",
14-
"demo:prod": "cd example && npm run build"
14+
"example:build": "cd example && yarn && yarn build"
1515
},
1616
"keywords": [
1717
"otp",

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"noImplicitThis": true,
1515
"noImplicitAny": true,
1616
"strictNullChecks": true,
17-
"suppressImplicitAnyIndexErrors": true,
1817
"allowSyntheticDefaultImports": true
1918
},
2019
"include": ["src"],

0 commit comments

Comments
 (0)