Skip to content

Commit

Permalink
chore: use vite/vitest in place of esbuild/karma+jasmine
Browse files Browse the repository at this point in the history
Neuroglancer can now be used as a regular NPM dependency with vite, parcel, or
webpack as the bundler (but unfortunately not esbuild due to
evanw/esbuild#795), and can be installed as a
dependency via a git URL.

Node.js import/export conditions are now used to enable/disable layer types and
datasources, which can be configured by dependent projects rather than when
Neuroglancer itself is built/published.

The Python tests accept a `--build-client` option to run the dev server
automatically rather than requiring a pre-built Python Neuroglancer client.
  • Loading branch information
jbms committed Feb 20, 2024
1 parent 405557f commit 7ff749f
Show file tree
Hide file tree
Showing 557 changed files with 41,954 additions and 16,588 deletions.
12 changes: 12 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,15 @@ node_modules
dist
python
templates/neuroglancer/sliceview
src/third_party/jpgjs/jpg.js
templates
build
.tox
.nox
/lib
python
config
typings
src/mesh/draco/stub.js
tsconfig.tsbuildinfo
/examples
19 changes: 0 additions & 19 deletions .eslintrc

This file was deleted.

67 changes: 67 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
root: true
parser: "@typescript-eslint/parser"
plugins:
- "@typescript-eslint"
- "import"
settings:
"import/parsers":
"@typescript-eslint/parser": [".ts", ".tsx"]
"import/resolver":
"typescript":
"node":
extends:
- "eslint:recommended"
- "plugin:@typescript-eslint/eslint-recommended"
- "plugin:@typescript-eslint/recommended"
- "plugin:import/recommended"
rules:
"@typescript-eslint/no-explicit-any": "off"
"@typescript-eslint/explicit-module-boundary-types": "off"
"@typescript-eslint/no-non-null-assertion": "off"
"@typescript-eslint/no-inferrable-types": "off"
"@typescript-eslint/no-this-alias": "off"
"@typescript-eslint/no-empty-function": "off"
"@typescript-eslint/no-empty-interface": "off"
"prefer-const":
- "error"
- destructuring: "all"
"no-constant-condition": "off"
"@typescript-eslint/no-unused-vars":
- "error"
- argsIgnorePattern: "^_"
ignoreRestSiblings: true
"@typescript-eslint/ban-types":
- "error"
- types:
# unban Function
"Function": false
extendDefaults: true
"no-unsafe-finally": "off"
"require-yield": "off"
"no-inner-declarations": "off"
"import/no-named-as-default-member": "off"
"import/no-cycle": "error"
"@typescript-eslint/consistent-type-imports": "error"
"import/no-unresolved": "error"
"import/no-extraneous-dependencies": "error"
"import/first": "error"
"import/order":
- "error"
- groups:
- "builtin"
- "external"
- "internal"
alphabetize:
order: "asc"
orderImportKind: "asc"
overrides:
- files:
- "src/**/*"
rules:
"no-restricted-imports":
- "error"
- patterns:
- group:
- "./"
- "../"
message: "Relative imports are not allowed."
22 changes: 6 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,12 @@ jobs:
- name: Typecheck with TypeScript
run: npm run typecheck
- name: Build client bundles
run: npm run build -- --no-typecheck
- name: Build JavaScript module
run: npm run build-module -- --no-typecheck
run: npm run build -- --no-typecheck --no-lint
- name: Build Python client bundles
run: npm run build-python -- --no-typecheck
run: npm run build-python -- --no-typecheck --no-lint
- uses: ./.github/actions/setup-firefox
- name: Run JavaScript tests (including WebGL)
# Swiftshader, used by Chrome headless, crashes when running Neuroglancer
# tests.
#
# The only reliable headless configuration is Firefox on Linux under
# xvfb-run, which uses Mesa software rendering.
if: startsWith(runner.os, 'Linux')
run: xvfb-run --auto-servernum --server-args='-screen 0 1024x768x24' npm run test -- --browsers Firefox
- name: Run JavaScript tests (excluding WebGL)
if: ${{ !startsWith(runner.os, 'Linux') }}
run: npm run test -- --browsers ChromeHeadless --define=NEUROGLANCER_SKIP_WEBGL_TESTS
run: npm test
- name: Run JavaScript benchmarks
run: npm run benchmark

Expand All @@ -63,6 +52,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
node-version:
- "20.x"
os:
Expand Down Expand Up @@ -99,7 +89,7 @@ jobs:
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Install Python packaging/test tools
run: python -m pip install --upgrade pip tox nox wheel numpy pytest
run: python -m pip install --upgrade pip tox nox wheel numpy -rpython/requirements-test.txt
- uses: ./.github/actions/setup-firefox
- run: nox -s lint format mypy
- name: Check for dirty working directory
Expand Down Expand Up @@ -162,7 +152,7 @@ jobs:
- run: npm install
- run: |
build_info="{'tag':'$(git describe --always --tags)', 'url':'https://github.com/google/neuroglancer/commit/$(git rev-parse HEAD)', 'timestamp':'$(date)'}"
npm run build-python -- --no-typecheck --define NEUROGLANCER_BUILD_INFO="${build_info}"
npm run build-python -- --no-typecheck --no-lint --define NEUROGLANCER_BUILD_INFO="${build_info}"
shell: bash
- name: Check for dirty working directory
run: git diff --exit-code
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/node_modules/
node_modules
/dist/
/trans
/build/
Expand All @@ -18,3 +18,5 @@ tsconfig.tsbuildinfo
.nox
.pytest_cache
/ngauth_server/secrets/
.eslintcache
/lib
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
/python/
/third_party/jpgjs/jpg.js
/testdata/*.json
.parcel-cache
dist
/lib
4 changes: 4 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
overrides:
- files: ".parcelrc"
options:
parser: "json5"
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All submissions, including submissions by project members, require review.
### Coding Style

For consistency, please ensure that all TypeScript/JavaScript files
are linted with Biome and formatted by `prettier`.
are linted with `eslint` and formatted by `prettier`.

You can check for lint/format issues with:

Expand Down
8 changes: 8 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ prune python/build_tools
prune config
prune ngauth_server
prune src
prune build_tools
prune templates
prune third_party
prune typings
Expand All @@ -24,9 +25,16 @@ exclude tslint.json
prune .github
prune *.egg-info
exclude tox.ini
exclude noxfile.py
exclude python/.pylintrc
global-exclude .gitignore
global-exclude .gitattributes
global-exclude .dockerignore
exclude python/Dockerfile
exclude python/CMakeLists.txt
exclude MANIFEST.in
exclude *.ts
exclude .prettierrc.yml
exclude .prettierignore
exclude .eslintrc.yml
exclude index.html
68 changes: 0 additions & 68 deletions biome.json

This file was deleted.

Loading

0 comments on commit 7ff749f

Please sign in to comment.