@osdk/create-widget 3.55.0 → 3.55.1-main-8718d53b7732f75b01252c7e08f65fb27c45e9aa
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/CHANGELOG.md +7 -0
- package/build/esm/{esm-5KIZJMMW.js → esm-JECCLHWP.js} +77 -7
- package/build/esm/esm-JECCLHWP.js.map +1 -0
- package/build/esm/index.js +76 -18
- package/build/esm/index.js.map +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/prompts/promptUseOsdk.d.ts +7 -0
- package/build/types/prompts/promptUseOsdk.d.ts.map +1 -0
- package/build/types/templates.d.ts +1 -1
- package/package.json +4 -4
- package/build/esm/esm-5KIZJMMW.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @osdk/create-widget
|
|
2
2
|
|
|
3
|
+
## 3.55.1-main-8718d53b7732f75b01252c7e08f65fb27c45e9aa
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8718d53: create-widget.template.react.v2 can be used with or without an osdk package
|
|
8
|
+
- @osdk/generator-utils@2.57.1-main-8718d53b7732f75b01252c7e08f65fb27c45e9aa
|
|
9
|
+
|
|
3
10
|
## 3.55.0
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -3,7 +3,11 @@ var files = /* @__PURE__ */ new Map([["README.md.hbs", {
|
|
|
3
3
|
type: "raw",
|
|
4
4
|
body: `# {{project}}
|
|
5
5
|
|
|
6
|
+
{{#if osdkPackage}}
|
|
6
7
|
This project was generated with [\`@osdk/create-widget\`](https://www.npmjs.com/package/@osdk/create-widget) and demonstrates developing custom widgets to be embedded within Foundry UIs such as Workshop. It uses the Ontology SDK package \`{{osdkPackage}}\` with React on top of Vite. Check out the [Vite](https://vitejs.dev/guide/) docs for further configuration. The Vite plugin [\`@osdk/widget.vite-plugin\`](https://www.npmjs.com/package/@osdk/widget.vite-plugin) automatically generates a \`widgets.config.json\` manifest file containing metadata about widgets inside this project during the build command.
|
|
8
|
+
{{else}}
|
|
9
|
+
This project was generated with [\`@osdk/create-widget\`](https://www.npmjs.com/package/@osdk/create-widget) and demonstrates developing custom widgets to be embedded within Foundry UIs such as Workshop. It uses React on top of Vite. Check out the [Vite](https://vitejs.dev/guide/) docs for further configuration. The Vite plugin [\`@osdk/widget.vite-plugin\`](https://www.npmjs.com/package/@osdk/widget.vite-plugin) automatically generates a \`widgets.config.json\` manifest file containing metadata about widgets inside this project during the build command.
|
|
10
|
+
{{/if}}
|
|
7
11
|
|
|
8
12
|
## Developing
|
|
9
13
|
|
|
@@ -84,7 +88,7 @@ dist-ssr
|
|
|
84
88
|
<head>
|
|
85
89
|
<meta charset="UTF-8" />
|
|
86
90
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
87
|
-
<title>
|
|
91
|
+
<title>React Custom Widget</title>
|
|
88
92
|
</head>
|
|
89
93
|
<body>
|
|
90
94
|
<div id="root"></div>
|
|
@@ -92,7 +96,51 @@ dist-ssr
|
|
|
92
96
|
</body>
|
|
93
97
|
</html>
|
|
94
98
|
`
|
|
95
|
-
}], ["package.json.hbs", {
|
|
99
|
+
}], ["package.json.no-osdk.hbs", {
|
|
100
|
+
type: "raw",
|
|
101
|
+
body: `{
|
|
102
|
+
"name": "{{project}}",
|
|
103
|
+
"private": true,
|
|
104
|
+
"version": "0.0.0",
|
|
105
|
+
"type": "module",
|
|
106
|
+
"scripts": {
|
|
107
|
+
"dev": "vite",
|
|
108
|
+
"build": "tsc && vite build",
|
|
109
|
+
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
|
|
110
|
+
"test": "vitest run --passWithNoTests",
|
|
111
|
+
"preview": "vite preview"
|
|
112
|
+
},
|
|
113
|
+
"dependencies": {
|
|
114
|
+
"@osdk/widget.client-react": "^3.26.0",
|
|
115
|
+
"@osdk/widget.client": "^3.26.0",
|
|
116
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
117
|
+
"@radix-ui/themes": "^3.2.1",
|
|
118
|
+
"react": "^18",
|
|
119
|
+
"react-dom": "^18"
|
|
120
|
+
},
|
|
121
|
+
"devDependencies": {
|
|
122
|
+
"@osdk/widget.vite-plugin": "^3.26.0",
|
|
123
|
+
"@eslint/compat": "^1.3.2",
|
|
124
|
+
"@eslint/js": "^9.35.0",
|
|
125
|
+
"@types/react": "^18",
|
|
126
|
+
"@types/react-dom": "^18",
|
|
127
|
+
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
128
|
+
"@typescript-eslint/parser": "^8.43.0",
|
|
129
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
130
|
+
"eslint": "^9.35.0",
|
|
131
|
+
"eslint-plugin-import": "^2.32.0",
|
|
132
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
133
|
+
"eslint-plugin-react": "^7.37.5",
|
|
134
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
135
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
136
|
+
"globals": "^15.15.0",
|
|
137
|
+
"typescript": "~5.5.4",
|
|
138
|
+
"typescript-eslint": "^8.43.0",
|
|
139
|
+
"vite": "^7.3.1",
|
|
140
|
+
"vitest": "^3.2.4"
|
|
141
|
+
}
|
|
142
|
+
}`
|
|
143
|
+
}], ["package.json.osdk.hbs", {
|
|
96
144
|
type: "raw",
|
|
97
145
|
body: `{
|
|
98
146
|
"name": "{{project}}",
|
|
@@ -141,7 +189,9 @@ dist-ssr
|
|
|
141
189
|
}`
|
|
142
190
|
}], ["src/Widget.tsx.hbs", {
|
|
143
191
|
type: "raw",
|
|
144
|
-
body: `
|
|
192
|
+
body: `{{#if osdkPackage}}
|
|
193
|
+
import { $Actions, $Objects, $Queries } from "{{osdkPackage}}";
|
|
194
|
+
{{/if}}
|
|
145
195
|
import {
|
|
146
196
|
Box,
|
|
147
197
|
Button,
|
|
@@ -151,21 +201,27 @@ import {
|
|
|
151
201
|
Heading,
|
|
152
202
|
Skeleton,
|
|
153
203
|
Table,
|
|
204
|
+
{{#if osdkPackage}}
|
|
154
205
|
Text,
|
|
206
|
+
{{/if}}
|
|
155
207
|
TextField,
|
|
156
208
|
Theme,
|
|
157
209
|
} from "@radix-ui/themes";
|
|
158
210
|
import React, { useCallback, useState } from "react";
|
|
159
211
|
import { useWidgetContext } from "./context.js";
|
|
160
212
|
import { useDarkTheme } from "./useDarkTheme.js";
|
|
213
|
+
{{#if osdkPackage}}
|
|
161
214
|
// import { useOsdkClient } from "@osdk/react";
|
|
162
215
|
// View the API documentation for your widget set to learn how to use the Ontology SDK.
|
|
216
|
+
{{/if}}
|
|
163
217
|
|
|
164
218
|
export const Widget: React.FC = () => {
|
|
219
|
+
{{#if osdkPackage}}
|
|
165
220
|
// See Ontology and Platform SDK docs in Developer Console on how to
|
|
166
221
|
// use the client object to access Ontology resources and platform APIs
|
|
167
222
|
// const client = useOsdkClient();
|
|
168
223
|
|
|
224
|
+
{{/if}}
|
|
169
225
|
const { parameters, emitEvent } = useWidgetContext();
|
|
170
226
|
const { headerText, todoItems } = parameters.values;
|
|
171
227
|
const [newTodoItem, setNewTodoItem] = useState("");
|
|
@@ -188,10 +244,12 @@ export const Widget: React.FC = () => {
|
|
|
188
244
|
|
|
189
245
|
const isDarkTheme = useDarkTheme();
|
|
190
246
|
|
|
247
|
+
{{#if osdkPackage}}
|
|
191
248
|
const objectApiNames = Object.keys($Objects);
|
|
192
249
|
const actionApiNames = Object.keys($Actions);
|
|
193
250
|
const queryApiNames = Object.keys($Queries);
|
|
194
251
|
|
|
252
|
+
{{/if}}
|
|
195
253
|
return (
|
|
196
254
|
<Theme appearance={isDarkTheme ? "dark" : "light"}>
|
|
197
255
|
<Box p="2">
|
|
@@ -272,6 +330,7 @@ export const Widget: React.FC = () => {
|
|
|
272
330
|
</Table.Body>
|
|
273
331
|
</Table.Root>
|
|
274
332
|
</Flex>
|
|
333
|
+
{{#if osdkPackage}}
|
|
275
334
|
<Box>
|
|
276
335
|
<Flex direction="column" gap="2">
|
|
277
336
|
<Text>
|
|
@@ -303,6 +362,7 @@ export const Widget: React.FC = () => {
|
|
|
303
362
|
</Flex>
|
|
304
363
|
</Flex>
|
|
305
364
|
</Box>
|
|
365
|
+
{{/if}}
|
|
306
366
|
</Flex>
|
|
307
367
|
</Container>
|
|
308
368
|
</Box>
|
|
@@ -310,7 +370,7 @@ export const Widget: React.FC = () => {
|
|
|
310
370
|
);
|
|
311
371
|
};
|
|
312
372
|
`
|
|
313
|
-
}], ["src/client.ts.hbs", {
|
|
373
|
+
}], ["src/client.ts.osdk.hbs", {
|
|
314
374
|
type: "raw",
|
|
315
375
|
body: `import { $ontologyRid } from "{{osdkPackage}}";
|
|
316
376
|
import { createClient } from "@osdk/client";
|
|
@@ -365,26 +425,36 @@ export default defineConfig({
|
|
|
365
425
|
}], ["src/main.css", {
|
|
366
426
|
"type": "base64",
|
|
367
427
|
"body": "aHRtbCwgYm9keSB7CiAgICBtYXJnaW46IDA7Cn0KCi5yYWRpeC10aGVtZXM6d2hlcmUoW2RhdGEtaXMtcm9vdC10aGVtZT0ndHJ1ZSddKSB7CiAgICBtaW4taGVpZ2h0OiAwOwogICAgQHN1cHBvcnRzKG1pbi1oZWlnaHQ6IDEwMGR2aCkgewogICAgICAgIG1pbi1oZWlnaHQ6IDA7CiAgICB9Cn0K"
|
|
368
|
-
}], ["src/main.tsx", {
|
|
428
|
+
}], ["src/main.tsx.hbs", {
|
|
369
429
|
type: "raw",
|
|
370
430
|
body: `import "@radix-ui/themes/styles.css";
|
|
371
431
|
import "./main.css";
|
|
372
432
|
|
|
433
|
+
{{#if osdkPackage}}
|
|
373
434
|
import { OsdkProvider } from "@osdk/react";
|
|
435
|
+
{{/if}}
|
|
374
436
|
import { FoundryWidget } from "@osdk/widget.client-react";
|
|
375
437
|
import { createRoot } from "react-dom/client";
|
|
438
|
+
{{#if osdkPackage}}
|
|
376
439
|
import { client } from "./client.js";
|
|
440
|
+
{{/if}}
|
|
377
441
|
import MainConfig from "./main.config.js";
|
|
378
442
|
import { Widget } from "./Widget.js";
|
|
379
443
|
|
|
380
444
|
const root = document.getElementById("root")!;
|
|
381
445
|
|
|
382
446
|
createRoot(root).render(
|
|
447
|
+
{{#if osdkPackage}}
|
|
383
448
|
<FoundryWidget config={MainConfig} client={client}>
|
|
384
449
|
<OsdkProvider client={client}>
|
|
385
450
|
<Widget />
|
|
386
451
|
</OsdkProvider>
|
|
387
452
|
</FoundryWidget>,
|
|
453
|
+
{{else}}
|
|
454
|
+
<FoundryWidget config={MainConfig}>
|
|
455
|
+
<Widget />
|
|
456
|
+
</FoundryWidget>,
|
|
457
|
+
{{/if}}
|
|
388
458
|
);
|
|
389
459
|
`
|
|
390
460
|
}], ["src/useDarkTheme.ts", {
|
|
@@ -422,5 +492,5 @@ export default defineConfig({
|
|
|
422
492
|
}]]);
|
|
423
493
|
|
|
424
494
|
export { files };
|
|
425
|
-
//# sourceMappingURL=esm-
|
|
426
|
-
//# sourceMappingURL=esm-
|
|
495
|
+
//# sourceMappingURL=esm-JECCLHWP.js.map
|
|
496
|
+
//# sourceMappingURL=esm-JECCLHWP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../create-widget.template.react.v2/build/esm/generatedNoCheck/index.js"],"names":[],"mappings":";AAAO,IAAM,KAAA,mBAAQ,IAAI,GAAA,CAAI,CAAC,CAAC,eAAA,EAAiB;AAAA,EAC9C,IAAA,EAAM,KAAA;AAAA,EACN,IAAA,EAAM,CAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiDR,CAAC,CAAA,EAAG,CAAC,YAAA,EAAc;AAAA,EACjB,IAAA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EACzB,IAAA,EAAM,KAAA;AAAA,EACN,IAAA,EAAM,CAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBR,CAAC,CAAC,CAAC","file":"esm-JECCLHWP.js","sourcesContent":["export const files = new Map([[\"README.md.hbs\", {\n type: \"raw\",\n body: `# {{project}}\n\n{{#if osdkPackage}}\nThis project was generated with [\\`@osdk/create-widget\\`](https://www.npmjs.com/package/@osdk/create-widget) and demonstrates developing custom widgets to be embedded within Foundry UIs such as Workshop. It uses the Ontology SDK package \\`{{osdkPackage}}\\` with React on top of Vite. Check out the [Vite](https://vitejs.dev/guide/) docs for further configuration. The Vite plugin [\\`@osdk/widget.vite-plugin\\`](https://www.npmjs.com/package/@osdk/widget.vite-plugin) automatically generates a \\`widgets.config.json\\` manifest file containing metadata about widgets inside this project during the build command.\n{{else}}\nThis project was generated with [\\`@osdk/create-widget\\`](https://www.npmjs.com/package/@osdk/create-widget) and demonstrates developing custom widgets to be embedded within Foundry UIs such as Workshop. It uses React on top of Vite. Check out the [Vite](https://vitejs.dev/guide/) docs for further configuration. The Vite plugin [\\`@osdk/widget.vite-plugin\\`](https://www.npmjs.com/package/@osdk/widget.vite-plugin) automatically generates a \\`widgets.config.json\\` manifest file containing metadata about widgets inside this project during the build command.\n{{/if}}\n\n## Developing\n\nRun the following commands (or equivalent with your preferred package manager) to start a local development server and follow the instructions printed to set up developer mode in Foundry:\n\n\\`\\`\\`sh\nexport FOUNDRY_TOKEN=<token>\nnpm run dev\n\\`\\`\\`\n\n> **Note:** A widget no longer needs to be published before you can develop on it. Publishing a widget once (see [Deploying](#deploying)) is still required to use it in Workshop so that it becomes selectable in the **Widget setup** panel.\n\n## Deploying\n\nA \\`foundry.config.json\\` file is included in the root of this project containing the deployment configuration to Foundry.\n\nRun the following commands (or equivalent with your preferred package manager) to create a production build of your widgets:\n\n\\`\\`\\`sh\nexport FOUNDRY_TOKEN=<token>\nnpm run build\n\\`\\`\\`\n\nA \\`.palantir/widgets.config.json\\` manifest file containing metadata about your widgets is created during the build.\n\nRun the following command (or equivalent with your preferred package manager) to deploy the production build of your widgets:\n\n\\`\\`\\`sh\nnpx @osdk/cli@latest widgetset deploy\n\\`\\`\\`\n\nBy default the \\`package-json\\` strategy is used for determining the version for your widgets from the \\`version\\` field in this project's \\`package.json\\` file. Remember to update this field and rerun the build command to update the manifest file when deploying a new version.\n\nIf you prefer to infer the version from a git tag, you can use the \\`git-describe\\` strategy by setting the \\`autoVersion\\` field in the \\`foundry.config.json\\` file to:\n\n\\`\\`\\`json\n{\n \"type\": \"git-describe\",\n \"tagPrefix\": \"\"\n}\n\\`\\`\\`\n`\n}], [\".gitignore\", {\n type: \"raw\",\n body: `# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndist-ssr\n*.local\n.pnpm-store\n\n# Editor directories and files\n.vscode/*\n!.vscode/extensions.json\n.idea\n.DS_Store\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?\n`\n}], [\"eslint.config.mjs\", {\n \"type\": \"base64\",\n \"body\": \"Ly8gQHRzLWNoZWNrCmltcG9ydCBlc2xpbnQgZnJvbSAiQGVzbGludC9qcyI7CmltcG9ydCB0c1BhcnNlciBmcm9tICJAdHlwZXNjcmlwdC1lc2xpbnQvcGFyc2VyIjsKaW1wb3J0ICogYXMgaW1wb3J0UGx1Z2luIGZyb20gImVzbGludC1wbHVnaW4taW1wb3J0IjsKaW1wb3J0IGpzeEExMXlQbHVnaW4gZnJvbSAiZXNsaW50LXBsdWdpbi1qc3gtYTExeSI7CmltcG9ydCByZWFjdFBsdWdpbiBmcm9tICJlc2xpbnQtcGx1Z2luLXJlYWN0IjsKaW1wb3J0IHJlYWN0SG9va3NQbHVnaW4gZnJvbSAiZXNsaW50LXBsdWdpbi1yZWFjdC1ob29rcy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iBpbXBvcnRQbHVnaW4sCiAgfSwKICBydWxlczogewogICAgLi4uKAogICAgICAvKiogQHR5cGUgaW1wb3J0KCJlc2xpbnQiKS5MaW50ZXIuUnVsZXNSZWNvcmQgKi8KICAgICAgKHJlYWN0UGx1Z2luLmNvbmZpZ3MuZmxhdD8ucmVjb21tZW5kZWQucnVsZXMpCiAgICApLAogICAgInJlYWN0LWhvb2tzL3J1bGVzLW9mLWhvb2tzIjogImVycm9yIiwKICAgICJyZWFjdC1ob29rcy9leGhhdXN0aXZlLWRlcHMiOiAid2FybiIsCiAgICAuLi5qc3hBMTF5UGx1Z2luLmNvbmZpZ3MucmVjb21tZW5kZWQucnVsZXMsCiAgICAicmVhY3QtcmVmcmVzaC9vbmx5LWV4cG9ydC1jb21wb25lbnRzIjogWyJ3YXJuIiwgewogICAgICBhbGxvd0NvbnN0YW50RXhwb3J0OiB0cnVlLAogICAgfV0sCgogICAgImltcG9ydC9uYW1lZCI6ICJlcnJvciIsCiAgICAiaW1wb3J0L2RlZmF1bHQiOiAiZXJyb3IiLAogICAgImltcG9ydC9uYW1lc3BhY2UiOiAiZXJyb3IiLAogICAgImltcG9ydC9uby1kdXBsaWNhdGVzIjogImVycm9yIiwKICAgICJpbXBvcnQvbm8tZXh0cmFuZW91cy1kZXBlbmRlbmNpZXMiOiAiZXJyb3IiLAoKICAgICJyZWFjdC9yZWFjdC1pbi1qc3gtc2NvcGUiOiAib2ZmIiwKICB9LAp9KTsK\"\n}], [\"index.html\", {\n type: \"raw\",\n body: `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>React Custom Widget</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`\n}], [\"package.json.no-osdk.hbs\", {\n type: \"raw\",\n body: `{\n \"name\": \"{{project}}\",\n \"private\": true,\n \"version\": \"0.0.0\",\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"tsc && vite build\",\n \"lint\": \"eslint . --report-unused-disable-directives --max-warnings 0\",\n \"test\": \"vitest run --passWithNoTests\",\n \"preview\": \"vite preview\"\n },\n \"dependencies\": {\n \"@osdk/widget.client-react\": \"^3.26.0\",\n \"@osdk/widget.client\": \"^3.26.0\",\n \"@radix-ui/react-icons\": \"^1.3.2\",\n \"@radix-ui/themes\": \"^3.2.1\",\n \"react\": \"^18\",\n \"react-dom\": \"^18\"\n },\n \"devDependencies\": {\n \"@osdk/widget.vite-plugin\": \"^3.26.0\",\n \"@eslint/compat\": \"^1.3.2\",\n \"@eslint/js\": \"^9.35.0\",\n \"@types/react\": \"^18\",\n \"@types/react-dom\": \"^18\",\n \"@typescript-eslint/eslint-plugin\": \"^8.43.0\",\n \"@typescript-eslint/parser\": \"^8.43.0\",\n \"@vitejs/plugin-react\": \"^4.7.0\",\n \"eslint\": \"^9.35.0\",\n \"eslint-plugin-import\": \"^2.32.0\",\n \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n \"eslint-plugin-react\": \"^7.37.5\",\n \"eslint-plugin-react-hooks\": \"^5.2.0\",\n \"eslint-plugin-react-refresh\": \"^0.4.20\",\n \"globals\": \"^15.15.0\",\n \"typescript\": \"~5.5.4\",\n \"typescript-eslint\": \"^8.43.0\",\n \"vite\": \"^7.3.1\",\n \"vitest\": \"^3.2.4\"\n }\n}`\n}], [\"package.json.osdk.hbs\", {\n type: \"raw\",\n body: `{\n \"name\": \"{{project}}\",\n \"private\": true,\n \"version\": \"0.0.0\",\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"tsc && vite build\",\n \"lint\": \"eslint . --report-unused-disable-directives --max-warnings 0\",\n \"test\": \"vitest run --passWithNoTests\",\n \"preview\": \"vite preview\"\n },\n \"dependencies\": {\n \"{{osdkPackage}}\": \"latest\",\n \"@osdk/client\": \"^2.0.0\",\n \"@osdk/react\": \"^2.0.0\",\n \"@osdk/widget.client-react\": \"^3.26.0\",\n \"@osdk/widget.client\": \"^3.26.0\",\n \"@radix-ui/react-icons\": \"^1.3.2\",\n \"@radix-ui/themes\": \"^3.2.1\",\n \"react\": \"^18\",\n \"react-dom\": \"^18\"\n },\n \"devDependencies\": {\n \"@osdk/widget.vite-plugin\": \"^3.26.0\",\n \"@eslint/compat\": \"^1.3.2\",\n \"@eslint/js\": \"^9.35.0\",\n \"@types/react\": \"^18\",\n \"@types/react-dom\": \"^18\",\n \"@typescript-eslint/eslint-plugin\": \"^8.43.0\",\n \"@typescript-eslint/parser\": \"^8.43.0\",\n \"@vitejs/plugin-react\": \"^4.7.0\",\n \"eslint\": \"^9.35.0\",\n \"eslint-plugin-import\": \"^2.32.0\",\n \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n \"eslint-plugin-react\": \"^7.37.5\",\n \"eslint-plugin-react-hooks\": \"^5.2.0\",\n \"eslint-plugin-react-refresh\": \"^0.4.20\",\n \"globals\": \"^15.15.0\",\n \"typescript\": \"~5.5.4\",\n \"typescript-eslint\": \"^8.43.0\",\n \"vite\": \"^7.3.1\",\n \"vitest\": \"^3.2.4\"\n }\n}`\n}], [\"src/Widget.tsx.hbs\", {\n type: \"raw\",\n body: `{{#if osdkPackage}}\nimport { \\$Actions, \\$Objects, \\$Queries } from \"{{osdkPackage}}\";\n{{/if}}\nimport {\n Box,\n Button,\n Checkbox,\n Container,\n Flex,\n Heading,\n Skeleton,\n Table,\n{{#if osdkPackage}}\n Text,\n{{/if}}\n TextField,\n Theme,\n} from \"@radix-ui/themes\";\nimport React, { useCallback, useState } from \"react\";\nimport { useWidgetContext } from \"./context.js\";\nimport { useDarkTheme } from \"./useDarkTheme.js\";\n{{#if osdkPackage}}\n// import { useOsdkClient } from \"@osdk/react\";\n// View the API documentation for your widget set to learn how to use the Ontology SDK.\n{{/if}}\n\nexport const Widget: React.FC = () => {\n{{#if osdkPackage}}\n // See Ontology and Platform SDK docs in Developer Console on how to\n // use the client object to access Ontology resources and platform APIs\n // const client = useOsdkClient();\n\n{{/if}}\n const { parameters, emitEvent } = useWidgetContext();\n const { headerText, todoItems } = parameters.values;\n const [newTodoItem, setNewTodoItem] = useState(\"\");\n\n const handleAddTodoItem = useCallback(() => {\n emitEvent(\"updateTodoItems\", {\n parameterUpdates: {\n todoItems: [...(todoItems ?? []), newTodoItem],\n },\n });\n setNewTodoItem(\"\");\n }, [emitEvent, newTodoItem, todoItems]);\n\n const handleNewTodoItemChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setNewTodoItem(event.target.value);\n },\n []\n );\n\n const isDarkTheme = useDarkTheme();\n\n{{#if osdkPackage}}\n const objectApiNames = Object.keys(\\$Objects);\n const actionApiNames = Object.keys(\\$Actions);\n const queryApiNames = Object.keys(\\$Queries);\n\n{{/if}}\n return (\n <Theme appearance={isDarkTheme ? \"dark\" : \"light\"}>\n <Box p=\"2\">\n <Container size=\"1\">\n <Flex direction=\"column\" gap=\"4\">\n <Flex p=\"5\" direction=\"column\" gap=\"2\">\n <Heading size=\"4\">\n {parameters.state === \"loading\" ||\n parameters.state === \"not-started\" ? (\n <Skeleton>Hello, world!</Skeleton>\n ) : (\n headerText ?? \"{{project}}\"\n )}\n </Heading>\n\n <Table.Root>\n <Table.Header>\n <Table.Row>\n <Table.ColumnHeaderCell>Finished</Table.ColumnHeaderCell>\n <Table.ColumnHeaderCell>Item</Table.ColumnHeaderCell>\n </Table.Row>\n </Table.Header>\n\n <Table.Body>\n {(parameters.state === \"loading\" ||\n parameters.state === \"not-started\") && (\n <>\n <Table.Row>\n <Table.Cell>\n <Skeleton>\n <Checkbox />\n </Skeleton>\n </Table.Cell>\n <Table.Cell>\n <Skeleton>Loading cell</Skeleton>\n </Table.Cell>\n </Table.Row>\n <Table.Row>\n <Table.Cell>\n <Skeleton>\n <Checkbox />\n </Skeleton>\n </Table.Cell>\n <Table.Cell>\n <Skeleton>Loading cell</Skeleton>\n </Table.Cell>\n </Table.Row>\n </>\n )}\n {parameters.state === \"loaded\" &&\n todoItems?.map((item, index) => (\n <Table.Row key={index}>\n <Table.Cell>\n <Checkbox />\n </Table.Cell>\n <Table.Cell>{item}</Table.Cell>\n </Table.Row>\n ))}\n {parameters.state === \"loaded\" &&\n (todoItems ?? []).length === 0 && (\n <Table.Row>\n <Table.Cell colSpan={2}>No items yet</Table.Cell>\n </Table.Row>\n )}\n <Table.Row>\n <Table.Cell colSpan={2}>\n <Flex gap=\"2\">\n <TextField.Root\n value={newTodoItem}\n onChange={handleNewTodoItemChange}\n size=\"2\"\n placeholder=\"Add item…\"\n />\n <Button onClick={handleAddTodoItem}>Add item</Button>\n </Flex>\n </Table.Cell>\n </Table.Row>\n </Table.Body>\n </Table.Root>\n </Flex>\n{{#if osdkPackage}}\n <Box>\n <Flex direction=\"column\" gap=\"2\">\n <Text>\n Try any of the following methods from your Ontology SDK\n </Text>\n <Flex direction=\"column\" gap=\"1\">\n <Heading size=\"4\">Objects ({objectApiNames.length})</Heading>\n <pre>\n {objectApiNames.map((objectApiName) => (\n <div key={objectApiName}>client({objectApiName})</div>\n ))}\n </pre>\n </Flex>\n <Flex direction=\"column\" gap=\"1\">\n <Heading size=\"4\">Actions ({actionApiNames.length})</Heading>\n <pre>\n {actionApiNames.map((actionApiName) => (\n <div key={actionApiName}>client({actionApiName})</div>\n ))}\n </pre>\n </Flex>\n <Flex direction=\"column\" gap=\"1\">\n <Heading size=\"4\">Queries ({queryApiNames.length})</Heading>\n <pre>\n {queryApiNames.map((queryApiName) => (\n <div key={queryApiName}>client({queryApiName})</div>\n ))}\n </pre>\n </Flex>\n </Flex>\n </Box>\n{{/if}}\n </Flex>\n </Container>\n </Box>\n </Theme>\n );\n};\n`\n}], [\"src/client.ts.osdk.hbs\", {\n type: \"raw\",\n body: `import { \\$ontologyRid } from \"{{osdkPackage}}\";\nimport { createClient } from \"@osdk/client\";\nimport { createFoundryWidgetTokenProvider } from \"@osdk/widget.client\";\n\nexport const client = createClient(\n window.location.origin,\n \\$ontologyRid,\n createFoundryWidgetTokenProvider(),\n);\n`\n}], [\"src/context.ts\", {\n \"type\": \"base64\",\n \"body\": \"aW1wb3J0IHsgdXNlRm91bmRyeVdpZGdldENvbnRleHQgfSBmcm9tICJAb3Nkay93aWRnZXQuY2xpZW50LXJlYWN0IjsKaW1wb3J0IHR5cGUgTWFpbkNvbmZpZyBmcm9tICIuL21haW4uY29uZmlnLmpzIjsKCmV4cG9ydCBjb25zdCB1c2VXaWRnZXRDb250ZXh0ID0gdXNlRm91bmRyeVdpZGdldENvbnRleHQud2l0aFR5cGVzPAogIHR5cGVvZiBNYWluQ29uZmlnCj4oKTsK\"\n}], [\"src/main.config.ts.hbs\", {\n type: \"raw\",\n body: `import { defineConfig } from \"@osdk/widget.client\";\n\n// Updates to the widget configuration in this file require reapplying dev mode\n// to preview the changes. When developing locally, open the setup URL printed\n// in your terminal again. When developing in Code Workspaces, refresh the\n// preview panel.\n\nexport default defineConfig({\n id: \"widgetId\",\n name: \"Custom Widget\",\n description: \"An example custom widget implementation\",\n type: \"workshop\",\n parameters: {\n headerText: {\n displayName: \"Widget title\",\n type: \"string\",\n },\n todoItems: {\n displayName: \"Todo items\",\n type: \"array\",\n subType: \"string\",\n },\n },\n events: {\n updateHeader: {\n displayName: \"Update header\",\n parameterUpdateIds: [\"headerText\"],\n },\n updateTodoItems: {\n displayName: \"Update todo items\",\n parameterUpdateIds: [\"todoItems\"],\n },\n },\n});\n`\n}], [\"src/main.css\", {\n \"type\": \"base64\",\n \"body\": \"aHRtbCwgYm9keSB7CiAgICBtYXJnaW46IDA7Cn0KCi5yYWRpeC10aGVtZXM6d2hlcmUoW2RhdGEtaXMtcm9vdC10aGVtZT0ndHJ1ZSddKSB7CiAgICBtaW4taGVpZ2h0OiAwOwogICAgQHN1cHBvcnRzKG1pbi1oZWlnaHQ6IDEwMGR2aCkgewogICAgICAgIG1pbi1oZWlnaHQ6IDA7CiAgICB9Cn0K\"\n}], [\"src/main.tsx.hbs\", {\n type: \"raw\",\n body: `import \"@radix-ui/themes/styles.css\";\nimport \"./main.css\";\n\n{{#if osdkPackage}}\nimport { OsdkProvider } from \"@osdk/react\";\n{{/if}}\nimport { FoundryWidget } from \"@osdk/widget.client-react\";\nimport { createRoot } from \"react-dom/client\";\n{{#if osdkPackage}}\nimport { client } from \"./client.js\";\n{{/if}}\nimport MainConfig from \"./main.config.js\";\nimport { Widget } from \"./Widget.js\";\n\nconst root = document.getElementById(\"root\")!;\n\ncreateRoot(root).render(\n{{#if osdkPackage}}\n <FoundryWidget config={MainConfig} client={client}>\n <OsdkProvider client={client}>\n <Widget />\n </OsdkProvider>\n </FoundryWidget>,\n{{else}}\n <FoundryWidget config={MainConfig}>\n <Widget />\n </FoundryWidget>,\n{{/if}}\n);\n`\n}], [\"src/useDarkTheme.ts\", {\n \"type\": \"base64\",\n \"body\": \"aW1wb3J0IHsgdXNlRWZmZWN0LCB1c2VTdGF0ZSB9IGZyb20gInJlYWN0IjsKCmV4cG9ydCBjb25zdCB1c2VEYXJrVGhlbWUgPSAoKSA9PiB1c2VNZWRpYVF1ZXJ5KCIocHJlZmVycy1jb2xvci1zY2hlbWU6IGRhcmspIik7Cgpjb25zdCB1c2VNZWRpYVF1ZXJ5ID0gKHF1ZXJ5OiBzdHJpbmcpID0+IHsKICBjb25zdCBbbWF0Y2hlcywgc2V0TWF0Y2hlc10gPSB1c2VTdGF0ZShmYWxzZSk7CgogIGNvbnN0IGhhbmRsZUNoYW5nZSA9IChlOiBNZWRpYVF1ZXJ5TGlzdEV2ZW50KSA9PiBzZXRNYXRjaGVzKGUubWF0Y2hlcyk7CgogIHVzZUVmZmVjdCgoKSA9PiB7CiAgICBjb25zdCBtID0gd2luZG93Lm1hdGNoTWVkaWEocXVlcnkpOwogICAgc2V0TWF0Y2hlcyhtLm1hdGNoZXMpOwogICAgbS5hZGRFdmVudExpc3RlbmVyKCJjaGFuZ2UiLCBoYW5kbGVDaGFuZ2UpOwogICAgcmV0dXJuICgpID0+IHsKICAgICAgbS5yZW1vdmVFdmVudExpc3RlbmVyKCJjaGFuZ2UiLCBoYW5kbGVDaGFuZ2UpOwogICAgfTsKICB9LCBbcXVlcnldKTsKCiAgcmV0dXJuIG1hdGNoZXM7Cn07Cg==\"\n}], [\"src/vite-env.d.ts\", {\n \"type\": \"base64\",\n \"body\": \"Ly8vIDxyZWZlcmVuY2UgdHlwZXM9InZpdGUvY2xpZW50IiAvPgo=\"\n}], [\"tsconfig.json\", {\n \"type\": \"base64\",\n \"body\": \"ewogICJjb21waWxlck9wdGlvbnMiOiB7CiAgICAidGFyZ2V0IjogIkVTMjAyMCIsCiAgICAidXNlRGVmaW5lRm9yQ2xhc3NGaWVsZHMiOiB0cnVlLAogICAgImxpYiI6IFsiRVMyMDIwIiwgIkRPTSIsICJET00uSXRlcmFibGUiXSwKICAgICJtb2R1bGUiOiAiRVNOZXh0IiwKICAgICJza2lwTGliQ2hlY2siOiB0cnVlLAoKICAgIC8qIEJ1bmRsZXIgbW9kZSAqLwogICAgIm1vZHVsZVJlc29sdXRpb24iOiAiYnVuZGxlciIsCiAgICAiYWxsb3dJbXBvcnRpbmdUc0V4dGVuc2lvbnMiOiB0cnVlLAogICAgInJlc29sdmVKc29uTW9kdWxlIjogdHJ1ZSwKICAgICJpc29sYXRlZE1vZHVsZXMiOiB0cnVlLAogICAgIm5vRW1pdCI6IHRydWUsCiAgICAianN4IjogInJlYWN0LWpzeCIsCgogICAgLyogTGludGluZyAqLwogICAgInN0cmljdCI6IHRydWUsCiAgICAibm9VbnVzZWRMb2NhbHMiOiB0cnVlLAogICAgIm5vVW51c2VkUGFyYW1ldGVycyI6IHRydWUsCiAgICAibm9GYWxsdGhyb3VnaENhc2VzSW5Td2l0Y2giOiB0cnVlCiAgfSwKICAiaW5jbHVkZSI6IFsic3JjIl0sCiAgInJlZmVyZW5jZXMiOiBbeyAicGF0aCI6ICIuL3RzY29uZmlnLm5vZGUuanNvbiIgfV0KfQo=\"\n}], [\"tsconfig.node.json\", {\n \"type\": \"base64\",\n \"body\": \"ewogICJjb21waWxlck9wdGlvbnMiOiB7CiAgICAiY29tcG9zaXRlIjogdHJ1ZSwKICAgICJza2lwTGliQ2hlY2siOiB0cnVlLAogICAgIm1vZHVsZSI6ICJFU05leHQiLAogICAgIm1vZHVsZVJlc29sdXRpb24iOiAiYnVuZGxlciIsCiAgICAiYWxsb3dTeW50aGV0aWNEZWZhdWx0SW1wb3J0cyI6IHRydWUKICB9LAogICJpbmNsdWRlIjogWyJ2aXRlLmNvbmZpZy50cyJdCn0K\"\n}], [\"vite.config.ts.hbs\", {\n type: \"raw\",\n body: `import foundryWidgetPlugin from \"@osdk/widget.vite-plugin\";\nimport react from \"@vitejs/plugin-react\";\nimport { defineConfig } from \"vite\";\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [react(), foundryWidgetPlugin()],\n server: {\n port: 8080,\n cors: true,\n },\n build: {\n rollupOptions: {\n input: [\"./index.html\"],\n },\n },\n});\n`\n}]]);"]}
|
package/build/esm/index.js
CHANGED
|
@@ -158,9 +158,9 @@ var TEMPLATES = [
|
|
|
158
158
|
label: "OSDK React",
|
|
159
159
|
envPrefix: "VITE_",
|
|
160
160
|
buildDirectory: "./dist",
|
|
161
|
-
|
|
161
|
+
supportsOsdk: true,
|
|
162
162
|
files: {
|
|
163
|
-
"2.x": getPackageFiles(import('./esm-
|
|
163
|
+
"2.x": getPackageFiles(import('./esm-JECCLHWP.js'))
|
|
164
164
|
}
|
|
165
165
|
},
|
|
166
166
|
// Minimal React
|
|
@@ -169,7 +169,7 @@ var TEMPLATES = [
|
|
|
169
169
|
label: "Minimal React",
|
|
170
170
|
envPrefix: "VITE_",
|
|
171
171
|
buildDirectory: "./dist",
|
|
172
|
-
|
|
172
|
+
supportsOsdk: false,
|
|
173
173
|
files: {
|
|
174
174
|
"2.x": getPackageFiles(import('./esm-W2HHSUQU.js'))
|
|
175
175
|
}
|
|
@@ -203,6 +203,35 @@ async function promptTemplate(parsed) {
|
|
|
203
203
|
return template;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
// src/prompts/promptUseOsdk.ts
|
|
207
|
+
async function promptUseOsdk({
|
|
208
|
+
template,
|
|
209
|
+
osdkPackage,
|
|
210
|
+
osdkRegistryUrl,
|
|
211
|
+
skipOsdk
|
|
212
|
+
}) {
|
|
213
|
+
if (!template.supportsOsdk) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
if (skipOsdk) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
if (osdkPackage != null || osdkRegistryUrl != null) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
const answer = await consola.prompt("Will you be using an OSDK in your widget set?", {
|
|
223
|
+
type: "select",
|
|
224
|
+
options: [{
|
|
225
|
+
label: "Yes, I will be using an OSDK",
|
|
226
|
+
value: "yes"
|
|
227
|
+
}, {
|
|
228
|
+
label: "No (can be added later)",
|
|
229
|
+
value: "no"
|
|
230
|
+
}]
|
|
231
|
+
});
|
|
232
|
+
return answer === "yes";
|
|
233
|
+
}
|
|
234
|
+
|
|
206
235
|
// src/prompts/promptWidgetSetRid.ts
|
|
207
236
|
async function promptWidgetSetRid({
|
|
208
237
|
widgetSet
|
|
@@ -308,26 +337,46 @@ async function run({
|
|
|
308
337
|
};
|
|
309
338
|
const processFiles = function(dir) {
|
|
310
339
|
fs2.readdirSync(dir).forEach((file) => {
|
|
311
|
-
|
|
312
|
-
const stat = fs2.statSync(
|
|
340
|
+
let fullPath = dir + "/" + file;
|
|
341
|
+
const stat = fs2.statSync(fullPath);
|
|
313
342
|
if (stat.isDirectory()) {
|
|
314
|
-
processFiles(
|
|
343
|
+
processFiles(fullPath);
|
|
315
344
|
return;
|
|
316
345
|
}
|
|
317
|
-
if (
|
|
318
|
-
fs2.renameSync(
|
|
346
|
+
if (fullPath.endsWith("/_gitignore")) {
|
|
347
|
+
fs2.renameSync(fullPath, fullPath.replace(/\/_gitignore$/u, "/.gitignore"));
|
|
319
348
|
return;
|
|
320
349
|
}
|
|
321
|
-
if (
|
|
350
|
+
if (file.includes(".osdk")) {
|
|
351
|
+
if (osdkPackage == null) {
|
|
352
|
+
fs2.rmSync(fullPath);
|
|
353
|
+
return;
|
|
354
|
+
} else {
|
|
355
|
+
const renamed = dir + "/" + file.replace(".osdk", "");
|
|
356
|
+
fs2.renameSync(fullPath, renamed);
|
|
357
|
+
fullPath = renamed;
|
|
358
|
+
}
|
|
359
|
+
} else if (file.includes(".no-osdk")) {
|
|
360
|
+
if (osdkPackage == null) {
|
|
361
|
+
const renamed = dir + "/" + file.replace(".no-osdk", "");
|
|
362
|
+
fs2.renameSync(fullPath, renamed);
|
|
363
|
+
fullPath = renamed;
|
|
364
|
+
} else {
|
|
365
|
+
fs2.rmSync(fullPath);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (!fullPath.endsWith(".hbs")) {
|
|
322
370
|
return;
|
|
323
371
|
}
|
|
324
|
-
const templated = Handlebars.compile(fs2.readFileSync(
|
|
325
|
-
fs2.writeFileSync(
|
|
326
|
-
fs2.rmSync(
|
|
372
|
+
const templated = Handlebars.compile(fs2.readFileSync(fullPath, "utf-8"))(templateContext);
|
|
373
|
+
fs2.writeFileSync(fullPath.replace(/.hbs$/u, ""), templated);
|
|
374
|
+
fs2.rmSync(fullPath);
|
|
327
375
|
});
|
|
328
376
|
};
|
|
329
377
|
processFiles(root);
|
|
330
|
-
|
|
378
|
+
const useOsdk = osdkPackage != null || osdkRegistryUrl != null;
|
|
379
|
+
if (useOsdk) {
|
|
331
380
|
if (osdkPackage == null || osdkRegistryUrl == null) {
|
|
332
381
|
throw new Error(`Template ${template.id} requires OSDK package and registry URL`);
|
|
333
382
|
}
|
|
@@ -364,7 +413,7 @@ async function run({
|
|
|
364
413
|
|
|
365
414
|
// src/cli.ts
|
|
366
415
|
async function cli(args = process.argv) {
|
|
367
|
-
const base = yargs(hideBin(args)).version("3.55.
|
|
416
|
+
const base = yargs(hideBin(args)).version("3.55.1-main-8718d53b7732f75b01252c7e08f65fb27c45e9aa").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK widget set based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
|
|
368
417
|
type: "string",
|
|
369
418
|
describe: "Project name to create"
|
|
370
419
|
}).option("overwrite", {
|
|
@@ -387,10 +436,15 @@ async function cli(args = process.argv) {
|
|
|
387
436
|
describe: "Repository resource identifier (rid)"
|
|
388
437
|
}).option("osdkPackage", {
|
|
389
438
|
type: "string",
|
|
390
|
-
describe: "OSDK package name for application"
|
|
439
|
+
describe: "OSDK package name for application",
|
|
440
|
+
conflicts: "skipOsdk"
|
|
391
441
|
}).option("osdkRegistryUrl", {
|
|
392
442
|
type: "string",
|
|
393
|
-
describe: "URL for NPM registry to install OSDK package"
|
|
443
|
+
describe: "URL for NPM registry to install OSDK package",
|
|
444
|
+
conflicts: "skipOsdk"
|
|
445
|
+
}).option("skipOsdk", {
|
|
446
|
+
type: "boolean",
|
|
447
|
+
describe: "Skip filling in OSDK options"
|
|
394
448
|
}));
|
|
395
449
|
const parsed = base.parseSync();
|
|
396
450
|
const project = await promptProject(parsed);
|
|
@@ -405,8 +459,12 @@ async function cli(args = process.argv) {
|
|
|
405
459
|
});
|
|
406
460
|
const foundryUrl = await promptFoundryUrl(parsed);
|
|
407
461
|
const repository = parsed.repository;
|
|
408
|
-
const
|
|
409
|
-
|
|
462
|
+
const useOsdk = await promptUseOsdk({
|
|
463
|
+
...parsed,
|
|
464
|
+
template
|
|
465
|
+
});
|
|
466
|
+
const osdkPackage = useOsdk ? await promptOsdkPackage(parsed) : void 0;
|
|
467
|
+
const osdkRegistryUrl = useOsdk ? await promptOsdkRegistryUrl(parsed) : void 0;
|
|
410
468
|
const widgetSet = await promptWidgetSetRid(parsed);
|
|
411
469
|
await run({
|
|
412
470
|
project,
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/consola.ts","../../src/highlight.ts","../../src/prompts/promptFoundryUrl.ts","../../src/prompts/promptOsdkPackage.ts","../../src/prompts/promptOsdkRegistryUrl.ts","../../src/prompts/promptOverwrite.ts","../../src/prompts/promptProject.ts","../../src/prompts/promptSdkVersion.ts","../../src/getPackageFiles.ts","../../src/generatedNoCheck/templates.ts","../../src/prompts/promptTemplate.ts","../../src/prompts/promptWidgetSetRid.ts","../../src/generate/generateFoundryConfigJson.ts","../../src/generate/generateNpmRc.ts","../../src/run.ts","../../src/cli.ts"],"names":["defaultConsola","fs","path","sdkVersion","template","yargs"],"mappings":";;;;;;;;;AAmBA,IAAM,YAAA,GAAe,MAAA,CAAO,GAAA,CAAI,QAAQ,CAAA;AACjC,IAAM,UAAU,aAAA,CAAc;AAAA,EACnC,MAAM,MAAA,CAAO,OAAA,EAAS,IAAA,EAAM;AAC1B,IAAA,MAAM,QAAA,GAAW,MAAMA,SAAA,CAAe,MAAA,CAAO,OAAA,EAAS;AAAA,MACpD,GAAG,IAAA;AAAA,MACH,MAAA,EAAQ,MAAM,MAAA,IAAU;AAAA,KACzB,CAAA;AACD,IAAA,IAAI,aAAa,YAAA,EAAc;AAC7B,MAAAA,SAAA,CAAe,KAAK,qBAAqB,CAAA;AACzC,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AACA,IAAA,OAAO,QAAA;AAAA,EACT;AACF,CAAC,CAAA;ACfM,SAAS,MAAM,IAAA,EAAM;AAC1B,EAAA,OAAO,QAAA,CAAS,SAAS,IAAI,CAAA;AAC/B;AACO,SAAS,OAAO,IAAA,EAAM;AAC3B,EAAA,OAAO,QAAA,CAAS,UAAU,IAAI,CAAA;AAChC;;;ACJA,eAAsB,gBAAA,CAAiB;AAAA,EACrC;AACF,CAAA,EAAG;AACD,EAAA,OAAO,cAAc,IAAA,IAAQ,CAAC,UAAA,CAAW,UAAA,CAAW,UAAU,CAAA,E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AiB;AAAA,IACxC,GAAG,MAAA;AAAA,IACH;AAAA,GACD,CAAA;AACD,EAAA,MAAM,UAAA,GAAa,MAAM,gBAAA,CAAiB,MAAM,CAAA;AAChD,EAAA,MAAM,aAAa,MAAA,CAAO,UAAA;AAC1B,EAAA,MAAM,cAAc,QAAA,CAAS,YAAA,GAAe,MAAM,iBAAA,CAAkB,MAAM,CAAA,GAAI,MAAA;AAC9E,EAAA,MAAM,kBAAkB,QAAA,CAAS,YAAA,GAAe,MAAM,qBAAA,CAAsB,MAAM,CAAA,GAAI,MAAA;AACtF,EAAA,MAAM,SAAA,GAAY,MAAM,kBAAA,CAAmB,MAAM,CAAA;AACjD,EAAA,MAAM,GAAA,CAAI;AAAA,IACR,OAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH","file":"index.js","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola as defaultConsola, createConsola } from \"consola\";\n\n// https://github.com/unjs/consola?tab=readme-ov-file#await-promptmessage--type-cancel-\nconst cancelSymbol = Symbol.for(\"cancel\");\nexport const consola = createConsola({\n async prompt(message, opts) {\n const response = await defaultConsola.prompt(message, {\n ...opts,\n cancel: opts?.cancel ?? \"symbol\"\n });\n if (response === cancelSymbol) {\n defaultConsola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n return response;\n }\n});","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { colorize } from \"consola/utils\";\nexport function green(text) {\n return colorize(\"green\", text);\n}\nexport function italic(text) {\n return colorize(\"italic\", text);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptFoundryUrl({\n foundryUrl\n}) {\n while (foundryUrl == null || !foundryUrl.startsWith(\"https://\")) {\n if (foundryUrl != null) {\n consola.fail(\"Please enter a valid Foundry URL\");\n }\n foundryUrl = await consola.prompt(`Enter the URL for your Foundry stack:\\n${italic(\"(Example: https://example.palantirfoundry.com)\")}`, {\n type: \"text\"\n });\n }\n return foundryUrl.replace(/\\/$/u, \"\");\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkPackage({\n osdkPackage\n}) {\n while (osdkPackage == null || !/^@[a-z0-9-]+\\/sdk$/u.test(osdkPackage)) {\n if (osdkPackage != null) {\n consola.fail(\"Please enter a valid OSDK package name\");\n }\n osdkPackage = await consola.prompt(`Enter the OSDK package name for your widget set:\\n${italic(\"(Example: @my-widget/sdk)\")}`, {\n type: \"text\"\n });\n }\n return osdkPackage;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkRegistryUrl({\n osdkRegistryUrl\n}) {\n while (osdkRegistryUrl == null || !/^https:\\/\\/[^/]+\\/artifacts\\/api\\/repositories\\/ri\\.[^/]+\\/contents\\/release\\/npm\\/?$/u.test(osdkRegistryUrl)) {\n if (osdkRegistryUrl != null) {\n consola.fail(\"Please enter a valid NPM registry URL to install your OSDK package\");\n }\n osdkRegistryUrl = await consola.prompt(`Enter the NPM registry URL to install your OSDK package:\\n${italic(\"(Example: https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.a4a7fe1c-486f-4226-b706-7b90005f527d/contents/release/npm)\")}`, {\n type: \"text\"\n });\n }\n return osdkRegistryUrl.replace(/\\/$/u, \"\");\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { consola } from \"../consola.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptOverwrite({\n project,\n overwrite\n}) {\n if (overwrite != null) {\n return overwrite;\n }\n if (!fs.existsSync(path.join(process.cwd(), project))) {\n return true;\n }\n const result = await consola.prompt(`The directory ${green(project)} already exists do you want to overwrite or ignore it?`, {\n type: \"select\",\n options: [{\n label: \"Remove existing files and continue\",\n value: \"overwrite\"\n }, {\n label: \"Ignore files and continue\",\n value: \"ignore\"\n }, {\n label: \"Cancel\",\n value: \"cancel\"\n }]\n });\n switch (result) {\n case \"overwrite\":\n return true;\n case \"ignore\":\n return false;\n case \"cancel\":\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptProject({\n project\n}) {\n while (project == null || !/^[a-zA-Z0-9-_]+$/u.test(project)) {\n if (project != null) {\n consola.fail(\"Project name can only contain alphanumeric characters, hyphens and underscores\");\n }\n project = await consola.prompt(\"Project name:\", {\n type: \"text\",\n placeholder: \"my-osdk-widget\",\n default: \"my-osdk-widget\"\n });\n }\n return project;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptSdkVersion({\n sdkVersion,\n template\n}) {\n if (sdkVersion == null) {\n // If the SDK version is not provided, default to the earliest template version for backwards-compatibility\n return Object.keys(template.files)[0];\n }\n if (template.files[sdkVersion] == null) {\n consola.fail(`The ${template.label} template does not support a \"${sdkVersion}\" SDK version.`);\n sdkVersion = await consola.prompt(`Please choose which version of the OSDK you'd like to use for the ${template.label} template:`, {\n type: \"select\",\n options: Object.keys(template.files).reverse().map(sdkVersion => ({\n label: sdkVersion,\n value: sdkVersion\n }))\n });\n }\n return sdkVersion;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const getPackageFiles = importPromise => async () => (await importPromise).files;","// THIS FILE IS GENERATED. DO NOT MODIFY.\n// You probably want to modify ../../../codegen.mjs instead.\n\nimport { getPackageFiles } from \"../getPackageFiles.js\";\nexport const TEMPLATES = [\n// OSDK React\n{\n id: \"template-widget-react\",\n label: \"OSDK React\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n requiresOsdk: true,\n files: {\n \"2.x\": getPackageFiles(import(\"@osdk/create-widget.template.react.v2\"))\n }\n},\n// Minimal React\n{\n id: \"template-widget-minimal-react\",\n label: \"Minimal React\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n requiresOsdk: false,\n files: {\n \"2.x\": getPackageFiles(import(\"@osdk/create-widget.template.minimal-react.v2\"))\n }\n}];","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { TEMPLATES } from \"../generatedNoCheck/templates.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptTemplate(parsed) {\n const useBeta = parsed.beta ?? false;\n let template = TEMPLATES.find(t => t.id === parsed.template || t.id === `template-${parsed.template}`);\n if (template == null) {\n const availableTemplates = TEMPLATES.filter(template => !template.hidden && (useBeta ? template.isBeta === true :\n // isBeta could be null\n !template.isBeta));\n if (availableTemplates.length === 0) {\n throw new Error(\"No available templates found for the selected options.\");\n }\n const templateId = await consola.prompt(parsed.template != null ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : \"Select a framework:\", {\n type: \"select\",\n options: availableTemplates.map(template => ({\n value: template.id,\n label: template.label\n }))\n });\n template = TEMPLATES.find(t => t.id === templateId);\n if (template == null) {\n throw new Error(`Template ${templateId} should be found`);\n }\n }\n return template;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptWidgetSetRid({\n widgetSet\n}) {\n while (widgetSet == null || !/^ri\\.widgetregistry\\.\\.widget-set\\.[^.]+$/u.test(widgetSet)) {\n if (widgetSet != null) {\n consola.fail(\"Please enter a valid widget resource identifier (rid)\");\n }\n widgetSet = await consola.prompt(`Enter the resource identifier (rid) for your widget set:\\n${italic(\"(Example: ri.widgetregistry..widget-set.1c66b352-4e00-40d2-995d-061c9d533ace)\")}`, {\n type: \"text\"\n });\n }\n return widgetSet;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateFoundryConfigJson({\n foundryUrl,\n widgetSet,\n repository,\n directory\n}) {\n return JSON.stringify({\n foundryUrl,\n widgetSet: {\n rid: widgetSet,\n repository,\n directory,\n autoVersion: {\n type: \"package-json\"\n }\n }\n }, null, 2) + \"\\n\";\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateNpmRc({\n foundryUrl,\n osdkPackage,\n osdkRegistryUrl\n}) {\n // pnpm requires a trailing slash in .npmrc\n // https://github.com/pnpm/pnpm/issues/5941\n const osdkRegistryUrlWithTrailingSlash = osdkRegistryUrl.endsWith(\"/\") ? osdkRegistryUrl : osdkRegistryUrl + \"/\";\n const formattedFoundryUrl = foundryUrl.replace(/^https:\\/\\//u, \"\").replace(/\\/$/u, \"\");\n const artifactsApiUrl = formattedFoundryUrl + \"/artifacts/api/\";\n const packageScope = osdkPackage.split(\"/\")[0];\n return `//${artifactsApiUrl}:_authToken=\\${FOUNDRY_TOKEN}\\n` + `${packageScope}:registry=${osdkRegistryUrlWithTrailingSlash}\\n`;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport Handlebars from \"handlebars\";\nimport { consola } from \"./consola.js\";\nimport { generateFoundryConfigJson } from \"./generate/generateFoundryConfigJson.js\";\nimport { generateNpmRc } from \"./generate/generateNpmRc.js\";\nimport { green } from \"./highlight.js\";\nexport async function run({\n project,\n overwrite,\n template,\n sdkVersion,\n foundryUrl,\n widgetSet,\n repository,\n osdkPackage,\n osdkRegistryUrl\n}) {\n consola.log(\"\");\n consola.start(`Creating project ${green(project)} using template ${green(template.id)}`);\n const cwd = process.cwd();\n const root = path.join(cwd, project);\n if (fs.existsSync(root)) {\n if (overwrite) {\n consola.info(`Overwriting existing project directory`);\n fs.rmSync(root, {\n recursive: true,\n force: true\n });\n fs.mkdirSync(root, {\n recursive: true\n });\n } else {\n consola.info(`Reusing existing project directory`);\n }\n } else {\n consola.info(`Creating project directory`);\n fs.mkdirSync(root, {\n recursive: true\n });\n }\n consola.info(`Copying files into project directory`);\n if (template.files[sdkVersion] == null) {\n throw new Error(`The ${template.label} template does not support a \"${sdkVersion}\" SDK version.`);\n }\n const files = await template.files[sdkVersion]();\n for (const [filePath, contents] of files) {\n const finalPath = path.join(root, filePath);\n const dirPath = path.dirname(finalPath);\n await fs.promises.mkdir(dirPath, {\n recursive: true\n });\n await fs.promises.writeFile(finalPath, Buffer.from(contents.body, contents.type === \"raw\" ? \"utf-8\" : \"base64\"));\n }\n const templateContext = {\n project,\n osdkPackage\n };\n const processFiles = function (dir) {\n fs.readdirSync(dir).forEach(file => {\n file = dir + \"/\" + file;\n const stat = fs.statSync(file);\n if (stat.isDirectory()) {\n processFiles(file);\n return;\n }\n if (file.endsWith(\"/_gitignore\")) {\n fs.renameSync(file, file.replace(/\\/_gitignore$/u, \"/.gitignore\"));\n return;\n }\n if (!file.endsWith(\".hbs\")) {\n return;\n }\n const templated = Handlebars.compile(fs.readFileSync(file, \"utf-8\"))(templateContext);\n fs.writeFileSync(file.replace(/.hbs$/u, \"\"), templated);\n fs.rmSync(file);\n });\n };\n processFiles(root);\n if (template.requiresOsdk) {\n if (osdkPackage == null || osdkRegistryUrl == null) {\n throw new Error(`Template ${template.id} requires OSDK package and registry URL`);\n }\n const npmRc = generateNpmRc({\n osdkPackage,\n osdkRegistryUrl,\n foundryUrl\n });\n fs.writeFileSync(path.join(root, \".npmrc\"), npmRc);\n }\n const foundryConfigJson = generateFoundryConfigJson({\n foundryUrl,\n widgetSet,\n repository,\n directory: template.buildDirectory\n });\n fs.writeFileSync(path.join(root, \"foundry.config.json\"), foundryConfigJson);\n consola.success(\"Success\");\n const cdRelative = path.relative(cwd, root);\n consola.box({\n message: `Done! Run the following commands to get started:\\n` + `\\n` + ` \\`cd ${cdRelative}\\`\\n` + ` \\`export FOUNDRY_TOKEN=<token>\\`\\n` + ` \\`npm install\\`\\n` + ` \\`npm run dev\\``,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { promptFoundryUrl } from \"./prompts/promptFoundryUrl.js\";\nimport { promptOsdkPackage } from \"./prompts/promptOsdkPackage.js\";\nimport { promptOsdkRegistryUrl } from \"./prompts/promptOsdkRegistryUrl.js\";\nimport { promptOverwrite } from \"./prompts/promptOverwrite.js\";\nimport { promptProject } from \"./prompts/promptProject.js\";\nimport { promptSdkVersion } from \"./prompts/promptSdkVersion.js\";\nimport { promptTemplate } from \"./prompts/promptTemplate.js\";\nimport { promptWidgetSetRid } from \"./prompts/promptWidgetSetRid.js\";\nimport { run } from \"./run.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command(\"$0 [project] [--<option>]\", \"Create a new OSDK widget set based on framework templates. Information may be provided through options to skip interactive prompts.\", yargs => yargs.positional(\"project\", {\n type: \"string\",\n describe: \"Project name to create\"\n }).option(\"overwrite\", {\n type: \"boolean\",\n describe: \"Overwrite project directory if already exists\"\n }).option(\"template\", {\n type: \"string\",\n describe: \"Template name to use\"\n }).option(\"sdkVersion\", {\n type: \"string\",\n describe: \"The OSDK version to use\"\n }).option(\"foundryUrl\", {\n type: \"string\",\n describe: \"URL for the Foundry stack\"\n }).option(\"widgetSet\", {\n type: \"string\",\n describe: \"Widget set resource identifier (rid)\"\n }).option(\"repository\", {\n type: \"string\",\n describe: \"Repository resource identifier (rid)\"\n }).option(\"osdkPackage\", {\n type: \"string\",\n describe: \"OSDK package name for application\"\n }).option(\"osdkRegistryUrl\", {\n type: \"string\",\n describe: \"URL for NPM registry to install OSDK package\"\n }));\n const parsed = base.parseSync();\n const project = await promptProject(parsed);\n const overwrite = await promptOverwrite({\n ...parsed,\n project\n });\n const template = await promptTemplate(parsed);\n const sdkVersion = await promptSdkVersion({\n ...parsed,\n template\n });\n const foundryUrl = await promptFoundryUrl(parsed);\n const repository = parsed.repository;\n const osdkPackage = template.requiresOsdk ? await promptOsdkPackage(parsed) : undefined;\n const osdkRegistryUrl = template.requiresOsdk ? await promptOsdkRegistryUrl(parsed) : undefined;\n const widgetSet = await promptWidgetSetRid(parsed);\n await run({\n project,\n overwrite,\n template,\n sdkVersion,\n foundryUrl,\n widgetSet,\n repository,\n osdkPackage,\n osdkRegistryUrl\n });\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/consola.ts","../../src/highlight.ts","../../src/prompts/promptFoundryUrl.ts","../../src/prompts/promptOsdkPackage.ts","../../src/prompts/promptOsdkRegistryUrl.ts","../../src/prompts/promptOverwrite.ts","../../src/prompts/promptProject.ts","../../src/prompts/promptSdkVersion.ts","../../src/getPackageFiles.ts","../../src/generatedNoCheck/templates.ts","../../src/prompts/promptTemplate.ts","../../src/prompts/promptUseOsdk.ts","../../src/prompts/promptWidgetSetRid.ts","../../src/generate/generateFoundryConfigJson.ts","../../src/generate/generateNpmRc.ts","../../src/run.ts","../../src/cli.ts"],"names":["defaultConsola","fs","path","sdkVersion","template","yargs"],"mappings":";;;;;;;;;AAmBA,IAAM,YAAA,GAAe,MAAA,CAAO,GAAA,CAAI,QAAQ,CAAA;AACjC,IAAM,UAAU,aAAA,CAAc;AAAA,EACnC,MAAM,MAAA,CAAO,OAAA,EAAS,IAAA,EAAM;AAC1B,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M,aAAa,MAAA,CAAO,UAAA;AAC1B,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc;AAAA,IAClC,GAAG,MAAA;AAAA,IACH;AAAA,GACD,CAAA;AACD,EAAA,MAAM,WAAA,GAAc,OAAA,GAAU,MAAM,iBAAA,CAAkB,MAAM,CAAA,GAAI,MAAA;AAChE,EAAA,MAAM,eAAA,GAAkB,OAAA,GAAU,MAAM,qBAAA,CAAsB,MAAM,CAAA,GAAI,MAAA;AACxE,EAAA,MAAM,SAAA,GAAY,MAAM,kBAAA,CAAmB,MAAM,CAAA;AACjD,EAAA,MAAM,GAAA,CAAI;AAAA,IACR,OAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH","file":"index.js","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola as defaultConsola, createConsola } from \"consola\";\n\n// https://github.com/unjs/consola?tab=readme-ov-file#await-promptmessage--type-cancel-\nconst cancelSymbol = Symbol.for(\"cancel\");\nexport const consola = createConsola({\n async prompt(message, opts) {\n const response = await defaultConsola.prompt(message, {\n ...opts,\n cancel: opts?.cancel ?? \"symbol\"\n });\n if (response === cancelSymbol) {\n defaultConsola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n return response;\n }\n});","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { colorize } from \"consola/utils\";\nexport function green(text) {\n return colorize(\"green\", text);\n}\nexport function italic(text) {\n return colorize(\"italic\", text);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptFoundryUrl({\n foundryUrl\n}) {\n while (foundryUrl == null || !foundryUrl.startsWith(\"https://\")) {\n if (foundryUrl != null) {\n consola.fail(\"Please enter a valid Foundry URL\");\n }\n foundryUrl = await consola.prompt(`Enter the URL for your Foundry stack:\\n${italic(\"(Example: https://example.palantirfoundry.com)\")}`, {\n type: \"text\"\n });\n }\n return foundryUrl.replace(/\\/$/u, \"\");\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkPackage({\n osdkPackage\n}) {\n while (osdkPackage == null || !/^@[a-z0-9-]+\\/sdk$/u.test(osdkPackage)) {\n if (osdkPackage != null) {\n consola.fail(\"Please enter a valid OSDK package name\");\n }\n osdkPackage = await consola.prompt(`Enter the OSDK package name for your widget set:\\n${italic(\"(Example: @my-widget/sdk)\")}`, {\n type: \"text\"\n });\n }\n return osdkPackage;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkRegistryUrl({\n osdkRegistryUrl\n}) {\n while (osdkRegistryUrl == null || !/^https:\\/\\/[^/]+\\/artifacts\\/api\\/repositories\\/ri\\.[^/]+\\/contents\\/release\\/npm\\/?$/u.test(osdkRegistryUrl)) {\n if (osdkRegistryUrl != null) {\n consola.fail(\"Please enter a valid NPM registry URL to install your OSDK package\");\n }\n osdkRegistryUrl = await consola.prompt(`Enter the NPM registry URL to install your OSDK package:\\n${italic(\"(Example: https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.a4a7fe1c-486f-4226-b706-7b90005f527d/contents/release/npm)\")}`, {\n type: \"text\"\n });\n }\n return osdkRegistryUrl.replace(/\\/$/u, \"\");\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { consola } from \"../consola.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptOverwrite({\n project,\n overwrite\n}) {\n if (overwrite != null) {\n return overwrite;\n }\n if (!fs.existsSync(path.join(process.cwd(), project))) {\n return true;\n }\n const result = await consola.prompt(`The directory ${green(project)} already exists do you want to overwrite or ignore it?`, {\n type: \"select\",\n options: [{\n label: \"Remove existing files and continue\",\n value: \"overwrite\"\n }, {\n label: \"Ignore files and continue\",\n value: \"ignore\"\n }, {\n label: \"Cancel\",\n value: \"cancel\"\n }]\n });\n switch (result) {\n case \"overwrite\":\n return true;\n case \"ignore\":\n return false;\n case \"cancel\":\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptProject({\n project\n}) {\n while (project == null || !/^[a-zA-Z0-9-_]+$/u.test(project)) {\n if (project != null) {\n consola.fail(\"Project name can only contain alphanumeric characters, hyphens and underscores\");\n }\n project = await consola.prompt(\"Project name:\", {\n type: \"text\",\n placeholder: \"my-osdk-widget\",\n default: \"my-osdk-widget\"\n });\n }\n return project;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptSdkVersion({\n sdkVersion,\n template\n}) {\n if (sdkVersion == null) {\n // If the SDK version is not provided, default to the earliest template version for backwards-compatibility\n return Object.keys(template.files)[0];\n }\n if (template.files[sdkVersion] == null) {\n consola.fail(`The ${template.label} template does not support a \"${sdkVersion}\" SDK version.`);\n sdkVersion = await consola.prompt(`Please choose which version of the OSDK you'd like to use for the ${template.label} template:`, {\n type: \"select\",\n options: Object.keys(template.files).reverse().map(sdkVersion => ({\n label: sdkVersion,\n value: sdkVersion\n }))\n });\n }\n return sdkVersion;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const getPackageFiles = importPromise => async () => (await importPromise).files;","// THIS FILE IS GENERATED. DO NOT MODIFY.\n// You probably want to modify ../../../codegen.mjs instead.\n\nimport { getPackageFiles } from \"../getPackageFiles.js\";\nexport const TEMPLATES = [\n// OSDK React\n{\n id: \"template-widget-react\",\n label: \"OSDK React\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n supportsOsdk: true,\n files: {\n \"2.x\": getPackageFiles(import(\"@osdk/create-widget.template.react.v2\"))\n }\n},\n// Minimal React\n{\n id: \"template-widget-minimal-react\",\n label: \"Minimal React\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n supportsOsdk: false,\n files: {\n \"2.x\": getPackageFiles(import(\"@osdk/create-widget.template.minimal-react.v2\"))\n }\n}];","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { TEMPLATES } from \"../generatedNoCheck/templates.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptTemplate(parsed) {\n const useBeta = parsed.beta ?? false;\n let template = TEMPLATES.find(t => t.id === parsed.template || t.id === `template-${parsed.template}`);\n if (template == null) {\n const availableTemplates = TEMPLATES.filter(template => !template.hidden && (useBeta ? template.isBeta === true :\n // isBeta could be null\n !template.isBeta));\n if (availableTemplates.length === 0) {\n throw new Error(\"No available templates found for the selected options.\");\n }\n const templateId = await consola.prompt(parsed.template != null ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : \"Select a framework:\", {\n type: \"select\",\n options: availableTemplates.map(template => ({\n value: template.id,\n label: template.label\n }))\n });\n template = TEMPLATES.find(t => t.id === templateId);\n if (template == null) {\n throw new Error(`Template ${templateId} should be found`);\n }\n }\n return template;\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptUseOsdk({\n template,\n osdkPackage,\n osdkRegistryUrl,\n skipOsdk\n}) {\n if (!template.supportsOsdk) {\n return false;\n }\n if (skipOsdk) {\n return false;\n }\n if (osdkPackage != null || osdkRegistryUrl != null) {\n return true;\n }\n const answer = await consola.prompt(\"Will you be using an OSDK in your widget set?\", {\n type: \"select\",\n options: [{\n label: \"Yes, I will be using an OSDK\",\n value: \"yes\"\n }, {\n label: \"No (can be added later)\",\n value: \"no\"\n }]\n });\n return answer === \"yes\";\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptWidgetSetRid({\n widgetSet\n}) {\n while (widgetSet == null || !/^ri\\.widgetregistry\\.\\.widget-set\\.[^.]+$/u.test(widgetSet)) {\n if (widgetSet != null) {\n consola.fail(\"Please enter a valid widget resource identifier (rid)\");\n }\n widgetSet = await consola.prompt(`Enter the resource identifier (rid) for your widget set:\\n${italic(\"(Example: ri.widgetregistry..widget-set.1c66b352-4e00-40d2-995d-061c9d533ace)\")}`, {\n type: \"text\"\n });\n }\n return widgetSet;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateFoundryConfigJson({\n foundryUrl,\n widgetSet,\n repository,\n directory\n}) {\n return JSON.stringify({\n foundryUrl,\n widgetSet: {\n rid: widgetSet,\n repository,\n directory,\n autoVersion: {\n type: \"package-json\"\n }\n }\n }, null, 2) + \"\\n\";\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateNpmRc({\n foundryUrl,\n osdkPackage,\n osdkRegistryUrl\n}) {\n // pnpm requires a trailing slash in .npmrc\n // https://github.com/pnpm/pnpm/issues/5941\n const osdkRegistryUrlWithTrailingSlash = osdkRegistryUrl.endsWith(\"/\") ? osdkRegistryUrl : osdkRegistryUrl + \"/\";\n const formattedFoundryUrl = foundryUrl.replace(/^https:\\/\\//u, \"\").replace(/\\/$/u, \"\");\n const artifactsApiUrl = formattedFoundryUrl + \"/artifacts/api/\";\n const packageScope = osdkPackage.split(\"/\")[0];\n return `//${artifactsApiUrl}:_authToken=\\${FOUNDRY_TOKEN}\\n` + `${packageScope}:registry=${osdkRegistryUrlWithTrailingSlash}\\n`;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport Handlebars from \"handlebars\";\nimport { consola } from \"./consola.js\";\nimport { generateFoundryConfigJson } from \"./generate/generateFoundryConfigJson.js\";\nimport { generateNpmRc } from \"./generate/generateNpmRc.js\";\nimport { green } from \"./highlight.js\";\nexport async function run({\n project,\n overwrite,\n template,\n sdkVersion,\n foundryUrl,\n widgetSet,\n repository,\n osdkPackage,\n osdkRegistryUrl\n}) {\n consola.log(\"\");\n consola.start(`Creating project ${green(project)} using template ${green(template.id)}`);\n const cwd = process.cwd();\n const root = path.join(cwd, project);\n if (fs.existsSync(root)) {\n if (overwrite) {\n consola.info(`Overwriting existing project directory`);\n fs.rmSync(root, {\n recursive: true,\n force: true\n });\n fs.mkdirSync(root, {\n recursive: true\n });\n } else {\n consola.info(`Reusing existing project directory`);\n }\n } else {\n consola.info(`Creating project directory`);\n fs.mkdirSync(root, {\n recursive: true\n });\n }\n consola.info(`Copying files into project directory`);\n if (template.files[sdkVersion] == null) {\n throw new Error(`The ${template.label} template does not support a \"${sdkVersion}\" SDK version.`);\n }\n const files = await template.files[sdkVersion]();\n for (const [filePath, contents] of files) {\n const finalPath = path.join(root, filePath);\n const dirPath = path.dirname(finalPath);\n await fs.promises.mkdir(dirPath, {\n recursive: true\n });\n await fs.promises.writeFile(finalPath, Buffer.from(contents.body, contents.type === \"raw\" ? \"utf-8\" : \"base64\"));\n }\n const templateContext = {\n project,\n osdkPackage\n };\n const processFiles = function (dir) {\n fs.readdirSync(dir).forEach(file => {\n let fullPath = dir + \"/\" + file;\n const stat = fs.statSync(fullPath);\n if (stat.isDirectory()) {\n processFiles(fullPath);\n return;\n }\n if (fullPath.endsWith(\"/_gitignore\")) {\n fs.renameSync(fullPath, fullPath.replace(/\\/_gitignore$/u, \"/.gitignore\"));\n return;\n }\n\n // Files with the `.osdk` extension are only kept if the application uses an OSDK\n if (file.includes(\".osdk\")) {\n if (osdkPackage == null) {\n fs.rmSync(fullPath);\n return;\n } else {\n const renamed = dir + \"/\" + file.replace(\".osdk\", \"\");\n fs.renameSync(fullPath, renamed);\n fullPath = renamed;\n }\n // Files with the `.no-osdk` extension are only kept if the application does not use an OSDK\n } else if (file.includes(\".no-osdk\")) {\n if (osdkPackage == null) {\n const renamed = dir + \"/\" + file.replace(\".no-osdk\", \"\");\n fs.renameSync(fullPath, renamed);\n fullPath = renamed;\n } else {\n fs.rmSync(fullPath);\n return;\n }\n }\n if (!fullPath.endsWith(\".hbs\")) {\n return;\n }\n const templated = Handlebars.compile(fs.readFileSync(fullPath, \"utf-8\"))(templateContext);\n fs.writeFileSync(fullPath.replace(/.hbs$/u, \"\"), templated);\n fs.rmSync(fullPath);\n });\n };\n processFiles(root);\n const useOsdk = osdkPackage != null || osdkRegistryUrl != null;\n if (useOsdk) {\n if (osdkPackage == null || osdkRegistryUrl == null) {\n throw new Error(`Template ${template.id} requires OSDK package and registry URL`);\n }\n const npmRc = generateNpmRc({\n osdkPackage,\n osdkRegistryUrl,\n foundryUrl\n });\n fs.writeFileSync(path.join(root, \".npmrc\"), npmRc);\n }\n const foundryConfigJson = generateFoundryConfigJson({\n foundryUrl,\n widgetSet,\n repository,\n directory: template.buildDirectory\n });\n fs.writeFileSync(path.join(root, \"foundry.config.json\"), foundryConfigJson);\n consola.success(\"Success\");\n const cdRelative = path.relative(cwd, root);\n consola.box({\n message: `Done! Run the following commands to get started:\\n` + `\\n` + ` \\`cd ${cdRelative}\\`\\n` + ` \\`export FOUNDRY_TOKEN=<token>\\`\\n` + ` \\`npm install\\`\\n` + ` \\`npm run dev\\``,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { promptFoundryUrl } from \"./prompts/promptFoundryUrl.js\";\nimport { promptOsdkPackage } from \"./prompts/promptOsdkPackage.js\";\nimport { promptOsdkRegistryUrl } from \"./prompts/promptOsdkRegistryUrl.js\";\nimport { promptOverwrite } from \"./prompts/promptOverwrite.js\";\nimport { promptProject } from \"./prompts/promptProject.js\";\nimport { promptSdkVersion } from \"./prompts/promptSdkVersion.js\";\nimport { promptTemplate } from \"./prompts/promptTemplate.js\";\nimport { promptUseOsdk } from \"./prompts/promptUseOsdk.js\";\nimport { promptWidgetSetRid } from \"./prompts/promptWidgetSetRid.js\";\nimport { run } from \"./run.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command(\"$0 [project] [--<option>]\", \"Create a new OSDK widget set based on framework templates. Information may be provided through options to skip interactive prompts.\", yargs => yargs.positional(\"project\", {\n type: \"string\",\n describe: \"Project name to create\"\n }).option(\"overwrite\", {\n type: \"boolean\",\n describe: \"Overwrite project directory if already exists\"\n }).option(\"template\", {\n type: \"string\",\n describe: \"Template name to use\"\n }).option(\"sdkVersion\", {\n type: \"string\",\n describe: \"The OSDK version to use\"\n }).option(\"foundryUrl\", {\n type: \"string\",\n describe: \"URL for the Foundry stack\"\n }).option(\"widgetSet\", {\n type: \"string\",\n describe: \"Widget set resource identifier (rid)\"\n }).option(\"repository\", {\n type: \"string\",\n describe: \"Repository resource identifier (rid)\"\n }).option(\"osdkPackage\", {\n type: \"string\",\n describe: \"OSDK package name for application\",\n conflicts: \"skipOsdk\"\n }).option(\"osdkRegistryUrl\", {\n type: \"string\",\n describe: \"URL for NPM registry to install OSDK package\",\n conflicts: \"skipOsdk\"\n }).option(\"skipOsdk\", {\n type: \"boolean\",\n describe: \"Skip filling in OSDK options\"\n }));\n const parsed = base.parseSync();\n const project = await promptProject(parsed);\n const overwrite = await promptOverwrite({\n ...parsed,\n project\n });\n const template = await promptTemplate(parsed);\n const sdkVersion = await promptSdkVersion({\n ...parsed,\n template\n });\n const foundryUrl = await promptFoundryUrl(parsed);\n const repository = parsed.repository;\n const useOsdk = await promptUseOsdk({\n ...parsed,\n template\n });\n const osdkPackage = useOsdk ? await promptOsdkPackage(parsed) : undefined;\n const osdkRegistryUrl = useOsdk ? await promptOsdkRegistryUrl(parsed) : undefined;\n const widgetSet = await promptWidgetSetRid(parsed);\n await run({\n project,\n overwrite,\n template,\n sdkVersion,\n foundryUrl,\n widgetSet,\n repository,\n osdkPackage,\n osdkRegistryUrl\n });\n}"]}
|
package/build/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"AA6CA,OAAO,iBAAe,IAAIA,kBAAgC","names":["args: string[]"],"sources":["../../src/cli.ts"],"version":3,"file":"cli.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAiBA,cAAc,gBAAgB,iBAAkB;AAEhD,OAAO,iBAAe,cAAc,EAClC,UACA,aACA,iBACA,UAMD,EALE;CACD,UAAU;CACV;CACA;CACA;AACD,IAAG","names":[],"sources":["../../../src/prompts/promptUseOsdk.ts"],"version":3,"file":"promptUseOsdk.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/create-widget",
|
|
3
|
-
"version": "3.55.
|
|
3
|
+
"version": "3.55.1-main-8718d53b7732f75b01252c7e08f65fb27c45e9aa",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"find-up": "7.0.0",
|
|
30
30
|
"handlebars": "4.7.8",
|
|
31
31
|
"yargs": "17.7.2",
|
|
32
|
-
"@osdk/generator-utils": "2.57.
|
|
32
|
+
"@osdk/generator-utils": "2.57.1-main-8718d53b7732f75b01252c7e08f65fb27c45e9aa"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^18.19.124",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"redent": "^4.0.0",
|
|
40
40
|
"tmp": "^0.2.5",
|
|
41
41
|
"typescript": "~5.5.4",
|
|
42
|
-
"@osdk/create-widget.template.react.v2": "3.55.
|
|
43
|
-
"@osdk/create-widget.template.
|
|
42
|
+
"@osdk/create-widget.template.minimal-react.v2": "3.55.1-main-8718d53b7732f75b01252c7e08f65fb27c45e9aa",
|
|
43
|
+
"@osdk/create-widget.template.react.v2": "3.55.1-main-8718d53b7732f75b01252c7e08f65fb27c45e9aa",
|
|
44
44
|
"@osdk/monorepo.api-extractor": "~0.7.0",
|
|
45
45
|
"@osdk/monorepo.tool.check-bundle": "~0.1.0",
|
|
46
46
|
"@osdk/monorepo.tsconfig": "~0.7.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../create-widget.template.react.v2/build/esm/generatedNoCheck/index.js"],"names":[],"mappings":";AAAO,IAAM,KAAA,mBAAQ,IAAI,GAAA,CAAI,CAAC,CAAC,eAAA,EAAiB;AAAA,EAC9C,IAAA,EAAM,KAAA;AAAA,EACN,IAAA,EAAM,CAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCR,CAAC,CAAA,EAAG,CAAC,cAAA,EAAgB;AAAA,EACnB,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ;AACV,CAAC,CAAA,EAAG,CAAC,cAAA,EAAgB;AAAA,EACnB,IAAA,EAAM,KAAA;AAAA,EACN,IAAA,EAAM,CAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBR,CAAC,CAAA,EAAG,CAAC,qBAAA,EAAuB;AAAA,EAC1B,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ;AACV,CAAC,CAAA,EAAG,CAAC,mBAAA,EAAqB;AAAA,EACxB,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ;AACV,CAAC,CAAA,EAAG,CAAC,eAAA,EAAiB;AAAA,EACpB,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ;AACV,CAAC,CAAA,EAAG,CAAC,oBAAA,EAAsB;AAAA,EACzB,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ;AACV,CAAC,CAAA,EAAG,CAAC,oBAAA,EAAsB;AAAA,EACzB,IAAA,EAAM,KAAA;AAAA,EACN,IAAA,EAAM,CAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBR,CAAC,CAAC,CAAC","file":"esm-5KIZJMMW.js","sourcesContent":["export const files = new Map([[\"README.md.hbs\", {\n type: \"raw\",\n body: `# {{project}}\n\nThis project was generated with [\\`@osdk/create-widget\\`](https://www.npmjs.com/package/@osdk/create-widget) and demonstrates developing custom widgets to be embedded within Foundry UIs such as Workshop. It uses the Ontology SDK package \\`{{osdkPackage}}\\` with React on top of Vite. Check out the [Vite](https://vitejs.dev/guide/) docs for further configuration. The Vite plugin [\\`@osdk/widget.vite-plugin\\`](https://www.npmjs.com/package/@osdk/widget.vite-plugin) automatically generates a \\`widgets.config.json\\` manifest file containing metadata about widgets inside this project during the build command.\n\n## Developing\n\nRun the following commands (or equivalent with your preferred package manager) to start a local development server and follow the instructions printed to set up developer mode in Foundry:\n\n\\`\\`\\`sh\nexport FOUNDRY_TOKEN=<token>\nnpm run dev\n\\`\\`\\`\n\n> **Note:** A widget no longer needs to be published before you can develop on it. Publishing a widget once (see [Deploying](#deploying)) is still required to use it in Workshop so that it becomes selectable in the **Widget setup** panel.\n\n## Deploying\n\nA \\`foundry.config.json\\` file is included in the root of this project containing the deployment configuration to Foundry.\n\nRun the following commands (or equivalent with your preferred package manager) to create a production build of your widgets:\n\n\\`\\`\\`sh\nexport FOUNDRY_TOKEN=<token>\nnpm run build\n\\`\\`\\`\n\nA \\`.palantir/widgets.config.json\\` manifest file containing metadata about your widgets is created during the build.\n\nRun the following command (or equivalent with your preferred package manager) to deploy the production build of your widgets:\n\n\\`\\`\\`sh\nnpx @osdk/cli@latest widgetset deploy\n\\`\\`\\`\n\nBy default the \\`package-json\\` strategy is used for determining the version for your widgets from the \\`version\\` field in this project's \\`package.json\\` file. Remember to update this field and rerun the build command to update the manifest file when deploying a new version.\n\nIf you prefer to infer the version from a git tag, you can use the \\`git-describe\\` strategy by setting the \\`autoVersion\\` field in the \\`foundry.config.json\\` file to:\n\n\\`\\`\\`json\n{\n \"type\": \"git-describe\",\n \"tagPrefix\": \"\"\n}\n\\`\\`\\`\n`\n}], [\".gitignore\", {\n type: \"raw\",\n body: `# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndist-ssr\n*.local\n.pnpm-store\n\n# Editor directories and files\n.vscode/*\n!.vscode/extensions.json\n.idea\n.DS_Store\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?\n`\n}], [\"eslint.config.mjs\", {\n \"type\": \"base64\",\n \"body\": \"Ly8gQHRzLWNoZWNrCmltcG9ydCBlc2xpbnQgZnJvbSAiQGVzbGludC9qcyI7CmltcG9ydCB0c1BhcnNlciBmcm9tICJAdHlwZXNjcmlwdC1lc2xpbnQvcGFyc2VyIjsKaW1wb3J0ICogYXMgaW1wb3J0UGx1Z2luIGZyb20gImVzbGludC1wbHVnaW4taW1wb3J0IjsKaW1wb3J0IGpzeEExMXlQbHVnaW4gZnJvbSAiZXNsaW50LXBsdWdpbi1qc3gtYTExeSI7CmltcG9ydCByZWFjdFBsdWdpbiBmcm9tICJlc2xpbnQtcGx1Z2luLXJlYWN0IjsKaW1wb3J0IHJlYWN0SG9va3NQbHVnaW4gZnJvbSAiZXNsaW50LXBsdWdpbi1yZWFjdC1ob29rcyI7CmltcG9ydCByZWFjdFJlZnJlc2ggZnJvbSAiZXNsaW50LXBsdWdpbi1yZWFjdC1yZWZyZXNoIjsKaW1wb3J0IGdsb2JhbHMgZnJvbSAiZ2xvYmFscyI7CmltcG9ydCB0c2VzbGludCBmcm9tICJ0eXBlc2NyaXB0LWVzbGludCI7CgpleHBvcnQgZGVmYXVsdCB0c2VzbGludC5jb25maWcoewogIGZpbGVzOiBbImVzbGludC5jb25maWcubWpzIiwgInNyYy8qKi8qLntqcyxtanMsY2pzLHRzLGpzeCx0c3h9Il0sCiAgc2V0dGluZ3M6IHsKICAgIHJlYWN0OiB7CiAgICAgIHZlcnNpb246ICJkZXRlY3QiLAogICAgfSwKCiAgICAiaW1wb3J0L3Jlc29sdmVyIjogewogICAgICBub2RlOiB7CiAgICAgICAgZXh0ZW5zaW9uczogWyIuanMiLCAiLmpzeCIsICIudHMiLCAiLnRzeCJdLAogICAgICB9LAogICAgfSwKICB9LAogIGxhbmd1YWdlT3B0aW9uczogewogICAgZ2xvYmFsczogewogICAgICAuLi5nbG9iYWxzLmJyb3dzZXIsCiAgICB9LAoKICAgIHBhcnNlcjogdHNQYXJzZXIsCiAgfSwKICBleH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GVzIjogImVycm9yIiwKICAgICJpbXBvcnQvbm8tZXh0cmFuZW91cy1kZXBlbmRlbmNpZXMiOiAiZXJyb3IiLAoKICAgICJyZWFjdC9yZWFjdC1pbi1qc3gtc2NvcGUiOiAib2ZmIiwKICB9LAp9KTsK\"\n}], [\"index.html\", {\n type: \"raw\",\n body: `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Widget: Ontology SDK + React</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`\n}], [\"package.json.hbs\", {\n type: \"raw\",\n body: `{\n \"name\": \"{{project}}\",\n \"private\": true,\n \"version\": \"0.0.0\",\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"tsc && vite build\",\n \"lint\": \"eslint . --report-unused-disable-directives --max-warnings 0\",\n \"test\": \"vitest run --passWithNoTests\",\n \"preview\": \"vite preview\"\n },\n \"dependencies\": {\n \"{{osdkPackage}}\": \"latest\",\n \"@osdk/client\": \"^2.0.0\",\n \"@osdk/react\": \"^2.0.0\",\n \"@osdk/widget.client-react\": \"^3.26.0\",\n \"@osdk/widget.client\": \"^3.26.0\",\n \"@radix-ui/react-icons\": \"^1.3.2\",\n \"@radix-ui/themes\": \"^3.2.1\",\n \"react\": \"^18\",\n \"react-dom\": \"^18\"\n },\n \"devDependencies\": {\n \"@osdk/widget.vite-plugin\": \"^3.26.0\",\n \"@eslint/compat\": \"^1.3.2\",\n \"@eslint/js\": \"^9.35.0\",\n \"@types/react\": \"^18\",\n \"@types/react-dom\": \"^18\",\n \"@typescript-eslint/eslint-plugin\": \"^8.43.0\",\n \"@typescript-eslint/parser\": \"^8.43.0\",\n \"@vitejs/plugin-react\": \"^4.7.0\",\n \"eslint\": \"^9.35.0\",\n \"eslint-plugin-import\": \"^2.32.0\",\n \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n \"eslint-plugin-react\": \"^7.37.5\",\n \"eslint-plugin-react-hooks\": \"^5.2.0\",\n \"eslint-plugin-react-refresh\": \"^0.4.20\",\n \"globals\": \"^15.15.0\",\n \"typescript\": \"~5.5.4\",\n \"typescript-eslint\": \"^8.43.0\",\n \"vite\": \"^7.3.1\",\n \"vitest\": \"^3.2.4\"\n }\n}`\n}], [\"src/Widget.tsx.hbs\", {\n type: \"raw\",\n body: `import { \\$Actions, \\$Objects, \\$Queries } from \"{{osdkPackage}}\";\nimport {\n Box,\n Button,\n Checkbox,\n Container,\n Flex,\n Heading,\n Skeleton,\n Table,\n Text,\n TextField,\n Theme,\n} from \"@radix-ui/themes\";\nimport React, { useCallback, useState } from \"react\";\nimport { useWidgetContext } from \"./context.js\";\nimport { useDarkTheme } from \"./useDarkTheme.js\";\n// import { useOsdkClient } from \"@osdk/react\";\n// View the API documentation for your widget set to learn how to use the Ontology SDK.\n\nexport const Widget: React.FC = () => {\n // See Ontology and Platform SDK docs in Developer Console on how to\n // use the client object to access Ontology resources and platform APIs\n // const client = useOsdkClient();\n\n const { parameters, emitEvent } = useWidgetContext();\n const { headerText, todoItems } = parameters.values;\n const [newTodoItem, setNewTodoItem] = useState(\"\");\n\n const handleAddTodoItem = useCallback(() => {\n emitEvent(\"updateTodoItems\", {\n parameterUpdates: {\n todoItems: [...(todoItems ?? []), newTodoItem],\n },\n });\n setNewTodoItem(\"\");\n }, [emitEvent, newTodoItem, todoItems]);\n\n const handleNewTodoItemChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setNewTodoItem(event.target.value);\n },\n []\n );\n\n const isDarkTheme = useDarkTheme();\n\n const objectApiNames = Object.keys(\\$Objects);\n const actionApiNames = Object.keys(\\$Actions);\n const queryApiNames = Object.keys(\\$Queries);\n\n return (\n <Theme appearance={isDarkTheme ? \"dark\" : \"light\"}>\n <Box p=\"2\">\n <Container size=\"1\">\n <Flex direction=\"column\" gap=\"4\">\n <Flex p=\"5\" direction=\"column\" gap=\"2\">\n <Heading size=\"4\">\n {parameters.state === \"loading\" ||\n parameters.state === \"not-started\" ? (\n <Skeleton>Hello, world!</Skeleton>\n ) : (\n headerText ?? \"{{project}}\"\n )}\n </Heading>\n\n <Table.Root>\n <Table.Header>\n <Table.Row>\n <Table.ColumnHeaderCell>Finished</Table.ColumnHeaderCell>\n <Table.ColumnHeaderCell>Item</Table.ColumnHeaderCell>\n </Table.Row>\n </Table.Header>\n\n <Table.Body>\n {(parameters.state === \"loading\" ||\n parameters.state === \"not-started\") && (\n <>\n <Table.Row>\n <Table.Cell>\n <Skeleton>\n <Checkbox />\n </Skeleton>\n </Table.Cell>\n <Table.Cell>\n <Skeleton>Loading cell</Skeleton>\n </Table.Cell>\n </Table.Row>\n <Table.Row>\n <Table.Cell>\n <Skeleton>\n <Checkbox />\n </Skeleton>\n </Table.Cell>\n <Table.Cell>\n <Skeleton>Loading cell</Skeleton>\n </Table.Cell>\n </Table.Row>\n </>\n )}\n {parameters.state === \"loaded\" &&\n todoItems?.map((item, index) => (\n <Table.Row key={index}>\n <Table.Cell>\n <Checkbox />\n </Table.Cell>\n <Table.Cell>{item}</Table.Cell>\n </Table.Row>\n ))}\n {parameters.state === \"loaded\" &&\n (todoItems ?? []).length === 0 && (\n <Table.Row>\n <Table.Cell colSpan={2}>No items yet</Table.Cell>\n </Table.Row>\n )}\n <Table.Row>\n <Table.Cell colSpan={2}>\n <Flex gap=\"2\">\n <TextField.Root\n value={newTodoItem}\n onChange={handleNewTodoItemChange}\n size=\"2\"\n placeholder=\"Add item…\"\n />\n <Button onClick={handleAddTodoItem}>Add item</Button>\n </Flex>\n </Table.Cell>\n </Table.Row>\n </Table.Body>\n </Table.Root>\n </Flex>\n <Box>\n <Flex direction=\"column\" gap=\"2\">\n <Text>\n Try any of the following methods from your Ontology SDK\n </Text>\n <Flex direction=\"column\" gap=\"1\">\n <Heading size=\"4\">Objects ({objectApiNames.length})</Heading>\n <pre>\n {objectApiNames.map((objectApiName) => (\n <div key={objectApiName}>client({objectApiName})</div>\n ))}\n </pre>\n </Flex>\n <Flex direction=\"column\" gap=\"1\">\n <Heading size=\"4\">Actions ({actionApiNames.length})</Heading>\n <pre>\n {actionApiNames.map((actionApiName) => (\n <div key={actionApiName}>client({actionApiName})</div>\n ))}\n </pre>\n </Flex>\n <Flex direction=\"column\" gap=\"1\">\n <Heading size=\"4\">Queries ({queryApiNames.length})</Heading>\n <pre>\n {queryApiNames.map((queryApiName) => (\n <div key={queryApiName}>client({queryApiName})</div>\n ))}\n </pre>\n </Flex>\n </Flex>\n </Box>\n </Flex>\n </Container>\n </Box>\n </Theme>\n );\n};\n`\n}], [\"src/client.ts.hbs\", {\n type: \"raw\",\n body: `import { \\$ontologyRid } from \"{{osdkPackage}}\";\nimport { createClient } from \"@osdk/client\";\nimport { createFoundryWidgetTokenProvider } from \"@osdk/widget.client\";\n\nexport const client = createClient(\n window.location.origin,\n \\$ontologyRid,\n createFoundryWidgetTokenProvider(),\n);\n`\n}], [\"src/context.ts\", {\n \"type\": \"base64\",\n \"body\": \"aW1wb3J0IHsgdXNlRm91bmRyeVdpZGdldENvbnRleHQgfSBmcm9tICJAb3Nkay93aWRnZXQuY2xpZW50LXJlYWN0IjsKaW1wb3J0IHR5cGUgTWFpbkNvbmZpZyBmcm9tICIuL21haW4uY29uZmlnLmpzIjsKCmV4cG9ydCBjb25zdCB1c2VXaWRnZXRDb250ZXh0ID0gdXNlRm91bmRyeVdpZGdldENvbnRleHQud2l0aFR5cGVzPAogIHR5cGVvZiBNYWluQ29uZmlnCj4oKTsK\"\n}], [\"src/main.config.ts.hbs\", {\n type: \"raw\",\n body: `import { defineConfig } from \"@osdk/widget.client\";\n\n// Updates to the widget configuration in this file require reapplying dev mode\n// to preview the changes. When developing locally, open the setup URL printed\n// in your terminal again. When developing in Code Workspaces, refresh the\n// preview panel.\n\nexport default defineConfig({\n id: \"widgetId\",\n name: \"Custom Widget\",\n description: \"An example custom widget implementation\",\n type: \"workshop\",\n parameters: {\n headerText: {\n displayName: \"Widget title\",\n type: \"string\",\n },\n todoItems: {\n displayName: \"Todo items\",\n type: \"array\",\n subType: \"string\",\n },\n },\n events: {\n updateHeader: {\n displayName: \"Update header\",\n parameterUpdateIds: [\"headerText\"],\n },\n updateTodoItems: {\n displayName: \"Update todo items\",\n parameterUpdateIds: [\"todoItems\"],\n },\n },\n});\n`\n}], [\"src/main.css\", {\n \"type\": \"base64\",\n \"body\": \"aHRtbCwgYm9keSB7CiAgICBtYXJnaW46IDA7Cn0KCi5yYWRpeC10aGVtZXM6d2hlcmUoW2RhdGEtaXMtcm9vdC10aGVtZT0ndHJ1ZSddKSB7CiAgICBtaW4taGVpZ2h0OiAwOwogICAgQHN1cHBvcnRzKG1pbi1oZWlnaHQ6IDEwMGR2aCkgewogICAgICAgIG1pbi1oZWlnaHQ6IDA7CiAgICB9Cn0K\"\n}], [\"src/main.tsx\", {\n type: \"raw\",\n body: `import \"@radix-ui/themes/styles.css\";\nimport \"./main.css\";\n\nimport { OsdkProvider } from \"@osdk/react\";\nimport { FoundryWidget } from \"@osdk/widget.client-react\";\nimport { createRoot } from \"react-dom/client\";\nimport { client } from \"./client.js\";\nimport MainConfig from \"./main.config.js\";\nimport { Widget } from \"./Widget.js\";\n\nconst root = document.getElementById(\"root\")!;\n\ncreateRoot(root).render(\n <FoundryWidget config={MainConfig} client={client}>\n <OsdkProvider client={client}>\n <Widget />\n </OsdkProvider>\n </FoundryWidget>,\n);\n`\n}], [\"src/useDarkTheme.ts\", {\n \"type\": \"base64\",\n \"body\": \"aW1wb3J0IHsgdXNlRWZmZWN0LCB1c2VTdGF0ZSB9IGZyb20gInJlYWN0IjsKCmV4cG9ydCBjb25zdCB1c2VEYXJrVGhlbWUgPSAoKSA9PiB1c2VNZWRpYVF1ZXJ5KCIocHJlZmVycy1jb2xvci1zY2hlbWU6IGRhcmspIik7Cgpjb25zdCB1c2VNZWRpYVF1ZXJ5ID0gKHF1ZXJ5OiBzdHJpbmcpID0+IHsKICBjb25zdCBbbWF0Y2hlcywgc2V0TWF0Y2hlc10gPSB1c2VTdGF0ZShmYWxzZSk7CgogIGNvbnN0IGhhbmRsZUNoYW5nZSA9IChlOiBNZWRpYVF1ZXJ5TGlzdEV2ZW50KSA9PiBzZXRNYXRjaGVzKGUubWF0Y2hlcyk7CgogIHVzZUVmZmVjdCgoKSA9PiB7CiAgICBjb25zdCBtID0gd2luZG93Lm1hdGNoTWVkaWEocXVlcnkpOwogICAgc2V0TWF0Y2hlcyhtLm1hdGNoZXMpOwogICAgbS5hZGRFdmVudExpc3RlbmVyKCJjaGFuZ2UiLCBoYW5kbGVDaGFuZ2UpOwogICAgcmV0dXJuICgpID0+IHsKICAgICAgbS5yZW1vdmVFdmVudExpc3RlbmVyKCJjaGFuZ2UiLCBoYW5kbGVDaGFuZ2UpOwogICAgfTsKICB9LCBbcXVlcnldKTsKCiAgcmV0dXJuIG1hdGNoZXM7Cn07Cg==\"\n}], [\"src/vite-env.d.ts\", {\n \"type\": \"base64\",\n \"body\": \"Ly8vIDxyZWZlcmVuY2UgdHlwZXM9InZpdGUvY2xpZW50IiAvPgo=\"\n}], [\"tsconfig.json\", {\n \"type\": \"base64\",\n \"body\": \"ewogICJjb21waWxlck9wdGlvbnMiOiB7CiAgICAidGFyZ2V0IjogIkVTMjAyMCIsCiAgICAidXNlRGVmaW5lRm9yQ2xhc3NGaWVsZHMiOiB0cnVlLAogICAgImxpYiI6IFsiRVMyMDIwIiwgIkRPTSIsICJET00uSXRlcmFibGUiXSwKICAgICJtb2R1bGUiOiAiRVNOZXh0IiwKICAgICJza2lwTGliQ2hlY2siOiB0cnVlLAoKICAgIC8qIEJ1bmRsZXIgbW9kZSAqLwogICAgIm1vZHVsZVJlc29sdXRpb24iOiAiYnVuZGxlciIsCiAgICAiYWxsb3dJbXBvcnRpbmdUc0V4dGVuc2lvbnMiOiB0cnVlLAogICAgInJlc29sdmVKc29uTW9kdWxlIjogdHJ1ZSwKICAgICJpc29sYXRlZE1vZHVsZXMiOiB0cnVlLAogICAgIm5vRW1pdCI6IHRydWUsCiAgICAianN4IjogInJlYWN0LWpzeCIsCgogICAgLyogTGludGluZyAqLwogICAgInN0cmljdCI6IHRydWUsCiAgICAibm9VbnVzZWRMb2NhbHMiOiB0cnVlLAogICAgIm5vVW51c2VkUGFyYW1ldGVycyI6IHRydWUsCiAgICAibm9GYWxsdGhyb3VnaENhc2VzSW5Td2l0Y2giOiB0cnVlCiAgfSwKICAiaW5jbHVkZSI6IFsic3JjIl0sCiAgInJlZmVyZW5jZXMiOiBbeyAicGF0aCI6ICIuL3RzY29uZmlnLm5vZGUuanNvbiIgfV0KfQo=\"\n}], [\"tsconfig.node.json\", {\n \"type\": \"base64\",\n \"body\": \"ewogICJjb21waWxlck9wdGlvbnMiOiB7CiAgICAiY29tcG9zaXRlIjogdHJ1ZSwKICAgICJza2lwTGliQ2hlY2siOiB0cnVlLAogICAgIm1vZHVsZSI6ICJFU05leHQiLAogICAgIm1vZHVsZVJlc29sdXRpb24iOiAiYnVuZGxlciIsCiAgICAiYWxsb3dTeW50aGV0aWNEZWZhdWx0SW1wb3J0cyI6IHRydWUKICB9LAogICJpbmNsdWRlIjogWyJ2aXRlLmNvbmZpZy50cyJdCn0K\"\n}], [\"vite.config.ts.hbs\", {\n type: \"raw\",\n body: `import foundryWidgetPlugin from \"@osdk/widget.vite-plugin\";\nimport react from \"@vitejs/plugin-react\";\nimport { defineConfig } from \"vite\";\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [react(), foundryWidgetPlugin()],\n server: {\n port: 8080,\n cors: true,\n },\n build: {\n rollupOptions: {\n input: [\"./index.html\"],\n },\n },\n});\n`\n}]]);"]}
|