sunpeak 0.7.9 → 0.7.10

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.
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { push } from './push.mjs';
2
+ import { join } from 'path';
3
+ import { push, findResources } from './push.mjs';
3
4
 
4
5
  /**
5
6
  * Deploy command - same as push but with tag="prod"
@@ -17,33 +18,48 @@ Usage:
17
18
 
18
19
  Options:
19
20
  -r, --repository <owner/repo> Repository name (defaults to git remote origin)
20
- -t, --tag <name> Tag to assign (defaults to "prod")
21
+ -t, --tag <name> Additional tag(s) to assign (always includes "prod")
21
22
  -h, --help Show this help message
22
23
 
23
24
  Arguments:
24
25
  file Optional JS file to deploy (e.g., dist/carousel.js)
25
- If not provided, deploys all resources from dist/
26
+ If not provided, looks for resources in current
27
+ directory first, then falls back to dist/
26
28
 
27
29
  Examples:
28
30
  sunpeak deploy Push all resources with "prod" tag
29
31
  sunpeak deploy dist/carousel.js Deploy a single resource
30
32
  sunpeak deploy -r myorg/my-app Deploy to "myorg/my-app" repository
31
- sunpeak deploy -t production Deploy with custom tag
33
+ sunpeak deploy -t v1.0 Deploy with "prod" and "v1.0" tags
32
34
 
33
35
  This command is equivalent to: sunpeak push --tag prod
34
36
  `);
35
37
  return;
36
38
  }
37
39
 
38
- // Default tag to "prod" for deploy
40
+ // Always include "prod" tag, supplemented by any additional tags
41
+ const additionalTags = options.tags?.filter((t) => t !== 'prod') ?? [];
39
42
  const deployOptions = {
40
43
  ...options,
41
- tags: options.tags && options.tags.length > 0 ? options.tags : ['prod'],
44
+ tags: ['prod', ...additionalTags],
42
45
  };
43
46
 
44
47
  console.log('Deploying to production...');
45
48
  console.log();
46
49
 
50
+ // If no specific file provided, check current directory first, then dist/
51
+ if (!deployOptions.file) {
52
+ const cwdResources = findResources(projectRoot);
53
+ if (cwdResources.length > 0) {
54
+ // Found resources in current directory, push each one
55
+ for (const resource of cwdResources) {
56
+ await push(projectRoot, { ...deployOptions, file: resource.jsPath });
57
+ }
58
+ return;
59
+ }
60
+ // Fall back to dist/ directory (handled by push)
61
+ }
62
+
47
63
  await push(projectRoot, deployOptions);
48
64
  }
49
65
 
@@ -70,18 +86,19 @@ Usage:
70
86
 
71
87
  Options:
72
88
  -r, --repository <owner/repo> Repository name (defaults to git remote origin)
73
- -t, --tag <name> Tag to assign (defaults to "prod")
89
+ -t, --tag <name> Additional tag(s) to assign (always includes "prod")
74
90
  -h, --help Show this help message
75
91
 
76
92
  Arguments:
77
93
  file Optional JS file to deploy (e.g., dist/carousel.js)
78
- If not provided, deploys all resources from dist/
94
+ If not provided, looks for resources in current
95
+ directory first, then falls back to dist/
79
96
 
80
97
  Examples:
81
98
  sunpeak deploy Deploy all resources with "prod" tag
82
99
  sunpeak deploy dist/carousel.js Deploy a single resource
83
100
  sunpeak deploy -r myorg/my-app Deploy to "myorg/my-app" repository
84
- sunpeak deploy -t production Deploy with custom tag
101
+ sunpeak deploy -t v1.0 Deploy with "prod" and "v1.0" tags
85
102
 
86
103
  This command is equivalent to: sunpeak push --tag prod
87
104
  `);
@@ -45,33 +45,38 @@ function getGitRepoName() {
45
45
  }
46
46
 
47
47
  /**
48
- * Find all resources in the dist folder
48
+ * Find all resources in a directory
49
49
  * Returns array of { name, jsPath, metaPath, meta }
50
50
  */
