@osdk/create-app 0.16.0 → 0.16.2

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/build/js/index.browser.mjs +1 -1
  3. package/build/js/index.cjs +1 -1
  4. package/build/js/index.mjs +1 -1
  5. package/package.json +1 -1
  6. package/templates/template-next-static-export/src/app/globals.css +7 -1
  7. package/templates/template-next-static-export/src/app/layout.tsx +27 -25
  8. package/templates/template-react/index.html +3 -1
  9. package/templates/template-react/package.json.hbs +1 -1
  10. package/templates/template-react/src/index.css +7 -1
  11. package/templates/template-react/src/main.tsx +24 -21
  12. package/templates/template-tutorial-todo-app/index.html +3 -1
  13. package/templates/template-tutorial-todo-app/package.json.hbs +1 -1
  14. package/templates/template-tutorial-todo-app/src/CreateProjectDialog.tsx +2 -2
  15. package/templates/template-tutorial-todo-app/src/CreateTaskDialog.tsx +2 -2
  16. package/templates/template-tutorial-todo-app/src/DeleteProjectDialog.tsx +2 -2
  17. package/templates/template-tutorial-todo-app/src/ProjectSelect.tsx +1 -1
  18. package/templates/template-tutorial-todo-app/src/index.css +7 -0
  19. package/templates/template-tutorial-todo-app/src/main.tsx +24 -21
  20. package/templates/template-tutorial-todo-app/src/mocks.ts +21 -21
  21. package/templates/template-tutorial-todo-app/src/useProjectTasks.ts +3 -3
  22. package/templates/template-tutorial-todo-app/src/useProjects.ts +2 -2
  23. package/templates/template-vue/index.html +3 -1
  24. package/templates/template-vue/src/Home.vue.hbs +3 -9
  25. package/templates/template-vue/src/main.ts +1 -1
  26. package/templates/template-vue/src/style.css +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @osdk/create-app
2
2
 
3
+ ## 0.16.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 524f1fe: Update global layout styles
8
+ - 524f1fe: Remove platform specific commands in template scripts
9
+ - 524f1fe: React/Vue router respects vite base path
10
+
11
+ ## 0.16.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 1ee2d4f: Fix runtime warnings on AipNow template
16
+ - 843f932: update the mock objects to the new TypeScript 1.1.1 syntax version
17
+
3
18
  ## 0.16.0
4
19
 
5
20
  ### Minor Changes
