-
Notifications
You must be signed in to change notification settings - Fork 8.3k
/
versionedLinks.js
32 lines (25 loc) · 1.01 KB
/
versionedLinks.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
module.exports = function (grunt) {
let { basename, resolve } = require('path');
let { forOwn } = require('lodash');
let exec = require('../utils/exec').silent;
grunt.registerTask('_build:versionedLinks', function () {
let rootPath = grunt.config.get('root');
let buildFiles = grunt.file.expand('build/kibana/{*,.*}')
.map(function (file) {
return resolve(rootPath, file);
});
//We don't want to build os packages with symlinks
let transferFiles = (source, link) => grunt.option('os-packages')
? exec('cp', ['-r', source, link])
: exec('ln', ['-s', source, link]);
grunt.config.get('platforms').forEach(function (platform) {
grunt.file.mkdir(platform.buildDir);
// link all files at the root of the build
buildFiles.forEach(function (source) {
transferFiles(source, resolve(platform.buildDir, basename(source)));
});
// link the node modules
transferFiles(platform.nodeDir, resolve(platform.buildDir, 'node'));
});
});
};