Skip to content

Commit ce04651

Browse files
authored
Merge pull request #25 from lifeomic/repo-upgrade
2 parents 3e67c55 + 0e64df6 commit ce04651

28 files changed

+2827
-7888
lines changed

.editorconfig

Lines changed: 0 additions & 9 deletions
This file was deleted.

.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: ['prettier', '@lifeomic/standards'],
3+
overrides: [
4+
// Set correct env for config files
5+
{ files: ['*.js'], env: { node: true } },
6+
],
7+
};

.github/lifeomic-probot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enforceSemanticCommits: true
2+
reportWorkflowFailures:
3+
Release:
4+
# This is #skillspring
5+
slackChannel: CF46X5T4G

.github/workflows/code-scanning-v4.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow is inherited from our internal .github repo at https://github.com/lifeomic/.github/blob/master/workflow-templates/code-scanning-2021-06-08.yml
2-
# Setting up this workflow on the repository will perform a static scan for security issues using GitHub Code Scanning.
2+
# Setting up this workflow on the repository will perform a static scan for security issues using GitHub Code Scanning.
33
# Any findings for a repository can be found under the `Security` tab -> `Code Scanning Alerts`
4-
name: "CodeQL"
4+
name: 'CodeQL'
55

66
on:
77
push:
@@ -33,24 +33,24 @@ jobs:
3333
fail-fast: false
3434

3535
steps:
36-
- name: Checkout repository
37-
uses: actions/checkout@v2
38-
with:
39-
# We must fetch at least the immediate parents so that if this is
40-
# a pull request then we can checkout the head.
41-
fetch-depth: 2
36+
- name: Checkout repository
37+
uses: actions/checkout@v2
38+
with:
39+
# We must fetch at least the immediate parents so that if this is
40+
# a pull request then we can checkout the head.
41+
fetch-depth: 2
4242

43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v1
46-
with:
47-
config-file: lifeomic/.github/config-files/codeql-config.yml@master # uses our config file from the lifeomic/.github repo
48-
queries: +security-extended # This will run all queries at https://github.com/github/codeql/:language/ql/src/codeql-suites/:language-security-extended.qls
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v1
46+
with:
47+
config-file: lifeomic/.github/config-files/codeql-config.yml@master # uses our config file from the lifeomic/.github repo
48+
queries: +security-extended # This will run all queries at https://github.com/github/codeql/:language/ql/src/codeql-suites/:language-security-extended.qls
4949

50-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51-
# If this step fails, it should be removed and replaced with custom build steps.
52-
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v1
50+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51+
# If this step fails, it should be removed and replaced with custom build steps.
52+
- name: Autobuild
53+
uses: github/codeql-action/autobuild@v1
5454

55-
- name: Perform CodeQL Analysis
56-
uses: github/codeql-action/analyze@v1
55+
- name: Perform CodeQL Analysis
56+
uses: github/codeql-action/analyze@v1

.github/workflows/pull-request.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: PR Build & Test
2+
3+
on: pull_request
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
env:
9+
NPM_TOKEN: ${{ secrets.LIFEOMIC_NPM_TOKEN }}
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 12
15+
- name: Build & Test
16+
run: |
17+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
18+
yarn install --frozen-lockfile
19+
yarn lint
20+
yarn test
21+
yarn build

