Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: publish APIs to npm and use those to add legacy apis to spec #203

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ jobs:
env:
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} # <-- Allows semantic-release to publish to npm without 2 factor auth.
npm_config_tag: ${{ env.NPM_DIST_TAG }} # <-- For main, this is `latest.` Otherwise, `next`, `next-major`, etc. See ./.releaserc for release branch config.
run: npm publish --tag $RELEASE_CHANNEL --workspaces
run: |
npm publish --tag $RELEASE_CHANNEL --workspaces
npm publish --tag $RELEASE_CHANNEL
- name: Dry-run Firebolt SDKs to NPM
if: steps.check_build.outputs.files_exists == 'true' && (github.ref_name == 'main' && github.event_name != 'workflow_dispatch')
env:
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} # <-- Allows semantic-release to publish to npm without 2 factor auth.
npm_config_tag: ${{ env.NPM_DIST_TAG }} # <-- For main, this is `latest.` Otherwise, `next`, `next-major`, etc. See ./.releaserc for release branch config.
run: npm publish --tag $RELEASE_CHANNEL --workspaces --dry-run
run: |
npm publish --tag $RELEASE_CHANNEL --workspaces --dry-run
npm publish --tag $RELEASE_CHANNEL --dry-run
- name: Checkout firebolt GitHub.io repository
if: steps.check_build.outputs.files_exists == 'true'
env:
Expand Down
16 changes: 3 additions & 13 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
.github/*
.husky/*
.DS_Store
build/*
src/*
test/*
*.config.js*
.releaserc
.commitlintrc.json
src/descriptions/*
src/js/*
src/openrpc/*
src/schemas/*
src/template/*
src/sdks/*/build/*
src/sdks/*/src/*
src/sdks/*/test/*
src/sdks/*/jest.config.json
src/sdks/*/sdk.config.json
src/sdks/*/tsconfig.json
src/sdks/*/.*
test/*
push-docs.sh
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest",
"clean": "rm -rf dist && npm run clean --workspaces",
"dist": "npm run fs:setup && npm run validate:each && npm run compile && npm run specification && npm run version && npm run dist:notest --workspaces && npm run test",
"specification": "node ./src/js/version-specification/index.mjs --source ./src/json/firebolt-specification.json",
"specification": "node ./src/js/version-specification/index.mjs --source ./src/json/firebolt-specification.json --legacy-versions 0",
"specification:report": "node ./src/js/version-specification/index.mjs --source ./dist/firebolt-specification.json --report",
"version": "node ./src/js/version.mjs sync",
"dev:setup": "husky install",
Expand Down
6 changes: 3 additions & 3 deletions src/js/version-specification/apis.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ const run = async (version, parsedArgs) => {

return new Promise( async (resolve, reject) => {
let legacy = major-1
while (legacy>major-parsedArgs['legacy-versions']-1 && legacy>0) {
while (legacy>=major-parsedArgs['legacy-versions'] && legacy >= 0) {
const v = `${legacy}.x`

// create a temporary npm package and install the version of Firebolt we want to grab
await exec(`cd build; mkdir temp${legacy}; cd temp${legacy}; npm init -y ; npm install --saveDev @firebolt-js/sdk@${v}`)
await exec(`cd build; mkdir temp${legacy}; cd temp${legacy}; npm init -y ; npm install --saveDev @firebolt-js/apis@${v}`)

version.apis[`${legacy}`] = await loadJson(`./build/temp${legacy}/node_modules/@firebolt-js/sdk/dist/firebolt-open-rpc.json`)
version.apis[`${legacy}`] = await loadJson(`./build/temp${legacy}/node_modules/@firebolt-js/apis/dist/firebolt-open-rpc.json`)
await exec(`cd build; rm -r temp${legacy}`)

logSuccess(`Added version ${v}`)
Expand Down
2 changes: 1 addition & 1 deletion src/js/version-specification/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const loadJson = file => readFile(file).then(data => JSON.parse(data.toString())

const knownOpts = {
'capabilities': [Boolean],
'legacy-support': [Number],
'legacy-versions': [Number],
'source': [String],
'report': [Boolean]
}
Expand Down
Loading