Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
markpbaggett authored Dec 5, 2023
0 parents commit d5e18fa
Show file tree
Hide file tree
Showing 190 changed files with 20,910 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["next/babel", "@babel/preset-typescript"],
"plugins": []
}
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_URL="https://canopy-iiif.github.io"
NEXT_PUBLIC_BASE_PATH="/canopy-iiif"
28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"plugins": ["@typescript-eslint", "testing-library"],
"extends": [
"plugin:@typescript-eslint/recommended",
"next",
"next/core-web-vitals",
"prettier"
],
"overrides": [
// Only uses Testing Library lint rules in test files
{
"files": [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[jt]s?(x)"
],
"extends": ["plugin:testing-library/react"]
}
],
"rules": {
// "sort-keys": "error",
// "sort-imports": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/sort-type-union-intersection-members": "error",
"@typescript-eslint/ban-ts-comment": "off"
}
}
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug
about: Report an issue
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature/Enhancement
about: New feature or enhancement
title: ''
labels: enhancement
assignees: ''

---

## Description

## Done Looks Like
- [ ] to do 1
- [ ] to do 2
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# What does this do?

_Please include a summary of the changes and the related issue. Please also include relevant motivation and context._

## What type of change is this?

- [ ] 🐛 **Bug fix** (non-breaking change addressing an issue)
- [ ]**New feature or enhancement** (non-breaking change which adds functionality)
- [ ] 🧨 **Breaking change** (fix or feature that would cause existing functionality to not work as expected)
- [ ] 🚧 **Maintenance or refinement of codebase structur**e (ex: dependency updates)
- [ ] 📘 **Documentation update**

## Additional Notes

_Please include any extra notes here._
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test IIIF Collection Build
on: push
jobs:
test-build:
runs-on: ubuntu-latest
# Only run if the repository is canopy-iiif/canopy-iiif
if: github.repository == 'canopy-iiif/canopy-iiif'
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Unit testing
run: npm run test:ci
- name: 2.x Collection (Aggregation)
run: npm run prebuild -- --path=./config/.fixtures/canopy.presentation-2.json
- name: 2.x Collection (Build)
run: npm run test-build
- name: 3.0 Collection (Aggregation)
run: npm run prebuild -- --path=./config/.fixtures/canopy.presentation-3.json
- name: 3.0 Collection (Build)
run: npm run test-build
- name: Customize Search (Aggregation)
run: npm run prebuild -- --path=./config/.fixtures/canopy.customize-search.json
- name: Customize Search (Build)
run: npm run test-build
- name: Minimal Configuration (Aggregation)
run: npm run prebuild -- --path=./config/.fixtures/canopy.minimal.json
- name: Minimal Configuration (Build)
run: npm run test-build
43 changes: 43 additions & 0 deletions .github/workflows/gh-pages.deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to GitHub Pages

on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Load NEXT_PUBLIC_URL and NEXT_PUBLIC_BASE_PATH from .env
run: |
set -o allexport
source .env
set +o allexport
- name: Install
run: npm ci

- name: Build
run: npm run build:static

- name: Bypass Jekyll
run: touch ./out/.nojekyll

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: out
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

.canopy
.vscode

public/api
public/robots.txt
public/sitemap*
Empty file added .prettierrc.json
Empty file.
4 changes: 4 additions & 0 deletions .stackblitzrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"installDependencies": true,
"startCommand": "npm run dev"
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Mat Jordan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Canopy IIIF

A purely IIIF sourced static site generator using Next.js. Canopy is an application that will build a browseable and searchable digital collections style static site entirely from a IIIF Collection and the items it contains.

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)](https://stackblitz.com/fork/github/canopy-iiif/canopy-iiif)

- [Demo (Static)](https://canopy-iiif.github.io/canopy-iiif/)
- [Demo (Vercel)](https://canopy-iiif.vercel.app/)
- [Documentation](https://canopy-iiif.github.io/docs/)

## Setup

### Install Dependencies

```shell
# installation
npm i
```

### Running in Development

```shell
# development
npm run dev
```

### Building in Production

```shell
# build
npm run build
```

## Tests

To run Jest unit tests:

```shell
npm run test
```

## Configuration

Canopy IIIF uses a default configuration `config/.default/canopy.default.json` for demonstration purposes if a custom one is not set. The build process will read from a custom configuration file at `config/canopy.json` if it exists. See the [Create a Canopy Project guide](https://canopy-iiif.github.io/docs/get-started) for detailed step-by-step instructions.

## License

This project is [licensed](https://github.com/canopy-iiif/canopy-iiif/blob/main/LICENSE) under the MIT License.
32 changes: 32 additions & 0 deletions canopy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require("dotenv").config();
const buildConfig = require("./src/lib/build/config");
const aggregate = require("./src/lib/build/aggregate");

const args = process.argv;

(() => {
const path = args
.find((value) => value.includes("--path="))
?.split("=")
?.pop();

const isDev = args.includes("dev");
const config = buildConfig.getConfig(path, isDev);

const url = isDev ? `http://localhost:5001` : process.env.NEXT_PUBLIC_URL;
const basePath = isDev ? `` : process.env.NEXT_PUBLIC_BASE_PATH;
const baseUrl = basePath ? `${url}${basePath}` : url;
const assetPrefix = basePath;

const env = {
CANOPY_CONFIG: {
...config,
url,
assetPrefix,
basePath,
baseUrl,
},
};

aggregate.build(env.CANOPY_CONFIG);
})();
72 changes: 72 additions & 0 deletions config/.default/canopy.default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"collection": "https://api.dc.library.northwestern.edu/api/v2/search?query=%22nez%20perce%22&as=iiif&size=125",
"metadata": ["Subject", "Date", "Dimensions"],
"featured": [
"https://api.dc.library.northwestern.edu/api/v2/works/cd5e1b9c-370b-40e5-b3d9-defc1d8e0777?as=iiif",
"https://api.dc.library.northwestern.edu/api/v2/works/14a6aa15-9e12-47a7-9617-91f430d4f47b?as=iiif"
],
"locales": [
{
"config": "locales/en.json",
"label": "English",
"lang": "en"
}
],
"map": {
"defaultBounds": [[51.505, -0.09]],
"enabled": false,
"icon": {
"iconUrl": "images/marker-icon.png",
"iconSize": [24, 36],
"iconAnchor": [12, 36]
},
"tileLayers": [
{
"name": "OpenStreetMap",
"url": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
"attribution": "&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
}
]
},
"search": {
"enabled": true,
"flexSearch": {
"charset": "latin:extra",
"optimize": true,
"tokenize": "strict",
"bidirectional": false,
"document": {
"index": [
{
"field": "label",
"tokenize": "full",
"resolution": 9,
"depth": 3,
"bidirectional": true
},
{
"field": "metadata",
"resolution": 2
},
{
"field": "summary",
"resolution": 1
}
]
}
},
"index": {
"metadata": {
"enabled": true,
"all": false
},
"summary": {
"enabled": false
}
}
},
"theme": {
"defaultTheme": "light",
"toggleEnabled": false
}
}
Loading

0 comments on commit d5e18fa

Please sign in to comment.