Skip to content
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
9 changes: 9 additions & 0 deletions .changeset/tricky-buckets-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'rushdb-core': minor
'rushdb-docs': minor
'@rushdb/javascript-sdk': minor
'rushdb-dashboard': minor
'rushdb-website': minor
---

Add private package installation setup
19 changes: 12 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,24 @@ jobs:
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: pnpm install

- name: Build SDK
run: pnpm --filter ./packages/javascript-sdk... build

- name: Setup .npmrc
- name: Setup .npmrc for Public and Private Packages
run: |
cat << EOF > ~/.npmrc
registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
access=public
always-auth=true

@rush-db:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${{ secrets.NPM_PRIVATE_REGISTRY_TOKEN }}
EOF

- name: Install Dependencies
run: pnpm install

- name: Build SDK
run: pnpm --filter ./packages/javascript-sdk... build

- name: Determine Upcoming Version
id: determine-version
run: |
Expand All @@ -73,6 +76,7 @@ jobs:
title: "chore(release): version packages v${{ steps.determine-version.outputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# @TODO: Dedupe
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down Expand Up @@ -120,6 +124,7 @@ jobs:
file: platform/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: NPM_PRIVATE_REGISTRY_TOKEN=${{ secrets.NPM_PRIVATE_REGISTRY_TOKEN }}
tags: |
rushdb/platform:latest
rushdb/platform:${{ needs.release.outputs.version }}
Expand Down
3 changes: 3 additions & 0 deletions platform/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
"tsconfig-paths": "~3.14.1",
"typescript": "5.7.2"
},
"optionalDependencies": {
"@rush-db/core-internal-module": "0.0.3"
},
"jest": {
"moduleFileExtensions": [
"js",
Expand Down
24 changes: 22 additions & 2 deletions platform/core/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Global, Module } from '@nestjs/common'
import { Global, Module, DynamicModule, Provider } from '@nestjs/common'
import { ConfigModule } from '@nestjs/config'
import { APP_INTERCEPTOR } from '@nestjs/core'
import { ServeStaticModule } from '@nestjs/serve-static'
Expand All @@ -19,6 +19,24 @@ import { DatabaseModule } from '@/database/database.module'

import { join } from 'path'

let internalModule: DynamicModule | null = null
let internalServiceProvider: Provider | null = null

if (process.env.RUSHDB_SELF_HOSTED === 'false') {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { InternalModule, InternalService } = require('@rush-db/core-internal-module')

internalModule = InternalModule
internalServiceProvider = {
provide: 'INTERNAL_SERVICE',
useClass: InternalService
}
} catch (error) {
console.warn('Warning: @rush-db/core-internal-module is not available. Running without it.')
}
}

@Global()
@Module({
imports: [
Expand All @@ -38,6 +56,7 @@ import { join } from 'path'
})
]
: []),
...(internalModule ? [internalModule] : []),
ConsoleModule,
BackupModule
],
Expand All @@ -47,7 +66,8 @@ import { join } from 'path'
provide: APP_INTERCEPTOR,
useClass: ExcludeNullInterceptor
},
CliService
CliService,
...(internalServiceProvider ? [internalServiceProvider] : [])
],
controllers: [
...(!toBoolean(process.env.RUSHDB_SERVE_STATIC) ? [AppController] : []),
Expand Down
18 changes: 16 additions & 2 deletions platform/core/src/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import { Injectable } from '@nestjs/common'
import { Injectable, Inject, OnModuleInit, Logger, Optional } from '@nestjs/common'

@Injectable()
export class AppService {}
export class AppService implements OnModuleInit {
private internalService?: any // Optional service reference

constructor(@Optional() @Inject('INTERNAL_SERVICE') private readonly _internalService: any) {
this.internalService = _internalService
}

async onModuleInit() {
if (this.internalService) {
Logger.log(this.internalService.getSecretData(), 'AppService')
} else {
Logger.warn('InternalService is not available', 'AppService')
}
}
}
58 changes: 58 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.