Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: import template repository from atlas #23

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: npm
directories:
- /
- /functions
schedule:
interval: monthly
groups:
safe-dependencies:
update-types: ['minor', 'patch']
major-dependencies:
update-types: ['major']
commit-message:
prefix: deps
prefix-development: deps(dev)
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
ci-dependencies:
dependency-type: 'production'
83 changes: 83 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Pull Request Events

on: pull_request

permissions:
contents: write
id-token: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
test-check:
name: Lint and check types
runs-on: ubuntu-latest

steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm

- name: 📥 Download dependencies
run: npm ci

- name: 🧶 Lint
run: npm run lint

- name: 🧪 Check types
run: npm run check

test-unit:
name: Unit tests
runs-on: ubuntu-latest

steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm

- name: 📥 Download dependencies
run: npm ci

- name: 🧪 Run tests
run: npm test

deploy-preview:
name: Firebase preview
runs-on: ubuntu-latest
needs: [test-unit, test-check]
if: ${{ github.event.sender.type == 'User' && github.head_ref != 'dev' }}
environment:
name: preview

steps:
- name: 🚀 Deploy
uses: agrc/firebase-website-deploy-composite-action@v1
with:
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
preview: yes
build-command: npm run build -- --mode dev
repo-token: ${{ secrets.GITHUB_TOKEN }}
env:
VITE_DISCOVER: ${{ secrets.VITE_DISCOVER }}
VITE_WEB_API: ${{ secrets.VITE_WEB_API }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,12 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# deploy
/public/assets
/build
/deploy
/dist

# MacOS
.DS_Store
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vscode
/data
/forklift
/maps
/mockups
/scripts
/dist
/public/assets
CHANGELOG.md
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson", "prettier-plugin-tailwindcss"],
"printWidth": 120,
"singleQuote": true
}
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"streetsidesoftware.code-spell-checker",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"dbaeumer.vscode-eslint",
]
}
45 changes: 45 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"cSpell.words": [
"apos",
"arcgis",
"arcpy",
"basemap",
"browserslist",
"cadastre",
"escaperegexp",
"esrijs",
"firebaserc",
"geocode",
"geodatabase",
"geodatabases",
"Geospatial",
"gnis",
"hostingchannels",
"lods",
"noopener",
"noreferrer",
"packagejson",
"sgid",
"sitla",
"srid",
"tagname",
"tailwindcss",
"topo",
"UDNR",
"udwr",
"UDWRRT",
"ugrc",
"usgs",
"USNG",
"vite",
"wkid"
],
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
1 change: 1 addition & 0 deletions data/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Intended to hold any data that you want included and version with the app.
54 changes: 54 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import js from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import prettier from 'eslint-plugin-prettier';
import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
import tseslint from 'typescript-eslint';

// eslint.config.js
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
...reactPlugin.configs.flat.recommended,
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
...reactPlugin.configs.flat.recommended.languageOptions,
globals: {
...globals.browser,
...globals.node,
...globals.es2022,
},
},
settings: { react: { version: 'detect' } },
plugins: {
react: reactPlugin,
prettier,
'react-hooks': reactHooks,
},
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
rules: {
...eslintConfigPrettier.rules,
...reactHooks.configs.recommended.rules,
...reactPlugin.configs['jsx-runtime'].rules,
},
},
{
ignores: [
'.firebase',
'.github/*',
'.vscode/*',
'data/*',
'dist/*',
'forklift/*',
'maps/*',
'mockups/*',
'node_modules/*',
'package-lock.json',
'public/*',
'scripts/*',
],
},
);
1 change: 1 addition & 0 deletions forklift/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A folder location for forklift pallets
59 changes: 59 additions & 0 deletions forklift/WRIPallet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
WRIPallet.py
A module that defines a forklift pallet for the WRI project.
'''

from pathlib import Path

import arcpy

from forklift.models import Pallet


class WRIPallet(Pallet):
def build(self, configuration):
sgid = str(Path(self.staging_rack) / 'SGID10.gdb')
udnr = str(Path(self.staging_rack) / 'UDNR.gdb')
udwr = str(Path(self.staging_rack) / 'UDWRRT2.gdb')

self.copy_data = [sgid, udnr, udwr]

self.add_crates([
'BLMDistricts',
'LandOwnership',
'ZoomLocations',
'Counties',
'StreamsNHDHighRes',
'Watersheds_Area'
], {'source_workspace': str(Path(self.garage) / 'SGID.sde'), 'destination_workspace': sgid})

self.add_crates([
'SageGrouse_SGMA_outlines',
'Regions'
], {'source_workspace': str(Path(self.garage) / 'UDNR.sde'), 'destination_workspace': udnr})

self.add_crates([
'NRCS_precip1981_2010_a_ut',
'SiteInfo'
], {'source_workspace': str(Path(self.garage) / 'UDWRRT2.sde'), 'destination_workspace': udwr})

def process(self):
for crate in [crate for crate in self.get_crates() if crate.was_updated()]:
self.log.debug('crate %s was updated', crate.source_name.lower())

if crate.source_name.lower() != 'sgid.water.watersheds_area':
continue

self.log.debug('watersheds area updated, rebuilding')
dissolve_location = str(Path(crate.destination_workspace) / "Watershed_Areas_Dissolved")

self.log.debug('dissolve layer location %s', dissolve_location)

if arcpy.Exists(dissolve_location):
self.log.debug('table exists, deleting')

arcpy.management.Delete(dissolve_location)

arcpy.management.Dissolve(in_features=crate.destination, out_feature_class=dissolve_location, dissolve_field=["HUC_10"], statistics_fields="HU_10_NAME FIRST")
19 changes: 19 additions & 0 deletions forklift/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# WRI forklift pallet

## Installation

> [!TIP]
> This pallet has no python dependencies that need to be installed.

This pallet uses the following enterprise geodatabases as sources

- UDNR
- SGID
- UDWRRT2

> [!IMPORTANT]
> Three `*.sde` files need to be installed in the garage for this pallet.
>
> 1. SGID.sde
> 1. UDNR.sde
> 1. UDWRRT2.sde
Empty file added functions/.gitkeep
Empty file.
Loading