diff --git a/.bazelignore b/.bazelignore index accce227b..3c3629e64 100644 --- a/.bazelignore +++ b/.bazelignore @@ -1 +1 @@ -ts/node_modules +node_modules diff --git a/.buildkite/linux/entrypoint b/.buildkite/linux/entrypoint index b6b664731..af8a3b42b 100755 --- a/.buildkite/linux/entrypoint +++ b/.buildkite/linux/entrypoint @@ -11,7 +11,7 @@ BAZEL="bazel --output_user_root=/state/bazel --output_base=/state/bazel/anki" BUILDARGS="--config=ci --experimental_convenience_symlinks=ignore --disk_cache=/state/bazel/disk --repository_cache=/state/bazel/repo" # move existing node_modules into tree -test -e /state/node_modules && mv /state/node_modules ts/ +test -e /state/node_modules && mv /state/node_modules . $BAZEL build $BUILDARGS ... @@ -26,4 +26,4 @@ python scripts/copyright_headers.py echo "--- Cleanup" # if tests succeed, back up node_modules folder -mv ts/node_modules /state/ +mv node_modules /state/ diff --git a/.buildkite/mac/entrypoint b/.buildkite/mac/entrypoint index 547cb053e..23b21e6f7 100755 --- a/.buildkite/mac/entrypoint +++ b/.buildkite/mac/entrypoint @@ -7,7 +7,7 @@ BAZEL="bazel --output_user_root=~/bazel --output_base=~/bazel/anki" BUILDARGS="--config=ci --experimental_convenience_symlinks=ignore" # move existing node_modules into tree -test -e ~/node_modules && mv ~/node_modules ts/ +test -e ~/node_modules && mv ~/node_modules . $BAZEL build $BUILDARGS ... @@ -16,4 +16,4 @@ $BAZEL test $BUILDARGS ... echo "--- Cleanup" # if tests succeed, back up node_modules folder -mv ts/node_modules ~/ +mv node_modules ~/ diff --git a/.buildkite/windows/entrypoint.bat b/.buildkite/windows/entrypoint.bat index e9c9c47f5..637b0bdda 100755 --- a/.buildkite/windows/entrypoint.bat +++ b/.buildkite/windows/entrypoint.bat @@ -3,7 +3,7 @@ set BAZEL=\bazel\bazel.exe --output_user_root=\bazel\ankici --output_base=\bazel set BUILDARGS=--config=ci if exist \bazel\node_modules ( - move \bazel\node_modules ts\node_modules + move \bazel\node_modules .\node_modules ) :: rollup may fail on the first build, so we build once without checking return code @@ -37,4 +37,4 @@ IF %ERRORLEVEL% NEQ 0 exit /B 1 @REM echo Import succesful. echo --- Cleanup -move ts\node_modules \bazel\node_modules +move node_modules \bazel\node_modules diff --git a/.gitignore b/.gitignore index bf65a8816..e26510d69 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ target user.bazelrc .dmypy.json rust-project.json +node_modules diff --git a/BUILD.bazel b/BUILD.bazel index f7c42abad..2e1218f56 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -33,5 +33,7 @@ pkg_tar( tags = ["manual"], ) -# for version info -exports_files(["defs.bzl"]) +exports_files([ + "defs.bzl", + "package.json", +]) diff --git a/WORKSPACE b/WORKSPACE index 26a551657..a6a9ab790 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,7 +1,7 @@ workspace( name = "ankidesktop", managed_directories = {"@npm": [ - "ts/node_modules", + "node_modules", ]}, ) diff --git a/defs.bzl b/defs.bzl index d165051eb..4c75a192b 100644 --- a/defs.bzl +++ b/defs.bzl @@ -43,12 +43,12 @@ def setup_deps(): python_runtime = "@python//:python", ) - node_repositories(package_json = ["@ankidesktop//ts:package.json"]) + node_repositories(package_json = ["@ankidesktop//:package.json"]) yarn_install( name = "npm", - package_json = "@ankidesktop//ts:package.json", - yarn_lock = "@ankidesktop//ts:yarn.lock", + package_json = "@ankidesktop//:package.json", + yarn_lock = "@ankidesktop//:yarn.lock", ) sass_repositories() diff --git a/docs/development.md b/docs/development.md index cff63dbb2..23166bf06 100644 --- a/docs/development.md +++ b/docs/development.md @@ -181,7 +181,7 @@ of `use` statements. The Bazel build products will make RA start up slowly out of the box. For a much nicer experience, add each of the bazel-* folders to Rust Analyzer's excludeDirs -settings, and ts/node_modules. Wildcards don't work unfortunately. Then adjust +settings, and node_modules. Wildcards don't work unfortunately. Then adjust VS Code's "watcher exclude", and add `**/bazel-*`. After running 'code' from the project root, it may take a minute or two to be @@ -203,12 +203,12 @@ Recording also requires `lame` to be in your system path. ## Build errors and cleaning If you get errors with @npm and node_modules in the message, try deleting the -ts/node_modules folder. +node_modules folder. Unlike the old Make system, a "clean build" should almost never be required unless you are debugging issues with the build system. But if you need to get -things to a fresh state, you can run `bazel clean --expunge`. Afte doing so, -make sure you remove the ts/node_modules folder, or subsequent build commands +things to a fresh state, you can run `bazel clean --expunge`. After doing so, +make sure you remove the node_modules folder, or subsequent build commands will fail with a "no such file or directory node_modules/anki" message. ## Tracing build problems diff --git a/ts/package.json b/package.json similarity index 97% rename from ts/package.json rename to package.json index e024d1b28..e4a38a57a 100644 --- a/ts/package.json +++ b/package.json @@ -51,7 +51,7 @@ }, "scripts": { "fix": "prettier --write */*.ts */*.svelte", - "postinstall": "patch-package" + "postinstall": "patch-package --patch-dir ts/patches" }, "dependencies": { "@fluent/bundle": "^0.17.0", diff --git a/scripts/copyright_headers.py b/scripts/copyright_headers.py index c24fc773b..3aed02dba 100644 --- a/scripts/copyright_headers.py +++ b/scripts/copyright_headers.py @@ -18,7 +18,7 @@ nonstandard_header = { ignored_folders = [ "bazel-", "qt/forms", - "ts/node_modules", + "node_modules", ] if not os.path.exists("WORKSPACE"): diff --git a/scripts/svelte-check b/scripts/svelte-check index 68433a505..a84d820e6 100755 --- a/scripts/svelte-check +++ b/scripts/svelte-check @@ -1,3 +1,5 @@ #!/bin/bash -SASS_PATH=$(pwd)/bazel-bin ts/node_modules/.bin/svelte-check --workspace ts +SASS_PATH=ts/sass:$(pwd)/bazel-bin/ts/sass \ + node_modules/.bin/svelte-check \ + --workspace ts diff --git a/ts/tsconfig.json b/ts/tsconfig.json index 75d7ed5af..7c93dc9dd 100644 --- a/ts/tsconfig.json +++ b/ts/tsconfig.json @@ -30,8 +30,7 @@ ], // uncomment for building with tsc directly // "outDir": "dist", - // "rootDir": "..", - "rootDir": ".", + "rootDir": "..", "rootDirs": [ ".", // for VS code diff --git a/ts/update-licenses.sh b/ts/update-licenses.sh index 3f0dd1f5d..348d5056e 100755 --- a/ts/update-licenses.sh +++ b/ts/update-licenses.sh @@ -3,6 +3,6 @@ set -e -./node_modules/.bin/license-checker-rseidelsohn --production --json \ +cd .. && ./node_modules/.bin/license-checker-rseidelsohn --production --json \ --excludePackages anki --relativeLicensePath \ - --relativeModulePath > licenses.json + --relativeModulePath > ts/licenses.json diff --git a/ts/yarn.lock b/yarn.lock similarity index 100% rename from ts/yarn.lock rename to yarn.lock