-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from hyubs/develop
Added PSGC
- Loading branch information
Showing
41 changed files
with
15,905 additions
and
335 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,24 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Data Updated PSGC | ||
|
||
on: | ||
schedule: | ||
- cron: 0 11 * * * | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
- run: npm ci | ||
- run: npm run diff:psgc | ||
env: | ||
CI: true |
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,54 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import md5 from 'md5'; | ||
import fs from 'fs'; | ||
import { resolve } from 'path'; | ||
import { buildLib } from '../src/build'; | ||
import iso3166 from '../src/iso3166'; | ||
|
||
function getFileMD5(filePath) { | ||
return md5(fs.readFileSync(filePath, { encoding: 'utf-8' })); | ||
} | ||
|
||
(async () => { | ||
const errors = []; | ||
|
||
const filePathRegions = resolve(__dirname, '../json/iso3166/regions.json'); | ||
const filePathProvinces = resolve(__dirname, '../json/iso3166/provinces.json'); | ||
const filePathCitiesMunicipalities = resolve(__dirname, '../json/iso3166/citiesMunicipalities.json'); | ||
|
||
const oldHashRegions = getFileMD5(filePathRegions); | ||
const oldHashProvinces = getFileMD5(filePathProvinces); | ||
const oldHashCitiesMunicipalities = getFileMD5(filePathCitiesMunicipalities); | ||
|
||
try { | ||
await buildLib('iso3166', iso3166); | ||
} catch (err) { | ||
errors.push(err.message); | ||
} | ||
|
||
const newHashRegions = getFileMD5(filePathRegions); | ||
const newHashProvinces = getFileMD5(filePathProvinces); | ||
const newHashCitiesMunicipalities = getFileMD5(filePathCitiesMunicipalities); | ||
|
||
if (oldHashRegions !== newHashRegions) { | ||
errors.push('List of regions is outdated.'); | ||
} | ||
|
||
if (oldHashProvinces !== newHashProvinces) { | ||
errors.push('List of provinces is outdated.'); | ||
} | ||
|
||
if (oldHashCitiesMunicipalities !== newHashCitiesMunicipalities) { | ||
errors.push('List of cities and municipalities is outdated.'); | ||
} | ||
|
||
if (errors.length > 0) { | ||
// eslint-disable-next-line no-console | ||
console.error('Errors', errors); | ||
process.exit(1); | ||
} | ||
|
||
// eslint-disable-next-line no-console | ||
console.log('Everything is updated.'); | ||
process.exit(0); | ||
})(); |
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 was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.