Skip to content

Commit

Permalink
feat(update): update to webpack 4, change mocha by jest
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Roiback committed Jul 30, 2019
1 parent 8a21541 commit 8f36fea
Show file tree
Hide file tree
Showing 28 changed files with 17,295 additions and 10,546 deletions.
10 changes: 7 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"presets": ["es2015", "react"],
"presets": [
"react",
"env"
],
"plugins": [
"add-module-exports"
]
"transform-runtime",
"transform-object-rest-spread"
],
}
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/dist/**
**/deploy/**
**/node_modules/**
**/coverage/**
webpack.config*.js
webpack.*.js
39 changes: 27 additions & 12 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,37 +1,52 @@
{
"extends": "airbnb-base",

"parser": "babel-eslint",

"env": {
"browser": true,
"node": true
},

"globals": {
"describe": false,
"it": false,
"before": false,
"beforeEach": false,
"after": false
},

"plugins": [
"react"
],

"rules": {
// Override any settings from the "parent" configuration
"no-console": "off",
"max-len": ["error", 120],
"max-len": [
"error",
120
],
"padded-blocks": "off",
"no-use-before-define": ["error", "nofunc"],
"comma-dangle": ["error", "never"],
"no-use-before-define": [
"error",
"nofunc"
],
// Code quality
"complexity": ["error", 5],
"max-params": ["error", 3],
"max-statements": ["error", 10],
"indent": ["error", 4],
"complexity": [
"error",
5
],
"max-params": [
"error",
3
],
"max-statements": [
"error",
10
],
"indent": [
"error",
4
],
"class-methods-use-this": [
"off"
],
"react/jsx-uses-react": 2, // Prevent React to be incorrectly marked as unused
"react/jsx-uses-vars": 2 // Prevent variables used in JSX to be incorrectly marked as unused
}
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ dist
.history

# MAC
.DS_Store
.DS_Store

deploy/builds

stats.json
59 changes: 49 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,69 @@
image: jramcast/node-openjdk
image: node:10-alpine

stages:
- test
- quality
- deploy

variables:
SONAR_URL: 'http://sonarqube.services.prod.roiback:9000'
SONAR_LOGIN: '56b121aa8ef455cea81c9088cf0bd102c8fc314e'

cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- sonar-scanner-2.6.1/

lint:
stage: test
script:
- npm install
- npm ci
- npm run lint

unit_tests:
stage: test
script:
- npm install
- npm test
- npm run check-coverage
- "[ -d sonar-scanner-2.6.1 ] || curl --insecure -OL https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-2.6.1.zip"
- "[ -d sonar-scanner-2.6.1 ] || unzip sonar-scanner-2.6.1.zip"
- ./sonar-scanner-2.6.1/bin/sonar-scanner -Dsonar.host.url=http://registry.roiback.com:9000
- npm ci
- npm run test:ci
artifacts:
paths:
- coverage
expire_in: 1 day



publish:
stage: deploy
script:
- npm install
- npm ci
- npm run dist
- npm publish
only:
- tags
- triggers


sonar-quality-gate:
image: jramcast/gitlab-ci-sonarqube
stage: quality
script:
# Publica report en sonarqube y Chequea si pasamos el quality gate
- sonar-scanner -Dsonar.projectVersion=${CI_COMMIT_SHA}
# No está claro todavía como vamos a configurar los quality gates de sonarqube para que fallen
# Así que de momento, prefiero no bloquear los pipelines
allow_failure: true


sonar-comments:
image: jramcast/gitlab-ci-sonarqube
stage: quality
except:
- master
script:
# Añade comentarios en Gitlab con los issues encontrados (sin publicar report).
# Para esto es necesario configurar el Gitlab User Token en la config del proyecto
# http://sonarqube.services.prod.roiback:9000/project/settings?category=gitlab&id=bookcore_client
- sonar-scanner-preview -Dsonar.projectVersion=${CI_COMMIT_SHA}
# No está claro todavía como vamos a configurar los fallos de sonarqube
# Así que de momento, prefiero no bloquear los pipelines
allow_failure: true
9 changes: 6 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ dist/stats.hml
coverage
test
example
webpack.config.dev.js
webpack.config.dist.js
webpack.dev.js
webpack.common.js
webpack.deploy.js
webpack.prod.js
postcss.config.js
.babelrc
.eslintignore
.eslintrc
Expand All @@ -14,4 +17,4 @@ webpack.config.dist.js
.idea
.vscode
sonar-scanner-2.6.1
sonar-scanner-2.6.1.zip
sonar-scanner-2.6.1.zip
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Siempre debe finalizar con @content para extender desde los demas ficheros los e
$screen-md: $screen_md, // variable librería o proyecto
){
%mainclass{
display: flex;
display: flex;
&-sub{
border: $border
width: 100%;
Expand Down
2 changes: 0 additions & 2 deletions contributors.txt

This file was deleted.

15 changes: 15 additions & 0 deletions deploy/deploy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>skeleton css component deployed</title>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
<div id="content"></div>
</body>

</html>
24 changes: 24 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
setupTestFrameworkScriptFile: '<rootDir>test/setup.js',
collectCoverage: true,
coverageDirectory: 'coverage/',
coverageReporters: ['lcov', 'text'],
collectCoverageFrom: ['src/**/*.(js|jsx)'],
coverageThreshold: {
global: {
branches: 70,
functions: 50,
lines: 50,
statements: -10,
},
},
testMatch: ['<rootDir>/test/*test.js'],
transform: {
'^.+\\.(js|jsx)$': 'babel-jest',
},
verbose: true,
transformIgnorePatterns: ['/node_modules/(?!roi-.*)'],
moduleNameMapper: {
'.svg': '<rootDir>/test/__mocks__/fileMock.js',
},
};

0 comments on commit 8f36fea

Please sign in to comment.