Skip to content

5.2 | Scripts

zalan-racz-gaijin edited this page Jun 13, 2024 · 4 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.
  • generate-dshl-antlr: Generates the ANTLR TypeScript lexer and parser from DshlLexer.g4, and DshlParser.g4.
  • generate-condition-antlr: Generates the ANTLR TypeScript lexer and parser from ConditionLexer.g4, and ConditionParser.g4.
  • 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. When you run the extension, this script is automatically called in the background. However, keep in mind, that it only rebuilds the code, but hot reload is not supported. So if you change a file, while you started the extension, you still have to close and reopen 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.
  • prepare: Runs when you install the dependencies and creates the formatting pre-commit hook. You probably never have to run it manually.

Useful resources

Clone this wiki locally