Skip to content
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

refactor: migrate to a monorepo #5162

Merged
merged 53 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
f17806b
move examples
Haroenv Nov 16, 2022
b0ff8a5
move everything
Haroenv Nov 16, 2022
a05c820
CI: workspace trial
Haroenv Nov 16, 2022
d9fae5b
put places in root to make sure everything builds fine
Haroenv Nov 16, 2022
954ff13
harmonise babel version between example and root
Haroenv Nov 16, 2022
32ebe32
ci: e2e only requires examples
Haroenv Nov 16, 2022
e55312e
netlify: redirects
Haroenv Nov 16, 2022
8976904
avoids horrible mismatch between algoliasearch versions
Haroenv Nov 16, 2022
e591b4b
codesandbox only build published
Haroenv Nov 16, 2022
a6a84d0
order deps the same
Haroenv Nov 16, 2022
32c4b02
codesandbox hardcode package (it publishes private ones otherwise)
Haroenv Nov 16, 2022
ea3fb24
RIP shared mocks used inside (es and src types aren't the same)
Haroenv Nov 16, 2022
00d56af
lower concurrency for examples
Haroenv Nov 16, 2022
f91f055
fix typo, run in root
Haroenv Nov 16, 2022
b46692f
correct redirects
Haroenv Nov 16, 2022
4a83493
ie compatible e2e tests
Haroenv Nov 16, 2022
dd7e0ac
re-introduce v3 test
Haroenv Nov 17, 2022
fe3b31b
correct lockfile
Haroenv Nov 17, 2022
7c47277
netlify swap order of redirects, prevent infinite redirect
Haroenv Nov 17, 2022
9561b62
colocate packages
Haroenv Nov 17, 2022
ba32765
fix jest ignore
Haroenv Nov 17, 2022
8ba076b
update contributing
Haroenv Nov 17, 2022
558a8af
private testutils
Haroenv Nov 17, 2022
6d430aa
update readme
Haroenv Nov 17, 2022
6936c34
replicate readme in root
Haroenv Nov 17, 2022
76f351b
correct doctoc script
Haroenv Nov 17, 2022
6e9a9e6
localised version update script
Haroenv Nov 17, 2022
4d946e3
independent versioning
Haroenv Nov 17, 2022
49aba0d
order packages
Haroenv Nov 17, 2022
2282840
wip
Haroenv Nov 17, 2022
419a2e5
changelog via lerna
Haroenv Nov 17, 2022
b7c60e2
clean
Haroenv Nov 18, 2022
00492ff
wip
Haroenv Nov 18, 2022
ee3e2fc
wip
Haroenv Nov 18, 2022
9889438
ignore changelog
Haroenv Nov 18, 2022
0854150
wip
Haroenv Nov 18, 2022
b1106f4
*/*
Haroenv Nov 18, 2022
fa18932
update shipjs to alpha
Haroenv Nov 18, 2022
4784840
yes
Haroenv Nov 18, 2022
0adb6d7
right prepare
Haroenv Nov 18, 2022
3b0c329
remove wrong stuff
Haroenv Nov 18, 2022
93f8791
request newest, possibly bug in shipjs
Haroenv Nov 18, 2022
c274941
remove non-working diff
Haroenv Nov 18, 2022
b00e7f2
fix undefined
Haroenv Nov 18, 2022
62f962b
lower concurrency
Haroenv Nov 18, 2022
5c461dd
ok this is needed after all
Haroenv Nov 18, 2022
969f66f
chore: remove unused config file
Haroenv Nov 21, 2022
b270947
move all jest together
Haroenv Nov 21, 2022
9439557
removing that part again for now, later only we'll actively use it
Haroenv Nov 21, 2022
62ef10c
move to tests
Haroenv Nov 21, 2022
896a1a0
move dependencies
Haroenv Nov 21, 2022
23bac95
chore: latest released
Haroenv Nov 22, 2022
f0e464f
no concurrency on netlify, it's too much change it overloads
Haroenv Nov 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
218 changes: 129 additions & 89 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,132 +1,198 @@
aliases:
- &install_yarn_version
name: Install specific Yarn version
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV

- &restore_yarn_cache
name: Restore Yarn cache
keys:
- yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}

- &save_yarn_cache
name: Save Yarn cache
key: yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
version: 2

- &run_yarn_install
name: Install dependencies
command: yarn install
references:
workspace_root: &workspace_root
~/instantsearch
attach_workspace: &attach_workspace
attach_workspace:
at: *workspace_root
install_yarn_version: &install_yarn_version
run:
name: Install specific Yarn version
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV
restore_yarn_cache: &restore_yarn_cache
restore_cache:
name: Restore Yarn cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
save_yarn_cache: &save_yarn_cache
save_cache:
name: Save Yarn cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
run_yarn_install: &run_yarn_install
run:
name: Install dependencies
command: yarn install --frozen-lockfile

defaults: &defaults
working_directory: ~/instantsearchjs
working_directory: ~/instantsearch
docker:
- image: cimg/node:14.17.0

version: 2
workflows:
version: 2
ci:
jobs:
- build
- lint:
requires:
- build
- unit tests:
requires:
- build
- legacy algoliasearch:
requires:
- build
- examples:
requires:
- build
- e2e tests:
requires:
- examples
- release if needed:
requires:
- build
- lint
- unit tests
- examples
- legacy algoliasearch
- e2e tests
filters:
branches:
only:
- master
scheduled release:
triggers:
- schedule:
cron: '0 9 * * 2'
filters:
branches:
only:
- master
jobs:
- prepare release


jobs:
'build and size':
build:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- *attach_workspace
- *install_yarn_version
- *restore_yarn_cache
- *run_yarn_install
- *save_yarn_cache
- run:
name: Build library
command: |
yarn run build:umd
yarn run build:cjs
yarn run build:es
yarn run build --ignore='example-*'
- run:
name: Test packages size
command: yarn run test:size
- run:
name: Type Export
command: yarn run build:types
- run:
name: Test Exports
command: yarn run test:exports
- persist_to_workspace:
root: *workspace_root
paths:
- packages/instantsearch.js/es
- packages/instantsearch.js/cjs
- packages/instantsearch.js/dist

lint:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- *attach_workspace
- *install_yarn_version
- *restore_yarn_cache
- *run_yarn_install
- run:
name: Lint & Code styles
command: yarn run lint
- run:
name: Type Checking
command: yarn run type-check

'type check algoliasearch v3':
legacy algoliasearch:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- *attach_workspace
- *install_yarn_version
- *restore_yarn_cache
- *run_yarn_install
- run:
name: Update dependencies
command: |
yarn remove @algolia/client-search
yarn add @types/[email protected] [email protected]
./scripts/legacy/downgrade-algoliasearch-dependency.js
- run:
name: Type Checking
command: yarn run type-check:v3

'unit tests':
unit tests:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- *attach_workspace
- *install_yarn_version
- *restore_yarn_cache
- *run_yarn_install
- run:
name: Unit tests
command: yarn run test --maxWorkers=4
- store_test_results:
path: junit/jest/

'e2e tests':
examples:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- *attach_workspace
- *install_yarn_version
- *restore_yarn_cache
- *run_yarn_install
- run:
name: Build example
command: yarn run website:build e-commerce
name: Build examples
command: yarn run website:examples --concurrency=1
- persist_to_workspace:
root: *workspace_root
paths:
- website/examples

e2e tests:
<<: *defaults
steps:
- checkout
- *attach_workspace
- *install_yarn_version
- *restore_yarn_cache
- *run_yarn_install
- run:
name: End-2-End tests
command: yarn run test:e2e:saucelabs
- store_test_results:
path: junit/wdio/

'release if needed':
release if needed:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- *attach_workspace
- *install_yarn_version
- *restore_yarn_cache
- *run_yarn_install
- run:
name: Trigger a release if the latest commit is a release commit
command: |
yarn shipjs trigger

'prepare release':
prepare release:
<<: *defaults
steps:
- checkout
Expand All @@ -139,30 +205,4 @@ jobs:
command: |
git config --global user.email "[email protected]"
git config --global user.name "InstantSearch"
yarn run release --yes --no-browse

workflows:
version: 2
ci:
jobs:
- build and size
- unit tests
- lint
- type check algoliasearch v3
- e2e tests
- 'release if needed':
filters:
branches:
only:
- master
- next
'scheduled release':
triggers:
- schedule:
cron: '0 9 * * 2'
filters:
branches:
only:
- master
jobs:
- prepare release
yarn run shipjs prepare --yes --no-browse
3 changes: 2 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"sandboxes": ["instantsearchjs-es-template-pcw1k"],
"buildCommand": "build",
"buildCommand": "build --no-private",
"packages": ["packages/instantsearch.js"],
"node": "14"
}
16 changes: 7 additions & 9 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/cjs
/es
**/cjs
**/es
**/dist

/website
dist
.cache
node_modules/

# TODO: don't ignore these examples once they're updated
/examples/calendar-widget
/examples/media
/examples/tourism
.cache
.parcel-cache
**/node_modules
23 changes: 11 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,7 @@ module.exports = {
{
files: ['*.ts', '*.tsx'],
// this is the same files as ignored in tsconfig.json
excludedFiles: [
'examples/**/*',
'es',
// these two files are temporarily excluded because
// they import files from node_modules/search-insights directly
// and it causes the type-checking to fail.
'src/middlewares/__tests__/createInsightsMiddleware.ts',
'test/mock/createInsightsClient.ts',
],
excludedFiles: ['examples/**/*', '*/es'],
parserOptions: {
project: './tsconfig.json',
},
Expand All @@ -92,7 +84,11 @@ module.exports = {
},
},
{
files: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.js'],
files: [
'packages/instantsearch.js/src/**/*.ts',
'packages/instantsearch.js/src/**/*.tsx',
'packages/instantsearch.js/src/**/*.js',
],
rules: {
'import/extensions': ['error', 'never'],
},
Expand All @@ -104,8 +100,11 @@ module.exports = {
},
},
{
files: ['src/**/*'],
excludedFiles: ['**/__tests__/**/*', 'src/widgets/**/*'],
files: ['packages/instantsearch.js/src/**/*'],
excludedFiles: [
'**/__tests__/**/*',
'packages/instantsearch.js/src/widgets/**/*',
],
rules: {
'no-restricted-globals': [
'error',
Expand Down
16 changes: 12 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
node_modules/
!scripts/docs/

.eslintcache
.parcel-cache

npm-debug.log
yarn-error.log

.DS_Store

.env

# Bundle build files
/dist
/cjs
/es
/packages/instantsearch.js/dist
/packages/instantsearch.js/cjs
/packages/instantsearch.js/es

# Generated files
/docs
/website/examples
/website/stories
/storybook/dist/*

# Unneeded changelogs
examples/*/*/CHANGELOG.md
tests/*/CHANGELOG.md

# Test output
/junit
Loading