Skip to content

Commit 10c7154

Browse files
committed
fix: type generation templates to include relative path and strict flag
1 parent ef5e9d9 commit 10c7154

File tree

8 files changed

+11
-13
lines changed

8 files changed

+11
-13
lines changed

templates/cli/lib/commands/types.js.twig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ const typesCommand = actionRunner(async (rawOutputDirectory, {language, strict})
117117
const content = templater({
118118
collections,
119119
strict,
120+
path: rawOutputDirectory ?? '',
120121
...templateHelpers,
121-
getType: meta.getType
122+
getType: meta.getType,
122123
});
123124

124125
const destination = singleFileDestination || path.join(outputDirectory, meta.getFileName());
@@ -130,8 +131,9 @@ const typesCommand = actionRunner(async (rawOutputDirectory, {language, strict})
130131
const content = templater({
131132
collection,
132133
strict,
134+
path: rawOutputDirectory ?? '',
133135
...templateHelpers,
134-
getType: meta.getType
136+
getType: meta.getType,
135137
});
136138

137139
const destination = path.join(outputDirectory, meta.getFileName(collection));

templates/cli/lib/type-generation/languages/dart.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ import '<%- toSnakeCase(attribute.relatedCollection) %>.dart';
9090
<% } -%>
9191
<% } -%>
9292
/// This file is auto-generated by the Appwrite CLI.
93-
/// You can regenerate it by running \`appwrite types -l dart ${this.getCurrentDirectory()}\`.
93+
/// You can regenerate it by running \`appwrite types -l <%- strict ? '--strict ' : '' %>dart <%- path %>\`.
9494

9595
<% for (const attribute of collection.attributes) { -%>
9696
<% if (attribute.format === 'enum') { -%>

templates/cli/lib/type-generation/languages/java.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Java extends LanguageMeta {
4747

4848
/**
4949
* This file is auto-generated by the Appwrite CLI.
50-
* You can regenerate it by running \`appwrite types -l java ${this.getCurrentDirectory()}\`.
50+
* You can regenerate it by running \`appwrite types -l <%- strict ? '--strict ' : '' %>java <%- path %>\`.
5151
*/
5252

5353
import java.util.Objects;

templates/cli/lib/type-generation/languages/javascript.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class JavaScript extends LanguageMeta {
6767
getTemplate() {
6868
return `
6969
// This file is auto-generated by the Appwrite CLI.
70-
// You can regenerate it by running \`appwrite types -l js ${this.getCurrentDirectory()}\`.
70+
// You can regenerate it by running \`appwrite types -l <%- strict ? '--strict ' : '' %>js <%- path %>\`.
7171

7272
/**
7373
* @typedef {import('${this._getAppwriteDependency()}').Models.Document} Document

templates/cli/lib/type-generation/languages/kotlin.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import <%- toPascalCase(attribute.relatedCollection) %>
5656
<% } -%>
5757
/**
5858
* This file is auto-generated by the Appwrite CLI.
59-
* You can regenerate it by running \`appwrite types -l kotlin ${this.getCurrentDirectory()}\`.
59+
* You can regenerate it by running \`appwrite types -l <%- strict ? '--strict ' : '' %>kotlin <%- path %>\`.
6060
*/
6161

6262
<% for (const attribute of collection.attributes) { -%>

templates/cli/lib/type-generation/languages/php.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class PHP extends LanguageMeta {
5050
namespace Appwrite\\Models;
5151
5252
// This file is auto-generated by the Appwrite CLI.
53-
// You can regenerate it by running \`appwrite types -l php ${this.getCurrentDirectory()}\`.
53+
// You can regenerate it by running \`appwrite types -l <%- strict ? '--strict ' : '' %>php <%- path %>\`.
5454
5555
<% for (const attribute of collection.attributes) { -%>
5656
<% if (attribute.type === 'relationship' && !(attribute.relationType === 'manyToMany') && !(attribute.relationType === 'oneToMany' && attribute.side === 'parent')) { -%>

templates/cli/lib/type-generation/languages/swift.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Swift extends LanguageMeta {
4949
return `import Foundation
5050

5151
/// This file is auto-generated by the Appwrite CLI.
52-
/// You can regenerate it by running \`appwrite types -l swift ${this.getCurrentDirectory()}\`.
52+
/// You can regenerate it by running \`appwrite types -l <%- strict ? '--strict ' : '' %>swift <%- path %>\`.
5353

5454
<% for (const attribute of collection.attributes) { -%>
5555
<% if (attribute.format === 'enum') { -%>

templates/cli/lib/type-generation/languages/typescript.js.twig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,11 @@ class TypeScript extends LanguageMeta {
6464
return "appwrite";
6565
}
6666

67-
getCurrentDirectory() {
68-
return process.cwd();
69-
}
70-
7167
getTemplate() {
7268
return `import { type Models } from '${this._getAppwriteDependency()}';
7369

7470
// This file is auto-generated by the Appwrite CLI.
75-
// You can regenerate it by running \`appwrite types -l ts ${this.getCurrentDirectory()}\`.
71+
// You can regenerate it by running \`appwrite types -l <%- strict ? '--strict ' : '' %>ts <%- path %>\`.
7672

7773
<% for (const collection of collections) { -%>
7874
<% for (const attribute of collection.attributes) { -%>

0 commit comments

Comments
 (0)