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
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ jobs:
path: clients-javascript.zip

client_gen:
timeout-minutes: 10
timeout-minutes: 15
runs-on: ubuntu-22.04
needs:
- setup
Expand Down Expand Up @@ -400,7 +400,7 @@ jobs:
path: clients-${{matrix.client.language }}.zip

kotlin_build_macos:
timeout-minutes: 10
timeout-minutes: 15
runs-on: macos-latest
needs:
- setup
Expand Down
2 changes: 1 addition & 1 deletion config/base.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
Expand All @@ -14,7 +15,6 @@
"lib": [
"ESNext"
],
"outDir": "dist",
"types": [
"node"
],
Expand Down
3 changes: 0 additions & 3 deletions playground/javascript/node/abtesting.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { abtestingClient } from '@algolia/client-abtesting';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey =
Expand Down
3 changes: 0 additions & 3 deletions playground/javascript/node/algoliasearch.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { algoliasearch, SearchClient } from 'algoliasearch';
import { liteClient } from 'algoliasearch/lite';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

import type { SearchResponses } from 'algoliasearch';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey = process.env.ALGOLIA_SEARCH_KEY || '**** SEARCH_API_KEY *****';

Expand Down
3 changes: 0 additions & 3 deletions playground/javascript/node/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { analyticsClient } from '@algolia/client-analytics';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey =
Expand Down
3 changes: 0 additions & 3 deletions playground/javascript/node/ingestion.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { ingestionClient } from '@algolia/ingestion';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey =
Expand Down
3 changes: 0 additions & 3 deletions playground/javascript/node/insights.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { insightsClient } from '@algolia/client-insights';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey =
Expand Down
13 changes: 2 additions & 11 deletions playground/javascript/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"start:algoliasearch": "tsc && node dist/algoliasearch.js",
"start:abtesting": "tsc && node dist/abtesting.js",
"start:analytics": "tsc && node dist/analytics.js",
"start:insights": "tsc && node dist/insights.js",
"start:personalization": "tsc && node dist/personalization.js",
"start:query-suggestions": "tsc && node dist/query-suggestions.js",
"start:recommend": "tsc && node dist/recommend.js",
"start:search": "tsc && node dist/search.js",
"start:sources": "tsc && node dist/sources.js",
"start": "tsc && node --env-file=../../.env dist/$0.js",
"build": "tsc"
},
"dependencies": {
Expand All @@ -29,11 +21,10 @@
"algoliasearch": "link:../../../clients/algoliasearch-client-javascript/packages/algoliasearch"
},
"devDependencies": {
"dotenv": "16.4.5",
"typescript": "5.6.2"
},
"engines": {
"node": ">= 14.0.0",
"node": ">= 20.0.0",
"yarn": "^4.0.0"
}
}
3 changes: 0 additions & 3 deletions playground/javascript/node/personalization.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { personalizationClient } from '@algolia/client-personalization';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey =
Expand Down
3 changes: 0 additions & 3 deletions playground/javascript/node/query-suggestions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { querySuggestionsClient } from '@algolia/client-query-suggestions';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey =
Expand Down
3 changes: 0 additions & 3 deletions playground/javascript/node/recommend.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { recommendClient } from '@algolia/recommend';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey = process.env.ALGOLIA_SEARCH_KEY || '**** SEARCH_API_KEY *****';
Expand Down
3 changes: 0 additions & 3 deletions playground/javascript/node/search.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { searchClient, apiClientVersion } from '@algolia/client-search';
import { SearchQuery } from '@algolia/client-search/model';
import { ApiError } from '@algolia/client-common';
import dotenv from 'dotenv';

dotenv.config({ path: '../../.env' });