@@ -451,7 +451,7 @@ async function run({
451
451
 
452
452
  // src/cli.ts
453
453
  async function cli(args = process.argv) {
454
- const base = yargs(hideBin(args)).version("0.16.0").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
454
+ const base = yargs(hideBin(args)).version("0.16.2").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
455
455
  type: "string",
456
456
  describe: "Project name to create"
457
457
  }).option("overwrite", {
@@ -461,7 +461,7 @@ async function run({
461
461
 
462
462
  // src/cli.ts
463
463
  async function cli(args = process.argv) {
464
- const base = yargs__default.default(helpers.hideBin(args)).version("0.16.0").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
464
+ const base = yargs__default.default(helpers.hideBin(args)).version("0.16.2").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
465
465
  type: "string",
466
466
  describe: "Project name to create"
467
467
  }).option("overwrite", {
@@ -451,7 +451,7 @@ async function run({
451
451
 
452
452
  // src/cli.ts
453
453
  async function cli(args = process.argv) {
454
- const base = yargs(hideBin(args)).version("0.16.0").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
454
+ const base = yargs(hideBin(args)).version("0.16.2").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
455
455
  type: "string",
456
456
  describe: "Project name to create"
457
457
  }).option("overwrite", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/create-app",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -13,6 +13,12 @@
13
13
  -moz-osx-font-smoothing: grayscale;
14
14
  }
15
15
 
16
+ #root-container {
17
+ display: flex;
18
+ flex: 1;
19
+ align-items: center;
20
+ }
21
+
16
22
  #root {
17
23
  max-width: 1280px;
18
24
  margin: 0 auto;
@@ -32,7 +38,7 @@ a:hover {
32
38
  body {
33
39
  margin: 0;
34
40
  display: flex;
35
- place-items: center;
41
+ flex-direction: column;
36
42
  min-width: 320px;
37
43
  min-height: 100vh;
38
44
  }
@@ -15,31 +15,33 @@ function RootLayout({ children }: { children: React.ReactNode }) {
15
15
  return (
16
16
  <html lang="en">
17
17
  <body className={inter.className}>
18
- <div id="root">
19
- <a
20
- href="https://www.palantir.com/docs/foundry/ontology-sdk/overview/"
21
- target="_blank"
22
- >
23
- <Image
24
- src="/palantir.svg"
25
- alt="Palantir logo"
26
- className={css.logo}
27
- width={16}
28
- height={16}
29
- priority
30
- />
31
- </a>
32
- <a href="https://nextjs.org/" target="_blank">
33
- <Image
34
- src="/next.svg"
35
- alt="Next logo"
36
- className={css.logo}
37
- width={16}
38
- height={16}
39
- priority
40
- />
41
- </a>
42
- {children}
18
+ <div id="root-container">
19
+ <div id="root">
20
+ <a
21
+ href="https://www.palantir.com/docs/foundry/ontology-sdk/overview/"
22
+ target="_blank"
23
+ >
24
+ <Image
25
+ src="/palantir.svg"
26
+ alt="Palantir logo"
27
+ className={css.logo}
28
+ width={16}
29
+ height={16}
30
+ priority
31
+ />
32
+ </a>
33
+ <a href="https://nextjs.org/" target="_blank">
34
+ <Image
35
+ src="/next.svg"
36
+ alt="Next logo"
37
+ className={css.logo}
38
+ width={16}
39
+ height={16}
40
+ priority
41
+ />
42
+ </a>
43
+ {children}
44
+ </div>
43
45
  </div>
44
46
  </body>
45
47
  </html>
@@ -7,7 +7,9 @@
7
7
  <title>Ontology SDK + React</title>
8
8
  </head>
9
9
  <body>
10
- <div id="root"></div>
10
+ <div id="root-container">
11
+ <div id="root"></div>
12
+ </div>
11
13
  <script type="module" src="/src/main.tsx"></script>
12
14
  </body>
13
15
  </html>
@@ -6,7 +6,7 @@
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "build": "tsc && vite build",
9
- "lint": "ESLINT_USE_FLAT_CONFIG=false eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
9
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
@@ -13,6 +13,12 @@
13
13
  -moz-osx-font-smoothing: grayscale;
14
14
  }
15
15
 
16
+ #root-container {
17
+ display: flex;
18
+ flex: 1;
19
+ align-items: center;
20
+ }
21
+
16
22
  #root {
17
23
  max-width: 1280px;
18
24
  margin: 0 auto;
@@ -32,7 +38,7 @@ a:hover {
32
38
  body {
33
39
  margin: 0;
34
40
  display: flex;
35
- place-items: center;
41
+ flex-direction: column;
36
42
  min-width: 320px;
37
43
  min-height: 100vh;
38
44
  }
@@ -6,27 +6,30 @@ import Home from "./Home";
6
6
  import Login from "./Login";
7
7
  import "./index.css";
8
8
 
9
- const router = createBrowserRouter([
10
- {
11
- path: "/",
12
- element: <AuthenticatedRoute />,
13
- children: [
14
- {
15
- path: "/",
16
- element: <Home />,
17
- },
18
- ],
19
- },
20
- {
21
- path: "/login",
22
- element: <Login />,
23
- },
24
- {
25
- // This is the route defined in your application's redirect URL
26
- path: "/auth/callback",
27
- element: <AuthCallback />,
28
- },
29
- ]);
9
+ const router = createBrowserRouter(
10
+ [
11
+ {
12
+ path: "/",
13
+ element: <AuthenticatedRoute />,
14
+ children: [
15
+ {
16
+ path: "/",
17
+ element: <Home />,
18
+ },
19
+ ],
20
+ },
21
+ {
22
+ path: "/login",
23
+ element: <Login />,
24
+ },
25
+ {
26
+ // This is the route defined in your application's redirect URL
27
+ path: "/auth/callback",
28
+ element: <AuthCallback />,
29
+ },
30
+ ],
31
+ { basename: import.meta.env.BASE_URL },
32
+ );
30
33
 
31
34
  ReactDOM.createRoot(document.getElementById("root")!).render(
32
35
  <RouterProvider router={router} />,
@@ -7,7 +7,9 @@
7
7
  <title>Ontology SDK Tutorial - Todo App</title>
8
8
  </head>
9
9
  <body>
10
- <div id="root"></div>
10
+ <div id="root-container">
11
+ <div id="root"></div>
12
+ </div>
11
13
  <script type="module" src="/src/main.tsx"></script>
12
14
  </body>
13
15
  </html>
@@ -6,7 +6,7 @@
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "build": "tsc && vite build",
9
- "lint": "ESLINT_USE_FLAT_CONFIG=false eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
9
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
@@ -39,10 +39,10 @@ function CreateProjectDialog({
39
39
  <Dialog
40
40
  isOpen={isOpen}
41
41
  buttons={[
42
- <button disabled={isCreating} onClick={handleSubmit}>
42
+ <button disabled={isCreating} onClick={handleSubmit} key="create">
43
43
  Create project
44
44
  </button>,
45
- <button disabled={isCreating} onClick={onClose}>
45
+ <button disabled={isCreating} onClick={onClose} key="cancel">
46
46
  Cancel
47
47
  </button>,
48
48
  ]}
@@ -35,10 +35,10 @@ function CreateTaskDialog({ project, isOpen, onClose }: CreateTaskDialogProps) {
35
35
  <Dialog
36
36
  isOpen={isOpen}
37
37
  buttons={[
38
- <button disabled={isCreating} onClick={handleSubmit}>
38
+ <button disabled={isCreating} onClick={handleSubmit} key="create">
39
39
  Create task
40
40
  </button>,
41
- <button disabled={isCreating} onClick={onClose}>
41
+ <button disabled={isCreating} onClick={onClose} key="cancel">
42
42
  Cancel
43
43
  </button>,
44
44
  ]}
@@ -31,10 +31,10 @@ function DeleteProjectDialog({
31
31
  <Dialog
32
32
  isOpen={isOpen}
33
33
  buttons={[
34
- <button disabled={isDeleting} onClick={handleSubmit}>
34
+ <button disabled={isDeleting} onClick={handleSubmit} key="delete">
35
35
  Delete
36
36
  </button>,
37
- <button disabled={isDeleting} onClick={onClose}>
37
+ <button disabled={isDeleting} onClick={onClose} key="cancel">
38
38
  Cancel
39
39
  </button>,
40
40
  ]}
@@ -24,7 +24,7 @@ function ProjectSelect({
24
24
 
25
25
  return (
26
26
  <select value={project?.id} onChange={handleSelect}>
27
- <option hidden disabled selected>
27
+ <option hidden disabled value="">
28
28
  -- select a project --
29
29
  </option>
30
30
 
@@ -13,6 +13,12 @@
13
13
  -moz-osx-font-smoothing: grayscale;
14
14
  }
15
15
 
16
+ #root-container {
17
+ display: flex;
18
+ flex: 1;
19
+ align-items: center;
20
+ }
21
+
16
22
  #root {
17
23
  max-width: 1280px;
18
24
  margin: 2rem auto;
@@ -31,6 +37,7 @@ a:hover {
31
37
  body {
32
38
  margin: 0;
33
39
  display: flex;
40
+ flex-direction: column;
34
41
  min-width: 320px;
35
42
  min-height: 100vh;
36
43
  }
@@ -6,27 +6,30 @@ import Home from "./Home";
6
6
  import Login from "./Login";
7
7
  import "./index.css";
8
8
 
9
- const router = createBrowserRouter([
10
- {
11
- path: "/",
12
- element: <AuthenticatedRoute />,
13
- children: [
14
- {
15
- path: "/",
16
- element: <Home />,
17
- },
18
- ],
19
- },
20
- {
21
- path: "/login",
22
- element: <Login />,
23
- },
24
- {
25
- // This is the route defined in your application's redirect URL
26
- path: "/auth/callback",
27
- element: <AuthCallback />,
28
- },
29
- ]);
9
+ const router = createBrowserRouter(
10
+ [
11
+ {
12
+ path: "/",
13
+ element: <AuthenticatedRoute />,
14
+ children: [
15
+ {
16
+ path: "/",
17
+ element: <Home />,
18
+ },
19
+ ],
20
+ },
21
+ {
22
+ path: "/login",
23
+ element: <Login />,
24
+ },
25
+ {
26
+ // This is the route defined in your application's redirect URL
27
+ path: "/auth/callback",
28
+ element: <AuthCallback />,
29
+ },
30
+ ],
31
+ { basename: import.meta.env.BASE_URL },
32
+ );
30
33
 
31
34
  ReactDOM.createRoot(document.getElementById("root")!).render(
32
35
  <RouterProvider router={router} />,
@@ -1,54 +1,54 @@
1
1
  export interface MockProject {
2
- __apiName: string;
3
- __primaryKey: string;
2
+ $apiName: string;
3
+ $primaryKey: string;
4
4
  id: string;
5
5
  name: string;
6
6
  tasks: MockTask[];
7
7
  }
8
8
 
9
9
  export interface MockTask {
10
- __apiName: string;
11
- __primaryKey: string;
10
+ $apiName: string;
11
+ $primaryKey: string;
12
12
  id: string;
13
13
  title: string;
14
14
  }
15
15
 
16
16
  const projects: MockProject[] = [
17
17
  {
18
- __apiName: "MockProject",
19
- __primaryKey: "1",
18
+ $apiName: "MockProject",
19
+ $primaryKey: "1",
20
20
  id: "1",
21
21
  name: "Fake Project",
22
22
  tasks: [
23
23
  {
24
- __apiName: "MockTask",
25
- __primaryKey: "1",
24
+ $apiName: "MockTask",
25
+ $primaryKey: "1",
26
26
  id: "1",
27
27
  title: "Try to",
28
28
  },
29
29
  {
30
- __apiName: "MockTask",
31
- __primaryKey: "2",
30
+ $apiName: "MockTask",
31
+ $primaryKey: "2",
32
32
  id: "2",
33
33
  title: "Implement this",
34
34
  },
35
35
  {
36
- __apiName: "MockTask",
37
- __primaryKey: "3",
36
+ $apiName: "MockTask",
37
+ $primaryKey: "3",
38
38
  id: "3",
39
39
  title: "With the Ontology SDK!",
40
40
  },
41
41
  ],
42
42
  },
43
43
  {
44
- __apiName: "MockProject",
45
- __primaryKey: "2",
44
+ $apiName: "MockProject",
45
+ $primaryKey: "2",
46
46
  id: "2",
47
47
  name: "Yet Another Fake Project",
48
48
  tasks: [
49
49
  {
50
- __apiName: "MockTask",
51
- __primaryKey: "4",
50
+ $apiName: "MockTask",
51
+ $primaryKey: "4",
52
52
  id: "4",
53
53
  title: "More tasks here",
54
54
  },
@@ -78,12 +78,12 @@ async function createProject({
78
78
  name,
79
79
  }: {
80
80
  name: string;
81
- }): Promise<MockTask["__primaryKey"]> {
81
+ }): Promise<MockTask["$primaryKey"]> {
82
82
  await delay();
83
83
  const id = randomId();
84
84
  projects.push({
85
- __apiName: "MockProject",
86
- __primaryKey: id,
85
+ $apiName: "MockProject",
86
+ $primaryKey: id,
87
87
  id,
88
88
  name,
89
89
  tasks: [],
@@ -105,14 +105,14 @@ async function createTask({
105
105
  }: {
106
106
  title: string;
107
107
  projectId: string;
108
- }): Promise<MockTask["__primaryKey"]> {
108
+ }): Promise<MockTask["$primaryKey"]> {
109
109
  await delay();
110
110
  const project = projects.find((p) => p.id === projectId);
111
111
  if (project == null) {
112
112
  throw new Error(`Project ${projectId} not found!`);
113
113
  }
114
114
  const id = randomId();
115
- project.tasks.unshift({ __apiName: "MockTask", __primaryKey: id, id, title });
115
+ project.tasks.unshift({ $apiName: "MockTask", $primaryKey: id, id, title });
116
116
  return id;
117
117
  }
118
118
 
@@ -16,7 +16,7 @@ export function useProjectTasks(project: MockProject | undefined) {
16
16
 
17
17
  const createTask: (
18
18
  title: string,
19
- ) => Promise<MockTask["__primaryKey"] | undefined> = useCallback(
19
+ ) => Promise<MockTask["$primaryKey"] | undefined> = useCallback(
20
20
  async (title) => {
21
21
  if (project == null) {
22
22
  return undefined;
@@ -24,7 +24,7 @@ export function useProjectTasks(project: MockProject | undefined) {
24
24
  // Try to implement this with the Ontology SDK!
25
25
  const id = await Mocks.createTask({
26
26
  title,
27
- projectId: project.__primaryKey,
27
+ projectId: project.$primaryKey,
28
28
  });
29
29
  await mutate();
30
30
  return id;
@@ -38,7 +38,7 @@ export function useProjectTasks(project: MockProject | undefined) {
38
38
  return;
39
39
  }
40
40
  // Try to implement this with the Ontology SDK!
41
- await Mocks.deleteTask(task.__primaryKey);
41
+ await Mocks.deleteTask(task.$primaryKey);
42
42
  await mutate();
43
43
  },
44
44
  [project, mutate],
@@ -10,7 +10,7 @@ function useProjects() {
10
10
  return Mocks.getProjects();
11
11
  });
12
12
 
13
- const createProject: (name: string) => Promise<MockProject["__primaryKey"]> =
13
+ const createProject: (name: string) => Promise<MockProject["$primaryKey"]> =
14
14
  useCallback(
15
15
  async (name) => {
16
16
  // Try to implement this with the Ontology SDK!
@@ -24,7 +24,7 @@ function useProjects() {
24
24
  const deleteProject: (project: MockProject) => Promise<void> = useCallback(
25
25
  async (project) => {
26
26
  // Try to implement this with the Ontology SDK!
27
- await Mocks.deleteProject(project.__primaryKey);
27
+ await Mocks.deleteProject(project.$primaryKey);
28
28
  await mutate();
29
29
  },
30
30
  [mutate],
@@ -7,7 +7,9 @@
7
7
  <title>Ontology SDK + Vue</title>
8
8
  </head>
9
9
  <body>
10
- <div id="app"></div>
10
+ <div id="app-container">
11
+ <div id="app"></div>
12
+ </div>
11
13
  <script type="module" src="/src/main.ts"></script>
12
14
  </body>
13
15
  </html>
@@ -14,21 +14,15 @@ const queryApiNames = Object.keys(client.ontology.queries);
14
14
  <div class="methods">
15
15
  <div>
16
16
  <h2>Objects (\{{ objectApiNames.length }})</h2>
17
- <pre v-for="objectApiName in objectApiNames" key="objectApiName">
18
- client.ontology.objects.\{{ objectApiName }}
19
- </pre>
17
+ <pre v-for="objectApiName in objectApiNames" key="objectApiName">client.ontology.objects.\{{ objectApiName }}</pre>
20
18
  </div>
21
19
  <div>
22
20
  <h2>Actions (\{{ actionApiNames.length }})</h2>
23
- <pre v-for="actionApiName in actionApiNames" key="actionApiName">
24
- client.ontology.actions.\{{ actionApiName }}
25
- </pre>
21
+ <pre v-for="actionApiName in actionApiNames" key="actionApiName">client.ontology.actions.\{{ actionApiName }}</pre>
26
22
  </div>
27
23
  <div>
28
24
  <h2>Queries (\{{ queryApiNames.length }})</h2>
29
- <pre v-for="queryApiName in queryApiNames" key="queryApiName">
30
- client.ontology.queries.\{{ queryApiName }}
31
- </pre>
25
+ <pre v-for="queryApiName in queryApiNames" key="queryApiName">client.ontology.queries.\{{ queryApiName }}</pre>
32
26
  </div>
33
27
  </div>
34
28
  </template>
@@ -14,7 +14,7 @@ const routes = [
14
14
  ];
15
15
 
16
16
  const router = createRouter({
17
- history: createWebHistory(),
17
+ history: createWebHistory(import.meta.env.BASE_URL),
18
18
  routes,
19
19
  });
20
20
 
@@ -13,6 +13,12 @@
13
13
  -moz-osx-font-smoothing: grayscale;
14
14
  }
15
15
 
16
+ #app-container {
17
+ display: flex;
18
+ flex: 1;
19
+ align-items: center;
20
+ }
21
+
16
22
  #app {
17
23
  max-width: 1280px;
18
24
  margin: 0 auto;
@@ -32,7 +38,7 @@ a:hover {
32
38
  body {
33
39
  margin: 0;
34
40
  display: flex;
35
- place-items: center;
41
+ flex-direction: column;
36
42
  min-width: 320px;
37
43
  min-height: 100vh;
38
44
  }