forked from po-ui/po-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
57 lines (46 loc) · 2.22 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const { dest, parallel, series, src, task } = require('gulp');
const { replaceVersionPlaceholders } = require('./tools/version-replace');
const argv = require('yargs').argv;
const path = require('path');
const run = require('gulp-run');
const sonarqubeScanner = require('sonarqube-scanner');
/** Folders definitions */
const rootFolder = path.join(__dirname, './');
const distFolder = path.resolve(rootFolder, './dist');
const uiFolder = path.resolve(rootFolder, './projects/ui');
const schematicsFolder = path.resolve(uiFolder, './schematics');
const distSchematicsFolder = path.resolve(rootFolder, './dist/portinari-ui/schematics');
/** REPLACE VERSION: replace version of dist package.json to repo version */
const replaceVersion = () => src([`${rootFolder}/package.json`]).on('end', () => replaceVersionPlaceholders(distFolder));
/** SCHEMATICS */
const buildSchematics = () => run('npm run build:schematics').exec();
const copySchemas = () =>
src([`${schematicsFolder}/**/*/schema.json`])
.pipe(dest(distSchematicsFolder));
const copyFiles = () =>
src([`${schematicsFolder}/ng-generate/*/files/**`])
.pipe(dest(`${distSchematicsFolder}/ng-generate`));
const copyCollection = () =>
src([`${schematicsFolder}/collection.json`])
.pipe(dest(distSchematicsFolder));
/** SONAR */
const sonarqube = task('sonarqube', function (callback) {
const token = argv.token || '';
sonarqubeScanner({
serverUrl: "http://sonarqube.po.portinari.com.br",
token: token,
options: { // Documentation: https://docs.sonarqube.org/display/SONAR/Analysis+Parameters
"sonar.projectKey": "portinari-ui",
"sonar.projectName": "portinari-ui",
"sonar.projectVersion": "1.0",
"sonar.test.inclusions": `projects/kendo/**/*.spec.ts`,
"sonar.test.exclusions": `projects/kendo/**/*.spec.ts`,
"sonar.exclusions": `projects/kendo/**/samples/**,index.ts,projects/kendo/**/*.js,projects/kendo/**/*.json,.*,projects/kendo/node_modules`,
"sonar.typescript.lcov.reportPaths": `projects/kendo/coverage/lcov.info`
}
}, callback);
});
/** Exported Functions */
exports.sonarqube = sonarqube;
exports.replaceVersion = replaceVersion;
exports.schematics = series(buildSchematics, parallel(copyCollection, copySchemas, copyFiles));