const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
const apiKey = process.env.ALGOLIA_ADMIN_KEY || '**** SEARCH_API_KEY *****';
Expand Down
2 changes: 1 addition & 1 deletion scripts/cts/runCts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async function runCtsOne(language: Language, suites: Record<CTSType, boolean>):
});
break;
case 'javascript':
await run(`YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install && yarn test ${filter((f) => `dist/${f}`)}`, {
await run(`YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install && yarn test ${filter((f) => `src/${f}`)}`, {
cwd,
});
break;
Expand Down
3 changes: 1 addition & 2 deletions scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"setRunVariables": "yarn runScript dist/ci/githubActions/setRunVariables.js",
"spreadGeneration": "yarn runScript dist/ci/codegen/spreadGeneration.js",
"start": "yarn runScript dist/cli/index.js",
"test": "vitest",
"test": "tsc --noEmit && vitest",
"waitForAllReleases": "yarn runScript dist/ci/codegen/waitForAllReleases.js"
},
"devDependencies": {
Expand All @@ -26,7 +26,6 @@
"@actions/exec": "1.1.1",
"@actions/io": "1.1.3",
"@octokit/rest": "21.0.2",
"@types/chai": "4.3.19",
"@types/express": "4.17.21",
"@types/folder-hash": "4.0.4",
"@types/fs-extra": "11.0.4",
Expand Down
2 changes: 1 addition & 1 deletion scripts/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function playground({ language, client }: { language: AllLanguage;
});
break;
case 'javascript':
await run(`yarn workspace javascript-playground start:${client}`);
await run(`yarn workspace javascript-playground start ${client}`);
break;
case 'java':
await run(
Expand Down
1 change: 1 addition & 0 deletions scripts/release/__tests__/sla.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck this file is broken while the SLA is unclear
import { describe, expect, it } from 'vitest';

import { fullReleaseConfig, LANGUAGES } from '../../common.js';
Expand Down
1 change: 1 addition & 0 deletions scripts/release/sla.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-console */
// @ts-nocheck this file is broken while the SLA is unclear
import fsp from 'fs/promises';

import semver from 'semver';
Expand Down
1 change: 0 additions & 1 deletion scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"typeRoots": ["../node_modules/@types"],
"types": ["node"],
"lib": ["esnext", "dom"],
"outDir": "dist"
},
"include": ["**/*.ts", "./**.cjs", "**/*.mjs"],
"exclude": ["dist", "*.json", "node_modules"]
Expand Down
12 changes: 3 additions & 9 deletions templates/javascript/tests/client/benchmark.mustache
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
// {{generationBanner}}
/* eslint-disable @typescript-eslint/no-unused-vars, require-await, no-lone-blocks */
// @ts-nocheck Failing tests will have type errors, but we cannot suppress them even with @ts-expect-error because it doesn't work for a block of lines.
import { {{client}}, {{#lambda.titlecase}}{{client}}{{/lambda.titlecase}} } from '{{{import}}}';

const appId = 'test-app-id';
const apiKey = 'test-api-key';
/* eslint-disable @typescript-eslint/no-unused-vars */
import { describe, test, expect } from 'vitest';

function createClient(): {{#lambda.titlecase}}{{client}}{{/lambda.titlecase}} {
return {{client}}(appId, apiKey, {{#hasRegionalHost}}'{{{defaultRegion}}}', {{/hasRegionalHost}}{ requester: nodeEchoRequester() });
}
import { {{client}}, {{#lambda.titlecase}}{{client}}{{/lambda.titlecase}} } from '{{{import}}}';

{{#blocksBenchmark}}
{{> tests/client/tests}}
Expand Down
2 changes: 2 additions & 0 deletions templates/javascript/tests/client/client.mustache
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// {{generationBanner}}
/* eslint-disable @typescript-eslint/no-unused-vars, require-await, no-lone-blocks */
// @ts-nocheck Failing tests will have type errors, but we cannot suppress them even with @ts-expect-error because it doesn't work for a block of lines.
import { describe, test, expect } from 'vitest';

import { {{client}}, {{#lambda.titlecase}}{{client}}{{/lambda.titlecase}} } from '{{{import}}}';
import { nodeEchoRequester } from '@algolia/requester-testing';
import type { EchoResponse } from '@algolia/requester-testing';
Expand Down
2 changes: 2 additions & 0 deletions templates/javascript/tests/e2e/e2e.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// {{generationBanner}}
import { describe, test, expect } from 'vitest';

import { union } from '../helpers';

import * as dotenv from 'dotenv';
Expand Down
10 changes: 5 additions & 5 deletions templates/javascript/tests/package.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "javascript-tests",
"version": "1.0.0",
"scripts": {
"test": "rm -rf dist || true && tsc && jest --passWithNoTests"
"test": "tsc --noEmit && vitest run"
},
"dependencies": {
{{#packageDependencies}}
Expand All @@ -13,9 +13,9 @@
},
"devDependencies": {
"@types/jest": "29.5.13",
"@types/node": "22.5.1",
"jest": "29.7.0",
"typescript": "5.5.4",
"dotenv": "16.4.5"
"@types/node": "22.5.5",
"dotenv": "16.4.5",
"typescript": "5.6.2",
"vitest": "2.1.1"
}
}
27 changes: 0 additions & 27 deletions templates/javascript/tests/requests/helpers.mustache

This file was deleted.

8 changes: 3 additions & 5 deletions templates/javascript/tests/requests/requests.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// {{generationBanner}}
import { describe, test, expect } from 'vitest';

import { {{client}} } from '{{{import}}}';
import { nodeEchoRequester } from '@algolia/requester-testing';
import type { EchoResponse } from '@algolia/requester-testing';
Expand Down Expand Up @@ -29,8 +31,4 @@ describe('{{operationId}}', () => {
{{/tests}}
})

{{/blocksRequests}}

{{#isSearchClient}}
{{> tests/requests/helpers}}
{{/isSearchClient}}
{{/blocksRequests}}
5 changes: 2 additions & 3 deletions tests/output/javascript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"extends": "../../../config/base.tsconfig.json",
"compilerOptions": {
"typeRoots": ["../../../node_modules/@types"],
"types": ["node", "jest"],
"lib": ["dom", "esnext"],
"outDir": "dist"
"types": ["node"],
"lib": ["dom", "esnext"]
},
"include": ["src"],
"exclude": ["dist", "node_modules"]
Expand Down
Loading