Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Run the test commands in the scope of the monorepo.
  2. # Eslint and prettier (plus some configs) are on the root.
  3. RUN_LINTING = ../../bin/run -w /overleaf/libraries/settings monorepo yarn run --silent
  4. RUN_LINTING_MONOREPO = ../../bin/run monorepo yarn run --silent
  5. WITH_CACHE_FOLDER = \
  6. lint \
  7. lint_ci \
  8. lint_fix \
  9. format \
  10. format_ci \
  11. format_fix \
  12. typecheck \
  13. typecheck_ci \
  14. $(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/
  15. ../../node_modules/.cache/prettier/:
  16. mkdir -p $@
  17. $(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/
  18. ../../node_modules/.cache/eslint/:
  19. mkdir -p $@
  20. format:
  21. $(RUN_LINTING_MONOREPO) format libraries/settings
  22. format_ci:
  23. $(RUN_LINTING_MONOREPO) format libraries/settings
  24. format_fix:
  25. $(RUN_LINTING_MONOREPO) format:fix libraries/settings
  26. lint:
  27. $(RUN_LINTING) lint
  28. lint_ci:
  29. -$(RUN_LINTING) lint --format json --output-file reports/eslint.json
  30. sed -i 's_"filePath":"/overleaf_"filePath":"$(MONOREPO)_g' reports/eslint.json
  31. lint_fix:
  32. $(RUN_LINTING) lint:fix
  33. typecheck:
  34. $(RUN_LINTING) types:check
  35. typecheck_ci:
  36. $(RUN_LINTING) types:check
  37. test: test_unit
  38. test_unit:
  39. ifneq (,$(wildcard test/unit))
  40. $(RUN_LINTING) test:unit
  41. endif
  42. test: test_acceptance
  43. test_acceptance:
  44. ifneq (,$(wildcard test/acceptance))
  45. $(RUN_LINTING) test:acceptance
  46. endif