score:0

Finally, I did something like this:

// tsconfig.scripts.json
{
  "compilerOptions": {
    "module": "commonjs",
    "baseUrl": ".",
    "rootDir": "./",
    "outDir": "build-script",
    "target": "es6",
    "sourceMap": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true,
    "resolveJsonModule": true
  },
  "include": ["./scripts/validateEnvVars.ts"]
}

And in the CI (github actions):

      - name: Validate Env Vars
        run: |
          set -o allexport; source .env; set +o allexport
          tsc --project ./tsconfig.scripts.json
          node build-script/scripts/validateEnvVars.js

cheers


Related Query

More Query from same tag