Skip to content

Commit

Permalink
feat(genenv): Small CLI to generate typescript file exporting constan…
Browse files Browse the repository at this point in the history
…ts from environment variables (#424)
  • Loading branch information
franklevasseur authored Oct 15, 2024
1 parent e70a098 commit 95aa5d1
Show file tree
Hide file tree
Showing 12 changed files with 1,478 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/genenv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: GenEnv

on:
push:
branches:
- master

pull_request:
paths:
- 'genenv/**'

workflow_dispatch: {}

defaults:
run:
working-directory: ./genenv

jobs:
genenv:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
with:
version: 8.6.2
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm check:type
- run: pnpm test
- name: Publish
if: github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch'
uses: botpress/gh-actions/publish-if-not-exists@master
with:
path: './genenv'
token: '${{ secrets.NPM_ACCESS_TOKEN }}'
2 changes: 2 additions & 0 deletions genenv/bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require("./dist/index.js");
11 changes: 11 additions & 0 deletions genenv/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import esbuild from 'esbuild'

void esbuild.build({
entryPoints: ['./src/index.ts'],
bundle: true,
platform: 'node',
format: 'cjs',
external: [],
outdir: './dist',
sourcemap: true
})
25 changes: 25 additions & 0 deletions genenv/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@bpinternal/genenv",
"version": "0.0.1",
"description": "Small CLI to generate typescript file exporting constants from environment variables.",
"bin": {
"genenv": "./bin.js"
},
"scripts": {
"check:type": "tsc --noEmit",
"dev": "ts-node -T ./src/index.ts",
"build": "ts-node -T ./build.ts",
"test": "vitest run"
},
"dependencies": {
"@bpinternal/yargs-extra": "0.0.14",
"dotenv": "^16.4.4"
},
"devDependencies": {
"@types/node": "^22.7.5",
"esbuild": "^0.16.12",
"ts-node": "^10.9.2",
"typescript": "^4.9.4",
"vitest": "^2.1.3"
}
}
Loading

0 comments on commit 95aa5d1

Please sign in to comment.