Skip to content

Commit

Permalink
chore: deploy refactored app
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmaynes committed Dec 31, 2023
1 parent c7de948 commit f3474cf
Show file tree
Hide file tree
Showing 52 changed files with 5,844 additions and 9,741 deletions.
9 changes: 7 additions & 2 deletions .eslintrc.json
@@ -1,9 +1,14 @@
{
"plugins": [
"eslint-plugin-next-on-pages"
],
"extends": [
"next/core-web-vitals",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:eslint-plugin-next-on-pages/recommended"
],
"rules": {
"prettier/prettier": "error"
"prettier/prettier": "error",
"next-on-pages/no-unsupported-configs": "error"
}
}
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Expand Up @@ -13,12 +13,14 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
- name: 🚀 Deploy 🚀
run: make deploy
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
node-version-file: '.node-version'
- name: 🔨 Install Dependencies 🔨
run: sudo apt-get update && sudo apt-get install make
# - name: 🚀 Deploy 🚀
# run: make deploy
# env:
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -30,6 +30,9 @@ yarn-error.log*
# vercel
.vercel

# Cloudflare
.wrangler

# typescript
*.tsbuildinfo
next-env.d.ts
Expand Down
1 change: 1 addition & 0 deletions .node-version
@@ -0,0 +1 @@
18.16.1
3 changes: 3 additions & 0 deletions .stylelintrc
@@ -0,0 +1,3 @@
{
"extends": ["stylelint-prettier/recommended"]
}
1 change: 1 addition & 0 deletions .tool-versions
@@ -0,0 +1 @@
nodejs 18.16.1
33 changes: 24 additions & 9 deletions Makefile
Expand Up @@ -4,11 +4,16 @@ install:
dev:
npm run dev

.PHONY: build
build:
dev_cloudflare:
npm run pages:dev

build: clean
npm run build

start: build
build_cloudflare:
npm run pages:build

start:
npm run start

lint:
Expand All @@ -18,13 +23,23 @@ lint_fix:
npm run lint:fix

performance:
chmod +x ./script/$@.sh
./script/$@.sh "3000"
npm run lighthouse

test: performance

ensure_cloudflare_kv_exists:
chmod +x ./script/ensure-cloudflare-kv-exists.sh
./script/ensure-cloudflare-kv-exists.sh "IMAGE_ANALYZER_KV"

ensure_cloudflare_page_exists:
chmod +x ./script/ensure-cloudflare-pages-exists.sh
./script/ensure-cloudflare-pages-exists.sh "image-analyzer-app"

test: lint build
ensure_cloudflare_infra_exists: ensure_cloudflare_page_exists ensure_cloudflare_kv_exists

deploy: install test
npm run pages:deploy
deploy: install test build_cloudflare ensure_cloudflare_infra_exists
chmod +x ./script/cloudflare-pages-deploy.sh
./script/cloudflare-pages-deploy.sh ".vercel/output/static" "image-analyzer-app"

clean:
rm -rf node_modules/ .next/
rm -rf node_modules/ .next/ .vercel/ build/
9 changes: 2 additions & 7 deletions README.md
@@ -1,5 +1,5 @@
# image-analyzer-app
> a NextJS application for analyzing images
> a NextJS app that allows users to analyze images using MobileNet (via TensorflowJS), ChatGPT, and Cloudflare Pages
## Requirements

Expand All @@ -26,9 +26,4 @@ make test
To deploy the application, run the following command:
```bash
make deploy
```

## TODOS

- [ ] Migrate [stockjs](https://github.com/tjmaynes/gists/tree/main/javascript/stockjs) app to web-playground
- [ ] Migrate [tic-tac-toe](https://github.com/tjmaynes/gists/tree/main/javascript/tic-tac-toe) app to web-playground
```
10 changes: 7 additions & 3 deletions lighthouserc.js
@@ -1,14 +1,18 @@
module.exports = {
ci: {
collect: {
url: 'http://localhost:3000',
startServerCommand: 'npm run start',
url: 'http://localhost:9900',
startServerReadyTimeout: 60 * 5, // 5 minutes
numberOfRuns: 1,
},
assert: {
preset: 'lighthouse:no-pwa',
assertions: {
'categories:performance': ['error', { minScore: 0.9 }],
'categories:accessibility': ['error', { minScore: 0.9 }],
'bf-cache': 'off',
'csp-xss': 'off',
'uses-long-cache-ttl': 'off',
'total-byte-weight': 'off',
},
},
},
Expand Down

0 comments on commit f3474cf

Please sign in to comment.