Compare commits

...
Author SHA1 Message Date
James Brunton 8acdb44067 test: wire up @stirling-tools/saas-private via GitHub Packages 2026-03-03 13:53:54 +00:00
James Brunton 19149e25af Add SaaS configs 2026-03-03 09:57:27 +00:00
6 changed files with 78 additions and 12 deletions
+2
View File
@@ -0,0 +1,2 @@
@stirling-tools:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
+12 -1
View File
@@ -5,6 +5,7 @@
"license": "SEE LICENSE IN https://raw.githubusercontent.com/Stirling-Tools/Stirling-PDF/refs/heads/main/proprietary/LICENSE",
"proxy": "http://localhost:8080",
"dependencies": {
"@stirling-tools/saas-private": "^0.1.0",
"@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
"@cantoo/pdf-lib": "^2.5.3",
"@dnd-kit/core": "^6.3.1",
@@ -76,11 +77,19 @@
"pretauri-build": "node scripts/build-provisioner.mjs",
"predev": "npm run generate-icons",
"dev": "vite",
"dev:core": "vite --mode core",
"dev:proprietary": "vite --mode proprietary",
"dev:saas": "vite --mode saas",
"dev:desktop": "vite --mode desktop",
"prebuild": "npm run generate-icons",
"lint": "npm run lint:eslint && npm run lint:cycles",
"lint:eslint": "eslint --max-warnings=0",
"lint:cycles": "dpdm src --circular --no-warning --no-tree --exit-code circular:1",
"build": "vite build",
"build:core": "vite build --mode core",
"build:proprietary": "vite build --mode proprietary",
"build:saas": "vite build --mode saas",
"build:desktop": "vite build --mode desktop",
"preview": "vite preview",
"tauri-dev": "tauri dev --no-watch",
"tauri-build": "tauri build",
@@ -92,8 +101,10 @@
"typecheck": "npm run typecheck:proprietary",
"typecheck:core": "tsc --noEmit --project tsconfig.core.json",
"typecheck:proprietary": "tsc --noEmit --project tsconfig.proprietary.json",
"typecheck:saas": "tsc --noEmit --project tsconfig.saas.json",
"typecheck:desktop": "tsc --noEmit --project tsconfig.desktop.json",
"typecheck:all": "npm run typecheck:core && npm run typecheck:proprietary && npm run typecheck:desktop",
"typecheck:scripts": "tsc --noEmit --project scripts/tsconfig.json",
"typecheck:all": "npm run typecheck:core && npm run typecheck:proprietary && npm run typecheck:saas && npm run typecheck:desktop && npm run typecheck:scripts",
"check": "npm run typecheck && npm run lint && npm run test:run",
"generate-licenses": "node scripts/generate-licenses.js",
"generate-icons": "node scripts/generate-icons.js",
+3
View File
@@ -0,0 +1,3 @@
import { getSaasConfig, SAAS_PRIVATE_PACKAGE_VERSION } from '@stirling-tools/saas-private';
export { getSaasConfig, SAAS_PRIVATE_PACKAGE_VERSION };
+20
View File
@@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {
"@app/*": [
"src/saas/*",
"src/proprietary/*",
"src/core/*"
],
"@proprietary/*": ["src/proprietary/*"],
"@core/*": ["src/core/*"]
}
},
"include": [
"src/*.js",
"src/*.ts",
"src/*.tsx",
"src/saas"
]
}
+22
View File
@@ -0,0 +1,22 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {
"@app/*": [
"src/saas/*",
"src/proprietary/*",
"src/core/*"
],
"@proprietary/*": ["src/proprietary/*"],
"@core/*": ["src/core/*"]
}
},
"exclude": [
"src/core/**/*.test.ts*",
"src/core/**/*.spec.ts*",
"src/proprietary/**/*.test.ts*",
"src/proprietary/**/*.spec.ts*",
"src/desktop",
"node_modules"
]
}
+19 -11
View File
@@ -4,6 +4,16 @@ import tsconfigPaths from 'vite-tsconfig-paths';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import path from 'path';
const VALID_MODES = ['core', 'proprietary', 'saas', 'desktop'] as const;
type BuildMode = typeof VALID_MODES[number];
const TSCONFIG_MAP: Record<BuildMode, string> = {
core: './tsconfig.core.vite.json',
proprietary: './tsconfig.proprietary.vite.json',
saas: './tsconfig.saas.vite.json',
desktop: './tsconfig.desktop.vite.json',
};
export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
@@ -11,15 +21,15 @@ export default defineConfig(({ mode }) => {
// `VITE_` prefix.
const env = loadEnv(mode, process.cwd(), '')
// When DISABLE_ADDITIONAL_FEATURES is false (or unset), enable proprietary features
const isProprietary = process.env.DISABLE_ADDITIONAL_FEATURES !== 'true';
const isDesktopMode =
mode === 'desktop' ||
env.STIRLING_DESKTOP === 'true' ||
env.VITE_DESKTOP === 'true';
// Resolve the effective build mode.
// Explicit --mode flags take precedence; otherwise default to proprietary
// unless DISABLE_ADDITIONAL_FEATURES=true, in which case default to core.
const effectiveMode: BuildMode = (VALID_MODES as readonly string[]).includes(mode)
? (mode as BuildMode)
: process.env.DISABLE_ADDITIONAL_FEATURES === 'true' ? 'core' : 'proprietary';
// Validate required environment variables for desktop builds
if (isDesktopMode) {
if (effectiveMode === 'desktop') {
const requiredEnvVars = [
'VITE_SAAS_SERVER_URL',
'VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY',
@@ -35,9 +45,7 @@ export default defineConfig(({ mode }) => {
}
}
const baseProject = isProprietary ? './tsconfig.proprietary.vite.json' : './tsconfig.core.vite.json';
const desktopProject = isProprietary ? './tsconfig.desktop.vite.json' : baseProject;
const tsconfigProject = isDesktopMode ? desktopProject : baseProject;
const tsconfigProject = TSCONFIG_MAP[effectiveMode];
return {
plugins: [
@@ -71,7 +79,7 @@ export default defineConfig(({ mode }) => {
ignored: ['**/src-tauri/**'],
},
// Only use proxy in web mode - Tauri handles backend connections directly
proxy: isDesktopMode ? undefined : {
proxy: effectiveMode === 'desktop' ? undefined : {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,