spine-framework 0.3.66 → 0.3.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,6 +56,8 @@ export function registerInstallAppCommands(program: Command) {
56
56
  throw new Error(`Package not found at ${pkgPath}`)
57
57
  }
58
58
 
59
+ console.log(` Package path: ${pkgPath}`)
60
+
59
61
  // 3. Determine app slug from package manifest or name
60
62
  const appSlug = resolveAppSlug(pkgPath, pkgSlug)
61
63
  console.log(` App slug: ${appSlug}`)
@@ -66,11 +68,18 @@ export function registerInstallAppCommands(program: Command) {
66
68
  mkdirSync(appDest, { recursive: true })
67
69
  }
68
70
 
69
- // Copy everything except node_modules and package.json internals
70
- const skipDirs = new Set(['node_modules', '.git'])
71
- for (const entry of ['index.tsx', 'manifest.json', 'pages', 'components', 'hooks', 'api', 'seed']) {
71
+ // Copy all allowed directories and files
72
+ const allowedEntries = [
73
+ 'index.tsx', 'manifest.json', 'package.json',
74
+ 'pages', 'components', 'hooks', 'utils', 'functions', 'seed', 'public'
75
+ ]
76
+
77
+ console.log(` Copying files from ${pkgPath} to ${appDest}`)
78
+
79
+ for (const entry of allowedEntries) {
72
80
  const src = join(pkgPath, entry)
73
81
  if (existsSync(src)) {
82
+ console.log(` Copying ${entry}`)
74
83
  cpSync(src, join(appDest, entry), { recursive: true })
75
84
  }
76
85
  }
@@ -109,7 +118,8 @@ export function registerInstallAppCommands(program: Command) {
109
118
  loadEnv()
110
119
 
111
120
  const pkgSlug = packageName.split('@')[0]
112
- const appSlug = pkgSlug.replace('spine-framework-', '')
121
+ const pkgPath = join(PROJECT_ROOT, 'node_modules', pkgSlug)
122
+ const appSlug = resolveAppSlug(pkgPath, pkgSlug)
113
123
  const appDir = join(PROJECT_ROOT, 'custom/apps', appSlug)
114
124
 
115
125
  try {
@@ -185,7 +195,8 @@ function resolveAppSlug(pkgPath: string, pkgName: string): string {
185
195
  if (manifest.slug) return manifest.slug
186
196
  } catch {}
187
197
  // Derive from package name: spine-framework-portal → portal
188
- return pkgName.replace(/^spine-framework-/, '')
198
+ const slug = pkgName.replace(/^spine-framework-/, '')
199
+ return slug || pkgName // fallback to full name if replacement results in empty
189
200
  }
190
201
 
191
202
  function loadEnv() {
@@ -235,6 +246,8 @@ async function seedApp(appDir: string, appSlug: string) {
235
246
  app_type: 'custom',
236
247
  source: 'npm',
237
248
  is_active: true,
249
+ route_prefix: manifest.route_prefix ?? ('/' + appSlug),
250
+ renderer: manifest.renderer ?? 'custom',
238
251
  },
239
252
  { onConflict: 'slug' }
240
253
  )
@@ -243,18 +243,21 @@ export function RegisterPage() {
243
243
  // Determine role and account strategy from URL params or config
244
244
  const urlRole = searchParams.get('role')
245
245
  const urlApp = searchParams.get('app')
246
+
247
+ // Resolve which app config to use: URL param → default_app → none
248
+ const effectiveApp = urlApp || regConfig?.default_app
246
249
 
247
250
  let effectiveRole = regConfig?.default_role || 'member'
248
251
  let effectiveAccountStrategy: 'existing' | 'new' | 'choice' = 'new'
249
252
  let targetAccount: string | undefined
250
253
 
251
- // If app is specified, use app's configuration
252
- if (urlApp && regConfig?.apps[urlApp]) {
253
- const appConfig = regConfig.apps[urlApp]
254
+ // If an app config is found (via URL param or default_app), apply it
255
+ if (effectiveApp && regConfig?.apps[effectiveApp]) {
256
+ const appConfig = regConfig.apps[effectiveApp]
254
257
 
255
- console.log('App config found:', appConfig)
258
+ console.log('App config found:', { app: effectiveApp, appConfig })
256
259
 
257
- // Determine role
260
+ // Determine role: URL param (if valid for this app) → app default → config default
258
261
  if (urlRole && appConfig.roles.includes(urlRole)) {
259
262
  effectiveRole = urlRole
260
263
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.3.66",
3
+ "version": "0.3.68",
4
4
  "description": "Multi-tenant, modular application platform for modern SaaS systems",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,13 +42,33 @@ fi
42
42
 
43
43
  # 3. Overlay custom functions (overrides + additions), excluding test files
44
44
  CUSTOM_COUNT=0
45
+
46
+ # 3a. Copy functions from custom/functions/
45
47
  if [ -d "$CUSTOM_DIR/functions" ]; then
46
48
  # Copy all files except test files (*-test.ts, *.test.ts)
47
49
  find "$CUSTOM_DIR/functions" -maxdepth 1 -name '*.ts' ! -name '*-test.ts' ! -name '*.test.ts' -exec cp {} "$TMP_DIR"/ \; 2>/dev/null || true
48
50
  # Copy subdirectories if any
49
51
  find "$CUSTOM_DIR/functions" -mindepth 1 -type d -exec sh -c 'dir="$1"; base=$(basename "$dir"); mkdir -p "'"$TMP_DIR"'/$base" && cp -r "$dir"/* "'"$TMP_DIR"'/$base/"' _ {} \; 2>/dev/null || true
50
- CUSTOM_COUNT=$(find "$CUSTOM_DIR/functions" -name '*.ts' ! -name '*-test.ts' ! -name '*.test.ts' 2>/dev/null | wc -l | tr -d ' ')
51
- echo " ✓ Custom: $CUSTOM_COUNT files"
52
+ CUSTOM_COUNT=$((CUSTOM_COUNT + $(find "$CUSTOM_DIR/functions" -name '*.ts' ! -name '*-test.ts' ! -name '*.test.ts' 2>/dev/null | wc -l | tr -d ' ')))
53
+ fi
54
+
55
+ # 3b. Copy functions from custom/apps/*/functions/
56
+ if [ -d "$CUSTOM_DIR/apps" ]; then
57
+ for app_dir in "$CUSTOM_DIR/apps"/*; do
58
+ if [ -d "$app_dir/functions" ]; then
59
+ # Copy all files except test files (*-test.ts, *.test.ts)
60
+ find "$app_dir/functions" -maxdepth 1 -name '*.ts' ! -name '*-test.ts' ! -name '*.test.ts' -exec cp {} "$TMP_DIR"/ \; 2>/dev/null || true
61
+ # Copy subdirectories if any
62
+ find "$app_dir/functions" -mindepth 1 -type d -exec sh -c 'dir="$1"; base=$(basename "$dir"); mkdir -p "'"$TMP_DIR"'/$base" && cp -r "$dir"/* "'"$TMP_DIR"'/$base/"' _ {} \; 2>/dev/null || true
63
+ APP_COUNT=$(find "$app_dir/functions" -name '*.ts' ! -name '*-test.ts' ! -name '*.test.ts' 2>/dev/null | wc -l | tr -d ' ')
64
+ CUSTOM_COUNT=$((CUSTOM_COUNT + APP_COUNT))
65
+ echo " ✓ $(basename "$app_dir"): $APP_COUNT files"
66
+ fi
67
+ done
68
+ fi
69
+
70
+ if [ $CUSTOM_COUNT -gt 0 ]; then
71
+ echo " ✓ Custom: $CUSTOM_COUNT total files"
52
72
  else
53
73
  echo " ○ Custom: (empty)"
54
74
  fi