Skip to content

Commit 83af698

Browse files
authored
Merge pull request #12 from conterra/ct-store-replacement
Update to use store-api, not ct/store
2 parents 96c72be + ef7a733 commit 83af698

20 files changed

Lines changed: 701 additions & 798 deletions

.editorconfig

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
# http://editorconfig.org
2-
# top-most EditorConfig file
31
root = true
42

53
[*]
64
indent_style = space
75
indent_size = 4
86
end_of_line = lf
97
charset = utf-8
10-
trim_trailing_whitespace = true
8+
trim_trailing_whitespace = false
119
insert_final_newline = true
10+
max_line_length = 120
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[*.yml]
16+
indent_size = 2

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"tabWidth": 4,
4+
"trailingComma": "none",
5+
"singleQuote": false,
6+
"quoteProps": "consistent"
7+
}

.vscode/tasks.json

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,54 @@
33
"tasks": [
44
{
55
"label": "Initialize",
6+
"detail": "Initialize mapapps-github-manager",
67
"type": "shell",
78
"command": "mvn initialize",
89
"group": "build"
910
},
1011
{
11-
"label": "Run HTTP Server",
12+
"label": "Run",
13+
"detail": "Run mapapps-github-manager development server",
1214
"type": "shell",
13-
"command": "mvn jetty:run -Denv=dev '-Dlocal.configfile=./build.properties'",
14-
"group": "build"
15+
"command": "mvn",
16+
"args": ["compile", "-Denv=dev", "'-Dlocal.configfile=./build.properties'", "-Pinclude-mapapps-deps"],
17+
"group": "build",
18+
"isBackground": true
1519
},
1620
{
17-
"label": "Run stand-alone HTTP Server",
21+
"label": "Run (Remote project mode)",
22+
"detail": "Run mapapps-github-manager development server in 'remote project' mode",
1823
"type": "shell",
19-
"command": "mvn jetty:run -Denv=dev '-Dlocal.configfile=./build.properties' -Pinclude-mapapps-deps",
20-
"group": "build"
24+
"command": "mvn",
25+
"args": ["compile", "-Denv=dev", "'-Dlocal.configfile=./build.properties'"],
26+
"group": "build",
27+
"isBackground": true
2128
},
2229
{
2330
"label": "Compress",
31+
"detail": "Prepare bundles and apps for deployment on a map.apps instance",
2432
"type": "shell",
25-
"command": "mvn install -P compress",
26-
"group": "build"
33+
"command": "mvn",
34+
"args": ["install", "-Pcompress"],
35+
"group": "build",
36+
"presentation": {
37+
"reveal": "always",
38+
"panel": "dedicated"
39+
}
2740
},
2841
{
2942
"label": "Clean",
3043
"type": "shell",
3144
"command": "mvn clean",
3245
"group": "build"
46+
},
47+
{
48+
"label": "Watch types",
49+
"detail": "Start TypeScript compiler in watch mode",
50+
"type": "npm",
51+
"script": "watch-types",
52+
"group": "build",
53+
"problemMatcher": [],
3354
}
3455
]
3556
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This project is intended to be integrated as a bundle to the installation of you
55
**Requirement: map.apps 4.14**
66

77
Before you add the Bundle to your manager, please configure the user and the topic property in the manifest.json to point to your GitHub account. Topic can be left empty.
8-
You will have to add a released bundle.jar/zip as a bundle in your map.apps manager.
8+
You will have to add a released bundle.jar/zip as a bundle in your map.apps manager.
99
Furthermore, you have to add the following lines to your `application.properties` or `custom.application.properties`, or `build.properties`:
1010

