Skip to content

Commit 69a79df

Browse files
committed
feat(): upd rollup config, remove vue2 version, release vue3-vis package
1 parent b421cd0 commit 69a79df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4623
-68747
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
1-
# vue-visjs
1+
# vue3-visjs
22

3-
> Vue2 component that helps with <a href="http://visjs.org/">Visjs</a> interaction.
4-
> This is a fork of the [vis2vue](https://github.com/alexcode/vue2vis) project to update to the latest split component Visjs structure.
3+
> Vue3 component that helps with <a href="http://visjs.org/">Visjs</a> interaction.
4+
> Originally this is fork of the [vis2vue](https://github.com/alexcode/vue2vis) project to update to the latest split component Visjs structure and a fork of [vue3-visjs](https://github.com/sjmallon/vue3-visjs) project to upgrade to Vue 3 compatibility.
5+
6+
> Also, my colleagues and me were starting to support vanilla visjs (a bit)
57
68
<p align="center">
7-
<a href="https://travis-ci.org/sjmallon/vue-visjs">
8-
<img src="https://travis-ci.com/sjmallon/vue-visjs.svg?branch=master" alt="Build Status" />
9-
</a>
109
<a href="LICENSE">
11-
<img src="https://img.shields.io/github/license/sjmallon/vue-visjs" alt="Software License" />
10+
<img src="https://img.shields.io/github/license/sjmallon/vue3-visjs" alt="Software License" />
1211
</a>
13-
<a href="https://github.com/sjmallon/vue-visjs/releases">
14-
<img src="https://img.shields.io/github/v/release/sjmallon/vue-visjs?sort=semver" alt="Latest Version" />
12+
<a href="https://github.com/sjmallon/vue3-visjs/releases">
13+
<img src="https://img.shields.io/github/v/release/sjmallon/vue3-visjs?sort=semver" alt="Latest Version" />
1514
</a>
1615

1716
<a href="https://github.com/alexcode/vue2vis/issues">
18-
<img src="https://img.shields.io/github/issues/sjmallon/vue-visjs" alt="Issues" />
17+
<img src="https://img.shields.io/github/issues/sjmallon/vue3-visjs" alt="Issues" />
1918
</a>
2019
</p>
2120

2221
### Installation
2322

2423
```
25-
npm install --save vue-visjs
24+
npm install --save vue3-visjs
2625
```
2726

2827
or
2928

3029
```
31-
yarn add vue-visjs
30+
yarn add vue3-visjs
3231
```
3332

3433
## Usage
3534

3635
Declare the component
3736

3837
```javascript
39-
import { Timeline } from 'vue-visjs'
40-
Vue.component('timeline', Timeline)
38+
import { Timeline } from 'vue3-visjs'
4139
```
4240

4341
Add the component in the template.
4442

4543
```html
4644
<body>
4745
<div id="app">
48-
<timeline ref="timeline" :items="items" :groups="groups" :options="options"> </timeline>
46+
<Timeline ref="timeline" :items="items" :groups="groups" :options="options" />
4947
</div>
5048
</body>
5149
```
@@ -88,16 +86,15 @@ By default all Vis events are emitted by your component. You can subscribe to a
8886
```html
8987
<body>
9088
<div id="app">
91-
<timeline
89+
<Timeline
9290
ref="timeline"
9391
:items="items"
9492
:groups="groups"
9593
:options="options"
9694
:events="['drop', 'changed']"
9795
@drop="myDropCallback"
9896
@changed="myChangedCallback"
99-
>
100-
</timeline>
97+
/>
10198
</div>
10299
</body>
103100
```
@@ -124,7 +121,7 @@ All the [Visjs DataSet event](http://visjs.org/docs/data/dataset.html#Events) wi
124121
You can also manage your own data bindings by passing your own DataSet or DataView instead of an Array.
125122

126123
```javascript
127-
import { DataSet } from 'vue2vis'
124+
import { DataSet } from 'vue3-visjs'
128125

129126
new Vue({
130127
el: '#app',
@@ -185,6 +182,8 @@ $ npm install
185182

186183
# build for development and production with minification
187184
$ npm run build
185+
# or only esm
186+
$ npm run build:es
188187

189188
```
190189

@@ -193,31 +192,29 @@ $ npm run build
193192
```bash
194193
# Run demo at localhost:8080
195194
$ npm link
196-
$ cd examples
195+
$ cd examples/vue3
197196
$ npm install
198-
$ npm link vue-visjs
197+
$ npm link vue3-visjs # or npm link ../..
199198
# serve with hot reload at localhost:8080
200-
$ npm run serve
199+
$ npm run dev
201200
```
202201

203-
Go to <http://localhost:8080/> to see running examples
202+
Go to <http://localhost:5173/> to see running examples
204203

205204
NOTE: If you make changes to the library you should run 'npm run build' again in the root folder.
206205
The dev server should detect modification and reload the demo
207206

208-
## Security
209-
210-
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
211-
212207
## Credits
213208

214-
- [Steve Malllon][link-author]
209+
- [Aleksei Klykov][link-author]
210+
211+
- [Steve Malllon](https://github.com/sjmallon)
215212

216213
- [vue2vis contributors](https://github.com/alexcode/vue2vis/graphs/contributors)
217214

218215
## License
219216

220217
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
221218

222-
[link-author]: https://github.com/sjmallon
219+
[link-author]: https://github.com/alexdeia
223220
[link-contributors]: ../../contributors

build/rollup.config.js

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ const esbrowserslist = fs
1616
.readFileSync('./.browserslistrc')
1717
.toString()
1818
.split('\n')
19-
.filter(entry => entry && entry.substring(0, 2) !== 'ie')
19+
.filter((entry) => entry && entry.substring(0, 2) !== 'ie')
2020

2121
// Extract babel preset-env config, to combine with esbrowserslist
2222
const babelPresetEnvConfig = require('../babel.config').presets.filter(
23-
entry => entry[0] === '@babel/preset-env'
23+
(entry) => entry[0] === '@babel/preset-env'
2424
)[0][1]
2525

2626
const argv = minimist(process.argv.slice(2))
@@ -29,56 +29,62 @@ const projectRoot = path.resolve(__dirname, '..')
2929

3030
const baseConfig = {
3131
input: 'src/main.js',
32+
output: {
33+
exports: 'named',
34+
globals: {
35+
vue: 'Vue',
36+
},
37+
},
3238
plugins: {
3339
preVue: [
3440
alias({
3541
entries: [
3642
{
3743
find: '@',
38-
replacement: `${path.resolve(projectRoot, 'src')}`
39-
}
40-
]
41-
})
44+
replacement: `${path.resolve(projectRoot, 'src')}`,
45+
},
46+
],
47+
}),
4248
],
4349
replace: {
4450
'process.env.NODE_ENV': JSON.stringify('production'),
45-
preventAssignment: true
51+
preventAssignment: true,
4652
},
4753
vue: {
4854
css: true,
4955
template: {
50-
isProduction: true
51-
}
56+
isProduction: true,
57+
},
5258
},
5359
postVue: [
5460
resolve({
55-
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue']
61+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
5662
}),
5763
commonjs(),
58-
postcss()
64+
postcss({ plugins: [] }),
5965
],
6066
babel: {
6167
exclude: 'node_modules/**',
6268
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
63-
babelHelpers: 'bundled'
64-
}
65-
}
69+
babelHelpers: 'bundled',
70+
},
71+
},
6672
}
6773

