-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
19,055 additions
and
77 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
packages/react-country-region-selector/config/minify-data.js
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,37 @@ | ||
/** | ||
* This script is called on bootstrap to generate a minified version of the source data from | ||
* country-region-data: | ||
* https://github.com/country-regions/country-region-data | ||
* | ||
* Example: `npm run minify-data -- --config-countries=GB,CA,US | ||
*/ | ||
const argv = require('minimist'); | ||
const args = argv(process.argv.slice(2)); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
let countryRegions = require('country-region-data/data.json'); | ||
|
||
let countries = []; | ||
if (args.hasOwnProperty('config-countries')) { | ||
countries = args['config-countries'].split(','); | ||
} | ||
|
||
// filter out those countries that the user wants | ||
if (countries.length > 0) { | ||
countryRegions = countryRegions.filter( | ||
(countryData) => countries.indexOf(countryData.countryShortCode) !== -1 | ||
); | ||
} | ||
|
||
const srcFolder = path.resolve(__dirname, '../src'); | ||
|
||
const data = JSON.stringify(countryRegions, undefined, ' '); | ||
const tsData = ` | ||
import { CountryRegionDataMinified } from './types'; | ||
const data = ${data}; | ||
export default data; | ||
`; | ||
fs.writeFileSync(`${srcFolder}/_data.ts`, tsData); |
36 changes: 0 additions & 36 deletions
36
packages/react-country-region-selector/config/rollup-plugin-parse-country-list.ts
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.