Skip to content

Commit 313fe13

Browse files
committed
first commit
0 parents  commit 313fe13

136 files changed

Lines changed: 61381 additions & 0 deletions

File tree

Some content is hidden

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

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_DEPLOYMENT=LOCAL

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# public/**/*.zip filter=lfs diff=lfs merge=lfs -text
2+
# public/**/*.jpg filter=lfs diff=lfs merge=lfs -text
3+
# public/**/*.png filter=lfs diff=lfs merge=lfs -text

.github/workflows/deploy.yml

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Workflow to build and deploy a Next.js site to GitHub Pages
2+
name: Deploy
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
tags:
8+
- "v*"
9+
workflow_dispatch:
10+
11+
permissions:
12+
actions: write
13+
contents: write
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
21+
jobs:
22+
cleanup:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Delete all artifacts in org repos
26+
uses: actions/github-script@v6
27+
with:
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
script: |
30+
const org = 'iDataVisualizationLab';
31+
32+
try {
33+
// Get all repositories in the org
34+
const repos = await github.paginate(github.rest.repos.listForOrg, {
35+
org,
36+
per_page: 100
37+
});
38+
39+
for (const repo of repos) {
40+
console.log(`📦 Checking artifacts in ${repo.name}...`);
41+
42+
let artifacts = [];
43+
try {
44+
artifacts = await github.paginate(github.rest.actions.listArtifactsForRepo, {
45+
owner: org,
46+
repo: repo.name,
47+
per_page: 100
48+
});
49+
} catch (err) {
50+
console.warn(`⚠️ Failed to list artifacts for ${repo.name}: ${err.message}`);
51+
continue;
52+
}
53+
54+
if (artifacts.length === 0) {
55+
console.log(`✅ No artifacts in ${repo.name}`);
56+
continue;
57+
}
58+
59+
for (const artifact of artifacts) {
60+
try {
61+
console.log(`🗑️ Deleting ${artifact.name} in ${repo.name}`);
62+
await github.rest.actions.deleteArtifact({
63+
owner: org,
64+
repo: repo.name,
65+
artifact_id: artifact.id,
66+
});
67+
} catch (err) {
68+
console.warn(`⚠️ Failed to delete ${artifact.name} in ${repo.name}: ${err.message}`);
69+
}
70+
}
71+
72+
console.log(`✅ Finished ${repo.name}`);
73+
}
74+
75+
console.log("🎉 All repositories processed.");
76+
} catch (err) {
77+
console.error(`❌ Unexpected error: ${err.message}`);
78+
core.setFailed(err.message);
79+
}
80+
81+
- name: Clean up workspace
82+
run: |
83+
sudo rm -rf $HOME/.npm
84+
sudo rm -rf $HOME/.cache
85+
sudo apt-get clean
86+
sudo rm -rf /tmp/*
87+
88+
- name: Aggressive Clean Up
89+
run: |
90+
echo "Freeing disk space..."
91+
sudo rm -rf $HOME/.npm
92+
sudo rm -rf $HOME/.cache
93+
sudo rm -rf /usr/share/dotnet
94+
sudo rm -rf /opt/hostedtoolcache
95+
sudo rm -rf /usr/local/share/boost
96+
sudo rm -rf /usr/lib/jvm
97+
sudo apt-get clean
98+
sudo rm -rf /tmp/*
99+
sudo journalctl --rotate
100+
sudo journalctl --vacuum-time=1s
101+
echo "Remaining space:"
102+
df -h
103+
104+
- name: Delete Old Artifacts
105+
uses: actions/github-script@v6
106+
id: artifact
107+
with:
108+
script: |
109+
if (context.repo.owner === 'iDataVisualizationLab') {
110+
const res = await github.rest.actions.listArtifactsForRepo({
111+
owner: context.repo.owner,
112+
repo: context.repo.repo,
113+
});
114+
115+
for (const { id } of res.data.artifacts) {
116+
await github.rest.actions.deleteArtifact({
117+
owner: context.repo.owner,
118+
repo: context.repo.repo,
119+
artifact_id: id,
120+
});
121+
}
122+
123+
console.log(`Deleted ${res.data.artifacts.length} artifacts.`);
124+
} else {
125+
console.log("Skipping artifact deletion: not in the main repo context.");
126+
}
127+
- name: Delete All Artifacts
128+
uses: actions/github-script@v6
129+
with:
130+
script: |
131+
const res = await github.rest.actions.listArtifactsForRepo({
132+
owner: context.repo.owner,
133+
repo: context.repo.repo,
134+
});
135+
136+
console.log(`Found ${res.data.artifacts.length} artifacts`);
137+
for (const { id, name, size_in_bytes, created_at } of res.data.artifacts) {
138+
console.log(`Deleting ${name} (${(size_in_bytes / 1024 / 1024).toFixed(2)} MB) created at ${created_at}`);
139+
await github.rest.actions.deleteArtifact({
140+
owner: context.repo.owner,
141+
repo: context.repo.repo,
142+
artifact_id: id,
143+
});
144+
}
145+
146+
console.log("All deletions attempted.");
147+
build:
148+
needs: cleanup
149+
runs-on: ubuntu-latest
150+
steps:
151+
- name: Checkout repository
152+
uses: actions/checkout@v4
153+
with:
154+
persist-credentials: false
155+
156+
- name: Setup Node.js
157+
uses: actions/setup-node@v4
158+
with:
159+
node-version: "20"
160+
cache: "npm"
161+
162+
- name: Cache dependencies
163+
uses: actions/cache@v4
164+
with:
165+
path: .next/cache
166+
key: ${{ runner.os }}-nextjs-${{ hashFiles('package-lock.json') }}
167+
restore-keys: |
168+
${{ runner.os }}-nextjs-
169+
170+
- name: Install dependencies
171+
run: npm install --force
172+
173+
- name: Set deployment environment variable
174+
run: echo "NEXT_PUBLIC_DEPLOYMENT=PRODUCTION" >> $GITHUB_ENV
175+
176+
- name: Set Version Environment Variable
177+
run: echo "NEXT_PUBLIC_VERSION=$VERSION" >> $GITHUB_ENV
178+
179+
- name: Set NEXT_PUBLIC_REPO_NAME
180+
run: |
181+
echo "NEXT_PUBLIC_REPO_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV
182+
183+
- name: Build Next.js site
184+
run: npm run build
185+
186+
- name: Upload static site artifact
187+
uses: actions/upload-pages-artifact@v3
188+
with:
189+
path: ./out
190+
191+
deploy:
192+
environment:
193+
name: github-pages
194+
url: ${{ steps.deployment.outputs.page_url }}
195+
runs-on: ubuntu-latest
196+
needs: build
197+
steps:
198+
- name: Deploy to GitHub Pages
199+
id: deployment
200+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# # local env files
29+
# .env*.local
30+
# # .env
31+
.venv
32+
.vscode
33+
34+
# vercel
35+
.vercel
36+
37+
# typescript
38+
*.tsbuildinfo
39+
next-env.d.ts
40+
41+
# /public/files/polygons_score_with_offset.geojson
42+
# /public/files/polygons_score.geojson
43+
44+
._.DS_Store
45+
46+
# Large geojson
47+
# public/files/pmis_lines_all_years.geojson
48+
public/files/pmis_data_line_full.geojson
49+
._*

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

components.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.ts",
8+
"css": "src/styles/globals.css",
9+
"baseColor": "zinc",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
}
20+
}

cross-env

Whitespace-only changes.

env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
NEXT_PUBLIC_DEPLOYMENT=DEVELOPMENT / PRODUCTION
2+
3+
// The data path is different for the github-pages deployment and local, see config.ts for more information

next.config.mjs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/** @type {import('next').NextConfig} */
2+
const isProduction = process.env.NEXT_PUBLIC_DEPLOYMENT === 'PRODUCTION';
3+
const isGithubActions = process.env.GITHUB_ACTIONS === 'true';
4+
5+
// Default values
6+
let assetPrefix = '';
7+
let basePath = '';
8+
let apiBaseUrl = 'https://rpdb-backend-eqgxdrekhegcdmdn.eastus-01.azurewebsites.net';
9+
10+
if (isProduction || isGithubActions) {
11+
const repo = process.env.GITHUB_REPOSITORY ?.replace(/.*?\//, '') || process.env.NEXT_PUBLIC_REPO_NAME;
12+
13+
// // Get the version from environment variable (set in GitHub Actions)
14+
// const version = process.env.NEXT_PUBLIC_VERSION || 'latest';
15+
16+
// // Ensure correct paths for each version
17+
// assetPrefix = `/${repo}/${version}/`;
18+
// basePath = `/${repo}/${version}`;
19+
assetPrefix = `/${repo}`;
20+
basePath = `/${repo}`;
21+
apiBaseUrl = 'https://rpdb-backend-eqgxdrekhegcdmdn.eastus-01.azurewebsites.net';
22+
}
23+
24+
const nextConfig = {
25+
reactStrictMode: true,
26+
output: 'export',
27+
images: {
28+
unoptimized: true,
29+
},
30+
basePath: basePath,
31+
assetPrefix: assetPrefix,
32+
trailingSlash: true,
33+
env: {
34+
API_BASE_URL: apiBaseUrl,
35+
BASE_PATH: basePath,
36+
},
37+
webpack: (config) => {
38+
config.resolve.alias['@arcgis/core'] = '@arcgis/core';
39+
return config;
40+
},
41+
42+
async headers() {
43+
return [{
44+
source: '/(.*)',
45+
headers: [{
46+
key: 'Access-Control-Allow-Origin',
47+
value: '*',
48+
}, ],
49+
}, ];
50+
},
51+
async redirects() {
52+
return [{
53+
source: '/home',
54+
destination: '/',
55+
permanent: true,
56+
}, ];
57+
},
58+
};
59+
60+
export default nextConfig;

0 commit comments

Comments
 (0)