1111
`proxy.allowedServerUrls = https://github.com,followRedirects:true`
@@ -14,7 +14,7 @@ Furthermore, you have to add the following lines to your `application.propertie
1414

1515
Restart your map.apps instance. You should now see a new tab in the manager view.
1616

17-
### Configurable Components of mapapps-github-manager:
17+
### Configurable Components of mapapps-github-manager:
1818

1919
#### BundleStore
2020
| Property | Type | Possible Values | Default | Description |

gulpfile.js

Lines changed: 140 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,167 @@
1515
*/
1616
const gulp = require("gulp");
1717
const mapapps = require('ct-mapapps-gulp-js');
18+
const mapappsBrowserSync = require("ct-mapapps-browser-sync");
19+
20+
const isProduction = process.env.NODE_ENV === "production";
21+
console.info(`Configuring gulp build for ${isProduction ? "production" : "development"}`);
22+
23+
const localOverrides = (function () {
24+
if (isProduction) {
25+
// Never override defaults in production mode
26+
return undefined;
27+
}
28+
29+
try {
30+
return require("./gulpfile.overrides");
31+
} catch (e) {
32+
// File may not exist
33+
return undefined;
34+
}
35+
})();
36+
37+
// used to transport test urls in "run-browser-tests-local" task
38+
const runBrowserTests = [];
1839

1940
mapapps.registerTasks({
41+
/** Enable debug logging */
42+
debug: localOverrides?.debug ?? false,
43+
/** enable linting */
44+
lintOnWatch: localOverrides?.lintOnWatch ?? true,
45+
/** enable es6 by default */
46+
forceTranspile: true,
2047
/* A detailed description of available setting is available at https://www.npmjs.com/package/ct-mapapps-gulp-js */
48+
compress: isProduction,
49+
50+
/* build source maps as e.g. ".js.map" */
51+
sourceMaps: "file",
52+
53+
/** Build Unit-Tests only in dev mode */
54+
rollupBuildTests: !isProduction,
55+
/** Amount of Threads used to build the bundles, if there are only a few bundles 1 is ok.
56+
* More as 3 is normally not required.
57+
*/
58+
rollupBuildMaxWorkers: localOverrides?.rollupBuildMaxWorkers ?? 1,
59+
60+
/** List of build time flags, usage like: import { debug } from "build-config!".
61+
*/
62+
rollupConfig: {
63+
debug: !isProduction
64+
},
65+
2166
/* a list of themes inside this project */
22-
themes: [/*"sample-theme"*/],
67+
themes: [],
2368
/* state that the custom theme will be dependant from map.apps everlasting theme that provides the base styles */
24-
hasBaseThemes: true,
69+
hasBaseThemes: false,
2570
/* state that we want to support vuetify components and therefore need the vuetify core styles*/
26-
hasVuetify: true
71+
hasVuetify: false,
2772
/*themeChangeTargets: {
2873
"vuetify": [
29-
"sample_theme"
74+
"theme-custom"
3075
]
31-
}*/
32-
});
76+
},*/
77+
/* A list oft target browser versions. This should be streamlined with Esri JS API requirements. */
78+
transpileTargets: {
79+
firefox: 102,
80+
edge: 104,
81+
chrome: 104,
82+
safari: 15
83+
},
84+
runBrowserTests,
85+
watchFinishedReceiver() {
86+
if (localOverrides?.autoReload ?? true) {
87+
mapappsBrowserSync.state.reload();
88+
}
89+
}
90+
}, gulp);
3391

34-
gulp.task("default",
92+
mapappsBrowserSync.registerTask({
93+
// on which port to listen
94+
port: localOverrides?.port ?? 9090,
95+
// activate https protocol, generates a self signed certificate for "localhost"
96+
// https://browsersync.io/docs/options#option-https
97+
https: localOverrides?.https ?? false,
98+
99+
// to prevent auto open of browser, set this to false
100+
urlToOpen: localOverrides?.openBrowser ?? true,
101+
properties: {
102+
paths: [
103+
// Ensure @@key@@ expressions filtered in tests files
104+
/^\/js\/tests\/(runTests.html|test-init.js|init-packs.js)$/
105+
]
106+
},
107+
jsreg: {
108+
//npmDir : __dirname + "/node_modules/",
109+
npmModules: [
110+
"mocha",
111+
"chai",
112+
"@conterra/mapapps-mocha-runner"
113+
]
114+
},
115+
// prevent reload by browser sync (reload triggered on watch end)
116+
externalReloadTrigger: true
117+
}, gulp);
118+
119+
gulp.task("build",
35120
gulp.series(
36121
"copy-resources",
37122
"themes-copy",
38123
gulp.parallel(
39-
//"js-lint",
40-
//"style-lint",
41124
"js-transpile",
125+
"rollup-build",
42126
"themes-compile"
43127
)
44128
)
45129
);
46130

131+
gulp.task("lint",
132+
gulp.parallel(
133+
"js-lint"
134+
/*, comment in to lint .css/.less files
135+
"style-lint"
136+
*/
137+
));
138+
139+
gulp.task("preview",
140+
gulp.series(
141+
"build",
142+
gulp.parallel(
143+
"watch",
144+
"browser-sync"
145+
)
146+
));
147+
148+
gulp.task("run-tests",
149+
gulp.series(
150+
"browser-sync-start",
151+
function transportTestUrls() {
152+
// transport test url to run-browser-tests
153+
// eslint-disable-next-line max-len
154+
const testsAt = mapappsBrowserSync.state.url + "/resources/jsregistry/root/@conterra/mapapps-mocha-runner/latest/mocha.html?boot=/js/tests/test-init.js&timeout=5000&test=mapapps-github-manager/tests/all&reporter=tap";
155+
runBrowserTests.push(testsAt);
156+
return Promise.resolve();
157+
},
158+
"run-browser-tests",
159+
"browser-sync-stop"
160+
));
161+
162+
gulp.task("test",
163+
gulp.series(
164+
"build",
165+
"lint",
166+
"run-tests"
167+
));
168+
47169
gulp.task("compress",
48170
gulp.series(
49-
"default",
50-
"themes-compress"
171+
"build",
172+
"themes-compress",
173+
"lint"
51174
)
52175
);
176+
177+
gulp.task("default",
178+
gulp.series(
179+
"build",
180+
"lint"
181+
));

package.json

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,29 @@
22
"name": "test",
33
"description": "test build",
44
"version": "0.0.1",
5+
"scripts": {
6+
"check-types": "tsc --noEmit",
7+
"watch-types": "tsc -w --noEmit"
8+
},
59
"devDependencies": {
6-
"@conterra/ct-mapapps-typings": "4.13.1",
7-
"@conterra/mapapps-mocha-runner": "^1.0.0",
8-
"@types/arcgis-js-api": "4.22.0",
9-
"ct-mapapps-gulp-js": "^0.6.18",
10-
"vue-template-compiler": "2.6.14",
11-
"puppeteer": "^13.3.2",
12-
"eslint-config-ct-prodeng": "^1.2.5",
13-
"stylelint-config-ct-prodeng": "1.0.3",
14-
"chai": "^4.3.4",
15-
"mocha": "^9.0.0"
10+
"@conterra/ct-mapapps-typings": "~4.17.0",
11+
"@conterra/mapapps-mocha-runner": "1.1.1",
12+
"@types/chai": "4.3.10",
13+
"@types/mocha": "10.0.4",
14+
"chai": "4.3.10",
15+
"ct-mapapps-browser-sync": "0.0.35",
16+
"ct-mapapps-gulp-js": "0.10.2",
17+
"eslint-config-ct-prodeng": "1.4.0",
18+
"mocha": "10.2.0",
19+
"puppeteer": "21.5.2",
20+
"stylelint": "15.11.0",
21+
"stylelint-config-ct-prodeng": "2.0.0",
22+
"stylelint-config-recommended": "13.0.0",
23+
"stylelint-config-recommended-less": "2.0.0",
24+
"ts-node": "^10.9.1",
25+
"tsx": "^4.6.0",
26+
"typescript": "5.2.2",
27+
"vue": "2.7.15",
28+
"vue-template-compiler": "2.7.15"
1629
}
1730
}

0 commit comments

Comments
 (0)