diff --git a/README.md b/README.md index 4a4568e..c3441cf 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Then, run the `models snapshot` command to export your model to disk: `directus Example: ```bash -directus models snapshot ./src/model.ts +directus models snapshot ./path/to/target/model.d.ts ``` ## Note: Geometry Support diff --git a/package.json b/package.json index fb4b380..984cfd4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "directus-extension-models", "description": "Generate .d.ts files from your directus schema", "icon": "extension", - "version": "2.1.0", + "version": "2.2.0", "keywords": [ "directus", "directus-extension", diff --git a/src/index.ts b/src/index.ts index b99e1be..6d01ebe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -153,9 +153,10 @@ Model generation will still continue, no worries. function generateIndex(collections: CollectionsOverview): string { let source = ``; + console.log({collections}); source += '\nexport type Collections = {\n'; Object.values(collections).forEach((collection: Collection) => { - source += ` ${collection.collection}: ${className(collection)};\n` + source += ` ${collection.collection}: ${className(collection)}${collection.singleton ? '' : '[]'};\n` }); source += '}\n'; return source;