@sealcode/sealgen 0.9.0 → 0.9.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.
- package/lib/page/list.js +4 -1
- package/lib/templates/form.js +2 -2
- package/lib/templates/list.js +2 -2
- package/lib/templates/multiform.js +1 -1
- package/lib/templates/page.js +1 -1
- package/lib/templates/route-test.js +43 -13
- package/lib/templates/stateful-page.js +1 -1
- package/package.json +1 -1
- package/src/page/list.ts +4 -1
- package/src/templates/form.ts +2 -2
- package/src/templates/list.ts +2 -2
- package/src/templates/multiform.ts +1 -1
- package/src/templates/page.ts +1 -1
- package/src/templates/route-test.ts +43 -13
- package/src/templates/stateful-page.ts +1 -1
package/lib/page/list.js
CHANGED
|
@@ -87,7 +87,10 @@ ${this.renderListContainer(ctx, this.renderItems(ctx, values))}`;
|
|
|
87
87
|
: ""}
|
|
88
88
|
</div>
|
|
89
89
|
<div class="list-pagination__center">
|
|
90
|
-
<select
|
|
90
|
+
<select
|
|
91
|
+
title="choose page"
|
|
92
|
+
onchange="if (this.value) Turbo.visit(this.value)"
|
|
93
|
+
>
|
|
91
94
|
${Array.from((0, utils_1.naturalNumbers)(1, totalIems)).map((n) => /* HTML */ `<option
|
|
92
95
|
value="${(0, utils_1.UrlWithNewParams)(ctx,
|
|
93
96
|
//eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
package/lib/templates/form.js
CHANGED
|
@@ -6,8 +6,8 @@ async function formTemplate(action_name, newfilefullpath) {
|
|
|
6
6
|
const rel = (0, import_path_1.curryImportPath)(newfilefullpath);
|
|
7
7
|
return `import { Context } from "koa";
|
|
8
8
|
import { Form, FormData, FormDataValue, Fields, Controls } from "@sealcode/sealgen";
|
|
9
|
-
import html from "${rel("src/back/html")}";
|
|
10
|
-
import { Users } from "${rel("src/back/collections/collections")}";
|
|
9
|
+
import html from "${rel("src/back/html.js")}";
|
|
10
|
+
import { Users } from "${rel("src/back/collections/collections.js")}";
|
|
11
11
|
|
|
12
12
|
export const actionName = "${action_name}";
|
|
13
13
|
|
package/lib/templates/list.js
CHANGED
|
@@ -20,8 +20,8 @@ const listTemplate = async (action_name, newfilefullpath) => {
|
|
|
20
20
|
return `import { Context } from "koa";
|
|
21
21
|
import { CollectionItem } from "sealious";
|
|
22
22
|
import { tempstream } from "tempstream";
|
|
23
|
-
import { ${uppercase_collection} } from "${rel("src/back/collections/collections")}";
|
|
24
|
-
import html from "${rel("src/back/html.
|
|
23
|
+
import { ${uppercase_collection} } from "${rel("src/back/collections/collections.js")}";
|
|
24
|
+
import html from "${rel("src/back/html.js")}";
|
|
25
25
|
import { SealiousItemListPage, BaseListPageFields } from "@sealcode/sealgen";
|
|
26
26
|
|
|
27
27
|
export const actionName = "${action_name}";
|
|
@@ -5,7 +5,7 @@ const utils_1 = require("../utils/utils");
|
|
|
5
5
|
async function multiformTemplate(action_name, newfilefullpath) {
|
|
6
6
|
const rel = (0, utils_1.curryImportPath)(newfilefullpath);
|
|
7
7
|
return `import { Context } from "koa";
|
|
8
|
-
import html from "${rel("src/back/html")}";
|
|
8
|
+
import html from "${rel("src/back/html.js")}";
|
|
9
9
|
import { Controls, Fields, Form, FormMessage, Multiform } from "@sealcode/sealgen";
|
|
10
10
|
import { FlatTemplatable } from "tempstream";
|
|
11
11
|
|
package/lib/templates/page.js
CHANGED
|
@@ -7,7 +7,7 @@ async function pageTemplate(action_name, newfilefullpath) {
|
|
|
7
7
|
return `import { Context } from "koa";
|
|
8
8
|
import { tempstream } from "tempstream";
|
|
9
9
|
import { Page } from "@sealcode/sealgen";
|
|
10
|
-
import html from "${rel("src/back/html")}";
|
|
10
|
+
import html from "${rel("src/back/html.js")}";
|
|
11
11
|
|
|
12
12
|
export const actionName = "${action_name}";
|
|
13
13
|
|
|
@@ -4,22 +4,52 @@ exports.testTemplate = void 0;
|
|
|
4
4
|
const import_path_1 = require("../utils/import-path");
|
|
5
5
|
function testTemplate(action_name, new_file_fullpath) {
|
|
6
6
|
const rel = (0, import_path_1.curryImportPath)(new_file_fullpath);
|
|
7
|
-
return `import { withProdApp } from "${rel("src/back/test_utils/with-prod-app")}";
|
|
8
|
-
import { LONG_TEST_TIMEOUT, webhintURL } from "${rel("src/back/test_utils/webhint")}";
|
|
9
|
-
import { ${action_name}URL } from "${rel("src/back/routes/urls")}";
|
|
7
|
+
return `import { withProdApp } from "${rel("src/back/test_utils/with-prod-app.js")}";
|
|
8
|
+
import { LONG_TEST_TIMEOUT, webhintURL } from "${rel("src/back/test_utils/webhint.js")}";
|
|
9
|
+
import { ${action_name}URL } from "${rel("src/back/routes/urls.js")}";
|
|
10
|
+
import { getBrowser } from "${rel("src/test_utils/browser-creator.js")}";
|
|
11
|
+
|
|
12
|
+
describe("${action_name} webhint", () => {
|
|
13
|
+
it(
|
|
14
|
+
"doesn't crash",
|
|
15
|
+
async function () {
|
|
16
|
+
return withProdApp(async ({ base_url, rest_api }) => {
|
|
17
|
+
await rest_api.get(${action_name}URL);
|
|
18
|
+
await webhintURL(base_url + ${action_name}URL);
|
|
19
|
+
// alternatively you can use webhintHTML for faster but less precise scans
|
|
20
|
+
// or for scanning responses of requests that use some form of authorization:
|
|
21
|
+
// const response = await rest_api.get(${action_name}URL);
|
|
22
|
+
// await webhintHTML(response);
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
VERY_LONG_TEST_TIMEOUT
|
|
26
|
+
);
|
|
27
|
+
});
|
|
10
28
|
|
|
11
29
|
describe("${action_name}", () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// await webhintHTML(response);
|
|
21
|
-
});
|
|
30
|
+
let page: Page;
|
|
31
|
+
let browser: Browser;
|
|
32
|
+
let context: BrowserContext;
|
|
33
|
+
|
|
34
|
+
beforeEach(async () => {
|
|
35
|
+
browser = await getBrowser();
|
|
36
|
+
context = await browser.newContext();
|
|
37
|
+
page = await context.newPage();
|
|
22
38
|
});
|
|
39
|
+
|
|
40
|
+
afterEach(async () => {
|
|
41
|
+
await context.close();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it(
|
|
45
|
+
"works as expected",
|
|
46
|
+
async function () {
|
|
47
|
+
return withProdApp(async ({ base_url }) => {
|
|
48
|
+
await page.goto(base_url + ${action_name}URL);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
VERY_LONG_TEST_TIMEOUT
|
|
52
|
+
);
|
|
23
53
|
});
|
|
24
54
|
`;
|
|
25
55
|
}
|
|
@@ -7,7 +7,7 @@ async function statefulPageTemplate(action_name, newfilefullpath) {
|
|
|
7
7
|
return `import { BaseContext } from "koa";
|
|
8
8
|
import { tempstream, Templatable } from "tempstream";
|
|
9
9
|
import { StatefulPage } from "@sealcode/sealgen";
|
|
10
|
-
import html from "${rel("src/back/html")}";
|
|
10
|
+
import html from "${rel("src/back/html.js")}";
|
|
11
11
|
|
|
12
12
|
export const actionName = "${action_name}";
|
|
13
13
|
|
package/package.json
CHANGED
package/src/page/list.ts
CHANGED
|
@@ -130,7 +130,10 @@ ${this.renderListContainer(ctx, this.renderItems(ctx, values))}`;
|
|
|
130
130
|
: ""}
|
|
131
131
|
</div>
|
|
132
132
|
<div class="list-pagination__center">
|
|
133
|
-
<select
|
|
133
|
+
<select
|
|
134
|
+
title="choose page"
|
|
135
|
+
onchange="if (this.value) Turbo.visit(this.value)"
|
|
136
|
+
>
|
|
134
137
|
${Array.from(naturalNumbers(1, totalIems)).map(
|
|
135
138
|
(n) => /* HTML */ `<option
|
|
136
139
|
value="${UrlWithNewParams(
|
package/src/templates/form.ts
CHANGED
|
@@ -7,8 +7,8 @@ export async function formTemplate(
|
|
|
7
7
|
const rel = curryImportPath(newfilefullpath);
|
|
8
8
|
return `import { Context } from "koa";
|
|
9
9
|
import { Form, FormData, FormDataValue, Fields, Controls } from "@sealcode/sealgen";
|
|
10
|
-
import html from "${rel("src/back/html")}";
|
|
11
|
-
import { Users } from "${rel("src/back/collections/collections")}";
|
|
10
|
+
import html from "${rel("src/back/html.js")}";
|
|
11
|
+
import { Users } from "${rel("src/back/collections/collections.js")}";
|
|
12
12
|
|
|
13
13
|
export const actionName = "${action_name}";
|
|
14
14
|
|
package/src/templates/list.ts
CHANGED
|
@@ -25,9 +25,9 @@ export const listTemplate = async (
|
|
|
25
25
|
import { CollectionItem } from "sealious";
|
|
26
26
|
import { tempstream } from "tempstream";
|
|
27
27
|
import { ${uppercase_collection} } from "${rel(
|
|
28
|
-
"src/back/collections/collections"
|
|
28
|
+
"src/back/collections/collections.js"
|
|
29
29
|
)}";
|
|
30
|
-
import html from "${rel("src/back/html.
|
|
30
|
+
import html from "${rel("src/back/html.js")}";
|
|
31
31
|
import { SealiousItemListPage, BaseListPageFields } from "@sealcode/sealgen";
|
|
32
32
|
|
|
33
33
|
export const actionName = "${action_name}";
|
|
@@ -6,7 +6,7 @@ export async function multiformTemplate(
|
|
|
6
6
|
): Promise<string> {
|
|
7
7
|
const rel = curryImportPath(newfilefullpath);
|
|
8
8
|
return `import { Context } from "koa";
|
|
9
|
-
import html from "${rel("src/back/html")}";
|
|
9
|
+
import html from "${rel("src/back/html.js")}";
|
|
10
10
|
import { Controls, Fields, Form, FormMessage, Multiform } from "@sealcode/sealgen";
|
|
11
11
|
import { FlatTemplatable } from "tempstream";
|
|
12
12
|
|
package/src/templates/page.ts
CHANGED
|
@@ -7,7 +7,7 @@ export async function pageTemplate(
|
|
|
7
7
|
return `import { Context } from "koa";
|
|
8
8
|
import { tempstream } from "tempstream";
|
|
9
9
|
import { Page } from "@sealcode/sealgen";
|
|
10
|
-
import html from "${rel("src/back/html")}";
|
|
10
|
+
import html from "${rel("src/back/html.js")}";
|
|
11
11
|
|
|
12
12
|
export const actionName = "${action_name}";
|
|
13
13
|
|
|
@@ -3,25 +3,55 @@ import { curryImportPath } from "../utils/import-path";
|
|
|
3
3
|
export function testTemplate(action_name: string, new_file_fullpath: string) {
|
|
4
4
|
const rel = curryImportPath(new_file_fullpath);
|
|
5
5
|
return `import { withProdApp } from "${rel(
|
|
6
|
-
"src/back/test_utils/with-prod-app"
|
|
6
|
+
"src/back/test_utils/with-prod-app.js"
|
|
7
7
|
)}";
|
|
8
8
|
import { LONG_TEST_TIMEOUT, webhintURL } from "${rel(
|
|
9
|
-
"src/back/test_utils/webhint"
|
|
9
|
+
"src/back/test_utils/webhint.js"
|
|
10
10
|
)}";
|
|
11
|
-
import { ${action_name}URL } from "${rel("src/back/routes/urls")}";
|
|
11
|
+
import { ${action_name}URL } from "${rel("src/back/routes/urls.js")}";
|
|
12
|
+
import { getBrowser } from "${rel("src/test_utils/browser-creator.js")}";
|
|
13
|
+
|
|
14
|
+
describe("${action_name} webhint", () => {
|
|
15
|
+
it(
|
|
16
|
+
"doesn't crash",
|
|
17
|
+
async function () {
|
|
18
|
+
return withProdApp(async ({ base_url, rest_api }) => {
|
|
19
|
+
await rest_api.get(${action_name}URL);
|
|
20
|
+
await webhintURL(base_url + ${action_name}URL);
|
|
21
|
+
// alternatively you can use webhintHTML for faster but less precise scans
|
|
22
|
+
// or for scanning responses of requests that use some form of authorization:
|
|
23
|
+
// const response = await rest_api.get(${action_name}URL);
|
|
24
|
+
// await webhintHTML(response);
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
VERY_LONG_TEST_TIMEOUT
|
|
28
|
+
);
|
|
29
|
+
});
|
|
12
30
|
|
|
13
31
|
describe("${action_name}", () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// await webhintHTML(response);
|
|
23
|
-
});
|
|
32
|
+
let page: Page;
|
|
33
|
+
let browser: Browser;
|
|
34
|
+
let context: BrowserContext;
|
|
35
|
+
|
|
36
|
+
beforeEach(async () => {
|
|
37
|
+
browser = await getBrowser();
|
|
38
|
+
context = await browser.newContext();
|
|
39
|
+
page = await context.newPage();
|
|
24
40
|
});
|
|
41
|
+
|
|
42
|
+
afterEach(async () => {
|
|
43
|
+
await context.close();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it(
|
|
47
|
+
"works as expected",
|
|
48
|
+
async function () {
|
|
49
|
+
return withProdApp(async ({ base_url }) => {
|
|
50
|
+
await page.goto(base_url + ${action_name}URL);
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
VERY_LONG_TEST_TIMEOUT
|
|
54
|
+
);
|
|
25
55
|
});
|
|
26
56
|
`;
|
|
27
57
|
}
|
|
@@ -8,7 +8,7 @@ export async function statefulPageTemplate(
|
|
|
8
8
|
return `import { BaseContext } from "koa";
|
|
9
9
|
import { tempstream, Templatable } from "tempstream";
|
|
10
10
|
import { StatefulPage } from "@sealcode/sealgen";
|
|
11
|
-
import html from "${rel("src/back/html")}";
|
|
11
|
+
import html from "${rel("src/back/html.js")}";
|
|
12
12
|
|
|
13
13
|
export const actionName = "${action_name}";
|
|
14
14
|
|