@dfosco/storyboard-core 4.0.0-beta.0 → 4.0.0-beta.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfosco/storyboard-core",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "bin": {
package/src/cli/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * storyboard dev Start Vite dev server + update proxy
7
7
  * storyboard setup Install deps, Caddy, start proxy
8
8
  * storyboard proxy Generate Caddyfile + start/reload Caddy
9
- * storyboard update:flag K V Update a feature flag in storyboard.config.json
9
+ * storyboard update:version Update @dfosco/storyboard-* packages to latest
10
10
  *
11
11
  * Aliases: `sb` is equivalent to `storyboard`.
12
12
  */
@@ -36,8 +36,8 @@ switch (command) {
36
36
  case 'proxy':
37
37
  import('./proxy.js')
38
38
  break
39
- case 'update:flag':
40
- import('./updateFlag.js')
39
+ case 'update:version':
40
+ import('./updateVersion.js')
41
41
  break
42
42
  case 'create':
43
43
  import('./create.js')
@@ -54,7 +54,7 @@ switch (command) {
54
54
  setup Install deps, Caddy proxy, start proxy
55
55
  proxy Generate Caddyfile + start/reload Caddy
56
56
  exit Stop all dev servers and proxy
57
- update:flag K V Update a feature flag`)
57
+ update:version Update storyboard packages to latest`)
58
58
 
59
59
  if (command) {
60
60
  p.log.error(`Unknown command: ${command}`)
@@ -0,0 +1,59 @@
1
+ /**
2
+ * storyboard update:version — Update all @dfosco/storyboard-* packages to the latest version.
3
+ *
4
+ * Equivalent to `npm run update` in a client repo.
5
+ *
6
+ * Usage:
7
+ * storyboard update:version # update to latest
8
+ * storyboard update:version 4.0.0 # update to specific version
9
+ */
10
+
11
+ import * as p from '@clack/prompts'
12
+ import { execSync } from 'child_process'
13
+ import { readFileSync } from 'fs'
14
+ import { resolve } from 'path'
15
+
16
+ const targetVersion = process.argv[3]
17
+
18
+ const pkgPath = resolve(process.cwd(), 'package.json')
19
+ let pkg
20
+ try {
21
+ pkg = JSON.parse(readFileSync(pkgPath, 'utf8'))
22
+ } catch (err) {
23
+ p.log.error(`Failed to read package.json: ${err.message}`)
24
+ process.exit(1)
25
+ }
26
+
27
+ // Collect all @dfosco/storyboard-* packages from deps and devDeps
28
+ const storyboardPkgs = new Set()
29
+ for (const depField of ['dependencies', 'devDependencies']) {
30
+ if (!pkg[depField]) continue
31
+ for (const name of Object.keys(pkg[depField])) {
32
+ if (name.startsWith('@dfosco/storyboard-') || name === '@dfosco/tiny-canvas') {
33
+ storyboardPkgs.add(name)
34
+ }
35
+ }
36
+ }
37
+
38
+ if (storyboardPkgs.size === 0) {
39
+ p.log.warn('No @dfosco/storyboard-* packages found in package.json')
40
+ process.exit(0)
41
+ }
42
+
43
+ const suffix = targetVersion ? `@${targetVersion}` : '@latest'
44
+ const packages = [...storyboardPkgs].map(name => `${name}${suffix}`).join(' ')
45
+
46
+ p.intro('storyboard update:version')
47
+ p.log.info(`Updating ${storyboardPkgs.size} package(s)${targetVersion ? ` to ${targetVersion}` : ''}…`)
48
+ for (const name of storyboardPkgs) {
49
+ p.log.message(` ${name}${suffix}`)
50
+ }
51
+
52
+ try {
53
+ execSync(`npm install ${packages}`, { stdio: 'inherit', cwd: process.cwd() })
54
+ p.log.success('All storyboard packages updated')
55
+ p.outro('Done')
56
+ } catch {
57
+ p.log.error('Failed to update packages — see npm output above')
58
+ process.exit(1)
59
+ }
@@ -1,45 +0,0 @@
1
- /**
2
- * storyboard update:flag <key> <value> — Update a feature flag in storyboard.config.json.
3
- *
4
- * Usage:
5
- * storyboard update:flag show-banner false
6
- * storyboard update:flag debug-mode true
7
- */
8
-
9
- import * as p from '@clack/prompts'
10
- import { readFileSync, writeFileSync } from 'fs'
11
- import { resolve } from 'path'
12
-
13
- const key = process.argv[3]
14
- const rawValue = process.argv[4]
15
-
16
- if (!key || rawValue === undefined) {
17
- p.intro('storyboard update:flag')
18
- p.log.error('Usage: storyboard update:flag <key> <value>')
19
- p.outro('Example: npx storyboard update:flag show-banner false')
20
- process.exit(1)
21
- }
22
-
23
- // Parse value: "true"/"false" → boolean, numbers → number, else string
24
- let value
25
- if (rawValue === 'true') value = true
26
- else if (rawValue === 'false') value = false
27
- else if (!isNaN(rawValue) && rawValue !== '') value = Number(rawValue)
28
- else value = rawValue
29
-
30
- const configPath = resolve(process.cwd(), 'storyboard.config.json')
31
-
32
- let config
33
- try {
34
- config = JSON.parse(readFileSync(configPath, 'utf8'))
35
- } catch (err) {
36
- p.log.error(`Failed to read storyboard.config.json: ${err.message}`)
37
- process.exit(1)
38
- }
39
-
40
- if (!config.featureFlags) config.featureFlags = {}
41
- const prev = config.featureFlags[key]
42
- config.featureFlags[key] = value
43
-
44
- writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n')
45
- p.log.success(`featureFlags.${key}: ${JSON.stringify(prev)} → ${JSON.stringify(value)}`)