@vcmap/plugin-cli 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,16 +21,23 @@ import { promiseExec, getDirname } from './pluginCliHelper.js';
21
21
  * @returns {string}
22
22
  */
23
23
  export function resolveMapUi(...pathSegments) {
24
- return path.join(getContext(), 'node_modules', '@vcmap', 'ui', ...pathSegments);
24
+ return path.join(
25
+ getContext(),
26
+ 'node_modules',
27
+ '@vcmap',
28
+ 'ui',
29
+ ...pathSegments,
30
+ );
25
31
  }
26
32
 
27
33
  export function checkReservedDirectories() {
28
- ['assets', 'plugins', 'config']
29
- .forEach((dir) => {
30
- if (fs.existsSync(path.join(getContext(), dir))) {
31
- logger.warning(`found reserved directory ${dir}. serving my not work as exptected`);
32
- }
33
- });
34
+ ['assets', 'plugins', 'config'].forEach((dir) => {
35
+ if (fs.existsSync(path.join(getContext(), dir))) {
36
+ logger.warning(
37
+ `found reserved directory ${dir}. serving my not work as exptected`,
38
+ );
39
+ }
40
+ });
34
41
  }
35
42
 
36
43
  /**
@@ -47,7 +54,9 @@ export function httpGet(stringUrl, auth, handler) {
47
54
  };
48
55
 
49
56
  if (auth) {
50
- options.headers = { Authorization: `Basic ${Buffer.from(auth).toString('base64')}` };
57
+ options.headers = {
58
+ Authorization: `Basic ${Buffer.from(auth).toString('base64')}`,
59
+ };
51
60
  }
52
61
  if (url.protocol === 'https:') {
53
62
  https.get(options, handler);
@@ -57,11 +66,11 @@ export function httpGet(stringUrl, auth, handler) {
57
66
  }
58
67
 
59
68
  /**
60
- * @param {string} fileName
69
+ * @param {string|undefined} fileName
61
70
  * @returns {Promise<Object>}
62
71
  */
