Skip to content

Commit

Permalink
create cliend-ids on publish
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeseda committed Jun 25, 2024
1 parent a17790c commit 94f2010
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
node-version: lts/*
registry-url: https://registry.npmjs.org/

- name: Create client-ids.json
run: node scripts/create-client-ids.js

- name: Publish @RC to npm
if: contains(github.ref, 'RC')
run: npm publish --tag RC
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
client-ids.json

.env
node_modules/
.nyc_output/
coverage/
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
"test:integration": "cross-env NODE_ENV=testing tape 'test/integration/**/*-test.js' | tap-arc -v",
"test:integration:slow": "cross-env NODE_ENV=testing tape 'test/integration/**/*-test-slow.js' | tap-arc -v",
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
"lint": "eslint . --fix"
"lint": "eslint . --fix",
"create:client-ids": "node --env-file .env scripts/create-client-ids.js"
},
"dependencies": {
"@architect/inventory": "4.0.4",
"@architect/parser": "6.0.3",
"@architect/utils": "4.0.4",
"@architect/inventory": "4.0.5",
"@architect/parser": "7.0.1",
"@architect/utils": "4.0.6",
"@begin/api": "1.9.4",
"@colors/colors": "1.6.0",
"@enhance/cli": "1.2.0",
Expand All @@ -33,19 +34,19 @@
"tiny-json-http": "7.5.1",
"tmp": "0.2.3",
"update-notifier-cjs": "5.1.6",
"ws": "8.16.0"
"ws": "8.17.1"
},
"devDependencies": {
"@architect/eslint-config": "3.0.0-RC.0",
"@architect/plugin-node-prune": "2.1.0-RC.0",
"cross-env": "~7.0.3",
"eslint": "~8.57.0",
"fs-extra": "~11.2.0",
"nyc": "~15.1.0",
"nyc": "~17.0.0",
"proxyquire": "~2.1.3",
"string-argv": "~0.3.2",
"tap-arc": "~1.2.2",
"tape": "~5.7.5"
"tape": "~5.8.1"
},
"eslintConfig": {
"extends": "@architect/eslint-config",
Expand Down
15 changes: 15 additions & 0 deletions scripts/create-client-ids.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /usr/bin/env node

const { join } = require('node:path')
const { writeFileSync } = require('node:fs')

const staging = process.env.BEGIN_CLI_CLIENT_ID_STAGING
const production = process.env.BEGIN_CLI_CLIENT_ID_PRODUCTION

if (!staging || !production) {
throw ReferenceError('Missing staging and/or production client ID')
}

const clientIDFile = join(__dirname, '..', 'client-ids.json')
const clientIDs = JSON.stringify({ staging, production })
writeFileSync(clientIDFile, clientIDs)

0 comments on commit 94f2010

Please sign in to comment.