Skip to content

Commit

Permalink
Update project to map.apps 4.15
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasstein committed Jun 6, 2023
1 parent ccacc37 commit dcb2b77
Show file tree
Hide file tree
Showing 12 changed files with 313 additions and 148 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:9090",
"webRoot": "${workspaceFolder}/src/main"
}
]
}
29 changes: 21 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,40 @@
"tasks": [
{
"label": "Initialize",
"detail": "Initialize map.apps for Developers project",
"type": "shell",
"command": "mvn initialize",
"group": "build"
},
{
"label": "Run HTTP Server",
"label": "Run",
"detail": "Run map.apps for Developers development server",
"type": "shell",
"command": "mvn clean compile -Denv=dev '-Dlocal.configfile=./build.properties'",
"group": "build"
"command": "mvn",
"args": ["compile", "-Denv=dev", "'-Dlocal.configfile=./build.properties'", "-Pinclude-mapapps-deps"],
"group": "build",
"isBackground": true
},
{
"label": "Run stand-alone HTTP Server",
"label": "Run (Remote project mode)",
"detail": "Run map.apps for Developers development server in 'remote project' mode",
"type": "shell",
"command": "mvn clean compile -Denv=dev '-Dlocal.configfile=./build.properties' -Pinclude-mapapps-deps",
"group": "build"
"command": "mvn",
"args": ["compile", "-Denv=dev", "'-Dlocal.configfile=./build.properties'"],
"group": "build",
"isBackground": true
},
{
"label": "Compress",
"detail": "Prepare bundles and apps for deployment on a map.apps instance",
"type": "shell",
"command": "mvn clean install -P compress",
"group": "build"
"command": "mvn",
"args": ["install", "-Pcompress"],
"group": "build",
"presentation": {
"reveal": "always",
"panel": "dedicated"
}
},
{
"label": "Clean",
Expand Down
75 changes: 56 additions & 19 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,49 @@ const mapappsBrowserSync = require("ct-mapapps-browser-sync");
const isProduction = process.env.NODE_ENV === "production";
console.info(`Configuring gulp build for ${isProduction ? "production" : "development"}`);

const localOverrides = (function () {
if (isProduction) {
// Never override defaults in production mode
return undefined;
}

try {
return require("./gulpfile.overrides");
} catch (e) {
// File may not exist
return undefined;
}
})();

// used to transport test urls in "run-browser-tests-local" task
const runBrowserTests = [];

mapapps.registerTasks({
/** Enable debug logging */
debug: localOverrides?.debug ?? false,
/** enable linting */
lintOnWatch: localOverrides?.lintOnWatch ?? true,
/** enable es6 by default */
forceTranspile: true,
/* A detailed description of available setting is available at https://www.npmjs.com/package/ct-mapapps-gulp-js */
compress: isProduction,

/* build source maps as e.g. ".js.map" */
sourceMaps: "file",

/** Build Unit-Tests only in dev mode */
rollupBuildTests: !isProduction,
/** Amount of Threads used to build the bundles, if there are only a few bundles 1 is ok.
* More as 3 is normally not required.
*/
rollupBuildMaxWorkers: localOverrides?.rollupBuildMaxWorkers ?? 1,

/** List of build time flags, usage like: import { debug } from "build-config!".
*/
rollupConfig: {
debug: !isProduction
},

/* a list of themes inside this project */
themes: [/*"sample-theme"*/],
/* state that the custom theme will be dependant from map.apps everlasting theme that provides the base styles */
Expand All @@ -41,24 +74,30 @@ mapapps.registerTasks({
// "sample_theme"
]
},
runBrowserTests,
/* A list oft target browser versions. This should be streamlined with Esri JS API requirements. */
transpileTargets: {
firefox: 102,
edge: 104,
chrome: 104,
safari: 15
},
runBrowserTests,
watchFinishedReceiver() {
if (localOverrides?.autoReload ?? true) {
mapappsBrowserSync.state.reload();
}
}
});
}, gulp);

mapappsBrowserSync.registerTask({
port: 9090,
// prevent reload by browser sync
externalReloadTrigger: true,
urlToOpen: true,

// on which port to listen
port: localOverrides?.port ?? 9090,
// activate https protocol, generates a self signed certificate for "localhost"
https: false,
// https://browsersync.io/docs/options#option-https
https: localOverrides?.https ?? false,

// to prevent auto open of browser, set this to false
urlToOpen: localOverrides?.openBrowser ?? true,

jsreg: {
//npmDir : __dirname + "/node_modules/",
Expand All @@ -67,7 +106,9 @@ mapappsBrowserSync.registerTask({
"chai",
"@conterra/mapapps-mocha-runner"
]
}
},
// prevent reload by browser sync (reload triggered on watch end)
externalReloadTrigger: true
}, gulp);

gulp.task("build",
Expand All @@ -76,6 +117,7 @@ gulp.task("build",
"themes-copy",
gulp.parallel(
"js-transpile",
"rollup-build",
"themes-compile"
)
)
Expand All @@ -85,8 +127,7 @@ gulp.task("lint",
gulp.parallel(
"js-lint"
//,"style-lint"
)
);
));

gulp.task("preview",
gulp.series(
Expand All @@ -95,8 +136,7 @@ gulp.task("preview",
"watch",
"browser-sync"
)
)
);
));

gulp.task("run-tests",
gulp.series(
Expand All @@ -110,16 +150,14 @@ gulp.task("run-tests",
},
"run-browser-tests",
"browser-sync-stop"
)
);
));

gulp.task("test",
gulp.series(
"build",
"lint",
"run-tests"
)
);
));

gulp.task("compress",
gulp.series(
Expand All @@ -133,5 +171,4 @@ gulp.task("default",
gulp.series(
"build",
"lint"
)
);
));
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
"check-licenses": "node ./src/support/js/check-licenses.js"
},
"devDependencies": {
"@conterra/ct-mapapps-typings": "4.14.3",
"@conterra/mapapps-mocha-runner": "^1.0.0",
"@types/arcgis-js-api": "4.24.0",
"chai": "^4.3.6",
"ct-mapapps-gulp-js": "^0.7.4",
"ct-mapapps-browser-sync": "^0.0.24",
"eslint-config-ct-prodeng": "^1.2.5",
"@conterra/ct-mapapps-typings": "4.15.0",
"@conterra/mapapps-mocha-runner": "^1.1.1",
"@types/arcgis-js-api": "4.26.0",
"chai": "^4.3.7",
"ct-mapapps-browser-sync": "0.0.27",
"ct-mapapps-gulp-js": "0.9.4",
"eslint-config-ct-prodeng": "1.3.0-next-2",
"license-checker": "^25.0.1",
"mocha": "^9.0.0",
"puppeteer": "^13.3.2",
"stylelint-config-ct-prodeng": "1.0.3",
"vue-template-compiler": "2.7.8"
"mocha": "^10.2.0",
"puppeteer": "^19.11.1",
"vue-template-compiler": "2.7.8",
"stylelint-config-ct-prodeng": "1.0.4",
"stylelint-config-recommended": "5.0.0",
"stylelint": "^13.13.1"
}
}
Loading

0 comments on commit dcb2b77

Please sign in to comment.