51
- function findResources(distDir) {
51
+ export function findResources(distDir) {
52
52
  if (!existsSync(distDir)) {
53
53
  return [];
54
54
  }
55
55
 
56
56
  const files = readdirSync(distDir);
57
- const jsFiles = files.filter((f) => f.endsWith('.js') && !f.endsWith('.meta.js'));
58
-
59
- return jsFiles.map((jsFile) => {
60
- const name = jsFile.replace('.js', '');
61
- const jsPath = join(distDir, jsFile);
62
- const metaPath = join(distDir, `${name}.json`);
63
-
64
- let meta = null;
65
- if (existsSync(metaPath)) {
57
+ const jsFiles = files.filter((f) => f.endsWith('.js'));
58
+ const jsonFiles = new Set(files.filter((f) => f.endsWith('.json')));
59
+
60
+ // Only include .js files that have a matching .json file
61
+ return jsFiles
62
+ .filter((jsFile) => {
63
+ const name = jsFile.replace('.js', '');
64
+ return jsonFiles.has(`${name}.json`);
65
+ })
66
+ .map((jsFile) => {
67
+ const name = jsFile.replace('.js', '');
68
+ const jsPath = join(distDir, jsFile);
69
+ const metaPath = join(distDir, `${name}.json`);
70
+
71
+ let meta = null;
66
72
  try {
67
73
  meta = JSON.parse(readFileSync(metaPath, 'utf-8'));
68
74
  } catch {
69
75
  console.warn(`Warning: Could not parse ${name}.json`);
70
76
  }
71
- }
72
77
 
73
- return { name, jsPath, metaPath, meta };
74
- });
78
+ return { name, jsPath, metaPath, meta };
79
+ });
75
80
  }
76
81
 
77
82
  /**
package/bin/sunpeak.js CHANGED
@@ -232,6 +232,15 @@ See README.md for more details.
232
232
 
233
233
  const [, , command, ...args] = process.argv;
234
234
 
235
+ /**
236
+ * Get the sunpeak version from package.json
237
+ */
238
+ function getVersion() {
239
+ const pkgPath = join(__dirname, '..', 'package.json');
240
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
241
+ return pkg.version;
242
+ }
243
+
235
244
  /**
236
245
  * Parse arguments for resource commands (push, pull, deploy)
237
246
  */
@@ -268,6 +277,12 @@ function parseResourceArgs(args) {
268
277
 
269
278
  // Main CLI handler
270
279
  (async () => {
280
+ // Handle --version / -v flags early
281
+ if (command === '--version' || command === '-v' || command === 'version') {
282
+ console.log(getVersion());
283
+ process.exit(0);
284
+ }
285
+
271
286
  // Commands that don't require a package.json
272
287
  const standaloneCommands = [
273
288
  'new',
@@ -373,6 +388,7 @@ Direct CLI commands (when sunpeak is installed):
373
388
  sunpeak push Push resources to repository
374
389
  sunpeak pull Pull resources from repository
375
390
  sunpeak deploy Push resources with "prod" tag
391
+ sunpeak --version Show version number
376
392
 
377
393
  For more information, visit: https://sunpeak.ai/
378
394
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sunpeak",
3
- "version": "0.7.9",
3
+ "version": "0.7.10",
4
4
  "description": "The ChatGPT App framework. Quickstart, build, & test your ChatGPT App locally!",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -11,5 +11,5 @@
11
11
  ]
12
12
  }
13
13
  },
14
- "uri": "ui://albums-mjhl94fw"
14
+ "uri": "ui://albums-mjiyadcd"
15
15
  }
@@ -11,5 +11,5 @@
11
11
  ]
12
12
  }
13
13
  },
14
- "uri": "ui://carousel-mjhl94fw"
14
+ "uri": "ui://carousel-mjiyadcd"
15
15
  }
@@ -6,5 +6,5 @@
6
6
  "_meta": {
7
7
  "openai/widgetDomain": "https://sunpeak.ai"
8
8
  },
9
- "uri": "ui://counter-mjhl94fw"
9
+ "uri": "ui://counter-mjiyadcd"
10
10
  }
@@ -15,5 +15,5 @@
15
15
  ]
16
16
  }
17
17
  },
18
- "uri": "ui://map-mjhl94fw"
18
+ "uri": "ui://map-mjiyadcd"
19
19
  }
@@ -7,115 +7,115 @@
7
7
  "react": {
8
8
  "src": "../../../../node_modules/.pnpm/react@19.2.0/node_modules/react/index.js",
9
9
  "file": "react.js",
10
- "fileHash": "34de8f5c",
10
+ "fileHash": "6d4a8455",
11
11
  "needsInterop": true
12
12
  },
13
13
  "react-dom": {
14
14
  "src": "../../../../node_modules/.pnpm/react-dom@19.2.0_react@19.2.0/node_modules/react-dom/index.js",
15
15
  "file": "react-dom.js",
16
- "fileHash": "25345a12",
16
+ "fileHash": "5c97c9fd",
17
17
  "needsInterop": true
18
18
  },
