@eik/common
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -0,1 +1,8 @@ | ||
# [1.3.0](https://github.com/eik-lib/common/compare/v1.2.0...v1.3.0) (2020-09-25) | ||
### Features | ||
* add helpers for development and production ([207708c](https://github.com/eik-lib/common/commit/207708ce68639388ad4cea033c0204417dfc684e)) | ||
# [1.2.0](https://github.com/eik-lib/common/compare/v1.1.0...v1.2.0) (2020-09-14) | ||
@@ -2,0 +9,0 @@ |
@@ -7,2 +7,4 @@ 'use strict'; | ||
const stream = require('./stream'); | ||
const helpers = require('./helpers'); | ||
const utils = require('./utils'); | ||
@@ -14,2 +16,4 @@ module.exports = { | ||
stream, | ||
helpers, | ||
utils, | ||
}; |
{ | ||
"name": "@eik/common", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Common utilities for Eik modules", | ||
@@ -29,2 +29,4 @@ "main": "lib/index.js", | ||
"ajv": "^6.10.2", | ||
"glob": "^7.1.6", | ||
"node-fetch": "^2.6.1", | ||
"semver": "^7.0.0", | ||
@@ -45,6 +47,9 @@ "validate-npm-package-name": "^3.0.0" | ||
"eslint-plugin-prettier": "3.1.4", | ||
"prettier": "2.1.1", | ||
"semantic-release": "17.1.1", | ||
"express": "^4.17.1", | ||
"fastify": "^3.4.1", | ||
"prettier": "2.1.2", | ||
"semantic-release": "17.1.2", | ||
"stoppable": "^1.1.0", | ||
"tap": "14.10.8" | ||
} | ||
} |
@@ -108,1 +108,67 @@ # Eik Commons | ||
``` | ||
### helpers | ||
#### localAssets | ||
A function to help development by mounting development routes to an Express.js or Fastify app based on values defined in `eik.json` | ||
```js | ||
const express = require('express'); | ||
const { helpers } = require('@eik/common'); | ||
const app = express(); | ||
await helpers.localAssets(app); | ||
``` | ||
For an `eik.json` file such as | ||
```json | ||
{ | ||
"name": "my-app", | ||
"version": "1.0.0", | ||
"server": "https://assets.myeikserver.com", | ||
"files" :{ | ||
"esm.js": "./assets/esm.js", | ||
"esm.css": "./assets/esm.css", | ||
"/": "./assets/**/*.map", | ||
} | ||
} | ||
``` | ||
A number of routes would be mounted into your app. | ||
``` | ||
/pkg/my-app/1.0.0/esm.js | ||
/pkg/my-app/1.0.0/esm.css | ||
/pkg/my-app/1.0.0/esm.js.map | ||
/pkg/my-app/1.0.0/esm.css.map | ||
``` | ||
#### packageURL | ||
This helper function can be used to build URLs for given entries in an `eik.json` files section. | ||
Given the following `eik.json` file: | ||
```json | ||
{ | ||
"name": "my-app", | ||
"version": "1.0.0", | ||
"server": "https://assets.myeikserver.com", | ||
"files" :{ | ||
"esm.js": "./assets/esm.js", | ||
"esm.css": "./assets/esm.css", | ||
"/": "./assets/**/*.map", | ||
} | ||
} | ||
``` | ||
and the following call to packageURL | ||
```js | ||
const { helpers } = require('@eik/common'); | ||
const url = await helpers.packageURL('esm.js'); | ||
``` | ||
The URL returned will be `https://assets.myeikserver.com/pkg/my-app/1.0.0/esm.js` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20757
17
442
174
5
17
2
+ Addedglob@^7.1.6
+ Addednode-fetch@^2.6.1
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedwrappy@1.0.2(transitive)