Skip to content

fix(recommend): export recommend methods to use them in algoliasearch #1512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2024
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 .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
- run:
name: Build
command: yarn build
- run:
name: Test exports
command: yarn test:exports
- run:
name: Test size
command: yarn test:build-size
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"test:browser-locally": "yarn setup:browser && ./scripts/prepare-test-browser.sh && wdio ./wdio.local.conf.js",
"test:build-declarations": "node --max-old-space-size=4096 scripts/test-build-declarations.js",
"test:build-size": "bundlesize",
"test:exports": "lerna run test:exports",
"test:lint": "eslint . --ext .js,.ts",
"test:locally": "lerna clean --yes && yarn lint && yarn test:types && yarn test:unit",
"test:types": "yarn tsc",
Expand Down
3 changes: 3 additions & 0 deletions packages/algoliasearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"lite.js",
"lite.d.ts"
],
"scripts": {
"test:exports": "node --experimental-modules test/module/is-es-module.mjs && node test/module/is-cjs-module.cjs"
},
"dependencies": {
"@algolia/cache-browser-local-storage": "4.23.0",
"@algolia/cache-common": "4.23.0",
Expand Down
9 changes: 9 additions & 0 deletions packages/algoliasearch/test/module/is-cjs-module.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable import/no-commonjs */
/* eslint-disable no-console */
const algoliasearch = require('algoliasearch');
const assert = require('assert');

assert.ok(algoliasearch);
assert.doesNotThrow(() => algoliasearch('..', '..'));

console.log('algoliasearch is valid CJS');
8 changes: 8 additions & 0 deletions packages/algoliasearch/test/module/is-es-module.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable no-console */
import algoliasearch from 'algoliasearch';
import assert from 'assert';

assert.ok(algoliasearch);
assert.doesNotThrow(() => algoliasearch('..', '..'));

console.log('algoliasearch is valid ESM');
1 change: 1 addition & 0 deletions packages/recommend/src/builds/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ recommend.version = version;

export type RecommendClient = WithRecommendMethods<BaseRecommendClient>;

export * from '../methods';
export * from '../types';
1 change: 1 addition & 0 deletions packages/recommend/src/builds/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ recommend.version = version;

export type RecommendClient = WithRecommendMethods<BaseRecommendClient> & Destroyable;

export * from '../methods';
export * from '../types';