Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
perf(*): implementaçao estável do travis, semantic-release e testes u…
Browse files Browse the repository at this point in the history
…nitários
  • Loading branch information
joaquimsn committed May 28, 2019
1 parent 4d706c7 commit 3465808
Show file tree
Hide file tree
Showing 11 changed files with 986 additions and 173 deletions.
566 changes: 566 additions & 0 deletions build/gtm/main.js

Large diffs are not rendered by default.

65 changes: 36 additions & 29 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
'use strict';

const gulp = require('gulp');
const concat = require('gulp-concat');
const beautify = require('gulp-beautify');
const include = require('gulp-include');
const strip = require('gulp-strip-comments');
const del = require('del');
var gulp = require('gulp');
var concat = require('gulp-concat');
var beautify = require('gulp-beautify');
var include = require('gulp-include');
var strip = require('gulp-strip-comments');
var del = require('del');
var replace = require('gulp-replace');

gulp.task('gtm-modules', () =>
gulp
.src(['./core/modules/*.js', './gtm/modules/*js'])
.pipe(concat('gtm-modules.js'))
.pipe(beautify({
indent_size: 2
}))
.pipe(strip())
.on('error', console.log)
.pipe(gulp.dest('./tmp'))
);
gulp.task('gtm-modules', function() {
return gulp.src(['./core/modules/*.js', './gtm/modules/*js'])
.pipe(replace(/module.exports[a-z-A-Z.]*\s*=\s*([a-zA-Z\-_]+;|([a-zA-Z\-_:.={},\n\s]+);+)/g, ''))
.pipe(concat('gtm-modules.js'))
.pipe(beautify({
indent_size: 2,
max_preserve_newlines: 2
}))
.pipe(strip())
.on('error', console.log)
.pipe(gulp.dest('./tmp'));
});

gulp.task('build-gtm', () =>
gulp
.src('./gtm/main.js')
.pipe(include({
includePaths: ['/tmp', '/gtm'].map(path => __dirname + path),
hardFail: true
}))
.on('error', console.log)
.pipe(gulp.dest('./build/gtm'))
);
gulp.task('build-gtm', function() {
return gulp.src('./gtm/main.js')
.pipe(replace(/module.exports\s*=\s*[a-zA-Z]+;/g, ''))
.pipe(include({
hardFail: true,
includePaths: [
__dirname + '/tmp',
__dirname + '/gtm',
]
}))
.on('error', console.log)
.pipe(gulp.dest('./build/gtm'));
});

gulp.task('clean', () => del(['./tmp']));
gulp.task('clean', function() {
return del(['./tmp']);
});

