Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 5969ebc

Browse files
authored
Merge pull request #45 from alvarosaburido/feature/refactor_main
Feature/refactor main
2 parents 084cefd + 96d70c1 commit 5969ebc

File tree

8 files changed

+3854
-2411
lines changed

8 files changed

+3854
-2411
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
node_modules
33
**/node_modules
44
/dist
5+
/docs/.vuepress/dist
56
/coverage
67
/tests/e2e/videos/
78
/tests/e2e/screenshots/

dev/vue/App.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import {
5454
maxLength,
5555
url,
5656
/* } from '../dist/as-dynamic-forms.common'; */
57-
} from '../src/main';
57+
} from '@/index';
5858
5959
const data = () => ({
6060
formData: {},
@@ -201,6 +201,9 @@ export default {
201201
name: 'app',
202202
data,
203203
methods,
204+
mounted() {
205+
console.log(this.$formUtils);
206+
},
204207
};
205208
</script>
206209
<style lang="scss">

dev/vue/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Vue from 'vue';
22
import App from './App.vue';
33
import './styles/main.scss';
44

5-
import VueDynamicForms from '../../src/main'; // Dev
5+
import VueDynamicForms from '@/index'; // Dev
66
// import VueDynamicForms from '@asigloo/vue-dynamic-forms' // Prod
77

88
Vue.config.productionTip = false;

dev/vue/styles/_vendors.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
$input-border-radius: 50px; */
77
// @import '../../src/styles/themes/default.scss';
88

9-
@import '../../src/styles/themes/material.scss';
9+
@import '@/styles/themes/material.scss';

package-lock.json

Lines changed: 3796 additions & 2378 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"scripts": {
1515
"serve": "vue-cli-service serve",
16-
"build": "vue-cli-service build --target lib --name as-dynamic-forms src/main.js",
16+
"build": "vue-cli-service build --target lib --name as-dynamic-forms src/index.js",
1717
"lint": "vue-cli-service lint",
1818
"test": "vue-cli-service test:unit --verbose --no-cache --watchAll",
1919
"publish": "npm run build && npm publish --access public",
@@ -22,28 +22,28 @@
2222
},
2323
"main": "dist/as-dynamic-forms.common.js",
2424
"dependencies": {
25-
"bootstrap": "^4.4.1",
26-
"core-js": "^3.6.4",
27-
"sass-resources-loader": "^2.0.1",
25+
"bootstrap": "^4.5.0",
26+
"core-js": "^3.6.5",
27+
"sass-resources-loader": "^2.0.3",
2828
"vue": "^2.6.11"
2929
},
3030
"devDependencies": {
31-
"@vue/cli-plugin-babel": "^4.2.3",
32-
"@vue/cli-plugin-eslint": "^4.2.3",
33-
"@vue/cli-plugin-unit-jest": "^4.2.3",
34-
"@vue/cli-service": "^4.2.3",
31+
"@vue/cli-plugin-babel": "^4.4.6",
32+
"@vue/cli-plugin-eslint": "^4.4.6",
33+
"@vue/cli-plugin-unit-jest": "^4.4.6",
34+
"@vue/cli-service": "^4.4.6",
3535
"@vue/eslint-config-prettier": "^6.0.0",
36-
"@vue/test-utils": "1.0.0-beta.32",
36+
"@vue/test-utils": "1.0.3",
3737
"babel-core": "7.0.0-bridge.0",
3838
"babel-eslint": "^10.1.0",
39-
"babel-jest": "^25.2.6",
40-
"eslint": "^6.8.0",
41-
"eslint-plugin-prettier": "^3.1.2",
39+
"babel-jest": "^26.1.0",
40+
"eslint": "^7.4.0",
41+
"eslint-plugin-prettier": "^3.1.4",
4242
"eslint-plugin-vue": "^6.2.2",
43-
"node-sass": "^4.13.1",
44-
"prettier": "^2.0.2",
45-
"sass-loader": "^8.0.2",
43+
"node-sass": "^4.14.1",
44+
"prettier": "^2.0.5",
45+
"sass-loader": "^9.0.1",
4646
"vue-template-compiler": "^2.6.11",
47-
"vuepress": "^1.5.0"
47+
"vuepress": "^1.5.2"
4848
}
4949
}

src/index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import DynamicForm from './components/dynamic-form/DynamicForm.vue';
2+
import DynamicInput from './components/dynamic-input/DynamicInput.vue';
3+
import utils from './core/utils';
4+
5+
const version = process.env.VERSION || require('../package.json').version;
6+
7+
export let _Vue;
8+
9+
export function install(Vue) {
10+
if (install.installed && _Vue === Vue) return;
11+
install.installed = true;
12+
13+
_Vue = Vue;
14+
15+
Vue.prototype.$formUtils = utils;
16+
17+
Vue.component('dynamic-form', DynamicForm);
18+
Vue.component('dynamic-input', DynamicInput);
19+
}
20+
21+
export const AsDynamicForms = {
22+
install,
23+
version,
24+
};
25+
26+
// Automatic installation if Vue has been added to the global scope.
27+
if (typeof window !== 'undefined' && window.Vue) {
28+
window.Vue.use(AsDynamicForms);
29+
}
30+
31+
export * from './core/utils';
32+
33+
export { DynamicForm, DynamicInput };
34+
35+
export default AsDynamicForms;

src/main.js

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

0 commit comments

Comments
 (0)