Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ commands:
name: Yarn Install
command: |
yarn install --frozen-lockfile --no-progress --non-interactive --cache-folder ~/.cache/yarn
cd ~/react-native-url-polyfill && yarn prepublishOnly

install-detox:
steps:
- restore-cache-detox-env
Expand Down
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import './js/ios10Fix';

import packageJson from './package.json';

export * from './js/URL';
export * from './js/URLSearchParams';

export function setupURLPolyfill() {
globalThis.REACT_NATIVE_URL_POLYFILL = `${packageJson.name}@${packageJson.version}`;
globalThis.REACT_NATIVE_URL_POLYFILL = '<INJECT_VERSION>';

globalThis.URL = require('./js/URL').URL;
globalThis.URLSearchParams = require('./js/URLSearchParams').URLSearchParams;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"lint": "eslint .",
"type-check": "tsc index.d.ts",
"prepare": "husky install",
"prepublishOnly": "node scripts/prepublish",
"bundle-size": "node scripts/bundle-size"
},
"author": "Nicolas Charpentier <nicolas.charpentier079@gmail.com>",
Expand Down
12 changes: 12 additions & 0 deletions scripts/prepublish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/node
const fs = require('node:fs');

const packageJson = require('../package.json');
const path = require.resolve('../index.js');

fs.writeFileSync(
path,
fs
.readFileSync(path, 'utf8')
.replace('<INJECT_VERSION>', `${packageJson.name}@${packageJson.version}`),
);