Skip to content

Commit

Permalink
feat: redo ES build with Rollup; use Prettier (#80)
Browse files Browse the repository at this point in the history
* feat: use prettier; revert webpack version

* feat: move to rollup
  • Loading branch information
dmythro authored Jan 12, 2021
1 parent e9c5a04 commit 345879a
Show file tree
Hide file tree
Showing 22 changed files with 4,166 additions and 6,155 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"extends": [
"eslint:recommended"
],
"ignorePatterns": ["**/dist/*.min.*"],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script"
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ about: Suggest an idea or use case
title: Feature
labels: feature request
assignees: ''

---

### Use case for the feature

<!-- please describe precisely where it is useful -->

### Examples or links

<!-- please specify or remove -->
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ about: Some data need an update? Please specify the changes
title: Data update
labels: update
assignees: ''

---

### Data changes

<!-- please describe required changes to be made, as strict as possible -->

### Links & sources

Here is a valid source for this change:

<!-- urls -->
51 changes: 25 additions & 26 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,35 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14, 12, 10]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('./package-lock.json') }}
- name: NPM install
run: npm ci --prefer-offline --no-audit --no-optional --ignore-scripts
env:
CI: true

- name: Build & Test
run: npm run build --if-present
# Test is intentionally glued with `build` script
# - run: npm test
env:
CI: true
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('./package-lock.json') }}
- name: NPM install
run: npm ci --prefer-offline --no-audit --no-optional --ignore-scripts
env:
CI: true

- name: Build & Test
run: npm run build --if-present
# Test is intentionally glued with `build` script
# - run: npm test
env:
CI: true
22 changes: 11 additions & 11 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ on:
branches:
- master
paths:
- ".github/workflows/*.yml"
- "data/**"
- "dist/*.php"
- "test/*.php"
- "*.js"
- "*.json"
- "*.ts"
- "!.editorconfig"
- "!.travis.yml"
- "!**LICENSE*"
- "!**README*"
- '.github/workflows/*.yml'
- 'data/**'
- 'dist/*.php'
- 'test/*.php'
- '*.js'
- '*.json'
- '*.ts'
- '!.editorconfig'
- '!.travis.yml'
- '!**LICENSE*'
- '!**README*'

jobs:
phpunit:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.lock

coverage
.eslintcache
.phpunit.cache

composer.phar
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ test/
.editorconfig
.eslintrc.json
.git*
.prettierrc*
.travis.yml

bower.json
Expand Down
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage/*

*.json

*.min.*
*.test.*
9 changes: 9 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"arrowParens": "always",
"endOfLine": "lf",
"printWidth": 100,
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
node_js:
- "14"
- "12"
- "10"
- '14'
- '12'
- '10'
os:
- linux
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Countries, Languages & Continents data

[![Monthly Downloads](https://img.shields.io/npm/dm/countries-list.svg)](https://www.npmjs.com/package/countries-list)
[![NPM](https://img.shields.io/npm/v/countries-list.svg "NPM package version")](https://www.npmjs.com/package/countries-list)
[![Packagist](https://img.shields.io/packagist/v/annexare/countries-list.svg "Packagist version")](https://packagist.org/packages/annexare/countries-list)
[![CI: JS](https://github.com/annexare/Countries/workflows/Countries%20JS/badge.svg "CI: JS")](https://github.com/annexare/Countries/actions)
[![CI: PHP](https://github.com/annexare/Countries/workflows/Countries%20PHP/badge.svg "CI: PHP")](https://github.com/annexare/Countries/actions)
[![NPM](https://img.shields.io/npm/v/countries-list.svg 'NPM package version')](https://www.npmjs.com/package/countries-list)
[![Packagist](https://img.shields.io/packagist/v/annexare/countries-list.svg 'Packagist version')](https://packagist.org/packages/annexare/countries-list)
[![CI: JS](https://github.com/annexare/Countries/workflows/Countries%20JS/badge.svg 'CI: JS')](https://github.com/annexare/Countries/actions)
[![CI: PHP](https://github.com/annexare/Countries/workflows/Countries%20PHP/badge.svg 'CI: PHP')](https://github.com/annexare/Countries/actions)
[![Twitter](https://img.shields.io/twitter/follow/annexare.svg?label=follow+@annexare)](https://twitter.com/annexare)

Continents & countries: **ISO 3166-1 alpha-2** code (with **alpha-2** to **alpha-3** set), name, **ISO 639-1** languages, capital and currency, native name, calling codes.
Expand All @@ -20,15 +20,16 @@ So, if your projects depend on the old structure — specify previous versions,

Package is available via:

* **NPM** `npm install countries-list`
* **Composer / Packagist** `composer require annexare/countries-list`
* **Bower** `bower install countries`
- **NPM** `npm install countries-list`
- **Composer / Packagist** `composer require annexare/countries-list`
- **Bower** `bower install countries`

## Usage

Module exports `continents`, `countries`, `languages`, `languagesAll` and functions:
* `getEmojiFlag(countryCode)`, where `countryCode` is alpha-2 `String`
* `getUnicode(emoji)`, where `emoji` is alpha-2 emoji flag `String`

- `getEmojiFlag(countryCode)`, where `countryCode` is alpha-2 `String`
- `getUnicode(emoji)`, where `emoji` is alpha-2 emoji flag `String`

Built files are in the `./dist` directory.
The `./data` directory contains source data.
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
},
"require": {},
"autoload": {
"files": [
"dist/index.php"
]
"files": [
"dist/index.php"
]
},
"homepage": "http://annexare.github.io/Countries/",
"require-dev": {
Expand Down
Loading

0 comments on commit 345879a

Please sign in to comment.