@vcmap/plugin-cli 4.0.0-rc.4 → 4.0.0-rc.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/plugin-cli",
3
- "version": "4.0.0-rc.4",
3
+ "version": "4.0.0-rc.5",
4
4
  "description": "A CLI to help develop and build plugins for the VC Map",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -31,19 +31,18 @@
31
31
  "dependencies": {
32
32
  "@vcmap/rollup-plugin-vcs-ol": "^1.0.2",
33
33
  "@vcsuite/cli-logger": "^1.0.0",
34
- "@vitejs/plugin-vue": "^5.0.4",
35
- "vite-plugin-vuetify": "^2.0.3",
34
+ "@vitejs/plugin-vue": "^5.1.3",
36
35
  "commander": "^10.0.1",
37
- "express": "^4.18.2",
36
+ "express": "^4.21.0",
38
37
  "prompts": "^2.4.2",
39
38
  "sass": "^1.77.1",
40
39
  "semver": "^7.5.4",
41
- "tar": "^6.1.15",
42
- "vite": "^5.2.11",
43
- "vue-template-compiler": "~2.7.14"
40
+ "tar": "^7.4.3",
41
+ "vite": "^5.4.3",
42
+ "vite-plugin-vuetify": "^2.0.4"
44
43
  },
45
44
  "peerDependencies": {
46
- "@vcmap/ui": "^6.0.0-rc.1",
45
+ "@vcmap/ui": "^6.0.0-rc.7",
47
46
  "vue": "~3.4.27"
48
47
  },
