Skip to content

Setup for JS projects#

See github-js-release-test as an example project.

Add the files in .github/workflows to the new project.

The project must contain the following scripts in the package.json:

{
  "scripts": {
    "test": "your-test-command",
    "verify": "your-test-command",
    "build": "your-build-command"
  }
}

Optionally, a format:package-json script can be added to format the package.json. This is used for the release process when the version is reset.

In order for unit test and code coverage results to be processed by GitHub, it is necessary that the unit tests are output in the junit format in the build/junit-report.xml file and the code coverage in the cobertura format in the build/coverage directory.

Example configuration for vite.config.ts

import { defineConfig } from "vite";

export default defineConfig({
  test: {
    // ...
    reporters: ["junit"],
    outputFile: {
      junit: "./build/junit-report.xml",
    },
    coverage: {
      // ...
      reporter: [/* ... , */ "cobertura"],
      reportsDirectory: "./build/coverage",
    },
  },
});

The reports directory should also be added to the .gitignore.

The releases are published for the standard away with pnpm publish.

It is important that no publishConfig is defined in the package.json, as this is controlled via the pipeline.

The release process and other functions of the branching model are provided by the script js-project.

See: https://github.com/sitepark/js-project

Register to www.npmjs.com#

An account with access to the Sitepark organization is required.

Follow the instructions from Trusted publishing for npm packages

The project setup-npm-trusted-publish can help to create an initial project in npm.com for the new project so that it can then be configured for OIDC.

Register to app.snyk.io#

https://app.snyk.io/

Log in with a user who has administration rights for the Github Sitepark organization. Add the project.