Skip to content

Commit

Permalink
fix(recommend): export recommend methods to use them in algoliasearch (
Browse files Browse the repository at this point in the history
  • Loading branch information
dhayab committed Mar 26, 2024
1 parent 19d4d3b commit 5fc5f4f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
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
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
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
@@ -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
@@ -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
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
Expand Up @@ -62,4 +62,5 @@ recommend.version = version;

export type RecommendClient = WithRecommendMethods<BaseRecommendClient> & Destroyable;

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

0 comments on commit 5fc5f4f

Please sign in to comment.