Skip to content

5.2 | Scripts

zalan-racz-gaijin edited this page Jun 14, 2024 · 3 revisions

The project contains several useful scripts you can use. In order to use them, first, you have to install the project's dependencies with npm install. The package.json contains the scripts' definitions. You can run them either from VS Code's NPM Scripts window or from the terminal like npm run eslint.

The list of scripts

  • build-production: Builds the extension in production mode, both the desktop and the web versions.
  • build: Builds the extension in development mode, both the desktop and the web versions.
  • watch: Builds the extension in development mode, both the desktop and the web versions in watch mode, so you don't have to manually run build when you change a file.
  • package-universal: Packages the Universal version of the extension. It doesn't contain platform-specific executable of the language server and therefore it can't run without Node.js. Before running this script, you have to use build-production.
  • package-windows-x64: Packages the x64 Windows-specific version of the extension. It contains the Windows-specific executable of the language server and therefore it can run without Node.js. Before running this script, you have to use build-production.
  • package-macos-x64: Packages the x64 Mac-specific version of the extension. It contains the Mac-specific executable of the language server and therefore it can run without Node.js. Before running this script, you have to use build-production.
  • package-linux-x64: Packages the x64 Linux-specific version of the extension. It contains the Linux-specific executable of the language server and therefore it can run without Node.js. Before running this script, you have to use build-production.
  • package-all: Packages all versions (Universal, Windows, Mac, Linux) of the extension. The Universal version can't run without Node.js, but the others can. Before running this script, you have to use build-production.
  • build-tests: Builds the E2E tests.
  • watch-tests: Same as build-tests, but it rebuilds the code as you change (and save) a file.
  • open-in-browser: Opens a browser and runs the web version of the extension. Use build or watch before it.
  • eslint: Runs ESLint to check if there are problems in the source code.
  • prettier-lint: Runs Prettier to check if the files are formatted correctly.
  • prettier-format: Runs Prettier to format all files. Since in the pre-commit hook Prettier formats all staged files, you rarely need to use it. However, it can be useful, if you change .prettierignore or .prettierrc.json.
  • test: Runs the E2E tests in the CI pipeline. Read this page if you want to know how to run the E2E tests locally.
  • prepare: Runs when you install the dependencies and creates the formatting pre-commit hook. You probably never have to run it manually.

Useful resources