Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eik/common

Package Overview
Dependencies
Maintainers
4
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eik/common - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

lib/helpers/index.js

7

CHANGELOG.md

@@ -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 @@

4

lib/index.js

@@ -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,
};

11

package.json
{
"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`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc