-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
84 lines (74 loc) · 3.43 KB
/
Copy pathgulpfile.js
File metadata and controls
84 lines (74 loc) · 3.43 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
/*
The gulpfile for WCM-embedded WRP web apps using the core library combined with bower and gulp.
You shouldn't have to change this file much, but you could if you wanted.
Note that this file uses es6 syntax.
http://gulpjs.com/
*/
const gulp = require('gulp');
const core = require('./bower_components/core/gulp_helper');
const pkg = require('./package.json');
var ghPages = require('gulp-gh-pages');
//You should pass options to the createTasks method below
let options = {
pkg, //pass in the contents of package.json
//How this app should be embedded in the simulator. Options are: 'full', 'left', or 'right'
//This is optional, and the default value is 'full'
//This only applies to apps where isEmbedded is true
embedArea: 'full',
//If you want to add vars to the preprocessor context, include this option
//You can add environment-specific vars or general vars
preprocessorContext: {
local: {
SOME_ENV: 'SOME_ENV will have this value in the local build environment'
},
dev: {
SOME_ENV: 'SOME_ENV will have this value in the dev build environment'
},
qa: {
SOME_ENV: 'SOME_ENV will have this value in the qa build environment'
},
prod: {
SOME_ENV: 'SOME_ENV will have this value in the prod build environment'
},
SOME_OTHER_ENV: 'this var will be in the context of any environment'
},
//If you want to override the environment that the build process uses, specify it here
//Valid values are: 'local', 'dev', 'qa', 'prod'
//If you omit this (which you probably should), then the environment will be:
//'local' when running or building on your machine
//'dev' when calling gulp deploy:dev
//'qa' when calling gulp deploy:qa
//'prod' when calling gulp deploy:prod
environmentOverride: null,
//By default, standalone apps are built to deploy to /webapps/appname
//BUT you can use this option to override that value. ex: /webapps/work/decom/appname
//IMPORTANT!! this value should NOT end with a forward slash
//This option has no effect on embedded apps, which are always deployed to /resources/app_name
//The value used here will also be used for the SRC_PATH preprocessor var
deploymentPath: null
};
//This creates several gulp tasks to use during development:
//default, clean, build, build_with_simulator, run, deploy:dev, deploy:qa, deploy:prod
core.embeddedApp.createTasks(gulp, options);
gulp.task('gh-deploy', function() {
return gulp.src('dist/**/*')
.pipe(ghPages());
});
//Note that you can override any task that createTasks added, by redefining it after the call to createTasks
//ex:
// gulp.task('deploy:dev', ['_deploy_prep'], () => {
// ...do some custom deploy code...
// });
//FAKING DATA AND CONFIG FILES:
//Some apps will load data and configurations from 'data' files, usually JSON.
//The location of these files in Dev, QA, and Prod may vary:
//- Could be in the S3 data bucket
//- Could be in a custom Wordpress post
//To 'fake' this when running your app locally, do the following:
// 1. Put some sample data/config files into /src/data folder in the project
// 2. Overwrite the _data gulp task here to copy your data files into a file path that mimics the one on your web server:
// gulp.task('_data', () => {
// let myDataPath = '/data'; //On S3, this will be something like /data/division/my_app
// //On WP, this will be something different
// return gulp.src(['src/data/**/*']).pipe(gulp.dest('dist' + myDataPath));
// });