@osdk/create-app 0.17.0-beta.1 → 0.17.0-beta.3

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @osdk/create-app
2
2
 
3
+ ## 0.17.0-beta.3
4
+
5
+ ### Minor Changes
6
+
7
+ - adebdb0: update AIP template
8
+
9
+ ## 0.17.0-beta.2
10
+
11
+ ### Minor Changes
12
+
13
+ - 79335e5: fix AIP template
14
+
3
15
  ## 0.17.0-beta.1
4
16
 
5
17
  ### Minor Changes
@@ -457,7 +457,7 @@ async function run({
457
457
 
458
458
  // src/cli.ts
459
459
  async function cli(args = process.argv) {
460
- const base = yargs(hideBin(args)).version("0.17.0-beta.1").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", {
460
+ const base = yargs(hideBin(args)).version("0.17.0-beta.3").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", {
461
461
  type: "string",
462
462
  describe: "Project name to create"
463
463
  }).option("overwrite", {
@@ -467,7 +467,7 @@ async function run({
467
467
 
468
468
  // src/cli.ts
469
469
  async function cli(args = process.argv) {
470
- const base = yargs__default.default(helpers.hideBin(args)).version("0.17.0-beta.1").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", {
470
+ const base = yargs__default.default(helpers.hideBin(args)).version("0.17.0-beta.3").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", {
471
471
  type: "string",
472
472
  describe: "Project name to create"
473
473
  }).option("overwrite", {
@@ -457,7 +457,7 @@ async function run({
457
457
 
458
458
  // src/cli.ts
459
459
  async function cli(args = process.argv) {
460
- const base = yargs(hideBin(args)).version("0.17.0-beta.1").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", {
460
+ const base = yargs(hideBin(args)).version("0.17.0-beta.3").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", {
461
461
  type: "string",
462
462
  describe: "Project name to create"
463
463
  }).option("overwrite", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/create-app",
3
- "version": "0.17.0-beta.1",
3
+ "version": "0.17.0-beta.3",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -18,8 +18,8 @@
18
18
  "devDependencies": {
19
19
  "@types/react": "^18",
20
20
  "@types/react-dom": "^18",
21
- "@typescript-eslint/eslint-plugin": "^7.8.0",
22
- "@typescript-eslint/parser": "^7.8.0",
21
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
22
+ "@typescript-eslint/parser": "^7.16.0",
23
23
  "@vitejs/plugin-react": "^4.2.0",
24
24
  "eslint": "^8.57.0",
25
25
  "eslint-plugin-react-hooks": "^4.6.2",
@@ -19,8 +19,8 @@
19
19
  "devDependencies": {
20
20
  "@types/react": "^18",
21
21
  "@types/react-dom": "^18",
22
- "@typescript-eslint/eslint-plugin": "^7.8.0",
23
- "@typescript-eslint/parser": "^7.8.0",
22
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
23
+ "@typescript-eslint/parser": "^7.16.0",
24
24
  "@vitejs/plugin-react": "^4.2.0",
25
25
  "eslint": "^8.57.0",
26
26
  "eslint-plugin-react-hooks": "^4.6.2",
@@ -26,55 +26,3 @@
26
26
  font-weight: 600;
27
27
  }
28
28
 
29
- .projectCard {
30
- margin: 2em;
31
- padding: 0.5em;
32
- border: 1px solid #ccc;
33
- /* margin: 0.5em; */
34
- gap: 0.5em;
35
- border-radius: 5px;
36
-
37
- }
38
-
39
- .projectTitle {
40
- font-size: 1.5em;
41
- }
42
-
43
- .description {
44
- display: flex;
45
- flex-direction: column;
46
- }
47
-
48
- .image {
49
- height: 16px;
50
- width: 16px;
51
- }
52
-
53
- .aip {
54
- background-color: #7961DB;
55
- color: #ffffff;
56
- border: 1px solid #ccc;
57
- padding: 2px;
58
- gap: 10px;
59
- height: 30px;
60
- }
61
-
62
- .processing {
63
- cursor: progress;
64
- }
65
-
66
- .aipText {
67
- display: flex;
68
- justify-content: center;
69
- gap: 10px;
70
- align-items: center;
71
- padding: 0 10px;
72
- }
73
-
74
- .textArea {
75
- border: none;
76
- color: gray;
77
- resize: none;
78
- overflow: hidden;
79
- pointer-events: none;
80
- }
@@ -1,22 +1,17 @@
1
- import aipLogo from "/aip-icon.svg";
2
- import { useCallback, useEffect, useRef, useState } from "react";
1
+ import { useCallback, useEffect, useState } from "react";
3
2
  import CreateProjectButton from "./CreateProjectButton";
4
- import CreateTaskButton from "./CreateTaskButton";
5
3
  import DeleteProjectButton from "./DeleteProjectButton";
6
4
  import css from "./Home.module.css";
7
5
  import Layout from "./Layout";
8
6
  import type { MockProject } from "./mocks";
7
+ import { ProjectDetails } from "./ProjectDetails";
9
8
  import ProjectSelect from "./ProjectSelect";
10
- import TaskList from "./TaskList";
11
9
  import useProjects from "./useProjects";
12
10
 
13
11
  function Home() {
14
12
  const [projectId, setProjectId] = useState<string | undefined>(undefined);
15
- const { projects, updateProjectDescription } = useProjects();
16
- const [isProcessing, setIsProcessing] = useState<boolean>(false);
17
- const [projectHasTasks, setProjectHasTasks] = useState<boolean>(false);
13
+ const { projects } = useProjects();
18
14
 
19
- const textAreaRef = useRef<HTMLTextAreaElement>(null);
20
15
  const project = projects?.find((p) => p.id === projectId);
21
16
 
22
17
  const handleSelectProject = useCallback(
@@ -24,48 +19,19 @@ function Home() {
24
19
  [],
25
20
  );
26
21
 
27
- const handleProjectDescriptionRecommendation = useCallback(async () => {
28
- if (project == null) {
29
- return;
30
- }
31
- setIsProcessing(true);
32
- await updateProjectDescription(project);
33
- setIsProcessing(false);
34
- }, [project, updateProjectDescription]);
35
-
36
22
  useEffect(() => {
37
23
  if (project == null && projects != null && projects.length > 0) {
38
24
  setProjectId(projects[0].id);
39
- setProjectHasTasks(projects[0].tasks.length > 0);
40
25
  }
41
26
  }, [project, projects]);
42
27
 
43
- useEffect(() => {
44
- if (textAreaRef.current) {
45
- const textArea = textAreaRef.current;
46
- textArea.style.height = "auto";
47
- textArea.style.height = `${textArea.scrollHeight}px`;
48
- }
49
- }, [project?.description]);
50
-
51
- const handleOnTaskCreated = useCallback(() => {
52
- setProjectHasTasks(true);
53
- }, []);
54
-
55
28
  const handleOnProjectCreated = useCallback(
56
29
  (projectId: string | undefined) => {
57
30
  setProjectId(projectId);
58
- setProjectHasTasks(false);
59
31
  },
60
32
  [],
61
33
  );
62
34
 
63
- const handleOnTaskDeleted = useCallback(() => {
64
- if (project != null && project.tasks.length === 0) {
65
- setProjectHasTasks(false);
66
- }
67
- }, [project]);
68
-
69
35
  return (
70
36
  <Layout>
71
37
  <div className={css.tutorialBannerWrapper}>
@@ -90,42 +56,7 @@ function Home() {
90
56
  <CreateProjectButton onProjectCreated={handleOnProjectCreated} />
91
57
  {project != null && <DeleteProjectButton project={project} />}
92
58
  </div>
93
- {project != null && (
94
- <div className={css.projectCard} key={project.id}>
95
- <h1 className={css.projectTitle}>{project.name}</h1>
96
- {projectHasTasks && (
97
- <div className={css.description}>
98
- <textarea
99
- ref={textAreaRef}
100
- readOnly
101
- value={project.description}
102
- className={css.textArea}
103
- />
104
- <button
105
- disabled={isProcessing}
106
- className={`${css.aip} ${isProcessing ? css.processing : ""}`}
107
- title="Click here to update project description based on AIP Logic"
108
- type="button"
109
- onClick={handleProjectDescriptionRecommendation}
110
- >
111
- <div className={css.aipText}>
112
- <img
113
- src={aipLogo}
114
- alt="AIP"
115
- className={css.image}
116
- />
117
- Get description recommendation
118
- </div>
119
- </button>
120
- </div>
121
- )}
122
- <TaskList project={project} onTaskDeleted={handleOnTaskDeleted} />
123
- <CreateTaskButton
124
- project={project}
125
- onTaskCreated={handleOnTaskCreated}
126
- />
127
- </div>
128
- )}
59
+ {project != null && <ProjectDetails project={project} />}
129
60
  </Layout>
130
61
  );
131
62
  }
@@ -0,0 +1,53 @@
1
+ .projectCard {
2
+ margin: 2em;
3
+ padding: 0.5em;
4
+ border: 1px solid #ccc;
5
+ /* margin: 0.5em; */
6
+ gap: 0.5em;
7
+ border-radius: 5px;
8
+
9
+ }
10
+
11
+ .projectTitle {
12
+ font-size: 1.5em;
13
+ }
14
+
15
+ .description {
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 5px;
19
+ }
20
+
21
+ .image {
22
+ height: 16px;
23
+ width: 16px;
24
+ }
25
+
26
+ .aip {
27
+ background-color: #7961DB;
28
+ color: #ffffff;
29
+ border: 1px solid #ccc;
30
+ padding: 2px;
31
+ gap: 10px;
32
+ height: 30px;
33
+ }
34
+
35
+ .processing {
36
+ cursor: progress;
37
+ }
38
+
39
+ .aipText {
40
+ display: flex;
41
+ justify-content: center;
42
+ gap: 10px;
43
+ align-items: center;
44
+ padding: 0 10px;
45
+ }
46
+
47
+ .textArea {
48
+ border: none;
49
+ color: gray;
50
+ resize: none;
51
+ overflow: hidden;
52
+ pointer-events: none;
53
+ }
@@ -0,0 +1,88 @@
1
+ import aipLogo from "/aip-icon.svg";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ import CreateTaskButton from "./CreateTaskButton";
4
+ import type { MockProject } from "./mocks";
5
+ import css from "./ProjectDetails.module.css";
6
+ import TaskList from "./TaskList";
7
+ import useProjects from "./useProjects";
8
+ import { useProjectTasks } from "./useProjectTasks";
9
+
10
+ interface ProjectDetailsProps {
11
+ project: MockProject;
12
+ }
13
+
14
+ export function ProjectDetails({ project }: ProjectDetailsProps) {
15
+ const [projectHasTasks, setProjectHasTasks] = useState<boolean>(false);
16
+ const [isProcessing, setIsProcessing] = useState<boolean>(false);
17
+ const { updateProjectDescription } = useProjects();
18
+ const tasks = useProjectTasks(project).tasks;
19
+ const textAreaRef = useRef<HTMLTextAreaElement>(null);
20
+
21
+ useEffect(() => {
22
+ setProjectHasTasks(tasks == null ? false : tasks.length > 0);
23
+ }, [project, tasks]);
24
+
25
+ const handleProjectDescriptionRecommendation = useCallback(async () => {
26
+ if (project == null) {
27
+ return;
28
+ }
29
+ setIsProcessing(true);
30
+ await updateProjectDescription(project);
31
+ setIsProcessing(false);
32
+ }, [project, updateProjectDescription]);
33
+
34
+ useEffect(() => {
35
+ if (textAreaRef.current) {
36
+ const textArea = textAreaRef.current;
37
+ textArea.style.height = "auto";
38
+ textArea.style.height = `${textArea.scrollHeight}px`;
39
+ }
40
+ }, [project.description]);
41
+
42
+ const handleOnTaskCreated = useCallback(() => {
43
+ setProjectHasTasks(true);
44
+ }, []);
45
+
46
+ const handleOnTaskDeleted = useCallback(() => {
47
+ if (tasks?.length === 0) {
48
+ setProjectHasTasks(false);
49
+ }
50
+ }, [tasks]);
51
+
52
+ return (
53
+ <div className={css.projectCard} key={project.id}>
54
+ <h1 className={css.projectTitle}>{project.name}</h1>
55
+ {projectHasTasks && (
56
+ <div className={css.description}>
57
+ <textarea
58
+ ref={textAreaRef}
59
+ readOnly
60
+ value={project.description}
61
+ className={css.textArea}
62
+ />
63
+ <button
64
+ disabled={isProcessing}
65
+ className={`${css.aip} ${isProcessing ? css.processing : ""}`}
66
+ title="Click here to update project description based on AIP Logic"
67
+ type="button"
68
+ onClick={handleProjectDescriptionRecommendation}
69
+ >
70
+ <div className={css.aipText}>
71
+ <img
72
+ src={aipLogo}
73
+ alt="AIP"
74
+ className={css.image}
75
+ />
76
+ Get description recommendation
77
+ </div>
78
+ </button>
79
+ </div>
80
+ )}
81
+ <TaskList project={project} onTaskDeleted={handleOnTaskDeleted} />
82
+ <CreateTaskButton
83
+ project={project}
84
+ onTaskCreated={handleOnTaskCreated}
85
+ />
86
+ </div>
87
+ );
88
+ }
@@ -5,7 +5,7 @@ import { useProjectTasks } from "./useProjectTasks";
5
5
 
6
6
  interface TaskListProps {
7
7
  project: MockProject;
8
- onTaskDeleted: (taskId: string) => void;
8
+ onTaskDeleted: (taskId: string | undefined) => void;
9
9
  }
10
10
 
11
11
  function TaskList({ project, onTaskDeleted }: TaskListProps) {
@@ -1,10 +1,11 @@
1
1
  import { useCallback, useEffect, useRef, useState } from "react";
2
2
  import type { MockTask } from "./mocks";
3
3
  import css from "./TaskListItem.module.css";
4
+
4
5
  interface TaskListItemProps {
5
6
  task: MockTask;
6
7
  deleteTask: (task: MockTask) => Promise<void>;
7
- onTaskDeleted: (taskId: string) => void;
8
+ onTaskDeleted: (taskId: string | undefined) => void;
8
9
  }
9
10
 
10
11
  function TaskListItem({ task, deleteTask, onTaskDeleted }: TaskListItemProps) {
@@ -28,9 +29,7 @@ function TaskListItem({ task, deleteTask, onTaskDeleted }: TaskListItemProps) {
28
29
  textArea.style.height = `${textArea.scrollHeight}px`;
29
30
  }
30
31
  }, [task.description]);
31
- const cleanDescription = task.description.trim() === ""
32
- ? null
33
- : task.description.trim();
32
+ const cleanDescription = task.description?.trim();
34
33
  return (
35
34
  <li className={css.li}>
36
35
  <input
@@ -106,7 +106,7 @@ async function getRecommendedProjectDescription(
106
106
  project: MockProject,
107
107
  ): Promise<string> {
108
108
  await delay();
109
- if (project.tasks.length === 0) {
109
+ if (project.tasks != null && project.tasks.length === 0) {
110
110
  throw new Error("Project description recommendation requires tasks");
111
111
  }
112
112
  return `AIP Logic mock description for project`;
@@ -114,10 +114,9 @@ async function getRecommendedProjectDescription(
114
114
 
115
115
  async function updateProjectDescription(
116
116
  project: MockProject,
117
- description: string,
118
117
  ): Promise<void> {
119
118
  await delay();
120
- project.description = description;
119
+ project.description = await getRecommendedProjectDescription(project);
121
120
  }
122
121
 
123
122
  async function deleteProject(id: string): Promise<void> {
@@ -28,8 +28,7 @@ function useProjects() {
28
28
  ) => Promise<void> = useCallback(
29
29
  async (project) => {
30
30
  // Try to implement this with the Ontology SDK!
31
- const description = await Mocks.getRecommendedProjectDescription(project);
32
- await Mocks.updateProjectDescription(project, description);
31
+ await Mocks.updateProjectDescription(project);
33
32
  await mutate();
34
33
  },
35
34
  [mutate],
@@ -19,8 +19,8 @@
19
19
  "devDependencies": {
20
20
  "@types/react": "^18",
21
21
  "@types/react-dom": "^18",
22
- "@typescript-eslint/eslint-plugin": "^7.8.0",
23
- "@typescript-eslint/parser": "^7.8.0",
22
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
23
+ "@typescript-eslint/parser": "^7.16.0",
24
24
  "@vitejs/plugin-react": "^4.2.0",
25
25
  "eslint": "^8.57.0",
26
26
  "eslint-plugin-react-hooks": "^4.6.2",