Skip to content

Commit

Permalink
Merge pull request #58 from ProjectMirador/vite
Browse files Browse the repository at this point in the history
Vite conversion
  • Loading branch information
cbeer authored Feb 3, 2025
2 parents 192a7ee + 8b90401 commit ef513a3
Show file tree
Hide file tree
Showing 20 changed files with 381 additions and 463 deletions.
92 changes: 82 additions & 10 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,91 @@
{
"env": {},
"extends": ["airbnb", "plugin:jest/recommended"],
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"extends": [
"airbnb",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:testing-library/react"
],
"globals": {
"document": true
"page": true,
"document": true,
"vi": true
},
"parser": "@babel/eslint-parser",
"plugins": ["babel", "jest", "react", "react-hooks"],
"plugins": [
"react",
"react-hooks",
"testing-library"
],
"rules": {
"import/no-unresolved": [
2, { "ignore": ["test-utils"] }
],
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": "off",
"no-console": "off",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"no-unused-vars": "off",
"no-undef": "off",
"no-restricted-syntax": ["warn", "WithStatement"],
"no-restricted-globals": ["error"],
"eqeqeq": ["warn", "smart"],
"no-use-before-define": [
"warn",
{
"functions": false,
"classes": false,
"variables": false
},
],
"no-mixed-operators": [
"warn",
{
"groups": [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"],
],
"allowSamePrecedence": false,
},
],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/jsx-fragments": "off",
"react/jsx-props-no-spreading": "off",
"no-underscore-dangle": "off",
"react/prefer-stateless-function": "off",
"react/function-component-definition": "off"
"sort-keys": ["error", "asc", {
"caseSensitive": false,
"natural": false
}],
"react/jsx-props-no-spreading": "off",
"react/function-component-definition": "off",
"default-param-last": "off",
"arrow-parens": "off",
"import/no-anonymous-default-export": "off",
"import/no-extraneous-dependencies": "off",
"max-len": ["error", {
"code": 120,
"ignoreComments": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}],
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/require-default-props": [2, {
"functions": "defaultArguments"
}],
"react-hooks/exhaustive-deps": "error",
"testing-library/render-result-naming-convention": "off",
"testing-library/no-render-in-lifecycle": [
"error",
{
"allowTestingFrameworkSetupHook": "beforeEach"
}
]
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/coverage
/demo/dist
/dist
/es
/lib
/node_modules
Expand Down
6 changes: 3 additions & 3 deletions __tests__/MiradorImageTools.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { TestableImageTools as MiradorImageTools } from '../src/plugins/MiradorI

const mockPalette = {
palette: {
shades: { main: 'rgb(255, 255, 255)' },
getContrastText: () => 'rgb(0, 0, 0)',
shades: { main: 'rgb(255, 255, 255)' },
},
};

jest.mock('@custom-react-hooks/use-element-size', () => ({
useElementSize: () => ([undefined, { width: 100, height: 200 }]),
vi.mock('@custom-react-hooks/use-element-size', () => ({
useElementSize: () => [undefined, { height: 200, width: 100 }],
}));

function createWrapper(props) {
Expand Down
93 changes: 0 additions & 93 deletions babel.config.js

This file was deleted.

1 change: 1 addition & 0 deletions demo/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<body>
<div id="demo"></div>
<script src="./index.js" type="module"></script>
</body>

</html>
10 changes: 5 additions & 5 deletions demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { miradorImageToolsPlugin } from '../../src';

const config = {
id: 'demo',
windows: [{
imageToolsEnabled: true,
imageToolsOpen: true,
manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
}],
theme: {
palette: {
primary: {
main: '#1967d2',
},
},
},
windows: [{
imageToolsEnabled: true,
imageToolsOpen: true,
manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
}],
};

Mirador.viewer(config, [
Expand Down
21 changes: 0 additions & 21 deletions jest.config.js

This file was deleted.

7 changes: 5 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
# See https://www.netlify.com/docs/netlify-toml-reference/ for more

[build]
command = "npm run build:demo"
publish = "demo/dist"
publish = "dist/"

[[redirects]]
from = "/"
to = "/demo/src/"
Loading

0 comments on commit ef513a3

Please sign in to comment.