.github/workflows/release.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
environment: npm
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
NPM_TOKEN: ${{ secrets.LIFEOMIC_NPM_TOKEN }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-node@v2
18+
with:
19+
node-version: 12
20+
- name: Test
21+
run: |
22+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
23+
yarn install --frozen-lockfile
24+
yarn lint
25+
yarn test
26+
yarn build
27+
- name: Publish
28+
run: |
29+
yarn semantic-release

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
/.nyc_output/
2-
node_modules/
1+
coverage
2+
node_modules
3+
dist

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,8 @@
1-
delta
2-
=====
3-
4-
[![Build Status](https://travis-ci.org/lifeomic/delta.svg?branch=master)](https://travis-ci.org/lifeomic/delta)
5-
[![Coverage Status](https://coveralls.io/repos/github/lifeomic/delta/badge.svg?branch=master)](https://coveralls.io/github/lifeomic/delta?branch=master)
6-
71
Delta provides tooling for creating and testing AWS Lambda functions that
82
process AWS data streams.
93

104
## Usage
115

126
```bash
13-
npm install --save @lifeomic/delta
7+
yarn add @lifeomic/delta
148
```
15-
16-
## API
17-
18-
### Handlers
19-
20-
The `delta.handlers` module provides tools for constructing `async` AWS Lambda
21-
handlers using [RxJS][rxjs].
22-
23-
#### records()
24-
25-
Create an [RxJS][rxjs] operator for extracting AWS Lambda data stream records
26-
from an event.
27-
28-
#### some(...operatorFactories)
29-
30-
Create an AWS Lambda handler from a set of `operatorFactories`. Each fatory is
31-
invoked with the `context` object from the Lambda invocation and is expected to
32-
return an [RxJS][rxjs] operator. The Lambda `event` is then piped through all of
33-
of the operators and the last emitted value is returned. If no operator emits
34-
a value an error is thrown.
35-
36-
#### withContext(generator, handler)
37-
38-
Creates a new AWS Lambda handler that wraps a given `handler`. The wrapper will
39-
invoke the `generator` with the `context` object Lambda invocation. The
40-
transformed `context` and the original Lambda `event` are then passed to the
41-
`handler` and the result is retuned.
42-
43-
### Generators
44-
45-
The `delta.generators` module provides tools for generating synthetic data
46-
stream event payloads. This is often useful for testing.
47-
48-
#### kinesisRecord(payload)
49-
50-
Encodes the `payload` object and returns a single Kinesis record.
51-
52-
#### streamEvent(records)
53-
54-
Encodes `records` as a event object like what AWS Lambda receives from a
55-
registered data stream. `records` may be a single record on an array of
56-
records.
57-
58-
[rxjs]: https://rxjs-dev.firebaseapp.com/ "RxJS"

build.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { execSync } = require('child_process');
2+
const { unlinkSync } = require('fs');
3+
const glob = require('glob');
4+
5+
const run = (cmd) => execSync(cmd, { cwd: __dirname, stdio: 'inherit' });
6+
7+
run('rm -rf dist/');
8+
9+
run('yarn tsc');
10+
11+
for (const file of ['package.json', 'README.md']) {
12+
run(`cp ${file} dist/`);
13+
}
14+
15+
// Remove test files from output
16+
for (const file of glob.sync('dist/**/*.test.*')) {
17+
unlinkSync(file);
18+
}
19+
20+
console.log('✔️ Successfully built library to dist folder');

jest.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
preset: '@lifeomic/jest-config',
3+
testMatch: ['<rootDir>/**/*.test.ts'],
4+
collectCoverage: true,
5+
coverageThreshold: {
6+
global: {
7+
branches: 100,
8+
statements: 100,
9+
functions: 100,
10+
lines: 100,
11+
},
12+
},
13+
};

package.json

Lines changed: 25 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,38 @@
11
{
22
"name": "@lifeomic/delta",
3-
"version": "1.0.0",
3+
"version": "0.0.0",
44
"description": "Tools for working with data streams in AWS Lambda",
5-
"main": "src/index.js",
6-
"scripts": {
7-
"coverage": "nyc report --reporter=text-lcov | coveralls",
8-
"lint": "eslint .",
9-
"pretest": "yarn lint",
10-
"test": "nyc ava -v"
5+
"license": "MIT",
6+
"publishConfig": {
7+
"access": "public"
8+
},
9+
"author": "LifeOmic <development@lifeomic.com>",
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/lifeomic/delta.git"
1113
},
1214
"keywords": [
1315
"aws",
1416
"lambda",
1517
"streams"
1618
],
17-
"author": "LifeOmic <development@lifeomic.com>",
18-
"repository": {
19-
"type": "git",
20-
"url": "https://github.com/lifeomic/delta.git"
19+
"main": "index.js",
20+
"scripts": {
21+
"format": "eslint . --fix && prettier . --write",
22+
"lint": "eslint . && prettier --check .",
23+
"test": "jest",
24+
"build": "node build.js"
2125
},
22-
"license": "MIT",
2326
"devDependencies": {
24-
"@lifeomic/eslint-plugin-node": "^1.1.2",
25-
"@lifeomic/lambda-tools": "^5.1.1",
26-
"ava": "^1.1.0",
27-
"coveralls": "^3.0.2",
28-
"eslint": "^5.4.0",
29-
"luxon": "^1.3.3",
30-
"nyc": "^13.1.0",
31-
"rxjs": "^6.2.2",
32-
"sinon": "^6.1.5",
33-
"uuid": "^3.3.2"
34-
},
35-
"ava": {
36-
"failWithoutAssertions": false,
37-
"files": [
38-
"test/**/*.test.js"
39-
]
40-
},
41-
"eslintConfig": {
42-
"extends": "plugin:@lifeomic/node/recommended"
43-
},
44-
"nyc": {
45-
"branches": 100,
46-
"check-coverage": true,
47-
"functions": 100,
48-
"lines": 100,
49-
"statements": 100
50-
},
51-
"publishConfig": {
52-
"access": "public"
53-
},
54-
"peerDependencies": {
55-
"rxjs": "^6.2.2"
56-
},
57-
"dependencies": {
58-
"lodash": "^4.17.11"
27+
"@lifeomic/eslint-config-standards": "^2.1.1",
28+
"@lifeomic/jest-config": "^1.1.2",
29+
"@lifeomic/typescript-config": "^1.0.3",
30+
"@types/jest": "^27.4.1",
31+
"eslint": "^8.9.0",
32+
"eslint-config-prettier": "^8.4.0",
33+
"jest": "^27.5.1",
34+
"prettier": "^2.5.1",
35+
"ts-jest": "^27.1.3",
36+
"typescript": "^4.5.5"
5937
}
6038
}

prettier.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
trailingComma: 'all',
3+
arrowParens: 'always',
4+
singleQuote: true,
5+
};

release.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
branches: ['master'],
3+
plugins: [
4+
['@semantic-release/commit-analyzer', { preset: 'conventionalcommits' }],
5+
['@semantic-release/npm', { pkgRoot: 'dist/' }],
6+
[
7+
'@semantic-release/github',
8+
{
9+
// Setting this to false disables the default behavior
10+
// of opening a GitHub issue when a release fails.
11+
// We have other methods of tracking these failures.
12+
failComment: false,
13+
},
14+
],
15+
],
16+
};

0 commit comments

Comments
 (0)