Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: algolia/instantsearch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.26.0
Choose a base ref
...
head repository: algolia/instantsearch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.27.0
Choose a head ref
  • 5 commits
  • 15 files changed
  • 2 contributors

Commits on Aug 16, 2021

  1. refactor(tests): avoid global jsdom declaration (#4830)

    * refactor(tests): avoid global jsdom declaration
    
    * chore: fix lockfile
    Haroenv authored Aug 16, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d06f82c View commit details
  2. fix(ts): correct entry point (#4829)

    The entry point used to be:
    
    ```ts
    export { default } from './index.es';
    export * from './connectors';
    export * from './helpers';
    export * from './types';
    export * from './widgets';
    export * from './lib/routers';
    ```
    
    While really the entry point should be the same as index.es.ts, as otherwise the js bundle doesn't match the declaration.
    
    This commit fixes that by no longer generating an entry point, and renaming index.es.d.ts to index.d.ts in the built files.
    
    In the same commit I also move the declaration-related configuration files to the subfolder to make the root a little cleaner
    Haroenv authored Aug 16, 2021
    Copy the full SHA
    24a45f9 View commit details
  3. Copy the full SHA
    d201322 View commit details

Commits on Aug 17, 2021

  1. feat(typescript): expose types at regular build (#4832)

    * feat(typescript): expose types at regular build
    
    This moves away from -experimental and to stable.
    
    Note that, like every type change, this could be a breaking change, as manually defined definitions will now merge with the ones provided by InstantSearch.
    
    In almost all cases manual definitions or changes made are no longer needed, if you do however see any problems, please open an issue or pull request with reproduction.
    
    * add cjs build again
    Haroenv authored Aug 17, 2021
    Copy the full SHA
    4bea07b View commit details
  2. chore: release v4.27.0 (#4833)

    * chore: release v4.27.0
    
    * Update CHANGELOG.md
    
    Co-authored-by: Haroen Viaene <hello@haroen.me>
    instantsearch-bot and Haroenv authored Aug 17, 2021
    Copy the full SHA
    50d9a22 View commit details
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -37,7 +37,10 @@ jobs:
- save_cache: *save_yarn_cache
- run:
name: Build library
command: yarn run build
command: |
yarn run build:umd
yarn run build:cjs
yarn run build:es
- run:
name: Test packages size
command: yarn run test:size
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/cjs
/es
/scripts/build/.temp
/website
dist
.cache
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ yarn-error.log
/dist
/cjs
/es
/scripts/build/.temp

# Generated files
/docs
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# [4.27.0](https://github.com/algolia/instantsearch.js/compare/v4.26.0...v4.27.0) (2021-08-17)


### Bug Fixes

* **ts:** correct entry point ([#4829](https://github.com/algolia/instantsearch.js/issues/4829)) ([24a45f9](https://github.com/algolia/instantsearch.js/commit/24a45f9a9fb3c8f62003d2aa37b3456c11af2985))
* **ts:** export PaginationConnector ([d201322](https://github.com/algolia/instantsearch.js/commit/d201322de0d09a664b762422fdc0a51e2bd566bc))


### Features

* **typescript:** expose types at regular build ([#4832](https://github.com/algolia/instantsearch.js/issues/4832)) ([4bea07b](https://github.com/algolia/instantsearch.js/commit/4bea07b99f492441eb94e483378e0778f90c5b43))

If you were using typescript via the `experimental-typescript` tag, you can now use regular InstantSearch.js.

# [4.26.0](https://github.com/algolia/instantsearch.js/compare/v4.25.3...v4.26.0) (2021-08-10)


1 change: 0 additions & 1 deletion global.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
declare const __DEV__: boolean;
declare const jsdom: any;
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "instantsearch.js",
"version": "4.26.0",
"version": "4.27.0",
"description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
"homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
"types": "es/index.d.ts",
@@ -22,11 +22,11 @@
"scripts": {
"start": "yarn run dev",
"dev": "yarn run storybook",
"build": "yarn run build:cjs && yarn run build:es && yarn run build:umd",
"build": "yarn run build:cjs && yarn run build:es && yarn run build:umd && yarn run build:types",
"build:umd": "rm -rf dist && BABEL_ENV=umd rollup --config scripts/rollup/config.js",
"build:cjs": "rm -rf cjs && BABEL_ENV=cjs babel src --extensions '.js,.ts,.tsx' --out-dir cjs/ --ignore 'src/index.es.ts','**/__tests__','**/__mocks__' --quiet",
"build:es": "rm -rf es && BABEL_ENV=es babel src --extensions '.js,.ts,.tsx' --out-dir es/ --ignore 'src/index.es.ts','**/__tests__','**/__mocks__' --quiet && BABEL_ENV=es babel src/index.es.ts --out-file es/index.js --quiet",
"build:types": "./scripts/build/types.js",
"build:types": "./scripts/typescript/extract.js",
"doctoc": "doctoc --no-title --maxlevel 3 README.md CONTRIBUTING.md",
"storybook": "start-storybook --quiet --port 6006 --ci --static-dir .storybook/static",
"storybook:build": "build-storybook --quiet --output-dir website/stories --static-dir .storybook/static",
@@ -82,7 +82,8 @@
"@types/enzyme": "^3.1.15",
"@types/jest": "^26.0.22",
"@types/jest-diff": "^24.3.0",
"@types/scriptjs": "0.0.2",
"@types/jsdom": "^16.2.13",
"@types/scriptjs": "^0.0.2",
"@types/storybook__addon-actions": "^3.4.2",
"@typescript-eslint/eslint-plugin": "4.15.1",
"@typescript-eslint/parser": "4.15.1",
29 changes: 0 additions & 29 deletions scripts/release/build-experimental-typescript.js

This file was deleted.

16 changes: 8 additions & 8 deletions api-extractor.json → scripts/typescript/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",

"projectFolder": "../../",

"mainEntryPointFilePath": "<projectFolder>/es/index.d.ts",

"dtsRollup": {
"enabled": false
},

"apiReport": {
"enabled": false
},
@@ -26,10 +34,6 @@
"addToApiReportFile": true
},

"ae-internal-missing-underscore": {
"logLevel": "none"
},

"ae-missing-release-tag": {
"logLevel": "none"
}
@@ -40,9 +44,5 @@
"logLevel": "none"
}
}
},
"mainEntryPointFilePath": "es/index.d.ts",
"dtsRollup": {
"enabled": false
}
}
36 changes: 10 additions & 26 deletions scripts/build/types.js → scripts/typescript/extract.js
Original file line number Diff line number Diff line change
@@ -2,13 +2,14 @@

/* eslint-disable import/no-commonjs, no-console */

const fs = require('fs');
const path = require('path');
const shell = require('shelljs');

console.log(`Compiling definitions...`);

shell.exec(`tsc -p tsconfig.declaration.json --outDir es/`);
shell.exec(
`tsc -p ${path.join(__dirname, 'tsconfig.declaration.json')} --outDir es/`
);

// replace block ts-ignore comments with line ones to support TS < 3.9
shell.sed(
@@ -18,36 +19,19 @@ shell.sed(
path.join(__dirname, '../../es/**/*.d.ts')
);

// expose only the es entry point, not the umd entry point
shell.mv(
path.join(__dirname, '../../es/index.es.d.ts'),
path.join(__dirname, '../../es/index.d.ts')
);

console.log();
console.log(`Validating definitions...`);

const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor');

const publicExports = [
// 'components' -> does not contains index.d.ts yet
'connectors',
// 'lib', -> Api extractor "import * as ___ from ___;" is not supported yet for local files
// 'middleware',
'helpers',
'types',
'widgets', // -> It does not compile as WidgetFactory is not imported in all files
'lib/routers',
];

fs.writeFileSync(
path.join(__dirname, '../../', 'es/index.d.ts'),
[
`export { default } from './index.es';`,
...publicExports
.map(publicExport => `./${publicExport}`)
.map(exportedFile => {
return `export * from '${exportedFile}';`;
}),
].join('\r\n')
);

const extractorConfig = ExtractorConfig.loadFileAndPrepare(
path.resolve(path.join(__dirname, '../../', 'api-extractor.json'))
path.resolve(path.join(__dirname, 'api-extractor.json'))
);

const result = Extractor.invoke(extractorConfig, {
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"extends": "./tsconfig",
"extends": "../../tsconfig",
"compilerOptions": {
"stripInternal": true,
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true,
"allowJs": true
},
"include": ["src", "./global.d.ts"],
"exclude": ["**/__tests__"]
"include": ["../../src", "../../global.d.ts"],
"exclude": ["../../**/__tests__"]
}
8 changes: 0 additions & 8 deletions ship.config.js
Original file line number Diff line number Diff line change
@@ -22,14 +22,6 @@ module.exports = {
pullRequestTeamReviewers: ['instantsearch-for-websites'],
buildCommand: ({ version }) =>
`NODE_ENV=production VERSION=${version} yarn build`,
afterPublish: ({ exec, version, releaseTag }) => {
if (releaseTag === 'latest' && version.startsWith('4.')) {
exec('./scripts/release/build-experimental-typescript.js');
exec(
`yarn publish --no-git-tag-version --non-interactive --tag experimental-typescript`
);
}
},
slack: {
// disable slack notification for `prepared` lifecycle.
// Ship.js will send slack message only for `releaseSuccess`.
2 changes: 1 addition & 1 deletion src/connectors/pagination/connectPagination.ts
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ export type PaginationWidgetDescription = {
};
};

type PaginationConnector = Connector<
export type PaginationConnector = Connector<
PaginationWidgetDescription,
PaginationConnectorParams
>;
5 changes: 3 additions & 2 deletions src/lib/__tests__/RoutingManager-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* globals jsdom */

import qs from 'qs';
import { createSearchClient } from '../../../test/mock/createSearchClient';
import { createWidget } from '../../../test/mock/createWidget';
@@ -13,6 +11,9 @@ import {
} from '../../types';
import historyRouter from '../routers/history';
import instantsearch from '../..';
import { JSDOM } from 'jsdom';

declare const jsdom: JSDOM;

const createFakeRouter = (args: Partial<Router> = {}): Router => ({
onUpdate(..._args) {},
2 changes: 1 addition & 1 deletion src/lib/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default '4.26.0';
export default '4.27.0';
21 changes: 20 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
@@ -2185,6 +2185,15 @@
jest-diff "^26.0.0"
pretty-format "^26.0.0"

"@types/jsdom@^16.2.13":
version "16.2.13"
resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.13.tgz#126c8b7441b159d6234610a48de77b6066f1823f"
integrity sha512-8JQCjdeAidptSsOcRWk2iTm9wCcwn9l+kRG6k5bzUacrnm1ezV4forq0kWjUih/tumAeoG+OspOvQEbbRucBTw==
dependencies:
"@types/node" "*"
"@types/parse5" "*"
"@types/tough-cookie" "*"

"@types/json-schema@^7.0.3":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636"
@@ -2220,6 +2229,11 @@
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==

"@types/parse5@*":
version "6.0.1"
resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-6.0.1.tgz#f8ae4fbcd2b9ba4ff934698e28778961f9cb22ca"
integrity sha512-ARATsLdrGPUnaBvxLhUlnltcMgn7pQG312S8ccdYlnyijabrX9RN/KN/iGj9Am96CoW8e/K9628BA7Bv4XHdrA==

"@types/prettier@^2.0.0":
version "2.2.3"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.2.3.tgz#ef65165aea2924c9359205bf748865b8881753c0"
@@ -2272,7 +2286,7 @@
dependencies:
"@types/node" "*"

"@types/scriptjs@0.0.2":
"@types/scriptjs@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@types/scriptjs/-/scriptjs-0.0.2.tgz#09a2287221a7a341fc6b95b005e4bfb2a5403538"
integrity sha1-CaIociGno0H8a5WwBeS/sqVANTg=
@@ -2301,6 +2315,11 @@
dependencies:
pretty-format "^24.3.0"

"@types/tough-cookie@*":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.1.tgz#8f80dd965ad81f3e1bc26d6f5c727e132721ff40"
integrity sha512-Y0K95ThC3esLEYD6ZuqNek29lNX2EM1qxV8y2FTLUB0ff5wWrk7az+mLrnNFUnaXcgKye22+sFBRXOgpPILZNg==

"@types/webpack-env@^1.15.0":
version "1.15.0"
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.15.0.tgz#bd9956d5044b1fb43e869a9ba9148862ff98d9fd"