@zenuml/core 2.0.16 → 2.0.18

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.
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  important: '.zenuml',
3
- content: ['./public/**/*.html', './src/**/*.vue'],
3
+ content: ['./**/*.html', './src/**/*.vue'],
4
4
  darkMode: false, // or 'media' or 'class'
5
5
  theme: {
6
6
  extend: {
package/types/svg.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ declare module '*.svg?raw' {
2
+ const content: string;
3
+ export default content;
4
+ }
package/vite.config.js ADDED
@@ -0,0 +1,23 @@
1
+ import { defineConfig } from 'vite'
2
+ import { createVuePlugin as vue } from 'vite-plugin-vue2'
3
+
4
+ export default defineConfig({
5
+ build: {
6
+ lib: {
7
+ entry: 'src/core.ts',
8
+ name: '@zenuml/core',
9
+ fileName: 'zenuml-core',
10
+ }
11
+ },
12
+ plugins: [vue()],
13
+ test: {
14
+ environment: 'jsdom',
15
+ deps: {
16
+ inline: [
17
+ ''
18
+ ]
19
+ }
20
+ }
21
+
22
+ }
23
+ )
@@ -1,53 +1,8 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  const config = require('./vue.config')
2
3
  describe('vue.config.js', function () {
3
4
  it('should get pages', () => {
4
- const expectedPages = {
5
- "cy/smoke-creation.html": {
6
- "entry": "src/main.ts",
7
- "filename": "cy/smoke-creation.html",
8
- "template": "public/cy/smoke-creation.html"
9
- },
10
- "cy/smoke-fragment-issue.html": {
11
- "entry": "src/main.ts",
12
- "filename": "cy/smoke-fragment-issue.html",
13
- "template": "public/cy/smoke-fragment-issue.html"
14
- },
15
- "cy/smoke-fragment.html": {
16
- "entry": "src/main.ts",
17
- "filename": "cy/smoke-fragment.html",
18
- "template": "public/cy/smoke-fragment.html"
19
- },
20
- "cy/smoke-interaction.html": {
21
- "entry": "src/main.ts",
22
- "filename": "cy/smoke-interaction.html",
23
- "template": "public/cy/smoke-interaction.html"
24
- },
25
- "cy/smoke-return.html": {
26
- "entry": "src/main.ts",
27
- "filename": "cy/smoke-return.html",
28
- "template": "public/cy/smoke-return.html"
29
- },
30
- "cy/smoke.html": {
31
- "entry": "src/main.ts",
32
- "filename": "cy/smoke.html",
33
- "template": "public/cy/smoke.html"
34
- },
35
- "embed-container-demo.html": {
36
- "entry": "src/main.ts",
37
- "filename": "embed-container-demo.html",
38
- "template": "public/embed-container-demo.html"
39
- },
40
- "embed.html": {
41
- "entry": "src/main.ts",
42
- "filename": "embed.html",
43
- "template": "public/embed.html"
44
- },
45
- "index.html": {
46
- "entry": "src/main.ts",
47
- "filename": "index.html",
48
- "template": "public/index.html"
49
- }
50
- };
5
+ const expectedPages = {"embed-container-demo.html":{"entry":"src/main.ts","template":"public/embed-container-demo.html","filename":"embed-container-demo.html"},"cy/smoke-fragment-issue.html":{"entry":"src/main.ts","template":"public/cy/smoke-fragment-issue.html","filename":"cy/smoke-fragment-issue.html"},"cy/smoke-creation.html":{"entry":"src/main.ts","template":"public/cy/smoke-creation.html","filename":"cy/smoke-creation.html"},"cy/smoke-interaction.html":{"entry":"src/main.ts","template":"public/cy/smoke-interaction.html","filename":"cy/smoke-interaction.html"},"cy/defect-406-alt-under-creation.html":{"entry":"src/main.ts","template":"public/cy/defect-406-alt-under-creation.html","filename":"cy/defect-406-alt-under-creation.html"},"cy/smoke.html":{"entry":"src/main.ts","template":"public/cy/smoke.html","filename":"cy/smoke.html"},"cy/smoke-return.html":{"entry":"src/main.ts","template":"public/cy/smoke-return.html","filename":"cy/smoke-return.html"},"cy/smoke-fragment.html":{"entry":"src/main.ts","template":"public/cy/smoke-fragment.html","filename":"cy/smoke-fragment.html"},"embed.html":{"entry":"src/main.ts","template":"public/embed.html","filename":"embed.html"}};
51
6
  expect(config.pages).toEqual(expectedPages)
52
7
  })
53
- });
8
+ });
@@ -0,0 +1,76 @@
1
+ const {execSync} = require("child_process");
2
+ process.env.VUE_APP_GIT_HASH = execSync('git rev-parse --short HEAD').toString().trim()
3
+ process.env.VUE_APP_GIT_BRANCH = execSync('git branch --show-current').toString().trim();
4
+
5
+ module.exports = {
6
+ pages: getPages(),
7
+ chainWebpack: config =>{
8
+ // A workaround that allows npm link or yarn link
9
+ // https://cli.vuejs.org/guide/troubleshooting.html#symbolic-links-in-node-modules
10
+ config.resolve.symlinks(false)
11
+
12
+ config.plugin('define').tap((definitions) => {
13
+ definitions[0]['VERSION'] = JSON.stringify(require('./package.json').version);
14
+ definitions[0]['BUILD_TIME'] = JSON.stringify(new Date());
15
+ return definitions;
16
+ });
17
+
18
+ // We need to clear the pre-built svg rule
19
+ // use `vue-cli-service inspect to check the webpack
20
+ // the built-in webpack uses file-loader
21
+ const svgRule = config.module.rule('svg')
22
+ svgRule.store.clear();
23
+ svgRule
24
+ .test(/\.svg$/)
25
+ .type('asset/inline')
26
+ .end();
27
+ },
28
+ configureWebpack: {
29
+ resolve: {
30
+ fallback: {
31
+ "fs": false,
32
+ }
33
+ }
34
+ },
35
+ devServer: {
36
+ allowedHosts: "all",
37
+ historyApiFallback: true,
38
+ hot: true,
39
+ host: '0.0.0.0',
40
+ port: 8080,
41
+ client: {
42
+ webSocketURL: 'auto://0.0.0.0:0/ws',
43
+ }
44
+ }
45
+ }
46
+
47
+
48
+ function getPageObject(file) {
49
+ // remove first level of directory, keep the rest
50
+ const subFilePath = file.split('/').slice(1).join('/')
51
+ return {
52
+ [subFilePath]: {
53
+ entry: 'src/main.ts',
54
+ template: file,
55
+ filename: subFilePath
56
+ }
57
+ };
58
+ }
59
+
60
+
61
+ // https://cli.vuejs.org/config/#pages
62
+ function getPages() {
63
+
64
+ // get all html files in public folder recursively
65
+ const files = execSync('find public -name "*.html"').toString().trim().split('\n');
66
+
67
+
68
+ function skipEmbedContainerDemo(file) {
69
+ return file !== 'embed-container-demo.html';
70
+ }
71
+
72
+ const pages = files.filter(skipEmbedContainerDemo)
73
+ .map(getPageObject);
74
+ // merge items in pages array into one object
75
+ return Object.assign({}, ...pages);
76
+ }
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- 14.21
Binary file