Skip to content

Commit 87824e0

Browse files
authored
Initial commit
0 parents  commit 87824e0

File tree

202 files changed

+27602
-0
lines changed

Some content is hidden

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

202 files changed

+27602
-0
lines changed

.babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["next/babel", "@babel/preset-typescript"],
3+
"plugins": []
4+
}

.env

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
NEXT_PUBLIC_URL="https://canopy-iiif.github.io"
2+
NEXT_PUBLIC_BASE_PATH="/canopy-iiif"

.eslintrc.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"plugins": ["@typescript-eslint", "testing-library"],
3+
"extends": [
4+
"plugin:@typescript-eslint/recommended",
5+
"next",
6+
"next/core-web-vitals",
7+
"prettier"
8+
],
9+
"overrides": [
10+
// Only uses Testing Library lint rules in test files
11+
{
12+
"files": [
13+
"**/__tests__/**/*.[jt]s?(x)",
14+
"**/?(*.)+(spec|test).[jt]s?(x)"
15+
],
16+
"extends": ["plugin:testing-library/react"]
17+
}
18+
],
19+
"rules": {
20+
// "sort-keys": "error",
21+
// "sort-imports": "error",
22+
"@typescript-eslint/no-var-requires": "off",
23+
"@typescript-eslint/no-unused-vars": "error",
24+
"@typescript-eslint/no-explicit-any": "off",
25+
"@typescript-eslint/sort-type-union-intersection-members": "error",
26+
"@typescript-eslint/ban-ts-comment": "off",
27+
"react/display-name": "off"
28+
}
29+
}

.github/ISSUE_TEMPLATE/bug.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug
3+
about: Report an issue
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Additional context**
27+
Add any other context about the problem here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Feature/Enhancement
3+
about: New feature or enhancement
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
## Description
11+
12+
## Done Looks Like
13+
- [ ] to do 1
14+
- [ ] to do 2

.github/pull_request_template.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# What does this do?
2+
3+
_Please include a summary of the changes and the related issue. Please also include relevant motivation and context._
4+
5+
## What type of change is this?
6+
7+
- [ ] 🐛 **Bug fix** (non-breaking change addressing an issue)
8+
- [ ]**New feature or enhancement** (non-breaking change which adds functionality)
9+
- [ ] 🧨 **Breaking change** (fix or feature that would cause existing functionality to not work as expected)
10+
- [ ] 🚧 **Maintenance or refinement of codebase structur**e (ex: dependency updates)
11+
- [ ] 📘 **Documentation update**
12+
13+
## Additional Notes
14+
15+
_Please include any extra notes here._

.github/workflows/build.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Test IIIF Collection Build
2+
on: push
3+
jobs:
4+
test-build:
5+
runs-on: ubuntu-latest
6+
# Only run if the repository is canopy-iiif/canopy-iiif
7+
if: github.repository == 'canopy-iiif/canopy-iiif'
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Install dependencies
11+
run: npm install
12+
- name: Unit testing
13+
run: npm run test:ci
14+
- name: 2.x Collection (Aggregation)
15+
run: npm run prebuild -- --path=./config/.fixtures/canopy.presentation-2.json
16+
- name: 2.x Collection (Build)
17+
run: npm run test-build
18+
- name: 3.0 Collection (Aggregation)
19+
run: npm run prebuild -- --path=./config/.fixtures/canopy.presentation-3.json
20+
- name: 3.0 Collection (Build)
21+
run: npm run test-build
22+
- name: Arabic Language (Aggregation)
23+
run: npm run prebuild -- --path=./config/.fixtures/canopy.arabic.json
24+
- name: Arabic Language (Build)
25+
run: npm run test-build
26+
- name: Customize Search (Aggregation)
27+
run: npm run prebuild -- --path=./config/.fixtures/canopy.customize-search.json
28+
- name: Customize Search (Build)
29+
run: npm run test-build
30+
- name: Minimal Configuration (Aggregation)
31+
run: npm run prebuild -- --path=./config/.fixtures/canopy.minimal.json
32+
- name: Minimal Configuration (Build)
33+
run: npm run test-build

.github/workflows/gh-pages.deploy.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
node-version: [18.x]
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
20+
- name: Setup Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- name: Load NEXT_PUBLIC_URL and NEXT_PUBLIC_BASE_PATH from .env
26+
run: |
27+
set -o allexport
28+
source .env
29+
set +o allexport
30+
31+
- name: Install
32+
run: npm ci
33+
34+
- name: Build
35+
run: npm run build:static
36+
37+
- name: Bypass Jekyll
38+
run: touch ./out/.nojekyll
39+
40+
- name: Deploy
41+
uses: JamesIves/github-pages-deploy-action@v4
42+
with:
43+
branch: gh-pages
44+
folder: out

.gitignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel
35+
36+
.canopy
37+
.vscode
38+
39+
public/api
40+
public/robots.txt
41+
public/sitemap*

.prettierrc.json

Whitespace-only changes.

.stackblitzrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"installDependencies": true,
3+
"startCommand": "npm run dev"
4+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Mat Jordan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Canopy IIIF
2+
3+
An open-source static site generator designed for fast creation, contextualization, and customization of a discovery-focused digital scholarship and collections website using [IIIF](https://iiif.io/) APIs.
4+
5+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)](https://stackblitz.com/fork/github/canopy-iiif/canopy-iiif)
6+
7+
- [Demo (Static)](https://canopy-iiif.github.io/canopy-iiif/)
8+
- [Documentation](https://canopy-iiif.github.io/docs/)
9+
10+
![collage of canopy iiif views](https://github.com/canopy-iiif/canopy-iiif/assets/7376450/1779a0ce-1f62-4e9b-8186-110264c81bba)
11+
12+
## Setup
13+
14+
### Install Dependencies
15+
16+
```shell
17+
# installation
18+
npm i
19+
```
20+
21+
### Running in Development
22+
23+
```shell
24+
# development
25+
npm run dev
26+
```
27+
28+
### Building in Production
29+
30+
```shell
31+
# build
32+
npm run build
33+
```
34+
35+
## Tests
36+
37+
To run Jest unit tests:
38+
39+
```shell
40+
npm run test
41+
```
42+
43+
## Configuration
44+
45+
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.
46+
47+
## License
48+
49+
This project is [licensed](https://github.com/canopy-iiif/canopy-iiif/blob/main/LICENSE) under the MIT License.

canopy.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require("dotenv").config();
2+
const buildConfig = require("./src/lib/build/config");
3+
const aggregate = require("./src/lib/build/aggregate");
4+
5+
const args = process.argv;
6+
7+
(() => {
8+
const path = args
9+
.find((value) => value.includes("--path="))
10+
?.split("=")
11+
?.pop();
12+
13+
const isDev = args.includes("dev");
14+
const config = buildConfig.getConfig(path, isDev);
15+
16+
const url = isDev ? `http://localhost:5001` : process.env.NEXT_PUBLIC_URL;
17+
const basePath = isDev ? `` : process.env.NEXT_PUBLIC_BASE_PATH;
18+
const baseUrl = basePath ? `${url}${basePath}` : url;
19+
const assetPrefix = basePath;
20+
21+
const env = {
22+
CANOPY_CONFIG: {
23+
...config,
24+
url,
25+
assetPrefix,
26+
basePath,
27+
baseUrl,
28+
},
29+
};
30+
31+
aggregate.build(env.CANOPY_CONFIG);
32+
})();

0 commit comments

Comments
 (0)