@vcmap/plugin-cli 2.0.10 → 2.0.12
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/README.md +70 -14
- package/assets/{helloWorld/.gitlab-ci.yml → .gitlab-ci.yml} +10 -0
- package/assets/gitignore +30 -0
- package/assets/index.html +29 -33
- package/assets/index.js +62 -0
- package/cli.js +7 -9
- package/index.js +1 -0
- package/package.json +8 -8
- package/src/build.js +0 -10
- package/src/buildStagingApp.js +12 -1
- package/src/create.js +198 -87
- package/src/hostingHelpers.js +9 -18
- package/src/packageJsonHelpers.js +34 -1
- package/src/pluginCliHelper.js +41 -0
- package/src/preview.js +13 -9
- package/src/serve.js +18 -17
- package/src/update.js +50 -0
- package/assets/helloWorld/build/staging/Dockerfile +0 -2
- package/assets/helloWorld/plugin-assets/vcs_logo.png +0 -0
- package/assets/helloWorld/src/helloWorld.vue +0 -54
- package/assets/helloWorld/src/index.js +0 -72
package/README.md
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
> For documentation on version 1 compatible with VC Map v4, see [this tag](https://github.com/virtualcitySYSTEMS/map-plugin-cli/tree/v1.1.1)
|
|
6
6
|
> and be sure to install using `npm i -g @vcmap/plugin-cli@^1.1.0`**
|
|
7
7
|
|
|
8
|
-
The `
|
|
8
|
+
The `@vcmap/plugin-cli` helps develop and build plugins for the **VC Map**.
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
12
|
- Creating basic plugin structure
|
|
13
|
+
- from scratch
|
|
14
|
+
- from an existing plugin [@vcmap/hello-world](https://www.npmjs.com/package/@vcmap/hello-world) used as template
|
|
13
15
|
- Providing plugin development server
|
|
14
16
|
- Building plugins for production
|
|
15
17
|
|
|
@@ -40,14 +42,20 @@ its current major version. You can then use either the scripts defined
|
|
|
40
42
|
by the template in your package.json `npm start`, `npm run pack` etc. or `npx`
|
|
41
43
|
to execute CLI commands.
|
|
42
44
|
|
|
45
|
+
All commands have (optional) cli options. Run `vcmplugin --help` or `vcmplugin help [command]` for more information.
|
|
46
|
+
For `serve` and `preview` you can alternatively define a `vcs.config.js` in your plugin's root directory.
|
|
47
|
+
For more information see [here](#vcm-config-js).
|
|
48
|
+
|
|
43
49
|
### 1. Creating a new plugin
|
|
44
50
|
|
|
45
|
-
To create a new plugin template, run the following
|
|
51
|
+
To create a new plugin template, run the following:
|
|
46
52
|
```
|
|
47
53
|
vcmplugin create
|
|
48
54
|
```
|
|
49
|
-
This will open a command prompt helping you to create the basic [structure of a plugin](
|
|
50
|
-
Be sure to check out the [peer dependecy section](#
|
|
55
|
+
This will open a command prompt helping you to create the basic [structure of a plugin](#vc-map-plugins).
|
|
56
|
+
Be sure to check out the [peer dependecy section](#about-peer-dependencies) as well.
|
|
57
|
+
|
|
58
|
+
Optionally, in step 7 of the create-prompt you can choose an existing plugin [@vcmap/hello-world](https://www.npmjs.com/package/@vcmap/hello-world) as template.
|
|
51
59
|
|
|
52
60
|
### 2. Serving a plugin for development
|
|
53
61
|
|
|
@@ -56,7 +64,7 @@ To serve your plugin in dev mode, run the following within your projects root:
|
|
|
56
64
|
npx vcmplugin serve
|
|
57
65
|
```
|
|
58
66
|
The dev mode gives you complete debug information on all integrated libraries (@vcmap/core, ol etc.)
|
|
59
|
-
By default this command will launch a dev server at localhost:8008 using
|
|
67
|
+
By default, this command will launch a dev server at localhost:8008 using
|
|
60
68
|
the @vcmap/ui peer dependency package of your plugin as its base.
|
|
61
69
|
You can provide an alternate map config if you wish.
|
|
62
70
|
|
|
@@ -122,15 +130,48 @@ npx vcmplugin pack
|
|
|
122
130
|
This will create a folder `dist` with a zip file containing your bundled code and assets.
|
|
123
131
|
To use the plugin productively in a hosted map,
|
|
124
132
|
unzip this file on your server to `{vcm-root}/plugins` and add
|
|
125
|
-
an entry to your VC MAP
|
|
133
|
+
an entry to your VC MAP `config` plugins section. This zip file can also be unzipped
|
|
126
134
|
in the VC Publishers `plugins` public directory.
|
|
127
135
|
|
|
136
|
+
## vcm config js
|
|
137
|
+
|
|
138
|
+
The `@vcmap/plugin-cli` supports an optional configuration file, which can be used for the commands `serve` and `preview`.
|
|
139
|
+
It's an alternative to providing cli parameters (which will still have precedence) and even has a few extra feature like proxy.
|
|
140
|
+
This can be helpful, if you want to share specific parameters valid for a specific plugin.
|
|
141
|
+
In order to do so just save a `vcm.config.js` in your plugin's root directory.
|
|
142
|
+
This file has to return a js object as default export.
|
|
143
|
+
|
|
144
|
+
Example `vcm.config.js` defining proxy and port:
|
|
145
|
+
```js
|
|
146
|
+
export default {
|
|
147
|
+
// server.proxy see https://vitejs.dev/config/server-options.html#server-proxy
|
|
148
|
+
proxy: {
|
|
149
|
+
// string shorthand: http://localhost:8008/foo -> https://vc.systems/foo
|
|
150
|
+
'/foo': 'https://vc.systems',
|
|
151
|
+
},
|
|
152
|
+
port: 5005,
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The following parameters are valid:
|
|
157
|
+
|
|
158
|
+
| parameter | type | description |
|
|
159
|
+
|-----------|---------|-----------------------------------------------------------------------------------------------|
|
|
160
|
+
| config | string | an optional fileName to use for configuring the plugin |
|
|
161
|
+
| port | number | optional alternative port (default 8008) |
|
|
162
|
+
| https | boolean | wether to use http (default) or https |
|
|
163
|
+
| mapConfig | string | a filename or URL to a map config (for `serve` command) |
|
|
164
|
+
| vcm | string | a filename or URL to a map (for `preview` command) |
|
|
165
|
+
| proxy | Object | a server proxy (see [vitejs.dev](https://vitejs.dev/config/server-options.html#server-proxy)) |
|
|
166
|
+
|
|
167
|
+
|
|
128
168
|
## About Peer Dependencies
|
|
129
|
-
The @vcmap/ui uses some _very large libraries_, notably `CesiumJS`. To reduce the amount
|
|
169
|
+
The [@vcmap/ui](https://github.com/virtualcitySYSTEMS/map-ui) uses some _very large libraries_, notably `CesiumJS`. To reduce the amount
|
|
130
170
|
of traffic generated for loading plugins, all large libraries (see the list below),
|
|
131
|
-
are _provided_ in production (instead of bundling them into every plugin). This
|
|
132
|
-
a certain amount of type safety (using the @vcsuite/check parameter
|
|
133
|
-
b) reduces the amount of traffic required to load an application and
|
|
171
|
+
are _provided_ in production (instead of bundling them into every plugin). This
|
|
172
|
+
a) guarantees a certain amount of type safety (using the [@vcsuite/check](https://www.npmjs.com/package/@vcsuite/check) parameter assertion library for instance),
|
|
173
|
+
b) reduces the amount of traffic required to load an application and
|
|
174
|
+
c) leverages browser
|
|
134
175
|
caching more readily.
|
|
135
176
|
|
|
136
177
|
The following libraries are provided by the @vcmap/ui in a deployed application. You should define these
|
|
@@ -141,7 +182,14 @@ as peer dependencies if you use them in your plugin:
|
|
|
141
182
|
- vue
|
|
142
183
|
- vuetify
|
|
143
184
|
|
|
144
|
-
|
|
185
|
+
If you want to update your plugin to a newer version of `@vcmap/ui`, the `@vcmap/plugin-cli` provides a update tool.
|
|
186
|
+
Just change to your plugin's directory and run:
|
|
187
|
+
```bash
|
|
188
|
+
vcmplugin update
|
|
189
|
+
```
|
|
190
|
+
This will automatically update all peer dependencies defined in your plugin to the corresponding version of the latest `@vcmap/ui`.
|
|
191
|
+
|
|
192
|
+
During the build step, these libraries are automatically externalized by the `@vcmap/plugin-cli` and in
|
|
145
193
|
production all plugins & the map core _share_ the same cesium library.
|
|
146
194
|
|
|
147
195
|
But, to make this work, it is important to define these dependencies as _peer dependencies_ of
|
|
@@ -161,7 +209,7 @@ import { Cartesian3 } from '@vcmap/cesium';
|
|
|
161
209
|
openlayers provides a special case, since its modules do not provide a _flat_ namespace.
|
|
162
210
|
To circumvent this limitation, _the @vcmap/ui provides a flat namespaced ol.js_ and a mechanic
|
|
163
211
|
to rewrite openlayers imports. This is automatically applied by the `@vcmap/rollup-plugin-vcs-ol`
|
|
164
|
-
used by the
|
|
212
|
+
used by the `@vcmap/plugin-cli` build step. So openlayers imports can be written as:
|
|
165
213
|
```js
|
|
166
214
|
import Feature from 'ol/Feature.js';
|
|
167
215
|
```
|
|
@@ -192,7 +240,7 @@ to create your project, a template already adhering to these specs will be creat
|
|
|
192
240
|
- Plugin dependencies have to be defined in the `package.json`.
|
|
193
241
|
- `dependency`: all plugin specific dependencies NOT provided by the `@vcmap/ui`.
|
|
194
242
|
- `peerDependency`: dependencies provided by the `@vcmap/ui`,
|
|
195
|
-
|
|
243
|
+
- e.g. `@vcmap/core` or `@vcmap/ui` (see [About Peer Dependencies](#About-Peer-Dependencies) for more details)
|
|
196
244
|
- `devDependency`: all dependencies only required for development, e.g. `eslint`.
|
|
197
245
|
- Plugins can be published to NPM, but should contain both source and minified code
|
|
198
246
|
to allow seamless integration into the [VC Map UI](https://github.com/virtualcitySYSTEMS/map-ui) environment.
|
|
@@ -305,7 +353,15 @@ cannot handle css resources.
|
|
|
305
353
|
If you have to access assets _before_ your plugin is created (in the exported function of
|
|
306
354
|
your plugin code), you will have to use the `baseUrl` provided to you to generate the URL yourself.
|
|
307
355
|
|
|
356
|
+
## About testing plugins
|
|
357
|
+
|
|
358
|
+
To test your plugin's API you can use [vitest](https://vitest.dev/).
|
|
359
|
+
The `@vcmap/hello-world` plugin contains a basic setup of a test environment including example spec using vitest.
|
|
360
|
+
You will find the required setup in your created plugin, if you chose to add `test` as script to your `package.json` during the create-prompt.
|
|
361
|
+
|
|
362
|
+
As for now, we don't do any components testing.
|
|
363
|
+
|
|
308
364
|
## Notes on Developing
|
|
309
365
|
To develop the plugin-cli, be sure to not `npm link` into plugins, since this will
|
|
310
366
|
throw the resolver in resolving the @vcmap/ui peer dependency from the current plugin.
|
|
311
|
-
Instead run `npm pack` in the plugin cli and install the tarball in the plugin directly.
|
|
367
|
+
Instead, run `npm pack` in the plugin cli and install the tarball in the plugin directly.
|
|
@@ -51,6 +51,16 @@ lint:
|
|
|
51
51
|
script:
|
|
52
52
|
- npm run lint
|
|
53
53
|
|
|
54
|
+
test:
|
|
55
|
+
<<: *after_build_definition
|
|
56
|
+
stage: test
|
|
57
|
+
script:
|
|
58
|
+
- npm run coverage -- --reporter junit --outputFile test-report.xml
|
|
59
|
+
coverage: '/^Statements\s*:\s*([^%]+)/'
|
|
60
|
+
artifacts:
|
|
61
|
+
reports:
|
|
62
|
+
junit: test-report.xml
|
|
63
|
+
|
|
54
64
|
audit:
|
|
55
65
|
<<: *after_build_definition
|
|
56
66
|
stage: test
|
package/assets/gitignore
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
node_modules
|
|
2
|
+
/dist
|
|
3
|
+
test-report.xml
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# local env files
|
|
7
|
+
.env.local
|
|
8
|
+
.env.*.local
|
|
9
|
+
|
|
10
|
+
# Log files
|
|
11
|
+
npm-debug.log*
|
|
12
|
+
yarn-debug.log*
|
|
13
|
+
yarn-error.log*
|
|
14
|
+
pnpm-debug.log*
|
|
15
|
+
|
|
16
|
+
# Editor directories and files
|
|
17
|
+
.idea
|
|
18
|
+
.vscode
|
|
19
|
+
*.suo
|
|
20
|
+
*.ntvs*
|
|
21
|
+
*.njsproj
|
|
22
|
+
*.sln
|
|
23
|
+
*.sw?
|
|
24
|
+
|
|
25
|
+
# test output
|
|
26
|
+
.nyc_output
|
|
27
|
+
coverage
|
|
28
|
+
|
|
29
|
+
# static output
|
|
30
|
+
docs
|
package/assets/index.html
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html class="vcs-ui" lang="en">
|
|
3
|
-
|
|
3
|
+
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
<strong>...</strong>
|
|
14
|
-
</noscript>
|
|
15
|
-
<div id="app">
|
|
16
|
-
<div id="loading-wrapper">
|
|
6
|
+
</head>
|
|
7
|
+
<body style="height: 100vH;">
|
|
8
|
+
<noscript>
|
|
9
|
+
<strong>...</strong>
|
|
10
|
+
</noscript>
|
|
11
|
+
<div id="app">
|
|
12
|
+
<div id="loading-wrapper">
|
|
17
13
|
<div id="loading-text">LOADING</div>
|
|
18
14
|
<div id="loading-content"></div>
|
|
19
|
-
</div>
|
|
20
15
|
</div>
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
</div>
|
|
17
|
+
<style>
|
|
18
|
+
#loading-wrapper {
|
|
23
19
|
position: fixed;
|
|
24
20
|
width: 100%;
|
|
25
21
|
height: 100%;
|
|
26
22
|
left: 0;
|
|
27
23
|
top: 0;
|
|
28
|
-
|
|
24
|
+
}
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
#loading-text {
|
|
31
27
|
display: block;
|
|
32
28
|
position: absolute;
|
|
33
29
|
top: 50%;
|
|
@@ -39,9 +35,9 @@
|
|
|
39
35
|
text-align: center;
|
|
40
36
|
font-family: 'PT Sans Narrow', sans-serif;
|
|
41
37
|
font-size: 20px;
|
|
42
|
-
|
|
38
|
+
}
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
#loading-content {
|
|
45
41
|
display: block;
|
|
46
42
|
position: relative;
|
|
47
43
|
left: 50%;
|
|
@@ -49,9 +45,9 @@
|
|
|
49
45
|
width: 170px;
|
|
50
46
|
height: 170px;
|
|
51
47
|
margin: -85px 0 0 -85px;
|
|
52
|
-
|
|
48
|
+
}
|
|
53
49
|
|
|
54
|
-
|
|
50
|
+
#loading-content {
|
|
55
51
|
border: 3px solid transparent;
|
|
56
52
|
border-top-color: #409d76;
|
|
57
53
|
border-bottom-color: #409d76;
|
|
@@ -60,22 +56,22 @@
|
|
|
60
56
|
-moz-animation: loader 2s linear infinite;
|
|
61
57
|
-o-animation: loader 2s linear infinite;
|
|
62
58
|
animation: loader 2s linear infinite;
|
|
63
|
-
|
|
59
|
+
}
|
|
64
60
|
|
|
65
|
-
|
|
61
|
+
@keyframes loader {
|
|
66
62
|
0% {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
-webkit-transform: rotate(0deg);
|
|
64
|
+
-ms-transform: rotate(0deg);
|
|
65
|
+
transform: rotate(0deg);
|
|
70
66
|
}
|
|
71
67
|
|
|
72
68
|
100% {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
-webkit-transform: rotate(360deg);
|
|
70
|
+
-ms-transform: rotate(360deg);
|
|
71
|
+
transform: rotate(360deg);
|
|
76
72
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
75
|
+
<script type="module" src="./node_modules/@vcmap/ui/start.js"></script>
|
|
76
|
+
</body>
|
|
81
77
|
</html>
|
package/assets/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { version, name } from '../package.json';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} PluginState
|
|
5
|
+
* @property {any} prop
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {T} config - the configuration of this plugin instance, passed in from the app.
|
|
10
|
+
* @param {string} baseUrl - the absolute URL from which the plugin was loaded (without filename, ending on /)
|
|
11
|
+
* @returns {import("@vcmap/ui/src/vcsUiApp").VcsPlugin<T, PluginState>}
|
|
12
|
+
* @template {Object} T
|
|
13
|
+
*/
|
|
14
|
+
export default function plugin(config, baseUrl) {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.log(config, baseUrl);
|
|
17
|
+
return {
|
|
18
|
+
get name() { return name; },
|
|
19
|
+
get version() { return version; },
|
|
20
|
+
/**
|
|
21
|
+
* @param {import("@vcmap/ui").VcsUiApp} vcsUiApp
|
|
22
|
+
* @param {PluginState=} state
|
|
23
|
+
* @returns {Promise<void>}
|
|
24
|
+
*/
|
|
25
|
+
initialize: async (vcsUiApp, state) => {
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.log('Called before loading the rest of the current context. Passed in the containing Vcs UI App ', vcsUiApp, state);
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* @param {import("@vcmap/ui").VcsUiApp} vcsUiApp
|
|
31
|
+
* @returns {Promise<void>}
|
|
32
|
+
*/
|
|
33
|
+
onVcsAppMounted: async (vcsUiApp) => {
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console.log('Called when the root UI component is mounted and managers are ready to accept components', vcsUiApp);
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* @returns {T}
|
|
39
|
+
*/
|
|
40
|
+
toJSON() {
|
|
41
|
+
// eslint-disable-next-line no-console
|
|
42
|
+
console.log('Called when serializing this plugin instance');
|
|
43
|
+
return {};
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* should return the plugins state
|
|
47
|
+
* @param {boolean} forUrl
|
|
48
|
+
* @returns {PluginState}
|
|
49
|
+
*/
|
|
50
|
+
getState(forUrl) {
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
|
+
console.log('Called when collecting state, e.g. for create link', forUrl);
|
|
53
|
+
return {
|
|
54
|
+
prop: '*',
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
destroy() {
|
|
58
|
+
// eslint-disable-next-line no-console
|
|
59
|
+
console.log('hook to cleanup');
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
package/cli.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import program from 'commander';
|
|
3
3
|
import './src/defaultCommand.js';
|
|
4
4
|
import {
|
|
5
|
-
create, serve, build, pack, preview,
|
|
5
|
+
create, serve, build, pack, preview, update,
|
|
6
6
|
} from './index.js';
|
|
7
|
-
import { version } from './src/
|
|
7
|
+
import { version } from './src/pluginCliHelper.js';
|
|
8
8
|
import setupMapUi from './src/setupMapUi.js';
|
|
9
9
|
import buildStagingApp from './src/buildStagingApp.js';
|
|
10
10
|
|
|
@@ -25,13 +25,6 @@ program
|
|
|
25
25
|
.defaultOptions()
|
|
26
26
|
.defaultServeOptions()
|
|
27
27
|
.option('--vcm [url]', 'URL to a virtualcityMAP application', val => val.replace(/\/$/, ''))
|
|
28
|
-
.option('--proxyRoute <route>', 'a route to proxy as well (e.g. if you have additional proxies on your server)', (val, prev) => {
|
|
29
|
-
if (!prev) {
|
|
30
|
-
return [val];
|
|
31
|
-
}
|
|
32
|
-
prev.push(val);
|
|
33
|
-
return prev;
|
|
34
|
-
}, [])
|
|
35
28
|
.safeAction(preview);
|
|
36
29
|
|
|
37
30
|
program
|
|
@@ -57,4 +50,9 @@ program
|
|
|
57
50
|
.command('setup-map-ui')
|
|
58
51
|
.safeAction(setupMapUi);
|
|
59
52
|
|
|
53
|
+
program
|
|
54
|
+
.command('update')
|
|
55
|
+
.defaultOptions()
|
|
56
|
+
.safeAction(update);
|
|
57
|
+
|
|
60
58
|
program.parse(process.argv);
|
package/index.js
CHANGED
|
@@ -4,5 +4,6 @@ export { default as build } from './src/build.js';
|
|
|
4
4
|
export { default as pack } from './src/pack.js';
|
|
5
5
|
export { default as preview } from './src/preview.js';
|
|
6
6
|
export { default as buildStagingApp } from './src/buildStagingApp.js';
|
|
7
|
+
export { default as update } from './src/update.js';
|
|
7
8
|
export { default as setupMapUi } from './src/setupMapUi.js';
|
|
8
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcmap/plugin-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"description": "A CLI to help develop and build plugins for the VC Map",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"LICENSE.md"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@vcmap/rollup-plugin-vcs-ol": "^1.0.
|
|
29
|
+
"@vcmap/rollup-plugin-vcs-ol": "^1.0.2",
|
|
30
30
|
"@vcsuite/cli-logger": "^1.0.0",
|
|
31
31
|
"archiver": "^5.0.0",
|
|
32
32
|
"commander": "^6.0.0",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"prompts": "^2.4.1",
|
|
35
35
|
"sass": "1.32.13",
|
|
36
36
|
"semver": "^7.3.5",
|
|
37
|
-
"
|
|
38
|
-
"vite": "^2.
|
|
39
|
-
"vite-plugin-vue2": "^2.0.
|
|
40
|
-
"vue-template-compiler": "~2.7.
|
|
37
|
+
"tar": "^6.1.13",
|
|
38
|
+
"vite": "^3.2.0",
|
|
39
|
+
"vite-plugin-vue2": "^2.0.2",
|
|
40
|
+
"vue-template-compiler": "~2.7.14"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@vcmap/ui": "^5.0.0-rc.
|
|
44
|
-
"vue": "~2.7.
|
|
43
|
+
"@vcmap/ui": "^5.0.0-rc.15",
|
|
44
|
+
"vue": "~2.7.14"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
47
47
|
"@vcmap/ui": {
|
package/src/build.js
CHANGED
|
@@ -3,8 +3,6 @@ import fs from 'fs/promises';
|
|
|
3
3
|
import { createVuePlugin } from 'vite-plugin-vue2';
|
|
4
4
|
import vcsOl from '@vcmap/rollup-plugin-vcs-ol';
|
|
5
5
|
import { logger } from '@vcsuite/cli-logger';
|
|
6
|
-
import { VuetifyResolver } from 'unplugin-vue-components/dist/resolvers.js';
|
|
7
|
-
import Components from 'unplugin-vue-components/dist/vite.js';
|
|
8
6
|
import { getPluginEntry, getPluginName } from './packageJsonHelpers.js';
|
|
9
7
|
import { getContext } from './context.js';
|
|
10
8
|
|
|
@@ -21,14 +19,6 @@ export function getDefaultConfig() {
|
|
|
21
19
|
publicDir: false,
|
|
22
20
|
plugins: [
|
|
23
21
|
createVuePlugin(),
|
|
24
|
-
Components({
|
|
25
|
-
resolvers: [
|
|
26
|
-
VuetifyResolver(),
|
|
27
|
-
],
|
|
28
|
-
dirs: ['./src'],
|
|
29
|
-
include: [],
|
|
30
|
-
exclude: [],
|
|
31
|
-
}),
|
|
32
22
|
vcsOl(),
|
|
33
23
|
],
|
|
34
24
|
};
|
package/src/buildStagingApp.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { cp, copyFile, writeFile, rm, mkdir } from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
+
import { logger } from '@vcsuite/cli-logger';
|
|
4
5
|
import { getContext, resolveContext } from './context.js';
|
|
5
|
-
import { getConfigJson } from './hostingHelpers.js';
|
|
6
|
+
import { executeUiNpm, getConfigJson, resolveMapUi } from './hostingHelpers.js';
|
|
6
7
|
import { getPluginName } from './packageJsonHelpers.js';
|
|
7
8
|
import buildModule, { getDefaultConfig } from './build.js';
|
|
8
9
|
import setupMapUi from './setupMapUi.js';
|
|
@@ -34,6 +35,15 @@ export default async function buildStagingApp() {
|
|
|
34
35
|
);
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
// In case @vcmap/ui is linked via git+ssh, dist folder is not available and must be built first
|
|
39
|
+
if (!fs.existsSync(resolveMapUi('dist'))) {
|
|
40
|
+
logger.spin('building @vcmap/ui');
|
|
41
|
+
await executeUiNpm('--production=false --no-package-lock', 'install');
|
|
42
|
+
await executeUiNpm('build');
|
|
43
|
+
logger.stopSpinner();
|
|
44
|
+
logger.info('@vcmap/ui built');
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
await copyFile(
|
|
38
48
|
path.join(getContext(), 'node_modules', '@vcmap', 'ui', 'dist', 'index.html'),
|
|
39
49
|
path.join(distPath, 'index.html'),
|
|
@@ -55,4 +65,5 @@ export default async function buildStagingApp() {
|
|
|
55
65
|
path.join(distPath, 'config'),
|
|
56
66
|
{ recursive: true },
|
|
57
67
|
);
|
|
68
|
+
logger.success('buildStagingApp finished');
|
|
58
69
|
}
|