File size: 499 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

set -e # exit on error

# replace all imports of instantsearch.js with /cjs
find dist/cjs -type f -exec sed -i.bak 's|instantsearch.js/es|instantsearch.js/cjs|g' {} +

# clean up the .bak files, as the set -i'' can not be enabled on BSD/Mac and Linux with the same syntax
find dist/cjs -name '*.bak' -type f -exec rm {} +

# create a package.json to be able to import using require
touch dist/cjs/package.json
echo '{ "type": "commonjs", "sideEffects": false }' > dist/cjs/package.json