diff --git a/Makefile b/Makefile index 50dc06f..ba4bb9a 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,26 @@ +default: run + +## Dependencies deps-js: cd frontend; npm install && npx puppeteer browsers install chrome +deps-js-update: + cd frontend; npx npm-check-updates -i + deps-py: pipenv install -d +deps-py-update: + pipenv update + deps: deps-js deps-py +## Build and Test build-js: cd frontend; npm run build +build: build-js + watch-js: cd frontend; npm run watch @@ -18,6 +30,9 @@ test-js: test-js-update: cd frontend; LANG=en npm run test -- -u +test: test-js + +## Utils run: cd example; pipenv run fava example.beancount @@ -25,6 +40,7 @@ run-debug: cd example; pipenv run fava --debug example.beancount lint: + cd frontend; npx tsc --noEmit pipenv run mypy src/fava_dashboards/__init__.py scripts/format_js_in_dashboard.py pipenv run pylint src/fava_dashboards/__init__.py scripts/format_js_in_dashboard.py @@ -36,9 +52,9 @@ format: ci: make lint - make build-js + make build make run & - make test-js + make test make format git diff --exit-code diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f36898c..dac1da1 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -19,7 +19,8 @@ "jest-puppeteer": "^9.0.0", "jest-serializer-html": "^7.1.0", "prettier": "^3.1.0", - "puppeteer": "^22.4.1" + "puppeteer": "^22.4.1", + "typescript": "^5.4.2" } }, "node_modules/@ampproject/remapping": { @@ -6143,6 +6144,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typescript": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", diff --git a/frontend/package.json b/frontend/package.json index 1ee3627..b0575a5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,7 +14,8 @@ "jest-puppeteer": "^9.0.0", "jest-serializer-html": "^7.1.0", "prettier": "^3.1.0", - "puppeteer": "^22.4.1" + "puppeteer": "^22.4.1", + "typescript": "^5.4.2" }, "dependencies": { "d3": "^7.8.5", diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json new file mode 100644 index 0000000..1d46a31 --- /dev/null +++ b/frontend/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "target": "es2022", + "moduleResolution": "Node", + }, +}