Skip to content

Commit

Permalink
chore(clients): provide snippets for all languages (#2518)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts authored Jan 15, 2024
1 parent 9cfc4cc commit 297baa9
Show file tree
Hide file tree
Showing 40 changed files with 1,298 additions and 42 deletions.
20 changes: 20 additions & 0 deletions config/clients.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"tests": {
"extension": ".test.cs",
"outputFolder": "src/tests"
},
"snippets": {
"extension": ".cs",
"outputFolder": "src"
}
},
"dart": {
Expand Down Expand Up @@ -50,6 +54,10 @@
"tests": {
"extension": "_test.dart",
"outputFolder": "test"
},
"snippets": {
"extension": ".dart",
"outputFolder": "lib"
}
},
"go": {
Expand Down Expand Up @@ -182,6 +190,10 @@
"tests": {
"extension": "Test.kt",
"outputFolder": "src/commonTest/kotlin/com/algolia"
},
"snippets": {
"extension": ".kt",
"outputFolder": "src/main/kotlin/com/algolia/snippets"
}
},
"php": {
Expand Down Expand Up @@ -259,6 +271,10 @@
"tests": {
"extension": "_test.rb",
"outputFolder": "test"
},
"snippets": {
"extension": ".rb",
"outputFolder": ""
}
},
"scala": {
Expand All @@ -282,6 +298,10 @@
"tests": {
"extension": "Test.scala",
"outputFolder": "src/test/scala/algoliasearch"
},
"snippets": {
"extension": ".scala",
"outputFolder": "src/main/scala"
}
},
"swift": {
Expand Down
10 changes: 10 additions & 0 deletions config/generation.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const patterns = [
'!clients/**/.openapi-generator-ignore',

// C#
'!snippets/csharp/**',
'snippets/csharp/src/**.cs',
'clients/algoliasearch-client-csharp/**',
'!clients/algoliasearch-client-csharp/*',
'clients/algoliasearch-client-csharp/global.json',
Expand All @@ -21,6 +23,8 @@ export const patterns = [
'tests/output/csharp/global.json',

// Dart
'!snippets/dart/**',
'snippets/dart/lib/**',
'!clients/algoliasearch-client-dart/**',
'clients/algoliasearch-client-dart/packages/*/pubspec.yaml',
'clients/algoliasearch-client-dart/packages/*/lib/*.dart',
Expand Down Expand Up @@ -71,6 +75,8 @@ export const patterns = [
'tests/output/javascript/package.json',

// Kotlin
'!snippets/kotlin/**',
'snippets/kotlin/src/**',
'!clients/algoliasearch-client-kotlin/**',
'clients/algoliasearch-client-kotlin/gradle.properties',
'clients/algoliasearch-client-kotlin/client/README.md',
Expand Down Expand Up @@ -105,6 +111,8 @@ export const patterns = [
'clients/algoliasearch-client-python/.gitignore',

// Ruby
'!snippets/ruby/Gemfile',
'!snippets/ruby/.rubocop.yml',
'!clients/algoliasearch-client-ruby/**',
'clients/algoliasearch-client-ruby/Gemfile.lock',
'clients/algoliasearch-client-ruby/lib/algolia/**',
Expand All @@ -117,6 +125,8 @@ export const patterns = [
'!clients/algoliasearch-client-ruby/lib/algolia/transport/**',

// Scala
'!snippets/scala/**',
'snippets/scala/src/**',
'!clients/algoliasearch-client-scala/**',
'clients/algoliasearch-client-scala/version.sbt',
'clients/algoliasearch-client-scala/src/main/scala/algoliasearch/**',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function formatter(language: string, cwd: string): Promise<void> {
await run('dotnet format', { cwd, language });
break;
case 'dart':
if (cwd.includes('tests')) {
if (cwd.includes('tests') || cwd.includes('snippets')) {
await run('dart pub get && dart fix --apply && dart format .', { cwd, language });
} else {
await run('dart pub get && melos bs && melos build --no-select && melos lint', {
Expand Down
Loading

0 comments on commit 297baa9

Please sign in to comment.