Skip to content

Commit 1e515c0

Browse files
committed
chore: build refactor and jest testing support
- bring build closer to upstream verdaccio model - move build from lib/ to build/ - add support for adding jest tests
1 parent 2286079 commit 1e515c0

28 files changed

+3662
-6181
lines changed

.babelrc

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
{
2-
"presets": [
3-
["env", {
4-
"targets": {
5-
"node": "6"
6-
}
7-
}], "flow"
8-
]
2+
"env": {
3+
"test": {
4+
"presets": [
5+
["env", {
6+
"targets": { "node": "current" }
7+
}],
8+
"flow"
9+
],
10+
"plugins": []
11+
},
12+
"registry": {
13+
"presets": [
14+
["env", {
15+
"targets": { "node": "current" }
16+
}],
17+
"flow"
18+
],
19+
"plugins": []
20+
},
21+
"registry-docker": {
22+
"presets": [
23+
["env", {
24+
"targets": { "node": "10" }
25+
}],
26+
"flow"
27+
],
28+
"plugins": []
29+
},
30+
"development": {}
31+
}
932
}

.eslintignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules/
2-
lib/
2+
build/
33
flow-typed/
4+
coverage/
5+
tests-report/

.eslintrc.yml

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
env:
22
es6: true
33
node: true
4-
parser: babel-eslint
5-
extends:
6-
- eslint:recommended
7-
- plugin:flowtype/recommended
4+
jest: true
85
plugins:
9-
- flowtype
6+
- flowtype
7+
- jest
8+
extends:
9+
- "eslint:recommended"
10+
- "plugin:flowtype/recommended"
11+
- "plugin:jest/recommended"
12+
parser: babel-eslint
1013
parserOptions:
11-
sourceType": module
12-
ecmaVersion": 6
14+
sourceType: module
15+
ecmaVersion: 6
1316
ecmaFeatures:
1417
impliedStrict: true
1518
jsx: true
@@ -19,15 +22,14 @@ rules:
1922
no-fallthrough: 2
2023
no-new-require: 2
2124
max-len:
22-
- 2
23-
- 160
25+
- 2
26+
- 160
2427
camelcase: 0
2528
require-jsdoc: 0
2629
valid-jsdoc: 0
2730
prefer-spread: 1
2831
prefer-rest-params: 1
2932
linebreak-style: 0
3033
quote-props:
31-
- "error"
32-
- "as-needed"
33-
34+
- error
35+
- as-needed

.flowconfig

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[ignore]
22
.*/node_modules/.*
33
.*/.vscode/.*
4-
.*/lib/.*
4+
.*/build/.*
55

66
[libs]
77
node_modules/@verdaccio/types/lib/
@@ -10,3 +10,4 @@ node_modules/@verdaccio/types/lib/
1010

1111
[options]
1212
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
13+
module.ignore_non_literal_requires=true

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22
npm-debug.log
3-
lib/
3+
build/
4+
coverage/
5+
tests-report/

.npmignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*
22
!bin/*
3-
!lib/*.js
3+
!build/*.js

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ node_js:
66
script:
77
- yarn install
88
- commitlint-travis
9-
- yarn run license
10-
- yarn run lint
9+
- yarn license
10+
- yarn lint

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENV NODE_ENV=production \
88

99
RUN yarn config set registry $VERDACCIO_BUILD_REGISTRY && \
1010
yarn install --production=false && \
11-
yarn build && \
11+
yarn code:docker-build && \
1212
yarn cache clean && \
1313
yarn install --production=true --pure-lockfile
1414

@@ -20,15 +20,15 @@ LABEL maintainer="https://github.com/bufferoverflow/verdaccio-gitlab"
2020
# Go back to root to be able to install the plugin
2121
USER root
2222

23-
COPY --from=builder /opt/verdaccio-gitlab-build/lib /opt/verdaccio-gitlab/lib
23+
COPY --from=builder /opt/verdaccio-gitlab-build/build /opt/verdaccio-gitlab/build
2424
COPY --from=builder /opt/verdaccio-gitlab-build/package.json /opt/verdaccio-gitlab/package.json
2525
COPY --from=builder /opt/verdaccio-gitlab-build/node_modules /opt/verdaccio-gitlab/node_modules
2626

2727
ADD conf/docker.yaml /verdaccio/conf/config.yaml
2828

2929
# Inherited from parent image
3030
WORKDIR $VERDACCIO_APPDIR
31-
RUN ln -s /opt/verdaccio-gitlab/lib /verdaccio/plugins/verdaccio-gitlab
31+
RUN ln -s /opt/verdaccio-gitlab/build /verdaccio/plugins/verdaccio-gitlab
3232

3333
# Inherited from parent image
3434
USER $VERDACCIO_USER_UID

flow-typed/npm/babel-eslint_vx.x.x.js

-123
This file was deleted.

flow-typed/npm/babel-preset-env_vx.x.x.js

-88
This file was deleted.

flow-typed/npm/babel-preset-flow_vx.x.x.js

-32
This file was deleted.

0 commit comments

Comments
 (0)