Skip to content

Commit

Permalink
Merge pull request #104 from Genymobile/dev/PLAYER-39-adding-version-…
Browse files Browse the repository at this point in the history
…to-minified-js-and-css

[PLAYER-39] adding player version to js and css minified files
  • Loading branch information
jparez authored Sep 20, 2024
2 parents c06e9a1 + f2594ec commit f76e163
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
4 changes: 2 additions & 2 deletions example/geny-window.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<!--load the player files -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@genymotion/device-web-player@4.0.2/dist/css/device-renderer.min.css"
href="https://cdn.jsdelivr.net/npm/@genymotion/device-web-player@4.1.2/dist/css/device-renderer.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/@genymotion/device-web-player@4.0.2/dist/js/device-renderer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@genymotion/device-web-player@4.1.2/dist/js/device-renderer.min.js"></script>

<!--
//to use maps option in gps widget you need to load google maps api and forward you google pai key
Expand Down
16 changes: 6 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const uglify = require('gulp-uglify-es').default;
const using = require('gulp-using');
const util = require('gulp-util');
const replace = require('gulp-replace');
const header = require('gulp-header');

const PATHS = {
SRC: {
Expand Down Expand Up @@ -97,15 +98,6 @@ gulp.task('app-partials', function () {
gulp.task('app-geny-window', function () {
const version = getVersion(); // Fetch the version from package.json

gulp.src(['./example/geny-window.html'])
.pipe(
replace(
/https:\/\/cdn\.jsdelivr\.net\/npm\/@genymotion\/device-web-player@[\d\.]+/g,
`https://cdn.jsdelivr.net/npm/@genymotion/device-web-player@${version}`,
),
)
.pipe(gulp.dest('./example/'));

return gulp
.src(['./example/*'])
.pipe(gulpif(util.env.debug, using({prefix: 'Processing example files:', color: 'cyan'})))
Expand All @@ -120,6 +112,7 @@ gulp.task('app-geny-window', function () {

// SASS styles
gulp.task('app-styles', function () {
const version = `/*! Version: ${getVersion()} */\n`;
return gulp
.src(PATHS.SRC.ASSETS.STYLES + '/**/*.scss')
.pipe(gulpif(util.env.debug, using()))
Expand All @@ -128,6 +121,7 @@ gulp.task('app-styles', function () {
.pipe(autoprefixer())
.pipe(gulpif(util.env.production, minifyCss()))
.pipe(concat('device-renderer.min.css'))
.pipe(header(version))
.pipe(gulp.dest(PATHS.DEST.ASSETS.CSS));
});

Expand Down Expand Up @@ -171,6 +165,7 @@ function getBundler() {
}

gulp.task('app-js', async function () {
const version = `/*! Version: ${getVersion()} */\n`;
const bundler = await getBundler();
return merge2(bundler.bundle().pipe(source(PATHS.SRC.APP)), {end: true})
.pipe(gulpif(util.env.debug, using()))
Expand All @@ -195,7 +190,8 @@ gulp.task('app-js', async function () {
),
)
.pipe(streamify(concat('device-renderer.min.js')))
.pipe(gulpif(util.env.production, streamify(uglify({keep_fnames: true}))))
.pipe(gulpif(util.env.production, streamify(uglify())))
.pipe(header(version))
.pipe(gulp.dest(PATHS.DEST.LIB.JS));
});

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"homepage": "https://github.com/Genymobile/genymotion-device-web-player#readme",
"dependencies": {
"gulp-header": "^2.0.9",
"gulp-replace": "^1.1.4",
"lodash": "^4.17.21",
"loglevel": "^1.8.0",
Expand Down
29 changes: 27 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2753,7 +2753,7 @@ concat-stream@^1.6.0, concat-stream@^1.6.1, concat-stream@~1.6.0:
readable-stream "^2.2.2"
typedarray "^0.0.6"

concat-with-sourcemaps@^1.0.0:
concat-with-sourcemaps@^1.0.0, concat-with-sourcemaps@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz"
integrity sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==
Expand Down Expand Up @@ -4470,6 +4470,16 @@ gulp-css-base64@^2.0.0:
through2 "^2.0.0"
vinyl "^2.2.0"

gulp-header@^2.0.9:
version "2.0.9"
resolved "https://registry.yarnpkg.com/gulp-header/-/gulp-header-2.0.9.tgz#8b432c4d4379dee6788845b16785b09c7675af84"
integrity sha512-LMGiBx+qH8giwrOuuZXSGvswcIUh0OiioNkUpLhNyvaC6/Ga8X6cfAeme2L5PqsbXMhL8o8b/OmVqIQdxprhcQ==
dependencies:
concat-with-sourcemaps "^1.1.0"
lodash.template "^4.5.0"
map-stream "0.0.7"
through2 "^2.0.0"

[email protected]:
version "0.0.7"
resolved "https://registry.npmjs.org/gulp-html-to-js/-/gulp-html-to-js-0.0.7.tgz"
Expand Down Expand Up @@ -6222,6 +6232,14 @@ lodash.template@^3.0.0:
lodash.restparam "^3.0.0"
lodash.templatesettings "^3.0.0"

lodash.template@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==
dependencies:
lodash._reinterpolate "^3.0.0"
lodash.templatesettings "^4.0.0"

lodash.templatesettings@^3.0.0:
version "3.1.1"
resolved "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz"
Expand All @@ -6230,6 +6248,13 @@ lodash.templatesettings@^3.0.0:
lodash._reinterpolate "^3.0.0"
lodash.escape "^3.0.0"

lodash.templatesettings@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33"
integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==
dependencies:
lodash._reinterpolate "^3.0.0"

lodash.truncate@^4.4.2:
version "4.4.2"
resolved "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz"
Expand Down Expand Up @@ -6298,7 +6323,7 @@ map-cache@^0.2.0, map-cache@^0.2.2:
resolved "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz"
integrity sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==

map-stream@^0.0.7:
map-stream@0.0.7, map-stream@^0.0.7:
version "0.0.7"
resolved "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz"
integrity sha512-C0X0KQmGm3N2ftbTGBhSyuydQ+vV1LC3f3zPvT3RXHXNZrvfPZcoXp/N5DOa8vedX/rTMm2CjTtivFg2STJMRQ==
Expand Down

0 comments on commit f76e163

Please sign in to comment.