@vcmap/plugin-cli 2.0.8 → 2.0.9

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.
@@ -11,6 +11,7 @@ stages:
11
11
  - deploy
12
12
  - version
13
13
  - publish
14
+ - deployCluster
14
15
 
15
16
  .template: &job_definition
16
17
  only:
@@ -109,8 +110,10 @@ stopEnvironment:
109
110
  action: stop
110
111
 
111
112
  deployStagingCluster:
112
- <<: *staging_build_template
113
113
  stage: deployCluster
114
+ except:
115
+ variables:
116
+ - $PUBLISH
114
117
  inherit:
115
118
  variables: false
116
119
  variables:
@@ -19,10 +19,10 @@
19
19
  </template>
20
20
 
21
21
  <script>
22
- import { inject } from '@vue/composition-api';
22
+ import { inject } from 'vue';
23
23
  import { VcsButton } from '@vcmap/ui';
24
24
 
25
- export const windowId = 'hello_world_window_id';
25
+ export const windowId = 'hello_world_window_id_plugin-cli';
26
26
 
27
27
  export default {
28
28
  name: 'HelloWorld',
@@ -53,13 +53,13 @@ export default function(config) {
53
53
  i18n: {
54
54
  en: {
55
55
  helloWorld: {
56
- helloWorld: 'Hello World',
56
+ helloWorld: '@vcmap/plugin-cli - Hello World',
57
57
  close: 'Close',
58
58
  },
59
59
  },
60
60
  de: {
61
61
  helloWorld: {
62
- helloWorld: 'Hallo Welt',
62
+ helloWorld: '@vcmap/plugin-cli - Hallo Welt',
63
63
  close: 'Schließen',
64
64
  },
65
65
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/plugin-cli",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "A CLI to help develop and build plugins for the VC Map",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,11 +1,12 @@
1
- import fs from 'fs';
2
- import { cp, copyFile, writeFile } from 'fs/promises';
1
+ import { cp, copyFile, writeFile, rm, mkdir } from 'fs/promises';
3
2
  import path from 'path';
4
- import { getContext } from './context.js';
3
+ import fs from 'fs';
4
+ import { getContext, resolveContext } from './context.js';
5
5
  import { getConfigJson } from './hostingHelpers.js';
6
6
  import { getPluginName } from './packageJsonHelpers.js';
7
7
  import buildModule, { getDefaultConfig } from './build.js';
8
8
  import setupMapUi from './setupMapUi.js';
9
+ import { replaceAssets } from './pack.js';
9
10
 
10
11
 
11
12
  /**
@@ -16,14 +17,25 @@ export default async function buildStagingApp() {
16
17
  const pluginName = await getPluginName();
17
18
  const distPath = path.join(getContext(), 'dist');
18
19
  // Clear dist folder
19
- await fs.rm(distPath, { recursive: true, force: true });
20
- await fs.mkdir(distPath);
20
+ await rm(distPath, { recursive: true, force: true });
21
+ await mkdir(distPath);
21
22
  await setupMapUi();
22
23
  const { buildPluginsForPreview } = await import('@vcmap/ui/build/buildHelpers.js');
23
24
  await buildPluginsForPreview(getDefaultConfig(), true);
24
- await fs.promises.mkdir(path.join(distPath, 'plugins', pluginName), { recursive: true });
25
+ await mkdir(path.join(distPath, 'plugins', pluginName), { recursive: true });
25
26
 
26
27
  await buildModule({ outputPath: `plugins/${pluginName}`, keepDistFolder: true });
28
+
29
+ // copy assets folder if exists
30
+ if (fs.existsSync(resolveContext('plugin-assets'))) {
31
+ await replaceAssets(path.join(distPath, 'plugins', pluginName, 'index.js'), pluginName);
32
+ await cp(
33
+ resolveContext('plugin-assets'),
34
+ path.join(distPath, 'plugins', pluginName, 'plugin-assets'),
35
+ { recursive: true },
36
+ );
37
+ }
38
+
27
39
  await copyFile(
28
40
  path.join(getContext(), 'node_modules', '@vcmap', 'ui', 'dist', 'index.html'),
29
41
  path.join(distPath, 'index.html'),
package/src/create.js CHANGED
@@ -168,7 +168,7 @@ export default async function create() {
168
168
  { title: 'pack', value: { pack: 'vcmplugin pack' }, selected: true },
169
169
  { title: 'start', value: { start: 'vcmplugin serve' }, selected: true },
170
170
  { title: 'preview', value: { preview: 'vcmplugin preview' }, selected: true },
171
- { title: 'buildStagingApp', value: { preview: 'vcmplugin buildStagingApp' }, selected: true },
171
+ { title: 'buildStagingApp', value: { buildStagingApp: 'vcmplugin buildStagingApp' }, selected: true },
172
172
  { title: 'lint', value: { lint: 'eslint "{src,tests}/**/*.{js,vue}"' }, selected: true },
173
173
  ];
174
174
 
@@ -176,7 +176,8 @@ export default async function create() {
176
176
  { title: '@vcmap/core', value: '@vcmap/core' },
177
177
  { title: '@vcmap/cesium', value: '@vcmap/cesium' },
178
178
  { title: 'ol', value: 'ol@~6.13.0' },
179
- { title: '@vue/composition-api', value: '@vue/composition-api@~1.4.5' },
179
+ { title: 'vue', value: 'vue@~2.7.3' },
180
+ { title: 'vuetify', value: 'vue@~2.6.7' },
180
181
  ];
181
182
 
182
183
  const questions = [
package/src/pack.js CHANGED
@@ -3,17 +3,18 @@ import { readFile, writeFile } from 'fs/promises';
3
3
  import archiver from 'archiver';
4
4
  import { logger } from '@vcsuite/cli-logger';
5
5
  import { getPluginName } from './packageJsonHelpers.js';
6
- import { resolveContext, getContext } from './context.js';
6
+ import { resolveContext } from './context.js';
7
7
  import build from './build.js';
8
8
 
9
9
  /**
10
+ * @param {string} fileName
10
11
  * @param {string} name
11
12
  * @returns {Promise<void>}
12
13
  */
13
- async function replaceAssets(name) {
14
- let indexJSContent = await readFile(getContext('dist', 'index.js'));
15
- indexJSContent = indexJSContent.replace(/\.?\/?(plugin-assets)\//g, `plugins/${name}/$1/`);
16
- await writeFile(getContext('dist', 'index.js'), indexJSContent);
14
+ export async function replaceAssets(fileName, name) {
15
+ let fileContent = await readFile(fileName, { encoding: 'utf8' });
16
+ fileContent = fileContent.replace(/\.?\/?(plugin-assets)\//g, `plugins/${name}/$1/`);
17
+ await writeFile(fileName, fileContent);
17
18
  }
18
19
 
19
20
  /**
@@ -93,7 +94,7 @@ export default async function pack() {
93
94
  const pluginName = await getPluginName();
94
95
  logger.spin(`building plugin: ${pluginName}`);
95
96
  await build({});
96
- await replaceAssets(pluginName);
97
+ await replaceAssets(resolveContext('dist', 'index.js'), pluginName);
97
98
  logger.debug('fixed asset paths');
98
99
  await ensureConfigJson();
99
100
  logger.debug('ensuring config.json');