diff --git a/package.json b/package.json index 3dabff18..de093810 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "dist/*", "components.js", "plugin.js", - "plugin-vue3.js", "screenshots/*" ], "scripts": { @@ -52,8 +51,7 @@ "rollup-plugin-css-only": "2.1.0", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-vue2": "npm:rollup-plugin-vue@^5.1.9", - "rollup-plugin-vue3": "npm:rollup-plugin-vue@^6.0.0", + "rollup-plugin-vue": "^6.0.0", "sass": "^1.55.0", "sass-loader": "^13.1.0", "semantic-release": "^19.0.5", @@ -86,4 +84,4 @@ "/node_modules/" ] } -} +} \ No newline at end of file diff --git a/plugin-vue3.js b/plugin-vue3.js deleted file mode 100644 index b9bf4f09..00000000 --- a/plugin-vue3.js +++ /dev/null @@ -1,42 +0,0 @@ -import * as Components from "./dist/js/BIMDataComponents/vue3/index.js"; -import * as Directives from "./dist/js/BIMDataDirectives/vue3/index.js"; - -/** - * Instal components and directives from the design system. - * WARNING: The css needs to be added manually. - * @param { { directives?: boolean, includedComponents?: string[], excludedComponents?: string[] } } [cfg] - */ -const pluginFactory = cfg => { - return { - install(app) { - // COMPONENTS - Object.entries(Components).forEach(([componentName, component]) => { - if ( - cfg && - cfg.excludedComponents && - cfg.excludedComponents.length > 0 && - cfg.excludedComponents.includes(componentName) - ) { - return; - } - - if ( - !cfg || - !cfg.includedComponents || - cfg.includedComponents.includes(componentName) - ) { - app.component(componentName, component); - } - }); - - // DIRECTIVES - if (!cfg || cfg.directives !== false) { - Object.entries(Directives).forEach(([directiveName, directive]) => - app.directive(directiveName.split("BIMData")[1], directive) - ); - } - }, - }; -}; - -export default pluginFactory; diff --git a/plugin.js b/plugin.js index 8320a162..b12b3945 100644 --- a/plugin.js +++ b/plugin.js @@ -8,7 +8,7 @@ import * as Directives from "./dist/js/BIMDataDirectives/index.js"; */ const pluginFactory = cfg => { return { - install(Vue) { + install(app) { // COMPONENTS Object.entries(Components).forEach(([componentName, component]) => { if ( @@ -25,14 +25,14 @@ const pluginFactory = cfg => { !cfg.includedComponents || cfg.includedComponents.includes(componentName) ) { - Vue.component(componentName, component); + app.component(componentName, component); } }); // DIRECTIVES if (!cfg || cfg.directives !== false) { Object.entries(Directives).forEach(([directiveName, directive]) => - Vue.directive(directiveName.split("BIMData")[1], directive) + app.directive(directiveName.split("BIMData")[1], directive) ); } }, diff --git a/rollup.config.js b/rollup.config.js index 54128b71..3f9507aa 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,14 +1,8 @@ import { terser } from "rollup-plugin-terser"; -import vue2 from "rollup-plugin-vue2"; -import vue3 from "rollup-plugin-vue3"; -import css from "rollup-plugin-css-only"; -import copy from "rollup-plugin-copy"; +import vue from "rollup-plugin-vue"; import replace from "@rollup/plugin-replace"; import postcss from "rollup-plugin-postcss"; -import alias from "@rollup/plugin-alias"; import image from "@rollup/plugin-image"; -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; module.exports = [ ...getDirectivesConfiguration(), @@ -20,7 +14,6 @@ module.exports = [ function getDirectivesConfiguration() { return [ { - // vue2 input: ["src/BIMDataDirectives/index.js"], plugins: [terser()], output: { @@ -29,16 +22,6 @@ function getDirectivesConfiguration() { }, external: ["vue"], }, - { - // vue3 - input: ["src/BIMDataDirectives/vue3/index.js"], - plugins: [terser()], - output: { - dir: "dist/js/BIMDataDirectives/vue3", - format: "es", - }, - external: ["vue"], - }, ]; } @@ -46,7 +29,6 @@ function getDirectivesConfiguration() { function getAllComponentsBundleConfiguration() { return [ { - // Vue 2 input: ["src/BIMDataComponents/index.js"], output: { dir: "dist/js/BIMDataComponents", @@ -59,72 +41,7 @@ function getAllComponentsBundleConfiguration() { delimiters: ["", ""], preventAssignment: true, }), - css({ - output: "dist/css/design-system.css", - }), - copy({ - targets: [ - { - src: "src/assets/fonts", - dest: "dist", - }, - { - src: "src/assets/scss", - dest: "dist", - }, - { - src: "src/BIMDataComponents/BIMDataColorSelector/colors.js", - dest: "dist", - }, - { - src: "src/assets/css/_BIMDataFonts.css", - dest: "dist/css", - rename: "fonts.css", - }, - { - src: "src/assets/scss/_BIMDataFonts.scss", - dest: "dist/scss", - transform: contents => - contents - .toString() - .replace( - /~@\/assets/g, - "node_modules/@bimdata/design-system/dist" - ), - }, - ], - }), - vue2({ - template: { isProduction: true }, - css: false, - }), - image(), - terser(), - ], - }, - { - // Vue 3 - input: ["src/BIMDataComponents/index.js"], - output: { - dir: "dist/js/BIMDataComponents/vue3", - format: "es", - }, - external: ["vue"], - plugins: [ - alias({ - entries: [ - { - find: /BIMDataDirectives\/(?!vue3\/)/, - replacement: "BIMDataDirectives/vue3/", - }, - ], - }), - replace({ - "~@/assets": "node_modules/@bimdata/design-system/dist", - delimiters: ["", ""], - preventAssignment: true, - }), - vue3({ + vue({ template: { isProduction: true }, preprocessStyles: true, }), @@ -141,7 +58,6 @@ function getSingleSmartComponentConfigurations() { const componentNames = ["BIMDataFileManager"]; return [ - // Build Vue 2.x compatible components ...componentNames.map(componentName => ({ input: [ `src/BIMDataSmartComponents/${componentName}/${componentName}.vue`, @@ -150,46 +66,13 @@ function getSingleSmartComponentConfigurations() { file: `dist/js/BIMDataSmartComponents/${componentName}.js`, format: "esm", }, - external: ["vue"], - plugins: [ - replace({ - "~@/assets": "node_modules/@bimdata/design-system/dist", - delimiters: ["", ""], - preventAssignment: true, - }), - vue2({ - template: { isProduction: true }, - }), - resolve({ browser: true, preferBuiltins: false }), - commonjs(), - image(), - terser(), - ], - })), - // Build Vue 3.x compatible components - ...componentNames.map(componentName => ({ - input: [ - `src/BIMDataSmartComponents/${componentName}/${componentName}.vue`, - ], - output: { - file: `dist/js/BIMDataSmartComponents/vue3/${componentName}.js`, - format: "esm", - }, plugins: [ - alias({ - entries: [ - { - find: /BIMDataDirectives\//, - replacement: "BIMDataDirectives/vue3/", - }, - ], - }), replace({ "~@/assets": "node_modules/@bimdata/design-system/dist", delimiters: ["", ""], preventAssignment: true, }), - vue3({ + vue({ template: { isProduction: true }, preprocessStyles: true, }), @@ -243,7 +126,6 @@ function getSingleComponentConfigurations() { ]; return [ - // Build Vue 2.x compatible components ...componentNames.map(componentName => ({ input: [`src/BIMDataComponents/${componentName}/${componentName}.vue`], output: { @@ -257,36 +139,7 @@ function getSingleComponentConfigurations() { delimiters: ["", ""], preventAssignment: true, }), - vue2({ - template: { isProduction: true }, - }), - image(), - terser(), - ], - })), - // Build Vue 3.x compatible components - ...componentNames.map(componentName => ({ - input: [`src/BIMDataComponents/${componentName}/${componentName}.vue`], - output: { - file: `dist/js/BIMDataComponents/vue3/${componentName}.js`, - format: "esm", - }, - external: ["vue"], - plugins: [ - alias({ - entries: [ - { - find: /BIMDataDirectives\/(?!vue3\/)/, - replacement: "BIMDataDirectives/vue3/", - }, - ], - }), - replace({ - "~@/assets": "node_modules/@bimdata/design-system/dist", - delimiters: ["", ""], - preventAssignment: true, - }), - vue3({ + vue({ template: { isProduction: true }, preprocessStyles: true, }),