@dfosco/storyboard-react 2.3.0 → 2.4.0

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.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dfosco/storyboard-react",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@dfosco/storyboard-core": "2.3.0",
6
+ "@dfosco/storyboard-core": "2.4.0",
7
7
  "glob": "^11.0.0",
8
8
  "jsonc-parser": "^3.3.1"
9
9
  },
@@ -24,12 +24,17 @@ function parseDataFile(filePath) {
24
24
  const base = path.basename(filePath)
25
25
  const match = base.match(/^(.+)\.(flow|scene|object|record|prototype|folder)\.(jsonc?)$/)
26
26
  if (!match) return null
27
+
28
+ // Skip _-prefixed files (drafts/internal)
29
+ if (match[1].startsWith('_')) return null
30
+
31
+ // Skip files inside _-prefixed directories
32
+ const normalized = filePath.replace(/\\/g, '/')
33
+ if (normalized.split('/').some(seg => seg.startsWith('_'))) return null
27
34
  // Normalize .scene → .flow for backward compatibility
28
35
  const suffix = match[2] === 'scene' ? 'flow' : match[2]
29
36
  let name = match[1]
30
37
 
31
- const normalized = filePath.replace(/\\/g, '/')
32
-
33
38
  // Detect if this file is inside a .folder/ directory
34
39
  const folderDirMatch = normalized.match(/(?:^|\/)src\/prototypes\/([^/]+)\.folder\//)
35
40
  const folderName = folderDirMatch ? folderDirMatch[1] : null
@@ -367,3 +367,71 @@ describe('folder grouping', () => {
367
367
  expect(() => plugin.load(RESOLVED_ID)).toThrow(/Nested .folder directories are not supported/)
368
368
  })
369
369
  })
370
+
371
+ describe('underscore prefix ignoring', () => {
372
+ it('ignores _-prefixed data files', () => {
373
+ writeFileSync(
374
+ path.join(tmpDir, '_draft.flow.json'),
375
+ JSON.stringify({ title: 'Draft' }),
376
+ )
377
+ writeFileSync(
378
+ path.join(tmpDir, 'visible.flow.json'),
379
+ JSON.stringify({ title: 'Visible' }),
380
+ )
381
+
382
+ const plugin = createPlugin()
383
+ const code = plugin.load(RESOLVED_ID)
384
+
385
+ expect(code).toContain('"Visible"')
386
+ expect(code).not.toContain('"Draft"')
387
+ })
388
+
389
+ it('ignores data files inside _-prefixed directories', () => {
390
+ mkdirSync(path.join(tmpDir, '_archive'), { recursive: true })
391
+ writeFileSync(
392
+ path.join(tmpDir, '_archive', 'old.flow.json'),
393
+ JSON.stringify({ title: 'Archived' }),
394
+ )
395
+ writeFileSync(
396
+ path.join(tmpDir, 'current.flow.json'),
397
+ JSON.stringify({ title: 'Current' }),
398
+ )
399
+
400
+ const plugin = createPlugin()
401
+ const code = plugin.load(RESOLVED_ID)
402
+
403
+ expect(code).toContain('"Current"')
404
+ expect(code).not.toContain('"Archived"')
405
+ })
406
+
407
+ it('ignores prototype.json inside _-prefixed directories', () => {
408
+ mkdirSync(path.join(tmpDir, 'src', 'prototypes', '_WIP'), { recursive: true })
409
+ writeFileSync(
410
+ path.join(tmpDir, 'src', 'prototypes', '_WIP', 'wip.prototype.json'),
411
+ JSON.stringify({ meta: { title: 'Work in Progress' } }),
412
+ )
413
+ mkdirSync(path.join(tmpDir, 'src', 'prototypes', 'Live'), { recursive: true })
414
+ writeFileSync(
415
+ path.join(tmpDir, 'src', 'prototypes', 'Live', 'live.prototype.json'),
416
+ JSON.stringify({ meta: { title: 'Live' } }),
417
+ )
418
+
419
+ const plugin = createPlugin()
420
+ const code = plugin.load(RESOLVED_ID)
421
+
422
+ expect(code).toContain('"Live"')
423
+ expect(code).not.toContain('"Work in Progress"')
424
+ })
425
+
426
+ it('does not ignore files with _ in the middle of the name', () => {
427
+ writeFileSync(
428
+ path.join(tmpDir, 'my_flow.flow.json'),
429
+ JSON.stringify({ title: 'Has Underscore' }),
430
+ )
431
+
432
+ const plugin = createPlugin()
433
+ const code = plugin.load(RESOLVED_ID)
434
+
435
+ expect(code).toContain('"Has Underscore"')
436
+ })
437
+ })