vue plugin system somehow works

This commit is contained in:
2021-12-29 01:25:35 +01:00
parent 1954659a82
commit ee20eb16e1
30 changed files with 136 additions and 51 deletions
@@ -26,6 +26,7 @@ import editorPlugin from '../editor/plugin';
import { ZeroSchema } from 'zero/schemas';
import { ZeroSchemaProp } from './zero';
import * as zeroOptions from '../options';
import plugins from '../plugins.generated';
export class ZeroRuntime implements Zero
{
@@ -113,6 +114,11 @@ export class ZeroRuntime implements Zero
translationPlugin.install(pluginOptions);
integrationPlugin.install(pluginOptions);
userPlugin.install(pluginOptions);
plugins.forEach(plugin =>
{
plugin.install(pluginOptions);
});
}
@@ -122,7 +122,7 @@
strong
{
display: inline-block;
margin-bottom: 5px;
margin-bottom: 3px;
color: var(--color-text);
}
}
@@ -1 +0,0 @@
export default [ ];
@@ -0,0 +1,2 @@
import zeroPlugin0 from '@zeroplugin0/plugin';
export default [ zeroPlugin0 ];
+3
View File
@@ -6,6 +6,9 @@
"dev": "vite",
"build": "vite build"
},
"workspaces": [
"../plugins/zero.Commerce/zero.Commerce.Plugin"
],
"dependencies": {
"axios": "^0.24.0",
"dayjs": "^1.10.7",
+2 -1
View File
@@ -11,5 +11,6 @@
"esModuleInterop": true,
"lib": [ "esnext", "dom" ]
},
"include": [ "app/**/*.ts", "app/**/*.d.ts", "app/**/*.tsx", "app/**/*.vue" ]
"include": [ "app/**/*.ts", "app/**/*.d.ts", "app/**/*.tsx", "app/**/*.vue" ],
"exclude": [ "node_modules" ]
}
+6 -4
View File
@@ -10,7 +10,8 @@ let loadedPlugins = JSON.parse(process.env.ZERO_PLUGINS || "[]");
if (!process.env.ZERO_PLUGINS)
{
//loadedPlugins = ["../zero.Commerce/Plugin", "../zero.Stories/Plugin", "../zero.Forms/Plugin", "../../Laola/Laola.Backoffice/Plugin"];
loadedPlugins = [];
loadedPlugins = ["../plugins/zero.Commerce/zero.Commerce.Plugin"]
//loadedPlugins = [];
}
let zeroPlugins = [];
@@ -40,12 +41,12 @@ loadedPlugins.forEach(pluginPath =>
}
pluginNames.push(name);
pluginFileContent += "import " + name + " from '" + alias + "/plugin.js';\n";
pluginFileContent += "import " + name + " from '" + alias + "/plugin';\n";
});
pluginFileContent += "export default [ " + pluginNames.join(', ') + " ];";
fs.writeFile(path.resolve(__dirname, 'app/plugins.generated.js'), pluginFileContent, err =>
fs.writeFile(path.resolve(__dirname, 'app/plugins.generated.ts'), pluginFileContent, err =>
{
if (err)
{
@@ -76,7 +77,8 @@ let config = defineConfig({
},
resolve: {
alias: {
vue: '@vue/compat'
vue: '@vue/compat',
...pluginAliases,
}
},
plugins: [