19
19
  "react/jsx-dev-runtime": {
20
20
  "src": "../../../../node_modules/.pnpm/react@19.2.0/node_modules/react/jsx-dev-runtime.js",
21
21
  "file": "react_jsx-dev-runtime.js",
22
- "fileHash": "d70cf82d",
22
+ "fileHash": "ae41483a",
23
23
  "needsInterop": true
24
24
  },
25
25
  "react/jsx-runtime": {
26
26
  "src": "../../../../node_modules/.pnpm/react@19.2.0/node_modules/react/jsx-runtime.js",
27
27
  "file": "react_jsx-runtime.js",
28
- "fileHash": "e558722d",
28
+ "fileHash": "7e854a26",
29
29
  "needsInterop": true
30
30
  },
31
31
  "@openai/apps-sdk-ui/components/Avatar": {
32
32
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Avatar/index.js",
33
33
  "file": "@openai_apps-sdk-ui_components_Avatar.js",
34
- "fileHash": "42d8a2ca",
34
+ "fileHash": "f67deed0",
35
35
  "needsInterop": false
36
36
  },
37
37
  "@openai/apps-sdk-ui/components/Button": {
38
38
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Button/index.js",
39
39
  "file": "@openai_apps-sdk-ui_components_Button.js",
40
- "fileHash": "3a859716",
40
+ "fileHash": "8e745ecd",
41
41
  "needsInterop": false
42
42
  },
43
43
  "@openai/apps-sdk-ui/components/Checkbox": {
44
44
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Checkbox/index.js",
45
45
  "file": "@openai_apps-sdk-ui_components_Checkbox.js",
46
- "fileHash": "023fd696",
46
+ "fileHash": "a7ab6ad4",
47
47
  "needsInterop": false
48
48
  },
49
49
  "@openai/apps-sdk-ui/components/Icon": {
50
50
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Icon/index.js",
51
51
  "file": "@openai_apps-sdk-ui_components_Icon.js",
52
- "fileHash": "b28344ea",
52
+ "fileHash": "221834b8",
53
53
  "needsInterop": false
54
54
  },
55
55
  "@openai/apps-sdk-ui/components/Input": {
56
56
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Input/index.js",
57
57
  "file": "@openai_apps-sdk-ui_components_Input.js",
58
- "fileHash": "1f7a8a17",
58
+ "fileHash": "b9753f11",
59
59
  "needsInterop": false
60
60
  },
61
61
  "@openai/apps-sdk-ui/components/SegmentedControl": {
62
62
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/SegmentedControl/index.js",
63
63
  "file": "@openai_apps-sdk-ui_components_SegmentedControl.js",
64
- "fileHash": "6dbcfe0b",
64
+ "fileHash": "8305f26a",
65
65
  "needsInterop": false
66
66
  },
67
67
  "@openai/apps-sdk-ui/components/Select": {
68
68
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Select/index.js",
69
69
  "file": "@openai_apps-sdk-ui_components_Select.js",
70
- "fileHash": "df124076",
70
+ "fileHash": "ad7b6e28",
71
71
  "needsInterop": false
72
72
  },
73
73
  "@openai/apps-sdk-ui/components/Textarea": {
74
74
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Textarea/index.js",
75
75
  "file": "@openai_apps-sdk-ui_components_Textarea.js",
76
- "fileHash": "c3d4fd40",
76
+ "fileHash": "9cb4568e",
77
77
  "needsInterop": false
78
78
  },
79
79
  "@openai/apps-sdk-ui/theme": {
80
80
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/lib/theme.js",
81
81
  "file": "@openai_apps-sdk-ui_theme.js",
82
- "fileHash": "bf2b8101",
82
+ "fileHash": "20d29073",
83
83
  "needsInterop": false
84
84
  },
85
85
  "clsx": {
86
86
  "src": "../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs",
87
87
  "file": "clsx.js",
88
- "fileHash": "8e45b38a",
88
+ "fileHash": "517b6e77",
89
89
  "needsInterop": false
90
90
  },
91
91
  "embla-carousel-react": {
92
92
  "src": "../../../../node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.0/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js",
93
93
  "file": "embla-carousel-react.js",
94
- "fileHash": "e02c407d",
94
+ "fileHash": "a798b33a",
95
95
  "needsInterop": false
96
96
  },
