@sealcode/sealgen 0.14.7 → 0.14.9

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.
@@ -33,6 +33,8 @@ const load_assets_plugin = {
33
33
  args.path
34
34
  )}";
35
35
 
36
+ const path = "${args.path}";
37
+
36
38
  import fs from "fs";
37
39
  let buffer_promise = null;
38
40
 
@@ -52,7 +54,7 @@ export const getBase64 = async function(){
52
54
  return buffer.toString("base64");
53
55
  }
54
56
 
55
- export default { getContent, url, getBase64, getBuffer };
57
+ export default { getContent, url, getBase64, getBuffer, path };
56
58
  `;
57
59
  return {
58
60
  contents
@@ -1,6 +1,5 @@
1
1
  function collectionTemplate(collection_name) {
2
- return `import type { App, Policy } from "sealious";
3
- import { Collection, FieldTypes, Policies } from "sealious";
2
+ return `import { Collection, FieldTypes, Policies } from "sealious";
4
3
 
5
4
  export default class ${collection_name} extends Collection {
6
5
  fields = {
@@ -1,15 +1,9 @@
1
1
  import { curryImportPath } from "../utils/import-path.js";
2
2
  async function formTemplate(action_name, newfilefullpath) {
3
3
  const rel = curryImportPath(newfilefullpath);
4
- return `import { Context } from "koa";
5
- import {
6
- Form,
7
- FormData,
8
- FormDataValue,
9
- Fields,
10
- Controls,
11
- fieldsToShape,
12
- } from "@sealcode/sealgen";
4
+ return `import type { Context } from "koa";
5
+ import type { FormData, FormDataValue } from "@sealcode/sealgen";
6
+ import { Form, Fields, Controls, fieldsToShape } from "@sealcode/sealgen";
13
7
  import html from "${rel("src/back/html.js")}";
14
8
  import { Users } from "${rel("src/back/collections/collections.js")}";
15
9
 
@@ -20,7 +14,7 @@ const fields = {
20
14
  password: new Fields.SimpleFormField(true),
21
15
  };
22
16
 
23
- export const ${action_name}Shape = Fields.fieldsToShape(fields);
17
+ export const ${action_name}Shape = fieldsToShape(fields);
24
18
 
25
19
  export default new (class ${action_name}Form extends Form<typeof fields, void> {
26
20
  defaultSuccessMessage = "Formularz wype\u0142niony poprawnie";
@@ -28,7 +22,10 @@ export default new (class ${action_name}Form extends Form<typeof fields, void> {
28
22
 
29
23
  controls = [
30
24
  new Controls.SimpleInput(fields.email, { label: "Email:", type: "email" }),
31
- new Controls.SimpleInput(fields.password, { label: "Password:", type: "password" }),
25
+ new Controls.SimpleInput(fields.password, {
26
+ label: "Password:",
27
+ type: "password",
28
+ }),
32
29
  ];
33
30
 
34
31
  async validateValues(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.14.7",
3
+ "version": "0.14.9",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -38,6 +38,8 @@ export const load_assets_plugin = {
38
38
  args.path
39
39
  )}";
40
40
 
41
+ const path = "${args.path}";
42
+
41
43
  import fs from "fs";
42
44
  let buffer_promise = null;
43
45
 
@@ -57,7 +59,7 @@ export const getBase64 = async function(){
57
59
  return buffer.toString("base64");
58
60
  }
59
61
 
60
- export default { getContent, url, getBase64, getBuffer };
62
+ export default { getContent, url, getBase64, getBuffer, path };
61
63
  `;
62
64
  return {
63
65
  contents,
@@ -1,6 +1,5 @@
1
1
  export function collectionTemplate(collection_name: string) {
2
- return `import type { App, Policy } from "sealious";
3
- import { Collection, FieldTypes, Policies } from "sealious";
2
+ return `import { Collection, FieldTypes, Policies } from "sealious";
4
3
 
5
4
  export default class ${collection_name} extends Collection {
6
5
  fields = {
@@ -5,15 +5,9 @@ export async function formTemplate(
5
5
  newfilefullpath: string
6
6
  ): Promise<string> {
7
7
  const rel = curryImportPath(newfilefullpath);
8
- return `import { Context } from "koa";
9
- import {
10
- Form,
11
- FormData,
12
- FormDataValue,
13
- Fields,
14
- Controls,
15
- fieldsToShape,
16
- } from "@sealcode/sealgen";
8
+ return `import type { Context } from "koa";
9
+ import type { FormData, FormDataValue } from "@sealcode/sealgen";
10
+ import { Form, Fields, Controls, fieldsToShape } from "@sealcode/sealgen";
17
11
  import html from "${rel("src/back/html.js")}";
18
12
  import { Users } from "${rel("src/back/collections/collections.js")}";
19
13
 
@@ -24,7 +18,7 @@ const fields = {
24
18
  password: new Fields.SimpleFormField(true),
25
19
  };
26
20
 
27
- export const ${action_name}Shape = Fields.fieldsToShape(fields);
21
+ export const ${action_name}Shape = fieldsToShape(fields);
28
22
 
29
23
  export default new (class ${action_name}Form extends Form<typeof fields, void> {
30
24
  defaultSuccessMessage = "Formularz wypełniony poprawnie";
@@ -32,7 +26,10 @@ export default new (class ${action_name}Form extends Form<typeof fields, void> {
32
26
 
33
27
  controls = [
34
28
  new Controls.SimpleInput(fields.email, { label: "Email:", type: "email" }),
35
- new Controls.SimpleInput(fields.password, { label: "Password:", type: "password" }),
29
+ new Controls.SimpleInput(fields.password, {
30
+ label: "Password:",
31
+ type: "password",
32
+ }),
36
33
  ];
37
34
 
38
35
  async validateValues(