6874
// ESM/UMD/IIFE shared settings: externals
6975
// Refer to https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
7076
const external = [
7177
// list external dependencies, exactly the way it is written in the import statement.
7278
// eg. 'jquery'
73-
'vue'
79+
'vue',
7480
]
7581

7682
// UMD/IIFE shared settings: output.globals
7783
// Refer to https://rollupjs.org/guide/en#output-globals for details
7884
const globals = {
7985
// Provide global variable names to replace your external imports
8086
// eg. jquery: '$'
81-
vue: 'Vue'
87+
vue: 'Vue',
8288
}
8389

8490
// Customize configs for individual targets
@@ -91,7 +97,7 @@ if (!argv.format || argv.format === 'es') {
9197
output: {
9298
file: 'dist/vue-visjs.esm.js',
9399
format: 'esm',
94-
exports: 'named'
100+
exports: 'named',
95101
},
96102
plugins: [
97103
replace(baseConfig.plugins.replace),
@@ -106,12 +112,12 @@ if (!argv.format || argv.format === 'es') {
106112
'@babel/preset-env',
107113
{
108114
...babelPresetEnvConfig,
109-
targets: esbrowserslist
110-
}
111-
]
112-
]
113-
})
114-
]
115+
targets: esbrowserslist,
116+
},
117+
],
118+
],
119+
}),
120+
],
115121
}
116122
buildFormats.push(esConfig)
117123
}
@@ -126,7 +132,7 @@ if (!argv.format || argv.format === 'cjs') {
126132
format: 'cjs',
127133
name: 'VueVisjs',
128134
exports: 'auto',
129-
globals
135+
globals,
130136
},
131137
plugins: [
132138
replace(baseConfig.plugins.replace),
@@ -135,12 +141,12 @@ if (!argv.format || argv.format === 'cjs') {
135141
...baseConfig.plugins.vue,
136142
template: {
137143
...baseConfig.plugins.vue.template,
138-
optimizeSSR: true
139-
}
144+
optimizeSSR: true,
145+
},
140146
}),
141147
...baseConfig.plugins.postVue,
142-
babel(baseConfig.plugins.babel)
143-
]
148+
babel(baseConfig.plugins.babel),
149+
],
144150
}
145151
buildFormats.push(umdConfig)
146152
}
@@ -155,7 +161,7 @@ if (!argv.format || argv.format === 'iife') {
155161
format: 'iife',
156162
name: 'VueVisjs',
157163
exports: 'auto',
158-
globals
164+
globals,
159165
},
160166
plugins: [
161167
replace(baseConfig.plugins.replace),
@@ -165,10 +171,10 @@ if (!argv.format || argv.format === 'iife') {
165171
babel(baseConfig.plugins.babel),
166172
terser({
167173
output: {
168-
ecma: 5
169-
}
170-
})
171-
]
174+
ecma: 5,
175+
},
176+
}),
177+
],
172178
}
173179
buildFormats.push(unpkgConfig)
174180
}

examples/.editorconfig

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/.eslintrc.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/README.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

examples/babel.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)