@deessejs/collections 0.0.42 → 0.0.45
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/dist/worker/index.d.ts +1 -2
- package/dist/worker/index.js +1 -62
- package/package.json +6 -8
package/dist/worker/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const loadCollections: () => Promise<Collection[]>;
|
|
1
|
+
export {};
|
package/dist/worker/index.js
CHANGED
|
@@ -1,72 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
38
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.loadCollections = void 0;
|
|
40
|
-
const fs_1 = __importDefault(require("fs"));
|
|
41
6
|
const path_1 = __importDefault(require("path"));
|
|
42
|
-
const generate_1 = require("../drizzle/generate");
|
|
43
|
-
// Dossier des collections
|
|
44
7
|
const collectionsDir = path_1.default.join(process.cwd(), "src", "collections");
|
|
45
8
|
console.log(`[worker] Loading collections from ${collectionsDir}`);
|
|
46
|
-
// Fonction pour importer toutes les collections
|
|
47
|
-
const loadCollections = async () => {
|
|
48
|
-
const files = fs_1.default
|
|
49
|
-
.readdirSync(collectionsDir)
|
|
50
|
-
.filter((f) => f.endsWith(".ts") || f.endsWith(".js"));
|
|
51
|
-
const collections = [];
|
|
52
|
-
for (const file of files) {
|
|
53
|
-
const fullPath = path_1.default.join(collectionsDir, file);
|
|
54
|
-
// Utilisation de import dynamique
|
|
55
|
-
const module = await Promise.resolve(`${fullPath}`).then(s => __importStar(require(s)));
|
|
56
|
-
// On suppose que la collection exporte toujours une const (ex: Posts)
|
|
57
|
-
for (const exported of Object.values(module)) {
|
|
58
|
-
const col = exported;
|
|
59
|
-
if (col?.slug && col?.fields) {
|
|
60
|
-
collections.push(col);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return collections;
|
|
65
|
-
};
|
|
66
|
-
exports.loadCollections = loadCollections;
|
|
67
|
-
// Exemple d'utilisation
|
|
68
9
|
(async () => {
|
|
69
|
-
|
|
70
|
-
(0, generate_1.generateShadowSchema)(collections);
|
|
71
|
-
console.log(`[worker] Shadow schema generated for ${collections.length} collections.`);
|
|
10
|
+
console.log(`[worker] Shadow schema generated for collections.`);
|
|
72
11
|
})();
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deessejs/collections",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"description": "",
|
|
5
|
-
"types": "dist/index.d.ts",
|
|
6
5
|
"main": "dist/index.js",
|
|
7
|
-
"
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import": "./dist/
|
|
10
|
+
"import": "./dist/index.esm.js",
|
|
11
11
|
"require": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts"
|
|
13
13
|
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
21
22
|
"build:watch": "tsc --watch",
|
|
22
23
|
"prepublishOnly": "npm run build",
|
|
23
24
|
"lint": "eslint src --ext .ts",
|
|
@@ -26,10 +27,7 @@
|
|
|
26
27
|
"test:ui": "vitest --ui",
|
|
27
28
|
"test:run": "vitest run",
|
|
28
29
|
"test:coverage": "vitest run --coverage",
|
|
29
|
-
"test:watch": "vitest watch"
|
|
30
|
-
"build:cjs": "tsc --project tsconfig.json",
|
|
31
|
-
"build:esm": "tsc --project tsconfig.esm.json",
|
|
32
|
-
"build": "npm run build:cjs && npm run build:esm"
|
|
30
|
+
"test:watch": "vitest watch"
|
|
33
31
|
},
|
|
34
32
|
"repository": {
|
|
35
33
|
"type": "git",
|