@sealcode/sealgen 0.14.9 → 0.14.10

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.
@@ -1,13 +1,10 @@
1
1
  import _locreq from "locreq";
2
- import { curryImportPath, exec } from "./utils.js";
2
+ import { exec } from "./utils.js";
3
3
  const target_locreq = _locreq(process.cwd());
4
4
  import { promises as fs } from "fs";
5
5
  async function extract_fields_from_collection(collection_name) {
6
- const rel = curryImportPath(target_locreq.resolve("dist/back"));
7
- const extractor_code = `import {default as Collection} from "${rel(
8
- `./back/collections/${collection_name}.js`
9
- )}";
10
- const c = new Collection();
6
+ const extractor_code = `import {default as the_app} from "./app.js";
7
+ const c = new the_app().collections["${collection_name}"];
11
8
  const fields = [];
12
9
  for (const field_name in c.fields){
13
10
  const field = c.fields[field_name];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.14.9",
3
+ "version": "0.14.10",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,16 +1,13 @@
1
1
  import _locreq from "locreq";
2
- import { curryImportPath, exec } from "./utils.js";
2
+ import { exec } from "./utils.js";
3
3
  const target_locreq = _locreq(process.cwd());
4
4
  import { promises as fs } from "fs";
5
5
 
6
6
  export default async function extract_fields_from_collection(
7
7
  collection_name: string
8
8
  ): Promise<{ name: string; type: string }[]> {
9
- const rel = curryImportPath(target_locreq.resolve("dist/back"));
10
- const extractor_code = `import {default as Collection} from "${rel(
11
- `./back/collections/${collection_name}.js`
12
- )}";
13
- const c = new Collection();
9
+ const extractor_code = `import {default as the_app} from "./app.js";
10
+ const c = new the_app().collections["${collection_name}"];
14
11
  const fields = [];
15
12
  for (const field_name in c.fields){
16
13
  const field = c.fields[field_name];