Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linter/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const DEFAULT_CONFIG = {
disallowTypeAnnotations: false,
},
],
"@typescript-eslint/consistent-type-imports": 0,
"prettier-vue/prettier": [
"error",
{
Expand Down
5 changes: 1 addition & 4 deletions stores/firestore/input.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "reflect-metadata";
import { reactive } from "vue";
import { onInitialize } from "./entity";
import type { EntityMetaData } from "./entityMetadata";
Expand All @@ -14,9 +15,5 @@ export function Input(type: any, options: any = {}) {
errors: [],
};
});
/* setPropertyMetadata(target, name, "input", {
type,
options,
});*/
};
}
13 changes: 12 additions & 1 deletion stores/firestore/var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,19 @@ function isUnparsedEqual(a: any, b: any, type: any): boolean {
return a === b;
}

export function Var(type: any) {
export function Var(type?: any) {
return function (target: EntityBase, name: string) {
if (type === undefined) {
const metadata = Reflect.getMetadata("design:type", target, name);
if (metadata === undefined)
throw new Error(
"Property type is not set for " + target.constructor.name + ":" + name
);

if (metadata.type === Array) type = Array.of(metadata.elementType);
else type = metadata;
}

onInitialize(target, function (this: any, metadata: EntityMetaData) {
if (metadata.properties[name] === undefined) metadata.properties[name] = {};

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"stylelint.config.js",
"index.ts",
"vite.config.cjs",
"default-styles.ts"
"default-styles.ts",
"reflect-metadata.d.ts"
]
}
25 changes: 24 additions & 1 deletion vite.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const vueI18n = require("@intlify/unplugin-vue-i18n/vite");
const { VitePWA } = require("vite-plugin-pwa");
const { createHtmlPlugin } = require("vite-plugin-html");
const purgecss = require("rollup-plugin-purgecss");
const { esbuildDecorators } = require("@anatine/esbuild-decorators");
const { default: babel } = require("vite-plugin-babel");
const {
VueUseComponentsResolver,
VueUseDirectiveResolver,
Expand Down Expand Up @@ -69,7 +71,6 @@ module.exports.define = function (config = {}) {
logLevel: SILENT ? "error" : "info",
clearScreen: false,
cacheDir: cacheDir,

css: {
devSourcemap: config.map !== undefined ? config.map : DEV,
preprocessorOptions: {
Expand All @@ -88,6 +89,13 @@ module.exports.define = function (config = {}) {
"bulma",
"addeus-common-library",
],
esbuildOptions: {
plugins: [
esbuildDecorators({
tsconfig: "./tsconfig.json",
}),
],
},
},
resolve: {
alias: [
Expand All @@ -103,6 +111,7 @@ module.exports.define = function (config = {}) {
sourcemap: config.map !== undefined ? config.map : !DEV,
outDir: outDir,
emptyOutDir: true,
esbuild: false,
//chunkSizeWarningLimit: 3000,
rollupOptions: {
maxParallelFileOps: Math.max(1, cpus().length - 1),
Expand Down Expand Up @@ -199,6 +208,20 @@ module.exports.define = function (config = {}) {
isProduction: !DEV,
}),

babel({
filter: /\.tsx?$/,
babelConfig: {
babelrc: false,
configFile: false,
presets: ["@babel/preset-typescript"],
plugins: [
"babel-plugin-reactgenie",
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
],
},
}),

createHtmlPlugin({
minify: !DEV,
inject: {
Expand Down