Skip to content

Commit 1e6c9d9

Browse files
authored
Closes #57, npm audit fix (#58)
* add codefresh * fix several security vulnerabilities in dependencies
1 parent 5445d2a commit 1e6c9d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6619
-7446
lines changed

.dockerignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# coverage
2+
# npm-debug.log
3+
# .vscode
4+
# .jest-test-results.json
5+
# .git
6+
# CNAME
7+
# dist
8+
# pids
9+
# *.pid
10+
# *.seed
11+
# *.pid.lock
12+
# .DS_Store
13+
# lib-cov
14+
# node_modules
15+
# .babel-cache
16+
# docs

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ npm-debug.log*
77
# Build deps
88
.jest-test-results.json
99

10-
# Website
11-
out*
12-
1310
# Runtime data
1411
pids
1512
*.pid

.npmignore

-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ docs/
77
rollup.config.*
88
.*
99
CNAME
10-
index.html

Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM node:10.15.0-alpine AS builder
2+
3+
WORKDIR /app
4+
5+
COPY package.json /app
6+
7+
# Install git required for codecov and chromatic cli's
8+
RUN apk --no-cache add git
9+
10+
# Create the .npmrc file
11+
RUN echo ${NPMRC} | base64 -d > .npmrc
12+
13+
# Creating tar of productions dependencies
14+
RUN npm i && cp -rp ./node_modules /tmp/node_modules
15+
16+
# Copying application code
17+
COPY . /app
18+
19+
# Install CodeClimate Test Coverage Reporter
20+
RUN apk --no-cache add curl
21+
RUN curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > "/usr/bin/cc-test-reporter" && chmod +x "/usr/bin/cc-test-reporter" && cp -p /usr/bin/cc-test-reporter /tmp/cc-test-reporter
22+
23+
#FROM node:10.15.0-alpine AS runner
24+
25+
# Expose Storybook port
26+
EXPOSE 6006
27+
WORKDIR /app
28+
29+
# Adding production dependencies to image
30+
# COPY --from=builder /tmp/node_modules /app/node_modules
31+
32+
# Copy Apps (Git and CodeCov)
33+
# COPY --from=builder /tmp/ /usr/bin/
34+
35+
# Copying application code
36+
# COPY . /app
37+
38+
CMD npm run build

README.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# React Command Palette
33
WAI-ARIA compliant React command palette like the one in Atom and Sublime
44

