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

Commit

Permalink
Merge pull request #215 from asigloo/hotifx/remove-vue-demi-rollup
Browse files Browse the repository at this point in the history
fix(build): remove vue-demi
  • Loading branch information
alvarosabu authored Jan 2, 2021
2 parents d9d7de5 + ed11af8 commit b63076f
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 49 deletions.
7 changes: 3 additions & 4 deletions dev/typescript/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ import {
email,
pattern,
ValidatorTrigger,
ValidationTriggerTypes,
TextAreaField,
} from '../../src';
/* } from '../../dist/as-dynamic-forms.esm'; */
/* } from '../../src'; */
} from '../../dist/as-dynamic-forms.esm';
export default defineComponent({
name: 'app',
setup() {
Expand Down Expand Up @@ -236,7 +235,7 @@ export default defineComponent({
validations: [emailValidator],
validationTrigger: ValidatorTrigger({
type: ValidationTriggerTypes.CHANGE,
type: 'change',
threshold: 4,
}),
}),
Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
"jsdelivr": "dist/as-dynamic-forms.global.js",
"module": "dist/as-dynamic-forms.esm-bundler.js",
"types": "dist/as-dynamic-forms.d.ts",
"peerDependencies": {
"@vue/composition-api": "^1.0.0-beta.10",
"vue": "^2.0.0 || >=3.0.4"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.12.0",
"@rollup/plugin-alias": "^3.1.1",
Expand Down Expand Up @@ -95,7 +91,6 @@
},
"dependencies": {
"deep-clone": "^3.0.3",
"deep-object-diff": "^1.1.0",
"vue-demi": "^0.5.3"
"deep-object-diff": "^1.1.0"
}
}
12 changes: 2 additions & 10 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ const outputConfigs = {
file: pkg.main,
format: `cjs`,
},
'global-vue-3': {
file: pkg.unpkg.replace('2', '3'),
format: `iife`,
},
'global-vue-2': {
file: pkg.unpkg,
format: `iife`,
},
esm: {
file: pkg.browser,
format: `es`,
Expand All @@ -56,7 +48,7 @@ function createConfig(format, output, plugins = []) {
output.sourcemap = !!process.env.SOURCE_MAP;
output.banner = banner;
output.externalLiveBindings = false;
output.globals = { 'vue-demi': 'VueDemi' };
output.globals = { vue: 'Vue' };

const isProductionBuild = /\.prod\.js$/.test(output.file);
const isGlobalBuild = format === 'global';
Expand Down Expand Up @@ -86,7 +78,7 @@ function createConfig(format, output, plugins = []) {
// during a single build.
/* hasTSChecked = true; */

const external = ['vue-demi'];
const external = ['vue'];

const nodePlugins = [resolve(), commonjs()];

Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox-input/CheckboxInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, h, PropType } from 'vue-demi';
import { defineComponent, h, PropType } from 'vue';
import { FormControl, CheckboxInput } from '@/core/models';
import { useInputEvents } from '@/composables/input-events';
import { useInputValidation } from '@/composables/use-validation';
Expand Down
4 changes: 2 additions & 2 deletions src/components/dynamic-form/DynamicForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</template>

<script lang="ts">
import { nextTick } from 'vue-demi';
import { nextTick } from 'vue';
import {
defineComponent,
Expand All @@ -48,7 +48,7 @@ import {
watch,
inject,
toRaw,
} from 'vue-demi';
} from 'vue';
import { diff } from 'deep-object-diff';
import DynamicInput from '../dynamic-input/DynamicInput.vue';
Expand Down
2 changes: 1 addition & 1 deletion src/components/dynamic-input/DynamicInput.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
/* eslint-disable @typescript-eslint/no-use-before-define */
import { defineComponent, PropType, computed, h } from 'vue-demi';
import { defineComponent, PropType, computed, h } from 'vue';
import TextInputComponent from '../text-input/TextInput.vue';
import SelectInputComponent from '../select-input/SelectInput.vue';
import TextAreaInputComponent from '../text-area-input/TextAreaInput.vue';
Expand Down
2 changes: 1 addition & 1 deletion src/components/number-input/NumberInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, h, PropType } from 'vue-demi';
import { defineComponent, h, PropType } from 'vue';
import { FormControl, NumberInput } from '@/core/models';
import { useInputEvents } from '@/composables/input-events';
import { useInputValidation } from '@/composables/use-validation';
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio-input/RadioInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, h, PropType } from 'vue-demi';
import { defineComponent, h, PropType } from 'vue';
import { FormControl, RadioInput } from '@/core/models';
import { useInputEvents } from '@/composables/input-events';
import { useInputValidation } from '@/composables/use-validation';
Expand Down
2 changes: 1 addition & 1 deletion src/components/select-input/SelectInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, h, PropType, computed } from 'vue-demi';
import { defineComponent, h, PropType, computed } from 'vue';
import { FormControl, SelectInput } from '@/core/models';
import { useInputEvents } from '@/composables/input-events';
import { isObject } from '@/core/utils/helpers';
Expand Down
2 changes: 1 addition & 1 deletion src/components/text-area-input/TextAreaInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, h, PropType } from 'vue-demi';
import { defineComponent, h, PropType } from 'vue';
import { FormControl, TextAreaInput } from '@/core/models';
import { useInputEvents } from '@/composables/input-events';
import { useInputValidation } from '@/composables/use-validation';
Expand Down
2 changes: 1 addition & 1 deletion src/components/text-input/TextInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, h, PropType } from 'vue-demi';
import { defineComponent, h, PropType } from 'vue';
import {
ColorInput,
EmailInput,
Expand Down
2 changes: 1 addition & 1 deletion src/composables/input-events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { computed, ComputedRef, watch } from 'vue-demi';
import { computed, ComputedRef, watch } from 'vue';
import { hasValue } from '../core/utils/helpers';

import { useInputValidation } from '@/composables/use-validation';
Expand Down
2 changes: 1 addition & 1 deletion src/composables/use-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { ErrorMessage } from '@/core/models';
import { removeEmpty } from '@/core/utils/helpers';
import { computed, ref, watch } from 'vue-demi';
import { computed, ref, watch } from 'vue';

export function useInputValidation(props: any, emit: any) {
const isPendingValidation = ref(false);
Expand Down
19 changes: 9 additions & 10 deletions src/core/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ export interface DynamicForm {
options?: FormOptions;
}

export const enum ValidationTriggerTypes {
BLUR = 'blur',
CHANGE = 'change',
}
export interface ValidationTrigger {
type: ValidationTriggerTypes;
threshold: number;
}

export interface ErrorMessage {
text: string;
value: boolean | null;
Expand Down Expand Up @@ -173,13 +182,3 @@ export const enum FieldTypes {
CUSTOM = 'custom-field',
COLOR = 'color',
}

export const enum ValidationTriggerTypes {
BLUR = 'blur',
CHANGE = 'change',
}

export interface ValidationTrigger {
type: ValidationTriggerTypes;
threshold: number;
}
8 changes: 2 additions & 6 deletions src/dynamicForms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, isVue3 } from 'vue-demi';
import { App } from 'vue';
import { dynamicFormsSymbol } from './useApi';
import DynamicForm from './components/dynamic-form/DynamicForm.vue';
import { FormOptions } from './core/models';
Expand All @@ -22,11 +22,7 @@ export function createDynamicForms(
const self = this;

app.component('dynamic-form', DynamicForm);
if (isVue3) {
app.provide(dynamicFormsSymbol, self);
} else {
app.config.globalProperties.$vdf = self;
}
app.provide(dynamicFormsSymbol, self);
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/shims-vue.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module '*.vue' {
import { defineComponent } from 'vue-demi';
import { defineComponent } from 'vue';
const component: ReturnType<typeof defineComponent>;
export default component;
}
2 changes: 1 addition & 1 deletion src/useApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inject, InjectionKey } from 'vue-demi';
import { inject, InjectionKey } from 'vue';
import { DynamicFormsPlugin } from './dynamicForms';

export const dynamicFormsSymbol: InjectionKey<DynamicFormsPlugin> = Symbol();
Expand Down

0 comments on commit b63076f

Please sign in to comment.