Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions templates/node/package-lock.json.twig

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions templates/node/package.json.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"lint:fix": "eslint --fix .",
"analyse": "tsc --noEmit"
},
"engines": {
"node": ">=18.17"
},
"exports": {
".": {
"import": {
Expand Down
1 change: 1 addition & 0 deletions templates/python/pyproject.toml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[project.optional-dependencies]
Expand Down
1 change: 1 addition & 0 deletions templates/python/setup.py.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ setuptools.setup(
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
],
)
1 change: 1 addition & 0 deletions templates/ruby/gemspec.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
spec.homepage = '{{ spec.info.contact.url }}'
spec.email = '{{ spec.info.contact.email }}'
spec.files = Dir['lib/**/*.rb']
spec.required_ruby_version = '>= 2.7'

spec.add_dependency 'mime-types', '~> 3.4.1'
end
54 changes: 54 additions & 0 deletions tests/generation/GenerationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,39 @@ final class GenerationTest extends TestCase
'rust' => ['src/enums/webhook_event.rs', 'pub const UserCreated', 'src/enums/localized_status.rs', 'Value1,', 'src/enums/province_type.rs', 'Capital,'],
];

/**
* Package metadata each language must declare, by generated path: the
* runtime floor its code and dependencies need, and every interpreter
* version the e2e suite runs it on.
*
* @var array<string, array<string, list<string>>>
*/
private const array PACKAGE_METADATA = [
'ruby' => [
'appwrite.gemspec' => ["spec.required_ruby_version = '>= 2.7'"],
],
'node' => [
'package.json' => ['"engines": {', '"node": ">=18.17"'],
'package-lock.json' => ['"engines": {', '"node": ">=18.17"'],
],
'python' => [
'setup.py' => [
"'Programming Language :: Python :: 3.9'",
"'Programming Language :: Python :: 3.10'",
"'Programming Language :: Python :: 3.11'",
"'Programming Language :: Python :: 3.12'",
"'Programming Language :: Python :: 3.13'",
],
'pyproject.toml' => [
'"Programming Language :: Python :: 3.9"',
'"Programming Language :: Python :: 3.10"',
'"Programming Language :: Python :: 3.11"',
'"Programming Language :: Python :: 3.12"',
'"Programming Language :: Python :: 3.13"',
],
],
];

/** @var array<string, array<string, string>> generated tree per language and platform */
private static array $generated = [];

Expand Down Expand Up @@ -687,6 +720,27 @@ public function testEnumsAreDeclared(string $name): void
}
}

/** @return iterable<string, array{string}> */
public static function packageLanguages(): iterable
{
foreach (\array_keys(self::PACKAGE_METADATA) as $name) {
yield $name => [$name];
}
}

#[DataProvider('packageLanguages')]
public function testPackageMetadataIsDeclared(string $name): void
{
$files = $this->generate($name, 'server');

foreach (self::PACKAGE_METADATA[$name] as $path => $declarations) {
$this->assertArrayHasKey($path, $files, "{$name} did not generate {$path}");
foreach ($declarations as $declaration) {
$this->assertStringContainsString(\strtolower($declaration), $files[$path], "{$name}: {$path} lacks `{$declaration}`");
}
}
}

/**
* Twig autoescapes to HTML, so a description that reaches a template through
* an unsafe filter arrives as `&quot;` rather than `"`. Go doc comments are
Expand Down
Loading