-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add downgrade script for algoliasearch v4 and steps (#6286)
* ci: add downgrade script for algoliasearch v4 and steps * test:ci instead * store results
- Loading branch information
1 parent
6e3a209
commit d3f16f1
Showing
3 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env node | ||
const path = require('path'); | ||
|
||
const shell = require('shelljs'); | ||
|
||
const packageJsonPaths = [ | ||
path.resolve(__dirname, '../../package.json'), | ||
...JSON.parse( | ||
shell.exec( | ||
"yarn run --silent lerna list --json --all --ignore='example-*'", | ||
{ | ||
silent: true, | ||
} | ||
).stdout | ||
).map(({ location }) => path.resolve(location, 'package.json')), | ||
]; | ||
|
||
console.log( | ||
`Downgrading algoliasearch dependency to v4 in: | ||
- ${packageJsonPaths.join('\n- ')}` | ||
); | ||
|
||
// change main dependency | ||
shell.sed( | ||
'-i', | ||
/"algoliasearch": "5.*"(,?)/, | ||
'"algoliasearch": "4.23.2"$1', | ||
packageJsonPaths | ||
); | ||
|
||
// Downgrade other dependency | ||
shell.sed( | ||
'-i', | ||
/"@algolia\/client-search": "5.*"(,?)/, | ||
'"@algolia/client-search": "4.23.2"$1', | ||
packageJsonPaths | ||
); | ||
|
||
// remove resolution | ||
shell.sed('-i', /"@algolia\/client-common": "5.*"(,?)/, '', packageJsonPaths); | ||
shell.sed( | ||
'-i', | ||
/"places.js\/algoliasearch": "5.*"(,?)/, | ||
'"places.js/algoliasearch": "4.23.2"$1', | ||
packageJsonPaths | ||
); | ||
|
||
// replace import in examples | ||
shell.sed( | ||
'-i', | ||
/import { liteClient as algoliasearch } from 'algoliasearch\/lite'/, | ||
"import algoliasearch from 'algoliasearch/lite'", | ||
...shell.ls('examples/*/*/*.{js,ts,tsx,vue}'), | ||
...shell.ls('examples/*/*/{src,pages,app}/*.{js,ts,tsx,vue}') | ||
); | ||
|
||
// replace dependency in examples | ||
shell.sed( | ||
'-i', | ||
/"algoliasearch": ".*"(,)?/, | ||
'"algoliasearch": "4.23.2"$1', | ||
...shell.ls('examples/*/*/package.json') | ||
); | ||
|
||
shell.exec('yarn install'); | ||
|
||
shell.exec('cp -r node_modules/algoliasearch-v4 node_modules/algoliasearch'); |