63
72
  export async function readConfigJson(fileName) {
64
- const configFileName = fileName || resolveContext('config.json');
73
+ const configFileName = fileName ?? resolveContext('config.json');
65
74
  let config = {};
66
75
  if (fs.existsSync(configFileName)) {
67
76
  const content = await fs.promises.readFile(configFileName);
@@ -72,7 +81,7 @@ export async function readConfigJson(fileName) {
72
81
  }
73
82
 
74
83
  /**
75
- * @param {string} pluginConfig
84
+ * @param {string|undefined} pluginConfig
76
85
  * @returns {Promise<Object>}
77
86
  */
78
87
  export async function getPluginConfig(pluginConfig) {
@@ -91,7 +100,9 @@ const configMap = new Map();
91
100
  export async function printVcmapUiVersion() {
92
101
  const packageJsonPath = resolveMapUi('package.json');
93
102
  if (!fs.existsSync(packageJsonPath)) {
94
- throw new Error(`Cannot find the @vcmap/ui package in ${getContext()}. Are you sure you installed it?`);
103
+ throw new Error(
104
+ `Cannot find the @vcmap/ui package in ${getContext()}. Are you sure you installed it?`,
105
+ );
95
106
  }
96
107
 
97
108
  const content = await fs.promises.readFile(packageJsonPath);
@@ -100,45 +111,47 @@ export async function printVcmapUiVersion() {
100
111
  }
101
112
 
102
113
  /**
103
- * @param {Object} config
114
+ * Deletes plugin from other inline configs and adds a temporary config containing the pluginConfig
115
+ * @param {Object} appConfig
104
116
  * @param {Object} pluginConfig
105
117
  * @param {boolean} production
106
118
  * @returns {Promise<void>}
107
119
  */
108
- export async function reWriteConfig(config, pluginConfig, production) {
109
- config.plugins = config.plugins ?? []; // XXX check if we have plugins in this repos dependencies?
120
+ export async function reWriteAppConfig(appConfig, pluginConfig, production) {
121
+ const name = await getPluginName();
122
+ pluginConfig.name = name;
110
123
  pluginConfig.entry = production ? 'dist/index.js' : await getPluginEntry();
111
- pluginConfig.name = await getPluginName();
112
- const idx = config.plugins.findIndex(p => p.name === pluginConfig.name);
113
- if (idx > -1) {
114
- config.plugins.splice(idx, 1, pluginConfig);
115
- } else {
116
- config.plugins.push(pluginConfig);
117
- }
124
+ appConfig.modules = appConfig.modules ?? [];
125
+ appConfig.modules.forEach((config) => {
126
+ if (Array.isArray(config.plugins)) {
127
+ config.plugins = config.plugins.filter((p) => p.name !== name);
128
+ }
129
+ });
130
+ appConfig.modules.push({ plugins: [pluginConfig] });
118
131
  }
119
132
 
120
133
  /**
121
- * @param {string} [mapConfig] - fs or https to config. defaults to @vcmap/ui/map.config.json
134
+ * @param {string} [appConfig] - fs or https to config. defaults to @vcmap/ui/app.config.json
122
135
  * @param {string} [auth]
123
136
  * @param {boolean} [production]
124
137
  * @param {string} [configFile]
125
138
  * @returns {Promise<unknown>}
126
139
  */
127
- export function getConfigJson(mapConfig, auth, production, configFile) {
128
- const usedConfig = mapConfig || resolveMapUi('map.config.json');
129
- if (configMap.has('map.config.json')) {
130
- return Promise.resolve(configMap.get('map.config.json'));
140
+ export function getAppConfigJson(appConfig, auth, production, configFile) {
141
+ const usedConfig = appConfig || resolveMapUi('app.config.json');
142
+ if (configMap.has('app.config.json')) {
143
+ return Promise.resolve(configMap.get('app.config.json'));
131
144
  }
132
- const isObject = typeof mapConfig === 'object' && mapConfig !== null;
145
+ const isObject = typeof appConfig === 'object' && appConfig !== null;
133
146
  const isWebVcm = !isObject && /^https?:\/\//.test(usedConfig);
134
147
  return new Promise((resolve, reject) => {
135
- async function handleConfig(data) {
148
+ async function handleAppConfig(data) {
136
149
  try {
137
- const configJson = JSON.parse(data);
138
- configMap.set('map.config.json', configJson);
150
+ const appConfigJson = JSON.parse(data);
151
+ configMap.set('app.config.json', appConfigJson);
139
152
  const pluginConfig = await getPluginConfig(configFile);
140
- await reWriteConfig(configJson, pluginConfig, production);
141
- resolve(configJson);
153
+ await reWriteAppConfig(appConfigJson, pluginConfig, production);
154
+ resolve(appConfigJson);
142
155
  } catch (e) {
143
156
  reject(e);
144
157
  }
@@ -150,11 +163,11 @@ export function getConfigJson(mapConfig, auth, production, configFile) {
150
163
  });
151
164
 
152
165
  stream.on('close', async () => {
153
- await handleConfig(data);
166
+ await handleAppConfig(data);
154
167
  });
155
168
  }
156
169
  if (isObject) {
157
- handleConfig(JSON.stringify(mapConfig));
170
+ handleAppConfig(JSON.stringify(appConfig));
158
171
  } else if (isWebVcm) {
159
172
  httpGet(usedConfig, auth, (res) => {
160
173
  if (res.statusCode < 400) {
@@ -206,32 +219,35 @@ export function createConfigJsonReloadPlugin() {
206
219
 
207
220
  /**
208
221
  * @param {Express} app
209
- * @param {string} mapConfig
222
+ * @param {string} appConfig
210
223
  * @param {string} [auth]
211
224
  * @param {string} [configFile]
212
225
  * @param {boolean} [production]
213
226
  */
214
- export function addMapConfigRoute(app, mapConfig, auth, configFile, production) {
215
- app.get('/map.config.json', (req, res) => {
216
- getConfigJson(mapConfig, auth, production, configFile)
217
- .then((config) => {
218
- const stringConfig = JSON.stringify(config, null, 2);
219
- res.setHeader('Content-Type', 'application/json');
220
- res.write(stringConfig);
221
- res.end();
222
- });
227
+ export function addAppConfigRoute(
228
+ app,
229
+ appConfig,
230
+ auth,
231
+ configFile,
232
+ production,
233
+ ) {
234
+ app.get('/app.config.json', (req, res) => {
235
+ getAppConfigJson(appConfig, auth, production, configFile).then((config) => {
236
+ const stringConfig = JSON.stringify(config, null, 2);
237
+ res.setHeader('Content-Type', 'application/json');
238
+ res.write(stringConfig);
239
+ res.end();
240
+ });
223
241
  });
224
242
  }
225
243
 
226
244
  /**
227
245
  * @param {Express} app
228
- * @param {string} [auth]
229
- * @param {string} [configFileName]
230
- * @param {boolean} [production]
231
246
  */
232
- export async function addConfigRoute(app, auth, configFileName, production) { // IDEA pass in available plugins and strip unavailable ones?
247
+ export async function addConfigRoute(app) {
248
+ // IDEA pass in available plugins and strip unavailable ones?
233
249
  const mapUiDir = resolveMapUi();
234
- const pluginConfig = await getPluginConfig(configFileName);
250
+ const pluginName = await getPluginName();
235
251
 
236
252
  app.get('/config*', async (req, res) => {
237
253
  const { url } = req;
@@ -244,7 +260,9 @@ export async function addConfigRoute(app, auth, configFileName, production) { //
244
260
  const configContent = await fs.promises.readFile(fileName);
245
261
  const config = JSON.parse(configContent);
246
262
  configMap.set(url, config);
247
- await reWriteConfig(config, pluginConfig, production);
263
+ if (Array.isArray(config.plugins)) {
264
+ config.plugins = config.plugins.filter((p) => p.name !== pluginName);
265
+ }
248
266
  response = JSON.stringify(config);
249
267
  } catch (e) {
250
268
  configMap.delete(url);
@@ -267,9 +285,9 @@ export async function addConfigRoute(app, auth, configFileName, production) { //
267
285
  * @returns {Promise<string>}
268
286
  */
269
287
  export async function getMapUiIndexHtml(production) {
270
- const indexHtmlFileName = production ?
271
- resolveMapUi('dist', 'index.html') :
272
- path.join(getDirname(), '..', 'assets', 'index.html');
288
+ const indexHtmlFileName = production
289
+ ? resolveMapUi('dist', 'index.html')
290
+ : path.join(getDirname(), '..', 'assets', 'index.html');
273
291
  const buffer = await fs.promises.readFile(indexHtmlFileName);
274
292
  return buffer.toString();
275
293
  }
@@ -293,15 +311,16 @@ export function addPluginAssets(app, base) {
293
311
  */
294
312
  export function addIndexRoute(app, server, production, hostedVcm, auth) {
295
313
  app.get('/', async (req, res) => {
296
- let originalIndex = hostedVcm ?
297
- await getIndexHtml(`${hostedVcm}/`, auth) :
298
- await getMapUiIndexHtml(production); // TODO change hosted vcm index via option?
314
+ let originalIndex = hostedVcm
315
+ ? await getIndexHtml(`${hostedVcm}/`, auth)
316
+ : await getMapUiIndexHtml(production); // TODO change hosted vcm index via option?
299
317
 
300
- originalIndex = await server.transformIndexHtml('/index.html', originalIndex);
318
+ originalIndex = await server.transformIndexHtml(
319
+ '/index.html',
320
+ originalIndex,
321
+ );
301
322
 
302
- res.status(200)
303
- .set({ 'Content-Type': 'text/html' })
304
- .end(originalIndex);
323
+ res.status(200).set({ 'Content-Type': 'text/html' }).end(originalIndex);
305
324
  });
306
325
  }
307
326
 
package/src/pack.js CHANGED
@@ -5,7 +5,6 @@ import { getPluginName } from './packageJsonHelpers.js';
5
5
  import { resolveContext } from './context.js';
6
6
  import build from './build.js';
7
7
 
8
-
9
8
  /**
10
9
  * @returns {Promise<void>}
11
10
  */
@@ -29,7 +28,10 @@ async function ensureConfigJson() {
29
28
  }
30
29
  }
31
30
  }
32
- await fs.promises.writeFile(resolveContext('dist', 'config.json'), JSON.stringify(config, null, 2));
31
+ await fs.promises.writeFile(
32
+ resolveContext('dist', 'config.json'),
33
+ JSON.stringify(config, null, 2),
34
+ );
33
35
  }
34
36
 
35
37
  /**
@@ -38,7 +40,9 @@ async function ensureConfigJson() {
38
40
  */
39
41
  function zip(name) {
40
42
  return new Promise((resolve, reject) => {
41
- const zipStream = fs.createWriteStream(resolveContext('dist', `${name.replace(/\//, '-')}.zip`));
43
+ const zipStream = fs.createWriteStream(
44
+ resolveContext('dist', `${name.replace(/\//, '-')}.zip`),
45
+ );
42
46
  const archive = archiver('zip', { zlib: { level: 5 } });
43
47
 
44
48
  zipStream.on('close', () => {
@@ -67,7 +71,10 @@ function zip(name) {
67
71
  });
68
72
 
69
73
  if (fs.existsSync(resolveContext('plugin-assets'))) {
70
- archive.directory(resolveContext('plugin-assets'), `${name}/plugin-assets`);
74
+ archive.directory(
75
+ resolveContext('plugin-assets'),
76
+ `${name}/plugin-assets`,
77
+ );
71
78
  }
72
79
 
73
80
  archive.finalize().then(() => {
@@ -17,7 +17,9 @@ export function getDirname() {
17
17
  * @type {string} version
18
18
  * @type {string} name
19
19
  */
20
- export const { version, name } = JSON.parse(fs.readFileSync(path.join(getDirname(), '..', 'package.json')).toString());
20
+ export const { version, name } = JSON.parse(
21
+ fs.readFileSync(path.join(getDirname(), '..', 'package.json')).toString(),
22
+ );
21
23
 
22
24
  /**
23
25
  * @type {(arg1: string) => Promise<string>}
package/src/preview.js CHANGED
@@ -6,14 +6,18 @@ import { logger } from '@vcsuite/cli-logger';
6
6
  import {
7
7
  addConfigRoute,
8
8
  addIndexRoute,
9
- addMapConfigRoute,
9
+ addAppConfigRoute,
10
10
  addPluginAssets,
11
11
  checkReservedDirectories,
12
12
  createConfigJsonReloadPlugin,
13
13
  printVcmapUiVersion,
14
14
  resolveMapUi,
15
15
  } from './hostingHelpers.js';
16
- import build, { buildMapUI, getDefaultConfig, getLibraryPaths } from './build.js';
16
+ import build, {
17
+ buildMapUI,
18
+ getDefaultConfig,
19
+ getLibraryPaths,
20
+ } from './build.js';
17
21
  import { getContext } from './context.js';
18
22
  import setupMapUi from './setupMapUi.js';
19
23
  import { getVcmConfigJs } from './pluginCliHelper.js';
@@ -58,9 +62,7 @@ async function getServerOptions(hostedVcm, https) {
58
62
 
59
63
  return {
60
64
  publicDir: false,
61
- plugins: [
62
- createConfigJsonReloadPlugin(),
63
- ],
65
+ plugins: [createConfigJsonReloadPlugin()],
64
66
  resolve: {
65
67
  alias,
66
68
  },
@@ -77,7 +79,7 @@ async function getServerOptions(hostedVcm, https) {
77
79
  * @returns {Promise<void>}
78
80
  */
79
81
  export default async function preview(options) {
80
- const { default: vcmConfigJs } = await getVcmConfigJs();
82
+ const vcmConfigJs = await getVcmConfigJs();
81
83
  const mergedOptions = { ...vcmConfigJs, ...options };
82
84
  if (!mergedOptions.vcm) {
83
85
  await printVcmapUiVersion();
@@ -90,25 +92,52 @@ export default async function preview(options) {
90
92
  await build({ development: false, watch: true });
91
93
  const app = express();
92
94
  logger.info('Starting preview server...');
93
- const server = await createServer(await getServerOptions(mergedOptions.vcm, mergedOptions.https));
95
+ const server = await createServer(
96
+ await getServerOptions(mergedOptions.vcm, mergedOptions.https),
97
+ );
94
98
 
95
- addMapConfigRoute(app, mergedOptions.vcm ? `${mergedOptions.vcm}/map.config.json` : null, mergedOptions.auth, mergedOptions.config, true);
99
+ addAppConfigRoute(
100
+ app,
101
+ mergedOptions.vcm ? `${mergedOptions.vcm}/app.config.json` : null,
102
+ mergedOptions.auth,
103
+ mergedOptions.config,
104
+ true,
105
+ );
96
106
  addIndexRoute(app, server, true, mergedOptions.vcm, mergedOptions.auth);
97
107
  addPluginAssets(app, 'dist');
98
108
 
99
109
  if (!mergedOptions.vcm) {
100
110
  logger.spin('compiling preview');
101
111
  if (!fs.existsSync(resolveMapUi('plugins', 'node_modules'))) {
102
- logger.info('Could not detect node_modules in map ui plugins. Assuming map UI not setup');
112
+ logger.info(
113
+ 'Could not detect node_modules in map ui plugins. Assuming map UI not setup',
114
+ );
103
115
  await setupMapUi();
104
116
  }
105
- const { buildPluginsForPreview } = await import('@vcmap/ui/build/buildHelpers.js');
117
+ const { buildPluginsForPreview } = await import(
118
+ '@vcmap/ui/build/buildHelpers.js'
119
+ );
106
120
  await buildPluginsForPreview(getDefaultConfig(), true);
107
121
  logger.stopSpinner();
108
122
  logger.info('@vcmap/ui built for preview');
109
- app.use('/assets', express.static(path.join(getContext(), 'node_modules', '@vcmap', 'ui', 'dist', 'assets')));
110
- app.use('/plugins', express.static(path.join(getContext(), 'dist', 'plugins')));
111
- await addConfigRoute(app, mergedOptions.auth, mergedOptions.config, true);
123
+ app.use(
124
+ '/assets',
125
+ express.static(
126
+ path.join(
127
+ getContext(),
128
+ 'node_modules',
129
+ '@vcmap',
130
+ 'ui',
131
+ 'dist',
132
+ 'assets',
133
+ ),
134
+ ),
135
+ );
136
+ app.use(
137
+ '/plugins',
138
+ express.static(path.join(getContext(), 'dist', 'plugins')),
139
+ );
140
+ await addConfigRoute(app);
112
141
  }
113
142
 
114
143
  app.use(server.middlewares);
package/src/serve.js CHANGED
@@ -8,24 +8,29 @@ import { getContext } from './context.js';
8
8
  import {
9
9
  addConfigRoute,
10
10
  addIndexRoute,
11
- addMapConfigRoute, addPluginAssets,
11
+ addAppConfigRoute,
12
+ addPluginAssets,
12
13
  checkReservedDirectories,
13
14
  createConfigJsonReloadPlugin,
14
15
  printVcmapUiVersion,
15
16
  resolveMapUi,
16
17
  } from './hostingHelpers.js';
17
- import { getPluginName } from './packageJsonHelpers.js';
18
+ import { getPackageJson, getPluginName } from './packageJsonHelpers.js';
18
19
  import { getVcmConfigJs } from './pluginCliHelper.js';
19
20
  import { buildMapUI } from './build.js';
20
21
 
21
22
  /**
22
23
  * @typedef {HostingOptions} ServeOptions
23
- * @property {string|Object} [mapConfig] - an optional configObject resp. fileName or URL to a map config
24
+ * @property {string|Object} [appConfig] - an optional configObject resp. fileName or URL to an app config
24
25
  */
25
26
 
26
27
  async function getProxy(protocol, port) {
27
- const { default: getPluginProxies } = await import('@vcmap/ui/build/getPluginProxies.js');
28
- const { determineHostIpFromInterfaces } = await import('@vcmap/ui/build/determineHost.js');
28
+ const { default: getPluginProxies } = await import(
29
+ '@vcmap/ui/build/getPluginProxies.js'
30
+ );
31
+ const { determineHostIpFromInterfaces } = await import(
32
+ '@vcmap/ui/build/determineHost.js'
33
+ );
29
34
  const { getInlinePlugins } = await import('@vcmap/ui/build/buildHelpers.js');
30
35
 
31
36
  const target = `${protocol}://${determineHostIpFromInterfaces()}:${port}`;
@@ -36,16 +41,25 @@ async function getProxy(protocol, port) {
36
41
  proxy[`^/plugins/${inlinePlugin}/.*`] = {
37
42
  target,
38
43
  rewrite: (route) => {
39
- const rest = route.replace(new RegExp(`^/plugins/${inlinePlugin}/`), '');
44
+ const rest = route.replace(
45
+ new RegExp(`^/plugins/${inlinePlugin}/`),
46
+ '',
47
+ );
40
48
  const file = rest || 'index.js';
41
- return path.posix.join(path.relative(getContext(), mapUiPlugins), inlinePlugin, file);
49
+ return path.posix.join(
50
+ path.relative(getContext(), mapUiPlugins),
51
+ inlinePlugin,
52
+ file,
53
+ );
42
54
  },
43
55
  };
44
56
  });
45
57
 
46
58
  const pluginRoutes = Object.keys(proxy);
47
59
  const name = await getPluginName();
48
- const hasThisPlugin = pluginRoutes.find(p => p.startsWith(`^/plugins/${name}`));
60
+ const hasThisPlugin = pluginRoutes.find((p) =>
61
+ p.startsWith(`^/plugins/${name}`),
62
+ );
49
63
 
50
64
  if (hasThisPlugin) {
51
65
  delete proxy[hasThisPlugin];
@@ -60,7 +74,7 @@ async function getProxy(protocol, port) {
60
74
  // Cesium engine assets are not part of Build
61
75
  proxy['/node_modules/@vcmap-cesium/engine/Build/Assets'] = {
62
76
  target,
63
- rewrite: p => p.replace(/Build/, 'Source'),
77
+ rewrite: (p) => p.replace(/Build/, 'Source'),
64
78
  };
65
79
  return proxy;
66
80
  }
@@ -71,10 +85,12 @@ async function getProxy(protocol, port) {
71
85
  */
72
86
  export default async function serve(options) {
73
87
  if (!fs.existsSync(path.join(getContext(), 'node_modules', '@vcmap', 'ui'))) {
74
- logger.error('Can only serve in dev mode, if the map ui is a dependency of the current context');
88
+ logger.error(
89
+ 'Can only serve in dev mode, if the map ui is a dependency of the current context',
90
+ );
75
91
  return;
76
92
  }
77
- const { default: vcmConfigJs } = await getVcmConfigJs();
93
+ const vcmConfigJs = await getVcmConfigJs();
78
94
  const mergedOptions = { ...vcmConfigJs, ...options };
79
95
  await printVcmapUiVersion();
80
96
  // In case @vcmap/ui is linked via git+ssh, dist folder is not available and must be built first
@@ -87,6 +103,7 @@ export default async function serve(options) {
87
103
 
88
104
  logger.info('Starting development server...');
89
105
  const proxy = await getProxy(mergedOptions.https ? 'https' : 'http', port);
106
+ const { peerDependencies } = await getPackageJson();
90
107
 
91
108
  const server = await createServer({
92
109
  root: getContext(),
@@ -95,25 +112,13 @@ export default async function serve(options) {
95
112
  alias: {
96
113
  '@cesium/engine': '@vcmap-cesium/engine',
97
114
  },
115
+ dedupe: Object.keys(peerDependencies),
98
116
  },
99
117
  optimizeDeps: {
100
- exclude: [
101
- '@vcmap/ui',
102
- '@vcmap/core',
103
- 'ol',
104
- 'proj4',
105
- ],
106
- include: [
107
- 'fast-deep-equal',
108
- 'rbush-knn',
109
- 'pbf',
110
- '@vcmap-cesium/engine',
111
- ],
118
+ exclude: ['@vcmap/ui', '@vcmap/core', 'ol', 'proj4'],
119
+ include: ['fast-deep-equal', 'rbush-knn', 'pbf', '@vcmap-cesium/engine'],
112
120
  },
113
- plugins: [
114
- createVuePlugin(),
115
- createConfigJsonReloadPlugin(),
116
- ],
121
+ plugins: [createVuePlugin(), createConfigJsonReloadPlugin()],
117
122
  server: {
118
123
  middlewareMode: true,
119
124
  https: mergedOptions.https,
@@ -122,16 +127,22 @@ export default async function serve(options) {
122
127
  css: {
123
128
  preprocessorOptions: {
124
129
  sass: {
125
- additionalData: "\n@import './node_modules/@vcmap/ui/src/styles/variables.scss'\n",
130
+ additionalData:
131
+ "\n@import './node_modules/@vcmap/ui/src/styles/variables.scss'\n",
126
132
  },
127
133
  },
128
134
  },
129
135
  });
130
136
 
131
- addMapConfigRoute(app, mergedOptions.mapConfig, mergedOptions.auth, mergedOptions.config);
137
+ addAppConfigRoute(
138
+ app,
139
+ mergedOptions.appConfig,
140
+ mergedOptions.auth,
141
+ mergedOptions.config,
142
+ );
132
143
  addIndexRoute(app, server);
133
144
  addPluginAssets(app, 'src');
134
- await addConfigRoute(app, mergedOptions.auth, mergedOptions.config);
145
+ await addConfigRoute(app);
135
146
 
136
147
  app.use(server.middlewares);
137
148
 
package/src/update.js CHANGED
@@ -15,8 +15,11 @@ export async function updatePeerDependencies(pluginPeer, pluginPath) {
15
15
  const peerDeps = [`${mapName}@latest`]; // @vcmap/ui is a required peer dep and will be updated in any case
16
16
  if (pluginPeer) {
17
17
  const pluginPeerDeps = Object.keys(pluginPeer)
18
- .filter(depName => !!mapPeer[depName] && pluginPeer[depName] !== mapPeer[depName])
19
- .map(depName => `${depName}@${mapPeer[depName]}`);
18
+ .filter(
19
+ (depName) =>
20
+ !!mapPeer[depName] && pluginPeer[depName] !== mapPeer[depName],
21
+ )
22
+ .map((depName) => `${depName}@${mapPeer[depName]}`);
20
23
  peerDeps.push(...pluginPeerDeps);
21
24
  }
22
25
  logger.spin('Updating peer dependencies');