Skip to content

Commit

Permalink
Merge branch 'mediamonks:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloCarreira authored Aug 22, 2024
2 parents 94c4cdc + 0601bae commit 1e365bf
Show file tree
Hide file tree
Showing 34 changed files with 1,483 additions and 621 deletions.
1 change: 1 addition & 0 deletions cli/displayDevServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ program
.option('-o, --outputDir <data>', 'output dir', './build')
.option('--skipBuild', 'skip compiling ads phase', false)
.option('--skipPreview', 'skip preview building phase', false)
.option('-p, --parallel [data]', 'run webpack in parallel')
.parse(process.argv);

const options = program.opts();
Expand Down
68 changes: 59 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@mediamonks/display-dev-server",
"version": "11.0.11",
"version": "11.6.2",
"description": "This is the Display.Monks development server, which handles previewing and compiling ads via webpack.",
"scripts": {
"preview-dev": "cd ./src/preview && npm run dev"
"preview-dev": "cd ./src/preview && npm run dev",
"preview-build": "cd ./src/preview && npm run build"
},
"engines": {
"node": ">= 16",
Expand Down Expand Up @@ -66,6 +67,7 @@
"webpack": "^5.75.0",
"webpack-dev-middleware": "^6.0.1",
"webpack-hot-middleware": "^2.25.3",
"webpack-virtual-modules": "^0.5.0"
"webpack-virtual-modules": "^0.5.0",
"worker-farm": "^1.7.0"
}
}
20 changes: 16 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
const getWebpackConfigs = require("./webpack/getWebpackConfigs");
const devServer = require("./webpack/devServer");
const devServerParallel = require("./webpack/devServerParallel");
const buildFiles = require("./webpack/buildFiles");
const buildFilesParallel = require("./webpack/buildFilesParallel");
const buildPreview = require("./webpack/buildPreview");
const deleteAllGooglesheetFiles = require("./util/deleteAllGooglesheetFiles");

module.exports = async function (options) {
// {mode = "development", glob = "./**/.richmediarc*", choices = null, stats = null, outputDir = "./build", configOverride = {}}
let {mode, glob, choices, stats, outputDir, skipBuild, skipPreview} = options;
let {mode, glob, choices, stats, outputDir, skipBuild, skipPreview, parallel} = options;

if (mode == "cleanup") {
return await deleteAllGooglesheetFiles()
}

const webpackConfigs = !skipBuild ? await getWebpackConfigs(options) : null;

if (mode === "development") {
await devServer(webpackConfigs.result, webpackConfigs.choices.openLocation);
if (parallel) await devServerParallel(webpackConfigs.result, webpackConfigs.choices.openLocation, options);
else await devServer(webpackConfigs.result, webpackConfigs.choices.openLocation);
} else {
if (!skipBuild) await buildFiles(webpackConfigs.result, outputDir);
if (!skipPreview) await buildPreview(outputDir);
let qualities
if (!skipBuild) {
if (parallel) qualities = await buildFilesParallel(webpackConfigs.result, options);
else qualities = await buildFiles(webpackConfigs.result, outputDir);
}
if (!skipPreview) await buildPreview(webpackConfigs?.result, qualities?.ads, outputDir);
}
};
2 changes: 2 additions & 0 deletions src/preview/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
<script src="static/gsap.min.js"></script>
<script src="static/GSDevTools.min.js"></script>
</html>
47 changes: 29 additions & 18 deletions src/preview/dist/js/index_bundle.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/preview/dist/static/GSDevTools.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/preview/dist/static/gsap.min.js

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions src/preview/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e365bf

Please sign in to comment.