97
97
  "embla-carousel-wheel-gestures": {
98
98
  "src": "../../../../node_modules/.pnpm/embla-carousel-wheel-gestures@8.1.0_embla-carousel@8.6.0/node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js",
99
99
  "file": "embla-carousel-wheel-gestures.js",
100
- "fileHash": "995231f5",
100
+ "fileHash": "ee5d3b2c",
101
101
  "needsInterop": false
102
102
  },
103
103
  "mapbox-gl": {
104
104
  "src": "../../../../node_modules/.pnpm/mapbox-gl@3.17.0/node_modules/mapbox-gl/dist/mapbox-gl.js",
105
105
  "file": "mapbox-gl.js",
106
- "fileHash": "ea0e6ce4",
106
+ "fileHash": "34b8d8b2",
107
107
  "needsInterop": true
108
108
  },
109
109
  "react-dom/client": {
110
110
  "src": "../../../../node_modules/.pnpm/react-dom@19.2.0_react@19.2.0/node_modules/react-dom/client.js",
111
111
  "file": "react-dom_client.js",
112
- "fileHash": "bb56d10f",
112
+ "fileHash": "1ca1a580",
113
113
  "needsInterop": true
114
114
  },
115
115
  "tailwind-merge": {
116
116
  "src": "../../../../node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs",
117
117
  "file": "tailwind-merge.js",
118
- "fileHash": "866233cc",
118
+ "fileHash": "3e71442c",
119
119
  "needsInterop": false
120
120
  }
121
121
  },
@@ -1 +1 @@
1
- {"version":"4.0.13","results":[[":src/resources/carousel-resource.test.tsx",{"duration":223.75794699999983,"failed":false}],[":src/components/album/albums.test.tsx",{"duration":323.4242160000001,"failed":false}],[":src/components/map/map-view.test.tsx",{"duration":81.51079499999992,"failed":false}],[":src/components/map/place-inspector.test.tsx",{"duration":422.8601289999997,"failed":false}],[":src/resources/counter-resource.test.tsx",{"duration":322.9052020000004,"failed":false}],[":src/components/album/fullscreen-viewer.test.tsx",{"duration":228.40596499999992,"failed":false}],[":src/components/map/place-list.test.tsx",{"duration":142.98616300000003,"failed":false}],[":src/components/map/place-card.test.tsx",{"duration":348.2026999999998,"failed":false}],[":src/components/map/place-carousel.test.tsx",{"duration":438.33390999999983,"failed":false}],[":src/components/album/album-carousel.test.tsx",{"duration":89.84293600000001,"failed":false}],[":src/components/carousel/carousel.test.tsx",{"duration":87.84814800000004,"failed":false}],[":src/resources/albums-resource.test.tsx",{"duration":246.36836600000015,"failed":false}],[":src/components/album/film-strip.test.tsx",{"duration":483.7447050000003,"failed":false}],[":src/components/album/album-card.test.tsx",{"duration":279.70283800000016,"failed":false}],[":src/components/carousel/card.test.tsx",{"duration":59.06079599999998,"failed":false}]]}
1
+ {"version":"4.0.13","results":[[":src/resources/carousel-resource.test.tsx",{"duration":261.84329300000013,"failed":false}],[":src/components/album/albums.test.tsx",{"duration":317.2989369999998,"failed":false}],[":src/components/map/map-view.test.tsx",{"duration":76.66073400000005,"failed":false}],[":src/resources/counter-resource.test.tsx",{"duration":259.7599730000002,"failed":false}],[":src/components/album/fullscreen-viewer.test.tsx",{"duration":288.81789500000014,"failed":false}],[":src/components/map/place-inspector.test.tsx",{"duration":434.8199370000002,"failed":false}],[":src/components/map/place-list.test.tsx",{"duration":144.7217720000001,"failed":false}],[":src/components/map/place-card.test.tsx",{"duration":357.5514350000001,"failed":false}],[":src/components/map/place-carousel.test.tsx",{"duration":396.25828000000024,"failed":false}],[":src/components/album/album-carousel.test.tsx",{"duration":70.4534279999998,"failed":false}],[":src/components/carousel/carousel.test.tsx",{"duration":88.68212000000017,"failed":false}],[":src/resources/albums-resource.test.tsx",{"duration":265.07265000000007,"failed":false}],[":src/components/album/film-strip.test.tsx",{"duration":454.02079600000025,"failed":false}],[":src/components/album/album-card.test.tsx",{"duration":318.5940679999999,"failed":false}],[":src/components/carousel/card.test.tsx",{"duration":98.01311299999998,"failed":false}]]}