5+
[![Codefresh build status]( https://g.codefresh.io/api/badges/pipeline/asabaylus/asabaylus%2Freact-command-palette%2Freact_command_palette?branch=master&key=eyJhbGciOiJIUzI1NiJ9.NWMzNjdiYTlhODU5MTAxOWFjOTdkNDEz.qLcoo1kugnvaRfNdM5ujH-bELwuU6KGPe65RB-tdlVk&type=cf-1)]( https://g.codefresh.io/pipelines/react_command_palette/builds?repoOwner=asabaylus&repoName=react-command-palette&serviceName=asabaylus%2Freact-command-palette&filter=trigger:build~Build;branch:master;pipeline:5c3e788ab131c1ebb82e699d~react_command_palette)
56
[![Codeship Status for asabaylus/react-command-palette](https://app.codeship.com/projects/f7cc0a30-3533-0135-cd98-56b308955afb/status?branch=master)](https://app.codeship.com/projects/227053)
67
[![codecov](https://codecov.io/gh/asabaylus/react-command-palette/branch/master/graph/badge.svg)](https://codecov.io/gh/asabaylus/react-command-palette)
78
[![Maintainability](https://api.codeclimate.com/v1/badges/761754992fe0cd293c40/maintainability)](https://codeclimate.com/github/asabaylus/react-command-palette/maintainability)
@@ -114,5 +115,34 @@ $ npm run dev
114115
$ npm run build-storybook
115116
```
116117

118+
## Building with Docker
119+
Build and tag the Docker image:
120+
```
121+
$ docker build -t react-command-palette .
122+
```
123+
124+
Then, spin up the container once the build is done:
125+
```
126+
$ docker run -it \
127+
-v ${PWD}:/usr/src/app \
128+
-v /usr/src/app/node_modules \
129+
-p 6006:6006 \
130+
npm i && npm run dev
131+
```
132+
You only need to run "npm i" the when the container is first created. The devDependencies need to be installed to compile and test the build during development. On subsequent builds run:
133+
```
134+
$ docker run -it \
135+
-v ${PWD}:/usr/src/app \
136+
-v /usr/src/app/node_modules \
137+
-p 6006:6006 \
138+
npm run dev
139+
```
140+
141+
Open your browser to http://localhost:6006/ and you should see the app. Try making a change to the command-palette component within your code editor. You should see the app hot-reload. Kill the server once done.
142+
143+
### Package for production with Docker:
144+
CodeFresh.io will autmatically run this build to prepare the package
145+
for publication to npm whenever a pull request is merged to master.
146+
117147
## Sponsors
118-
Visual Regression Tests by [ChromaticQA](https://www.chromaticqa.com/)
148+
Visual Regression Tests by [ChromaticQA](https://www.chromaticqa.com/)

codefresh.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: '1.0'
2+
steps:
3+
BuildingDockerImage:
4+
title: Build Docker Image
5+
type: build
6+
image_name: asabaylus/reactcommandpalette
7+
working_directory: ./
8+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
9+
dockerfile: Dockerfile
10+
build_arguments:
11+
- CF_BRANCH=${{CF_BRANCH}}
12+
- NPM_TOKEN=${{NPM_TOKEN}}
13+
UnitTest:
14+
title: Jest
15+
image: ${{BuildingDockerImage}}
16+
working_directory: /app
17+
commands:
18+
- npm test
19+
Lint:
20+
title: ESlint
21+
image: ${{BuildingDockerImage}}
22+
working_directory: /app
23+
commands:
24+
- npm run lint
25+
VisualRegression:
26+
title: Chromatic
27+
image: ${{BuildingDockerImage}}
28+
working_directory: /app
29+
build_arguments:
30+
- CHROMATIC_APP_CODE=${{CHROMATIC_APP_CODE}}
31+
commands:
32+
- npm run prebuild:storybook
33+
- npm run chromatic
34+
Coverage:
35+
title: CodeCov & CodeClimate Coverage
36+
image: ${{BuildingDockerImage}}
37+
working_directory: /app
38+
build_arguments:
39+
- CC_TEST_REPORTER_ID=${{CC_TEST_REPORTER_ID}}
40+
commands:
41+
- ./node_modules/.bin/codecov
42+
# - cc-test-reporter after-build -t lcov --prefix "/codefresh/volume/react-command-palette" --exit-code $?
43+
PublishNPM:
44+
title: Publish to NPM
45+
image: ${{BuildingDockerImage}}
46+
working_directory: /app
47+
build_arguments:
48+
- NPM_TOKEN=${{NPM_TOKEN}}
49+
commands:
50+
- npm publish --dry-run
51+
when:
52+
branch:
53+
only:
54+
- master

docs/iframe.html

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><base target="_parent"><style>:not(.sb-show-main) > .sb-main,
1+
<!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><meta name="viewport" content="width=device-width,initial-scale=1"><base target="_parent"><style>:not(.sb-show-main) > .sb-main,
22
:not(.sb-show-nopreview) > .sb-nopreview,
33
:not(.sb-show-errordisplay) > .sb-errordisplay {
4-
display: none;
4+
display: none;
55
}
66

77
.sb-wrapper {
@@ -48,13 +48,14 @@
4848
font-size: 14px;
4949
width: 100vw;
5050
overflow: auto;
51-
}</style><script>try {
51+
}</style><script>/* globals window */
52+
/* eslint-disable no-underscore-dangle */
53+
try {
5254
if (window.parent !== window) {
5355
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
5456
window.__VUE_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
5557
}
5658
} catch (e) {
59+
// eslint-disable-next-line no-console
5760
console.warn('unable to connect to parent frame for connecting dev tools');
58-
}</script></head><body><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the storybook config.</li><li>Try reloading the page.</li></ul></div></div><div class="sb-errordisplay sb-wrapper"><div id="error-message" class="sb-heading"></div><pre class="sb-errordisplay_code">
59-
<code id="error-stack"></code>
60-
</pre></div><div id="root"></div><script src="runtime~main.cbc6baa1bb88c6d5c1b1.bundle.js"></script><script src="vendors~main.cbc6baa1bb88c6d5c1b1.bundle.js"></script><script src="main.cbc6baa1bb88c6d5c1b1.bundle.js"></script></body></html>
61+
}</script></head><body><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the Storybook config.</li><li>Try reloading the page.</li></ul><p>If the problem persists, check the browser console, or the terminal you've run Storybook from.</p></div></div><div class="sb-errordisplay sb-wrapper"><div id="error-message" class="sb-heading"></div><pre class="sb-errordisplay_code"><code id="error-stack"></code></pre></div><div id="root"></div><script src="runtime~main.2bf26010cfd559e04d8b.bundle.js"></script><script src="vendors~main.2bf26010cfd559e04d8b.bundle.js"></script><script src="main.2bf26010cfd559e04d8b.bundle.js"></script></body></html>

docs/index.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
<!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><style>html, body {
1+
<!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><meta name="viewport" content="width=device-width,initial-scale=1"><style>html, body {
22
overflow: hidden;
33
height: 100%;
44
width: 100%;
55
margin: 0;
66
padding: 0;
7-
}</style><script>try {
7+
}</style><script>/* globals window */
8+
/* eslint-disable no-underscore-dangle */
9+
try {
810
if (window.parent !== window) {
911
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
1012
window.__VUE_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
1113
}
1214
} catch (e) {
15+
// eslint-disable-next-line no-console
1316
console.warn('unable to connect to parent frame for connecting dev tools');
14-
}</script></head><body><div id="root"></div><script src="/sb_dll/storybook_ui_dll.js"></script><script src="runtime~main.729a62daeea60911f9f0.bundle.js"></script><script src="vendors~main.0e31423da3a604242b15.bundle.js"></script><script src="main.0e777b5dc57c1c727d67.bundle.js"></script></body></html>
17+
}</script></head><body><div id="root"></div><script src="runtime~main.6ac4c33d73ae9704bbb9.bundle.js"></script><script src="vendors~main.a54d446d916e9cdaa820.bundle.js"></script><script src="main.3dd87f6ba79754fb6de4.bundle.js"></script></body></html>

docs/main.207c2388cd65a77d984e.bundle.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.2a4f77d5a050b16116a0.bundle.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.2a4f77d5a050b16116a0.bundle.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.2bf26010cfd559e04d8b.bundle.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.2bf26010cfd559e04d8b.bundle.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.2ef7732a1856cfaac655.bundle.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.2ef7732a1856cfaac655.bundle.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.3dd87f6ba79754fb6de4.bundle.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/runtime~main.2a4f77d5a050b16116a0.bundle.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/runtime~main.2a4f77d5a050b16116a0.bundle.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)