Skip to content

Commit

Permalink
Merge pull request #96 from sergiitk/cleanup/esm
Browse files Browse the repository at this point in the history
[CLEANUP] Use esm instead of experimental modules
  • Loading branch information
sergiitk authored Mar 10, 2019
2 parents 3f4e6da + 094efdc commit 3416af7
Show file tree
Hide file tree
Showing 44 changed files with 58 additions and 32 deletions.
3 changes: 1 addition & 2 deletions .nycrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"ava.config.js"
],
"extension": [
".jsx",
".mjs"
".jsx"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ NPM repo: [`pagerbeauty`](https://www.npmjs.com/package/pagerbeauty)
Setup PagerBeauty by following [configuration](#configuration) section and run:
```sh
yarn add pagerbeauty
node --experimental-modules node_modules/pagerbeauty/src/pagerbeauty.mjs
node -r esm node_modules/pagerbeauty/src/pagerbeauty.js
```

## Configuration
Expand Down
2 changes: 0 additions & 2 deletions ava.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
const avaConfig = {
files: [
'test/**/*.js',
'test/**/*.mjs',
'!test/helpers',
'!test/mocks',
'!test/grafana',
Expand All @@ -12,7 +11,6 @@ const avaConfig = {
compileEnhancements: false,
extensions: [
'js',
'mjs',
],
// https://github.com/avajs/ava/blob/master/docs/03-assertions.md#custom-assertions
// Chai is used for assertions.
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ services:
entrypoint: ['yarn']
command: ['help']
volumes:
- ./src/:/usr/src/app/src/:ro
- ./test/:/usr/src/app/test/:ro
- ./package.json:/usr/src/app/package.json:rw
- ./yarn.lock:/usr/src/app/yarn.lock:rw
- node-modules-shared:/usr/src/app/node_modules
Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"author": "Sergii Tkachenko <[email protected]>",
"license": "MIT",
"main": "./src/pagerbeauty",
"module": "./src/pagerbeauty",
"engines": {
"node": "^10.14.0",
"npm": "^6.4.1",
Expand All @@ -23,20 +24,21 @@
"coverage:report:text": "nyc report --reporter=text",
"coverage:report:html": "nyc report --reporter=html",
"coverage:report:codecov": "nyc report --reporter=lcovonly && codecov",
"lint": "eslint --ext .js --ext .mjs --ext .jsx -f unix .",
"eslint": "eslint --ext .js --ext .mjs --ext .jsx",
"lint": "eslint --ext .js --ext .jsx -f unix .",
"eslint": "eslint --ext .js --ext .jsx",
"mock:pagerduty_api": "mockserver -m test/mocks",
"build": "webpack --config webpack.dev.js",
"build:watch": "webpack --watch --config webpack.dev.js",
"build:prod": "NODE_ENV=production webpack --config webpack.prod.js --display-modules",
"app": "node --experimental-modules src/pagerbeauty.mjs",
"app:watch": "nodemon --experimental-modules src/pagerbeauty.mjs",
"app:prod": "NODE_ENV=production node --experimental-modules src/pagerbeauty.mjs",
"app": "node -r esm src/pagerbeauty.js",
"app:watch": "nodemon -r esm src/pagerbeauty.js",
"app:prod": "NODE_ENV=production node -r esm src/pagerbeauty.js",
"heroku-postbuild": "NODE_ENV=production webpack --config webpack.prod.js"
},
"dependencies": {
"basic-auth": "^2.0.1",
"dotenv": "^6.1.0",
"esm": "^3.2.14",
"koa": "^2.7.0",
"koa-mount": "^4.0.0",
"koa-route": "^3.2.0",
Expand Down Expand Up @@ -90,15 +92,12 @@
"webpack-cli": "^3.2.3",
"webpack-merge": "^4.2.1"
},
"resolutions": {
"esm": "3.2.9"
},
"nodemonConfig": {
"verbose": true,
"watch": [
"src"
],
"ext": "js,mjs,html.j2"
"ext": "js,html.j2"
},
"babel": {
"presets": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/assets/javascripts/views/OnCallViews.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import React from 'react';

// ------- Internal imports ----------------------------------------------------

import { OnCall } from '../../../models/OnCall.mjs';
import { Incident } from '../../../models/Incident.mjs';
import { OnCall } from '../../../models/OnCall';
import { Incident } from '../../../models/Incident';
import { PagerBeautyFetchNotFoundUiError } from '../ui-errors';
import { StatusIndicatorView } from './StatusIndicatorView';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 1 addition & 5 deletions src/models/OnCall.mjs → src/models/OnCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

// This model to be compatible both with backend and frontend.

import luxon from 'luxon';
import { DateTime } from 'luxon';

// ------- Internal imports ----------------------------------------------------

import { Incident } from './Incident';
import { Schedule } from './Schedule';

// ------- Init --------------------------------------------------------------

const { DateTime } = luxon;

// ------- OnCall --------------------------------------------------------------

export class OnCall {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ module.exports = {
],
},
resolve: {
extensions: ['.js', '.jsx', '.mjs'],
extensions: ['.js', '.jsx'],
},
};
52 changes: 42 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1991,9 +1991,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000939:
version "1.0.30000942"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000942.tgz#454139b28274bce70bfe1d50c30970df7430c6e4"
integrity sha512-wLf+IhZUy2rfz48tc40OH7jHjXjnvDFEYqBHluINs/6MgzoNLPf25zhE4NOVzqxLKndf+hau81sAW0RcGHIaBQ==
version "1.0.30000943"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000943.tgz#00b25bd5808edc2ed1cfb53533a6a6ff6ca014ee"
integrity sha512-nJMjU4UaesbOHTcmz6VS+qaog++Fdepg4KAya5DL/AZrL/aaAZDGOOQ0AECtsJa09r4cJBdHZMive5mw8lnQ5A==

capture-stack-trace@^1.0.0:
version "1.0.1"
Expand Down Expand Up @@ -2952,7 +2952,7 @@ debug@^3.1.0:
dependencies:
ms "^2.1.1"

debuglog@^1.0.1:
debuglog@*, debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
Expand Down Expand Up @@ -3623,10 +3623,10 @@ eslint@^5.15.1:
table "^5.2.3"
text-table "^0.2.0"

esm@3.2.9, esm@^3.0.82, esm@^3.2.10:
version "3.2.9"
resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.9.tgz#9dca653e3b39f89c3c65c5e84cebfa4af345c10d"
integrity sha512-mATFs9dpCjnEyNv27z29UNDmJmBBX8zMdcFip7aIOrBRTpLs8SA+6Ek1QtsWfvecAJVeZy+X5D3Z6xZVtUvYdg==
esm@^3.0.82, esm@^3.2.10, esm@^3.2.14:
version "3.2.14"
resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.14.tgz#567f65e9433bb0873eb92ed5e92e876c3ec2a212"
integrity sha512-uQq8DK0HB0n2Ze9gshhxGQa60caKmwNH7tKxALAT6wxYGfQCdEMXA3MV3z1rh8TSmQIVFYbltm9Xe1ghusnCqw==

espower-location-detector@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -4703,7 +4703,7 @@ import-modules@^1.1.0:
resolved "https://registry.yarnpkg.com/import-modules/-/import-modules-1.1.0.tgz#748db79c5cc42bb9701efab424f894e72600e9dc"
integrity sha1-dI23nFzEK7lwHvq0JPiU5yYA6dw=

imurmurhash@^0.1.4:
imurmurhash@*, imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
Expand Down Expand Up @@ -5722,6 +5722,11 @@ lockfile@^1.0.4:
dependencies:
signal-exit "^3.0.2"

lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=

lodash._baseuniq@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
Expand All @@ -5730,11 +5735,33 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0"
lodash._root "~3.0.0"

lodash._bindcallback@*:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=

lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=

lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
dependencies:
lodash._getnative "^3.0.0"

lodash._createset@~4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=

lodash._getnative@*, lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=

lodash._root@~3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692"
Expand Down Expand Up @@ -5825,6 +5852,11 @@ lodash.mergewith@^4.6.0:
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"
integrity sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==

lodash.restparam@*:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=

lodash.set@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
Expand Down Expand Up @@ -8351,7 +8383,7 @@ readable-stream@~1.1.10, readable-stream@~1.1.11, readable-stream@~1.1.9:
isarray "0.0.1"
string_decoder "~0.10.x"

readdir-scoped-modules@^1.0.0:
readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=
Expand Down

0 comments on commit 3416af7

Please sign in to comment.