gulp.task('default', gulp.series(['clean', 'gtm-modules', 'build-gtm', 'clean']));
gulp.task('default', gulp.series(['clean', 'gtm-modules', 'build-gtm', 'clean']));
213 changes: 105 additions & 108 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,112 +1,109 @@
{
"name": "analytics-helper",
"version": "1.0.1",
"description": "> Biblioteca auxiliar para implementação dos Tag Managers da DP6.",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/joaquimsn/analytics-helper.git"
},
"author": "",
"contributors": [
{
"name": "Bruno Munhoz",
"email": "bpm1993@gmail.com"
"name": "analytics-helper",
"version": "1.0.1",
"description": "> Biblioteca auxiliar para implementação dos Tag Managers da DP6.",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/DP6/analytics-helper.git"
},
{
"name": "Paulo Brumatti",
"email": "paulo8624@gmail.com"
}
],
"license": "ISC",
"bugs": {
"url": "https://github.com/joaquimsn/analytics-helper/issues"
},
"homepage": "https://github.com/joaquimsn/analytics-helper#readme",
"scripts": {
"test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary --reporter=text mocha test/index.test.js",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"nyc": {
"check-coverage": true,
"per-file": true,
"lines": [
80,
99
"author": "",
"contributors": [
{
"name": "Bruno Munhoz",
"email": "bpm1993@gmail.com"
},
{
"name": "Paulo Brumatti",
"email": "paulo8624@gmail.com"
}
],
"statements": [
90,
99
],
"functions": [
90,
99
],
"branches": [
80,
99
],
"exclude": [
"build",
"documentation-images"
],
"include": [
"core/**/*.js",
"gtm/*.js",
"gtm/**/*.js"
],
"reporter": [
"lcov",
"text-summary",
"text"
],
"require": [
"@babel/register"
],
"sourceMap": false,
"instrument": false
},
"release": {
"branch": "master",
"verifyConditions": [
"@semantic-release/github"
],
"publish": [
"@semantic-release/github"
],
"prepare": [],
"success": [
"@semantic-release/github"
],
"fail": [
"@semantic-release/github"
]
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-plugin-istanbul": "^5.0.1",
"chai": "^4.1.2",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-beautify": "^2.0.1",
"gulp-concat": "^2.6.1",
"gulp-include": "^2.3.1",
<<<<<<< HEAD
"gulp-minify": "^2.1.0",
"gulp-replace": "^1.0.0",
=======
>>>>>>> 0f9f68c... Remoção de plugins sem uso
"gulp-strip-comments": "^2.5.2",
"gulp-sync": "^0.1.4",
"gulp-uglify": "^3.0.0",
"mocha": "^5.2.0",
"nyc": "^13.0.1",
"sonarqube-scanner": "^2.1.1"
},
"dependencies": {}
"license": "ISC",
"bugs": {
"url": "https://github.com/DP6/analytics-helper/issues"
},
"homepage": "https://github.com/DP6/analytics-helper#readme",
"scripts": {
"test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary --reporter=text mocha test/index.test.js",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"nyc": {
"check-coverage": true,
"per-file": true,
"lines": [
80,
99
],
"statements": [
90,
99
],
"functions": [
90,
99
],
"branches": [
80,
99
],
"exclude": [
"build",
"documentation-images"
],
"include": [
"core/**/*.js",
"gtm/*.js",
"gtm/**/*.js"
],
"reporter": [
"lcov",
"text-summary",
"text"
],
"require": [
"@babel/register"
],
"sourceMap": false,
"instrument": false
},
"release": {
"branch": "master",
"verifyConditions": [
"@semantic-release/github"
],
"publish": [
"@semantic-release/github"
],
"prepare": [],
"success": [
"@semantic-release/github"
],
"fail": [
"@semantic-release/github"
]
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-plugin-istanbul": "^5.0.1",
"chai": "^4.1.2",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"del": "^3.0.0",
"gulp": "^4.0.0",
"gulp-beautify": "^2.0.1",
"gulp-concat": "^2.6.1",
"gulp-include": "^2.3.1",
"gulp-minify": "^2.1.0",
"gulp-replace": "^1.0.0",
"gulp-strip-comments": "^2.5.2",
"gulp-uglify": "^3.0.0",
"jsdom": "^13.0.0",
"mocha": "^5.2.0",
"nyc": "^13.0.1",
"sonarqube-scanner": "^2.1.1"
},
"dependencies": {}
}
14 changes: 14 additions & 0 deletions test/core/modules/closet.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

const expect = require('chai').expect;
const closet = require('../../.././core/modules/closet.js');

describe('Core', () => {
describe('Modules', () => {
describe('.closest(elm, seletor)', () => {
it('should export a function', () => {
expect(closet).to.be.a('function');
});
});
});
});
20 changes: 20 additions & 0 deletions test/core/modules/cookie.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

const expect = require('chai').expect;
const cookie = require('../../.././core/modules/cookie.js');

describe('Core', () => {
describe('Modules', () => {
describe('.cookie(name, value, opts)', () => {
it('should export a function', () => {
expect(cookie.cookie).to.be.a('function');
});
});

describe('.getCookie(key)', () => {
it('should export a function', () => {
expect(cookie.setCookie).to.be.a('function');
});
});
});
});
20 changes: 10 additions & 10 deletions test/core/modules/has.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const expect = require('chai').expect;
const has = require('../../.././core/modules/has.js');

describe('Core', () => {
describe('Modules', () => {
describe('.has(obj, key)', () => {
it('should export a function', () => {
expect(has).to.be.a('function');
});

it('should return true if object has attribute with name of the key', () => {
expect(has({ name: 'foo' }, 'name')).true;
});
});
describe('Modules', () => {
describe('.has(obj, key)', () => {
it('should export a function', () => {
expect(has).to.be.a('function');
});

it('should return true if object has attribute with name of the key', () => {
expect(has({ name: 'foo' }, 'name')).true;
});
});
});
});
Loading

0 comments on commit 3465808

Please sign in to comment.