@osdk/create-app 0.17.0-beta.2 → 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 +6 -0
- package/build/browser/index.js +1 -1
- package/build/cjs/index.cjs +1 -1
- package/build/esm/index.js +1 -1
- package/package.json +1 -1
- package/templates/template-react/package.json.hbs +2 -2
- package/templates/template-tutorial-todo-aip-app/package.json.hbs +2 -2
- package/templates/template-tutorial-todo-aip-app/src/Home.module.css +0 -52
- package/templates/template-tutorial-todo-aip-app/src/Home.tsx +5 -76
- package/templates/template-tutorial-todo-aip-app/src/ProjectDetails.module.css +53 -0
- package/templates/template-tutorial-todo-aip-app/src/ProjectDetails.tsx +88 -0
- package/templates/template-tutorial-todo-aip-app/src/mocks.ts +2 -3
- package/templates/template-tutorial-todo-aip-app/src/useProjects.ts +1 -2
- package/templates/template-tutorial-todo-app/package.json.hbs +2 -2
package/CHANGELOG.md
CHANGED
package/build/browser/index.js
CHANGED
|
@@ -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.
|
|
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/build/cjs/index.cjs
CHANGED
|
@@ -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.
|
|
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", {
|
package/build/esm/index.js
CHANGED
|
@@ -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.
|
|
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
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/react": "^18",
|
|
20
20
|
"@types/react-dom": "^18",
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
22
|
-
"@typescript-eslint/parser": "^7.
|
|
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.
|
|
23
|
-
"@typescript-eslint/parser": "^7.
|
|
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,73 +1,37 @@
|
|
|
1
|
-
import
|
|
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
|
-
import { useProjectTasks } from "./useProjectTasks";
|
|
13
10
|
|
|
14
11
|
function Home() {
|
|
15
12
|
const [projectId, setProjectId] = useState<string | undefined>(undefined);
|
|
16
|
-
const { projects
|
|
17
|
-
const [isProcessing, setIsProcessing] = useState<boolean>(false);
|
|
18
|
-
const [projectHasTasks, setProjectHasTasks] = useState<boolean>(false);
|
|
13
|
+
const { projects } = useProjects();
|
|
19
14
|
|
|
20
|
-
const textAreaRef = useRef<HTMLTextAreaElement>(null);
|
|
21
15
|
const project = projects?.find((p) => p.id === projectId);
|
|
22
|
-
const tasks = useProjectTasks(project).tasks;
|
|
23
16
|
|
|
24
17
|
const handleSelectProject = useCallback(
|
|
25
18
|
(p: MockProject) => setProjectId(p.id),
|
|
26
19
|
[],
|
|
27
20
|
);
|
|
28
21
|
|
|
29
|
-
const handleProjectDescriptionRecommendation = useCallback(async () => {
|
|
30
|
-
if (project == null) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
setIsProcessing(true);
|
|
34
|
-
await updateProjectDescription(project);
|
|
35
|
-
setIsProcessing(false);
|
|
36
|
-
}, [project, updateProjectDescription]);
|
|
37
|
-
|
|
38
22
|
useEffect(() => {
|
|
39
23
|
if (project == null && projects != null && projects.length > 0) {
|
|
40
24
|
setProjectId(projects[0].id);
|
|
41
|
-
setProjectHasTasks(tasks == null ? false : tasks.length > 0);
|
|
42
|
-
}
|
|
43
|
-
}, [project, projects, tasks]);
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (textAreaRef.current) {
|
|
47
|
-
const textArea = textAreaRef.current;
|
|
48
|
-
textArea.style.height = "auto";
|
|
49
|
-
textArea.style.height = `${textArea.scrollHeight}px`;
|
|
50
25
|
}
|
|
51
|
-
}, [project
|
|
52
|
-
|
|
53
|
-
const handleOnTaskCreated = useCallback(() => {
|
|
54
|
-
setProjectHasTasks(true);
|
|
55
|
-
}, []);
|
|
26
|
+
}, [project, projects]);
|
|
56
27
|
|
|
57
28
|
const handleOnProjectCreated = useCallback(
|
|
58
29
|
(projectId: string | undefined) => {
|
|
59
30
|
setProjectId(projectId);
|
|
60
|
-
setProjectHasTasks(false);
|
|
61
31
|
},
|
|
62
32
|
[],
|
|
63
33
|
);
|
|
64
34
|
|
|
65
|
-
const handleOnTaskDeleted = useCallback(() => {
|
|
66
|
-
if (tasks?.length === 0) {
|
|
67
|
-
setProjectHasTasks(false);
|
|
68
|
-
}
|
|
69
|
-
}, [tasks]);
|
|
70
|
-
|
|
71
35
|
return (
|
|
72
36
|
<Layout>
|
|
73
37
|
<div className={css.tutorialBannerWrapper}>
|
|
@@ -92,42 +56,7 @@ function Home() {
|
|
|
92
56
|
<CreateProjectButton onProjectCreated={handleOnProjectCreated} />
|
|
93
57
|
{project != null && <DeleteProjectButton project={project} />}
|
|
94
58
|
</div>
|
|
95
|
-
{project != null &&
|
|
96
|
-
<div className={css.projectCard} key={project.id}>
|
|
97
|
-
<h1 className={css.projectTitle}>{project.name}</h1>
|
|
98
|
-
{projectHasTasks && (
|
|
99
|
-
<div className={css.description}>
|
|
100
|
-
<textarea
|
|
101
|
-
ref={textAreaRef}
|
|
102
|
-
readOnly
|
|
103
|
-
value={project.description}
|
|
104
|
-
className={css.textArea}
|
|
105
|
-
/>
|
|
106
|
-
<button
|
|
107
|
-
disabled={isProcessing}
|
|
108
|
-
className={`${css.aip} ${isProcessing ? css.processing : ""}`}
|
|
109
|
-
title="Click here to update project description based on AIP Logic"
|
|
110
|
-
type="button"
|
|
111
|
-
onClick={handleProjectDescriptionRecommendation}
|
|
112
|
-
>
|
|
113
|
-
<div className={css.aipText}>
|
|
114
|
-
<img
|
|
115
|
-
src={aipLogo}
|
|
116
|
-
alt="AIP"
|
|
117
|
-
className={css.image}
|
|
118
|
-
/>
|
|
119
|
-
Get description recommendation
|
|
120
|
-
</div>
|
|
121
|
-
</button>
|
|
122
|
-
</div>
|
|
123
|
-
)}
|
|
124
|
-
<TaskList project={project} onTaskDeleted={handleOnTaskDeleted} />
|
|
125
|
-
<CreateTaskButton
|
|
126
|
-
project={project}
|
|
127
|
-
onTaskCreated={handleOnTaskCreated}
|
|
128
|
-
/>
|
|
129
|
-
</div>
|
|
130
|
-
)}
|
|
59
|
+
{project != null && <ProjectDetails project={project} />}
|
|
131
60
|
</Layout>
|
|
132
61
|
);
|
|
133
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
|
+
}
|
|
@@ -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 =
|
|
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
|
-
|
|
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.
|
|
23
|
-
"@typescript-eslint/parser": "^7.
|
|
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",
|