Skip to content

Commit 4c42fa1

Browse files
authored
Merge pull request #178 from artemv/https-dev-mode
feat(dev): support https dev mode with EgisUI and plugins
2 parents ca6f13a + 69752d8 commit 4c42fa1

5 files changed

Lines changed: 32 additions & 3 deletions

File tree

Gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ gulp.task('test', function() {});
3939

4040
gulp.task('dev-package', devPackageTaskDeps, pack);
4141

42-
gulp.task('watch', ['dev-package', 'dev-bundle-tests', 'webserver'], function() {
42+
gulp.task('watch', common.addWebserver(['dev-package', 'dev-bundle-tests']), function() {
4343
_.each(common.bundleKinds, function(kind) {
4444
watch(path.join(common.srcDirs[kind], '**', '*.js'), function() {
4545
gulp.start('dev-recompile-' + kind);

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,27 @@ For SSL mode, just specify https protocol:
130130
yarn browsersync -- --proxied-host=https://testbox.papertrail.co.za
131131
```
132132

133+
In case you also want dev mode of EgisUI and a plugin while proxying an https UAT and access it from another machine you can do it following way:
134+
```
135+
# open terminal tab
136+
cd [egis-ui-path]
137+
yarn dev --serve=false --scheme=https --host=[your-ip]
138+
139+
# open another terminal tab
140+
yarn browser-sync start --server --https --files "dist/**/*" --port 8101 --cors
141+
142+
# open another terminal tab
143+
cd [plugin-path]
144+
yarn dev --serve=false --scheme=https --host=[your-ip]
145+
146+
# open another terminal tab
147+
yarn browser-sync start --server --https --files "dist/**/*" --port 8120 --cors
148+
149+
# open another terminal tab
150+
cd [build-tools-path]
151+
yarn browsersync --proxied-host=https://bidshows-dev.papertrail.co.za --plugin=[your-plugin-name]
152+
```
153+
133154
#### Caveats
134155
* URLs with default pages other than index.html, e.g. `http://papertrail.lvh.me:3001/web/eSign/?3760` don't work, so
135156
you'll get "page not found" if you try to use Sign action. Specify `http://papertrail.lvh.me:3001/web/eSign/sign.html?3760`

gulp/common.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ var config = {
107107
},
108108
dependenciesJson: dependenciesJson,
109109
watch: options.watch,
110+
scheme: argv.scheme || 'http',
110111
host: argv.host || pkg.host || 'localhost',
111112
port: argv.port || pkg.port || '8101',
112113
prod: !process.env.DEV && options.env === 'production',
@@ -135,6 +136,12 @@ var config = {
135136
dependsOnEgisUi: function() {
136137
return pkg.devDependencies && pkg.devDependencies[config.egisUiPkgName] ||
137138
pkg.dependencies && pkg.dependencies[config.egisUiPkgName];
139+
},
140+
addWebserver: function(deps) {
141+
if (argv.serve !== 'false') {
142+
deps.push('webserver')
143+
}
144+
return deps
138145
}
139146
};
140147

gulp/dev-bundle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ _.each(common.bundleKinds, function(kind) {
8484
}
8585
return gulp.src(s1)
8686
.pipe(sourcemaps.init())
87+
.pipe(replace('http:', common.scheme + ':'))
8788
.pipe(replace('HOST', common.host))
8889
.pipe(replace('PORT', common.port))
8990
.pipe(concat('dev-loader.js')) //not with dot 'cause Gulp webserver doesn't serve .dotfiles
@@ -107,7 +108,7 @@ _.each(common.bundleKinds, function(kind) {
107108
return gulp.src(sources)
108109
.pipe(sourcemaps.init({loadMaps: true}))
109110
.pipe(pseudoconcat(common.bundles[kind], {
110-
host: 'http://' + common.host + ':' + common.port + '/'
111+
host: common.scheme + '://' + common.host + ':' + common.port + '/'
111112
}))
112113
.pipe(sourcemaps.write('.', {includeContent: true}))
113114
.pipe(gulp.dest(destDir))

gulp/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ gulp.task('plugin-dev-package', ['dev-bundle-main', 'styles', 'resources'], func
4646
return packagePlugin();
4747
});
4848

49-
gulp.task('plugin_watch', ['plugin-dev-package', 'dev-bundle-tests', 'webserver'], function() {
49+
gulp.task('plugin_watch', common.addWebserver(['plugin-dev-package', 'dev-bundle-tests']), function() {
5050
_.each(common.bundleKinds, function(kind) {
5151
watch([common.srcDirs[kind] + '/**/*.js'], function() {
5252
gulp.start('dev-recompile-' + kind);

0 commit comments

Comments
 (0)