Skip to content

Commit 47dd7ff

Browse files
authored
Merge pull request #85 from mrsteele/feature/githubActions
fix: resolving security issues
2 parents e1454fe + 517deaf commit 47dd7ff

File tree

8 files changed

+3909
-44
lines changed

8 files changed

+3909
-44
lines changed

.github/workflows/main.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Main
2+
on: push
3+
4+
# TODO - Need to not repeat the checkout and setup node steps...
5+
6+
jobs:
7+
# Set the job key. The key is displayed as the job name
8+
# when a job name is not provided
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: 🛑 Cancel Previous Runs
13+
uses: styfle/cancel-workflow-action@0.6.0
14+
with:
15+
access_token: ${{ secrets.GITHUB_TOKEN }}
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: 12
24+
- uses: actions/checkout@v2
25+
- name: Install dependencies
26+
run: npm i
27+
- name: Check Security
28+
run: npm audit
29+
- uses: goto-bus-stop/standard-action@v1
30+
with:
31+
# optionally select a different, standard-like linter
32+
# linter: semistandard
33+
34+
# optionally select a different eslint formatter for the log output, default 'stylish'
35+
# formatter: tap
36+
37+
# limit the files to lint, default '**/*.js'
38+
# files: src/*.js
39+
40+
# show errors in the the github diff UI
41+
annotate: true
42+
43+
# Allow the action to add lint errors to the github diff UI
44+
env:
45+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
46+
test:
47+
name: Test Node v${{ matrix.node }}
48+
runs-on: ubuntu-18.04
49+
strategy:
50+
matrix:
51+
node: [ '10', '12', '14' ]
52+
steps:
53+
- name: 🛑 Cancel Previous Runs
54+
uses: styfle/cancel-workflow-action@0.6.0
55+
with:
56+
access_token: ${{ secrets.GITHUB_TOKEN }}
57+
- name: Checkout
58+
uses: actions/checkout@v2
59+
with:
60+
fetch-depth: 0
61+
- name: Setup Node.js
62+
uses: actions/setup-node@v2
63+
with:
64+
node-version: ${{ matrix.node }}
65+
- name: Install dependencies
66+
run: npm i
67+
- name: Test
68+
run: npm t
69+
release:
70+
name: Release
71+
runs-on: ubuntu-18.04
72+
needs: [
73+
test,
74+
lint
75+
]
76+
steps:
77+
- name: 🛑 Cancel Previous Runs
78+
uses: styfle/cancel-workflow-action@0.6.0
79+
with:
80+
access_token: ${{ secrets.GITHUB_TOKEN }}
81+
- name: Checkout
82+
uses: actions/checkout@v2
83+
with:
84+
fetch-depth: 0
85+
- name: Setup Node.js
86+
uses: actions/setup-node@v2
87+
with:
88+
node-version: 12
89+
- name: Build
90+
run: npm i
91+
- name: 🚀 Release
92+
uses: cycjimmy/semantic-release-action@v2
93+
with:
94+
semantic_version: 17
95+
branches: |
96+
[
97+
'master'
98+
]
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

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

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ A way to truncate a json object. Useful for circular referenced objects.
55
## Status
66

77
[![npm](https://img.shields.io/npm/v/json-truncate.svg?maxAge=0&style=flat)](https://www.npmjs.com/package/json-truncate)
8-
[![Travis](https://travis-ci.org/mrsteele/json-truncate.svg?branch=master)](https://travis-ci.org/mrsteele/json-truncate)
9-
[![codecov](https://codecov.io/gh/mrsteele/json-truncate/branch/master/graph/badge.svg)](https://codecov.io/gh/mrsteele/json-truncate)
8+
[![Main](https://github.com/mrsteele/json-truncate/actions/workflows/main.yml/badge.svg)](https://github.com/mrsteele/json-truncate/actions/workflows/main.yml)
109
[![Dependency Status](https://david-dm.org/mrsteele/json-truncate.svg)](#)
1110
[![devDependency Status](https://david-dm.org/mrsteele/json-truncate/dev-status.svg)](https://david-dm.org/mrsteele/json-truncate#info=devDependencies)
1211
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

json-truncate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const truncate = (obj, options = {}, curDepth = 0) => {
3131
return obj
3232
} else if (Array.isArray(obj)) {
3333
const newArr = []
34-
obj.map(value => {
34+
obj.forEach(value => {
3535
if (isFlat(value)) {
3636
newArr.push(value)
3737
} else {

0 commit comments

Comments
 (0)