@osdk/create-app 0.16.0 → 0.16.1
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/js/index.browser.mjs +1 -1
- package/build/js/index.cjs +1 -1
- package/build/js/index.mjs +1 -1
- package/package.json +1 -1
- package/templates/template-tutorial-todo-app/src/CreateProjectDialog.tsx +2 -2
- package/templates/template-tutorial-todo-app/src/CreateTaskDialog.tsx +2 -2
- package/templates/template-tutorial-todo-app/src/DeleteProjectDialog.tsx +2 -2
- package/templates/template-tutorial-todo-app/src/ProjectSelect.tsx +1 -1
- package/templates/template-tutorial-todo-app/src/mocks.ts +21 -21
- package/templates/template-tutorial-todo-app/src/useProjectTasks.ts +3 -3
- package/templates/template-tutorial-todo-app/src/useProjects.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -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.
|
|
454
|
+
const base = yargs(hideBin(args)).version("0.16.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", {
|
|
455
455
|
type: "string",
|
|
456
456
|
describe: "Project name to create"
|
|
457
457
|
}).option("overwrite", {
|
package/build/js/index.cjs
CHANGED
|
@@ -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.
|
|
464
|
+
const base = yargs__default.default(helpers.hideBin(args)).version("0.16.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", {
|
|
465
465
|
type: "string",
|
|
466
466
|
describe: "Project name to create"
|
|
467
467
|
}).option("overwrite", {
|
package/build/js/index.mjs
CHANGED
|
@@ -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.
|
|
454
|
+
const base = yargs(hideBin(args)).version("0.16.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", {
|
|
455
455
|
type: "string",
|
|
456
456
|
describe: "Project name to create"
|
|
457
457
|
}).option("overwrite", {
|
package/package.json
CHANGED
|
@@ -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
|
]}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
export interface MockProject {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
19
|
-
|
|
18
|
+
$apiName: "MockProject",
|
|
19
|
+
$primaryKey: "1",
|
|
20
20
|
id: "1",
|
|
21
21
|
name: "Fake Project",
|
|
22
22
|
tasks: [
|
|
23
23
|
{
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
$apiName: "MockTask",
|
|
25
|
+
$primaryKey: "1",
|
|
26
26
|
id: "1",
|
|
27
27
|
title: "Try to",
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
$apiName: "MockTask",
|
|
31
|
+
$primaryKey: "2",
|
|
32
32
|
id: "2",
|
|
33
33
|
title: "Implement this",
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
45
|
-
|
|
44
|
+
$apiName: "MockProject",
|
|
45
|
+
$primaryKey: "2",
|
|
46
46
|
id: "2",
|
|
47
47
|
name: "Yet Another Fake Project",
|
|
48
48
|
tasks: [
|
|
49
49
|
{
|
|
50
|
-
|
|
51
|
-
|
|
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["
|
|
81
|
+
}): Promise<MockTask["$primaryKey"]> {
|
|
82
82
|
await delay();
|
|
83
83
|
const id = randomId();
|
|
84
84
|
projects.push({
|
|
85
|
-
|
|
86
|
-
|
|
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["
|
|
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({
|
|
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["
|
|
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
|
|
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
|
|
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["
|
|
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
|
|
27
|
+
await Mocks.deleteProject(project.$primaryKey);
|
|
28
28
|
await mutate();
|
|
29
29
|
},
|
|
30
30
|
[mutate],
|