49
48
  "peerDependenciesMeta": {
package/src/create.js CHANGED
@@ -2,7 +2,7 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import prompts from 'prompts';
4
4
  import { minVersion, parse, prerelease, valid } from 'semver';
5
- import tar from 'tar';
5
+ import * as tar from 'tar';
6
6
  import { logger } from '@vcsuite/cli-logger';
7
7
  import { LicenseType, writeLicense } from './licenses.js';
8
8
  import { DepType, installDeps, setVcMapVersion } from './packageJsonHelpers.js';
@@ -6,7 +6,7 @@ import path from 'path';
6
6
  import { logger } from '@vcsuite/cli-logger';
7
7
  import { getContext, resolveContext } from './context.js';
8
8
  import { getPluginName } from './packageJsonHelpers.js';
9
- import { promiseExec, getDirname } from './pluginCliHelper.js';
9
+ import { promiseExec } from './pluginCliHelper.js';
10
10
 
11
11
  /**
12
12
  * @typedef {Object} HostingOptions
@@ -299,7 +299,7 @@ export async function addConfigRoute(app) {
299
299
  export async function getMapUiIndexHtml(production) {
300
300
  const indexHtmlFileName = production
301
301
  ? resolveMapUi('dist', 'index.html')
302
- : path.join(getDirname(), '..', 'assets', 'index.html');
302
+ : resolveMapUi('index.html');
303
303
  const buffer = await fs.promises.readFile(indexHtmlFileName);
304
304
  return buffer.toString();
305
305
  }
package/src/pack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import tar from 'tar';
3
+ import * as tar from 'tar';
4
4
  import { pipeline } from 'stream';
5
5
  import { createGzip } from 'zlib';
6
6
  import { rm } from 'fs/promises';
package/src/preview.js CHANGED
@@ -58,7 +58,7 @@ async function getServerOptions(options) {
58
58
  resolve: {
59
59
  alias: [
60
60
  {
61
- find: /(\.\.\/)+assets(.*)/,
61
+ find: /(\.\.?\/)+assets(.*)/,
62
62
  replacement: '/assets$2',
63
63
  customResolver: {
64
64
  resolveId(source) {
package/src/serve.js CHANGED
@@ -163,14 +163,6 @@ export default async function serve(options) {
163
163
  middlewareMode: true,
164
164
  proxy: { ...mergedOptions.proxy, ...proxy },
165
165
  },
166
- css: {
167
- preprocessorOptions: {
168
- sass: {
169
- additionalData:
170
- "\n@import './node_modules/@vcmap/ui/src/styles/variables.scss'\n",
171
- },
172
- },
173
- },
174
166
  });
175
167
 
176
168
  addAppConfigRoute(
package/src/update.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  DepType,
6
6
  getPackageJson,
7
7
  installDeps,
8
+ isTS,
8
9
  } from './packageJsonHelpers.js';
9
10
  import { name, version, promiseExec } from './pluginCliHelper.js';
10
11
  import { getContext } from './context.js';
@@ -13,6 +14,8 @@ import { getContext } from './context.js';
13
14
  * @typedef {Object} UpdateOptions
14
15
  * @property {string} [mapVersion] - Optional version of @vcmap/ui to update to. Default is latest
15
16
  * @property {boolean} [force] - Force install
17
+ * @property {boolean} [updateDev] - update typescript & vue-tsc
18
+ * @property {Object} [pluginDev] - provide if providing updateDev
16
19
  */
17
20
 
18
21
  /**
@@ -39,7 +42,11 @@ export async function updatePeerDependencies(
39
42
  }
40
43
  const { stdout, stderr } = await promiseExec(viewCmd);
41
44
  logger.error(stderr);
42
- const { name: mapName, peerDependencies: mapPeer } = JSON.parse(stdout);
45
+ const {
46
+ name: mapName,
47
+ peerDependencies: mapPeer,
48
+ devDependencies: mapDev,
49
+ } = JSON.parse(stdout);
43
50
  const peerDeps = [`${mapName}@${options.mapVersion || 'latest'}`]; // @vcmap/ui is a required peer dep and will be updated in any case
44
51
  if (pluginPeer) {
45
52
  const pluginPeerDeps = Object.keys(pluginPeer)
@@ -52,8 +59,36 @@ export async function updatePeerDependencies(
52
59
  }
53
60
  logger.spin('Updating peer dependencies');
54
61
  await installDeps(peerDeps, DepType.PEER, pluginPath, options.force);
62
+
63
+ if (options.updateDev && options.pluginDev) {
64
+ logger.spin('Updating dev dependencies');
65
+ const devDeps = [];
66
+ if (isTS()) {
67
+ if (mapDev.typescript) {
68
+ devDeps.push(`typescript@${mapDev.typescript}`);
69
+ }
70
+ if (mapDev['vue-tsc']) {
71
+ devDeps.push(`vue-tsc@${mapDev['vue-tsc']}`);
72
+ }
73
+ }
74
+
75
+ if (options.pluginDev?.vitest && mapDev.vitest) {
76
+ devDeps.push(`vitest@${mapDev.vitest}`);
77
+ }
78
+
79
+ if (
80
+ options.pluginDev?.['@vitest/coverage-v8'] &&
81
+ mapDev['@vitest/coverage-v8']
82
+ ) {
83
+ devDeps.push(`@vitest/coverage-v8@${mapDev['@vitest/coverage-v8']}`);
84
+ }
85
+
86
+ await installDeps(devDeps, DepType.DEV, pluginPath, options.force);
87
+ }
55
88
  logger.stopSpinner();
56
- logger.success('Updated peer dependencies');
89
+ logger.success(
90
+ `Updated peer${options.updateDev ? ' & dev' : ''} dependencies`,
91
+ );
57
92
  }
58
93
 
59
94
  /**
@@ -84,6 +119,8 @@ export default async function update(options) {
84
119
  await updateCli(context);
85
120
  await updatePeerDependencies(packageJson.peerDependencies, context, {
86
121
  force: true,
122
+ updateDev: true,
123
+ pluginDev: packageJson.devDependencies,
87
124
  ...options,
88
125
  });
89
126
  await checkVcMapVersion(context);
package/assets/index.html DELETED
@@ -1,115 +0,0 @@
1
- <!DOCTYPE html>
2
- <html class="vcs-ui" lang="en">
3
- <head>
4
- <title>VC Map</title>
5
- <meta charset="utf-8">
6
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
- <link
8
- class="vcs-favicon"
9
- rel="icon"
10
- type="image/png"
11
- href="./assets/favicon-32.png"
12
- sizes="32x32"
13
- >
14
- <link
15
- class="vcs-favicon"
16
- rel="icon"
17
- type="image/png"
18
- href="./assets/favicon-128.png"
19
- sizes="128x128"
20
- >
21
- <link
22
- class="vcs-favicon"
23
- rel="icon"
24
- type="image/png"
25
- href="./assets/favicon-180.png"
26
- sizes="180x180"
27
- >
28
- <link
29
- class="vcs-favicon"
30
- rel="icon"
31
- type="image/png"
32
- href="./assets/favicon-192.png"
33
- sizes="192x192"
34
- >
35
- <link class="vcs-favicon" rel="icon" type="image/svg+xml" href="./assets/favicon.svg">
36
- <link
37
- rel="stylesheet"
38
- href="./assets/@mdi/font/css/materialdesignicons.min.css"
39
- >
40
- <style>
41
- #loading-wrapper {
42
- position: fixed;
43
- width: 100%;
44
- height: 100%;
45
- left: 0;
46
- top: 0;
47
- }
48
-
49
- #loading-text {
50
- display: block;
51
- position: absolute;
52
- top: 50%;
53
- left: 50%;
54
- color: grey;
55
- width: 100px;
56
- height: 30px;
57
- margin: -7px 0 0 -45px;
58
- text-align: center;
59
- font-family: 'PT Sans Narrow', sans-serif;
60
- font-size: 20px;
61
- }
62
-
63
- #loading-content {
64
- display: block;
65
- position: relative;
66
- left: 50%;
67
- top: 50%;
68
- width: 170px;
69
- height: 170px;
70
- margin: -85px 0 0 -85px;
71
- }
72
-
73
- #loading-content {
74
- border: 3px solid transparent;
75
- border-top-color: grey;
76
- border-bottom-color: grey;
77
- border-radius: 50%;
78
- -webkit-animation: loader 2s linear infinite;
79
- -moz-animation: loader 2s linear infinite;
80
- -o-animation: loader 2s linear infinite;
81
- animation: loader 2s linear infinite;
82
- }
83
-
84
- @keyframes loader {
85
- 0% {
86
- -webkit-transform: rotate(0deg);
87
- -ms-transform: rotate(0deg);
88
- transform: rotate(0deg);
89
- }
90
-
91
- 100% {
92
- -webkit-transform: rotate(360deg);
93
- -ms-transform: rotate(360deg);
94
- transform: rotate(360deg);
95
- }
96
- }
97
- </style>
98
- </head>
99
- <body style="height: 100vh; margin: 0;">
100
- <noscript>
101
- <strong>...</strong>
102
- </noscript>
103
- <div id="app">
104
- <div id="loading-wrapper">
105
- <div id="loading-text">LOADING</div>
106
- <div id="loading-content"></div>
107
- </div>
108
- </div>
109
- <script type="module">
110
- import { initAppFromAppConfig } from '@vcmap/ui';
111
-
112
- initAppFromAppConfig('#app', 'app.config.json');
113
- </script>
114
- </body>
115
- </html>