-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathgulp.config.js
More file actions
143 lines (136 loc) · 4.52 KB
/
gulp.config.js
File metadata and controls
143 lines (136 loc) · 4.52 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
var source = './src/',
moduleName = 'orderCloud',
assets = 'assets/',
build = './build/',
bowerFiles = './bower_components/',
npmFiles = './node_modules',
compile = './compile/',
index = 'index.html',
root = __dirname,
gulp_dir = './gulp/',
fs = require('fs');
try {
var saasConfig = require(source + 'app/saas/gulp.config');
} catch(ex) {
var saasConfig = {};
}
module.exports = {
moduleName: moduleName,
saas: saasConfig,
bowerFiles: bowerFiles,
npmFiles: npmFiles,
src: source,
build: build,
compile: compile,
assets: assets,
appCss: assets + 'styles/',
appFonts: assets + 'fonts/',
appImages: assets + 'images/',
root: root,
gulp: gulp_dir,
index: source + index,
styles: [
source + '**/*.css',
source + '**/*.less'
],
templates: [
'!' + source + index,
source + 'app/**/*.html'
],
scripts: [
source + 'app/**/*.js',
'!' + source + '**/saas/gulp.config.js',
'!' + source + '**/*.spec.js',
'!' + source + '**/*.test.js'
],
appFiles: [
build + '**/saas.module.js',
build + '**/saas/**/*.js',
'!' + build + '**/saas/gulp.config.js',
build + '**/app.module.js',
build + '**/common/config/**/routing.js',
build + '**/common/config/**/*.js',
build + '**/*s.config.js',
build + '**/*.config.js',
build + '**/app.run.js',
build + '**/app.controller.js',
build + '**/*.js',
build + '**/*.css',
source + '**/*.css'
],
wrapper: {
header: '(function() {\n"use strict";\n',
footer: '}());'
},
templateCacheSettings: {
standalone: false,
moduleSystem: 'IIFE',
module: moduleName
},
ngConstantSettings: {
name: moduleName,
deps: false,
constants: saasConfig.getConstants ? saasConfig.getConstants() : getConstants()
},
autoprefixerSettings: {
browsers: ['last 2 versions'],
cascade: true
},
jsCache: 'jsscripts',
indentSize: 4,
checkBootswatchTheme: _checkBootswatchTheme
};
function getConstants() {
var result = {};
var constants = JSON.parse(fs.readFileSync(source + 'app/app.constants.json'));
var environment = process.env.environment || constants.environment;
switch (environment) {
case 'local':
result.authurl = 'http://core.four51.com:11629';
result.apiurl = 'http://core.four51.com:9002';
break;
case 'qa':
result.authurl = 'https://qaauth.ordercloud.io';
result.apiurl = 'https://qaapi.ordercloud.io';
break;
case 'staging':
result.authurl = 'https://stagingauth.ordercloud.io';
result.apiurl = 'https://stagingapi.ordercloud.io';
break;
default:
result.authurl = 'https://auth.ordercloud.io';
result.apiurl = 'https://api.ordercloud.io';
break;
}
if (process.env.apiurl && process.env.authurl) {
result.authurl = process.env.authurl;
result.apiurl = process.env.apiurl;
}
else if (!environment && !process.env.apiurl && !process.env.authurl) {
result.authurl = 'https://auth.ordercloud.io/oauth/token';
result.apiurl = 'https://api.ordercloud.io';
}
if (process.env.clientid) result.clientid = process.env.clientid;
if (process.env.appname) result.appname = process.env.appname;
if (process.env.scope) result.scope = process.env.scope;
if (process.env.ocscope) result.ocscope = process.env.ocscope;
if (process.env.html5mode) result.html5mode = process.env.html5mode;
if (process.env.bootswatchtheme) result.bootswatchtheme = process.env.bootswatchtheme;
if (process.env.awsaccesskeyid) result.awsaccesskeyid = process.env.awsaccesskeyid;
if (process.env.awssecretaccesskey) result.awssecretaccesskey = process.env.awssecretaccesskey;
if (process.env.awsregion) result.awsregion = process.env.awsregion;
if (process.env.awsbucket) result.awsbucket = process.env.awsbucket;
return result;
}
function _checkBootswatchTheme() {
var bootswatchBower = {};
var constants = JSON.parse(fs.readFileSync(source + 'app/app.constants.json'));
var theme = process.env.bootswatchtheme || constants.bootswatchtheme;
if (theme) {
bootswatchBower.main = [
'./' + theme + '/bootswatch.less',
'./' + theme + '/variables.less'
];
}
return bootswatchBower;
}