@hywax/cms 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createResolver, addComponentsDir, addPlugin, addImports, addImportsDir, addServerImports, addServerImportsDir,
|
|
1
|
+
import { createResolver, addComponentsDir, addPlugin, addImports, addImportsDir, addServerImports, addServerImportsDir, addServerHandler, addTypeTemplate, addTemplate, addServerTemplate, defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { dirname, join } from 'pathe';
|
|
4
4
|
import { defu } from 'defu';
|
|
@@ -6,7 +6,7 @@ import { snakeCase, kebabCase } from 'scule';
|
|
|
6
6
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
7
7
|
|
|
8
8
|
const name = "@hywax/cms";
|
|
9
|
-
const version = "1.
|
|
9
|
+
const version = "1.3.0";
|
|
10
10
|
|
|
11
11
|
function createContext(options, nuxt) {
|
|
12
12
|
const { resolve } = createResolver(import.meta.url);
|
|
@@ -53,6 +53,7 @@ function transformHttpCodes(httpCodes) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function prepareAutoImports({ resolve, options, nuxt }) {
|
|
56
|
+
const cmsConfigPath = resolve(nuxt.options.buildDir, "cms/config");
|
|
56
57
|
const httpCodesPath = resolve(nuxt.options.buildDir, "cms/http-codes");
|
|
57
58
|
const httpCodesImports = transformHttpCodes(options.httpCodes).map(({ code }) => ({ name: code, from: httpCodesPath }));
|
|
58
59
|
addComponentsDir({
|
|
@@ -70,7 +71,8 @@ function prepareAutoImports({ resolve, options, nuxt }) {
|
|
|
70
71
|
addPlugin(resolve("./runtime/plugins/api"));
|
|
71
72
|
addPlugin(resolve("./runtime/plugins/zod"));
|
|
72
73
|
addImports([
|
|
73
|
-
...httpCodesImports
|
|
74
|
+
...httpCodesImports,
|
|
75
|
+
{ name: "getCmsConfig", from: cmsConfigPath }
|
|
74
76
|
// { name: 'docToMarkdown', from: resolve('./runtime/editor/markdown') },
|
|
75
77
|
// { name: 'markdownToDoc', from: resolve('./runtime/editor/markdown') },
|
|
76
78
|
]);
|
|
@@ -79,7 +81,8 @@ function prepareAutoImports({ resolve, options, nuxt }) {
|
|
|
79
81
|
resolve("./runtime/composables")
|
|
80
82
|
]);
|
|
81
83
|
addServerImports([
|
|
82
|
-
...httpCodesImports
|
|
84
|
+
...httpCodesImports,
|
|
85
|
+
{ name: "getCmsConfig", from: cmsConfigPath }
|
|
83
86
|
// { name: 'docToMarkdown', from: resolve('./runtime/editor/markdown') },
|
|
84
87
|
// { name: 'markdownToDoc', from: resolve('./runtime/editor/markdown') },
|
|
85
88
|
]);
|
|
@@ -110,21 +113,6 @@ async function prepareGenerateEnv({ nuxt }) {
|
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
async function prepareInstallModules(_context) {
|
|
114
|
-
if (!hasNuxtModule("@nuxt/ui")) {
|
|
115
|
-
await installModule("@nuxt/ui");
|
|
116
|
-
}
|
|
117
|
-
if (!hasNuxtModule("@nuxtjs/mdc")) {
|
|
118
|
-
await installModule("@nuxtjs/mdc");
|
|
119
|
-
}
|
|
120
|
-
if (!hasNuxtModule("@vueuse/nuxt")) {
|
|
121
|
-
await installModule("@vueuse/nuxt");
|
|
122
|
-
}
|
|
123
|
-
if (!hasNuxtModule("nuxt-auth-utils")) {
|
|
124
|
-
await installModule("nuxt-auth-utils");
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
116
|
const icons = {
|
|
129
117
|
calendar: "lucide:calendar",
|
|
130
118
|
sort: "lucide:arrow-down-up",
|
|
@@ -161,6 +149,9 @@ function prepareMergeConfigs({ nuxt, options }) {
|
|
|
161
149
|
nuxt.options.experimental = defu(nuxt.options.experimental || {}, {
|
|
162
150
|
typedPages: true
|
|
163
151
|
});
|
|
152
|
+
nuxt.options.future = defu(nuxt.options.future || {}, {
|
|
153
|
+
compatibilityVersion: 5
|
|
154
|
+
});
|
|
164
155
|
nuxt.options.runtimeConfig.public = defu(nuxt.options.runtimeConfig.public || {}, {
|
|
165
156
|
fluxorUrl: options.fluxorUrl,
|
|
166
157
|
version: "develop"
|
|
@@ -208,7 +199,7 @@ function prepareMergeConfigs({ nuxt, options }) {
|
|
|
208
199
|
fonts: true
|
|
209
200
|
});
|
|
210
201
|
nuxt.options.colorMode = defu(nuxt.options.colorMode || {}, {
|
|
211
|
-
storageKey: `${options.name}
|
|
202
|
+
storageKey: `${options.name}:color-mode`
|
|
212
203
|
});
|
|
213
204
|
nuxt.options.mdc = defu(nuxt.options.mdc || {}, {
|
|
214
205
|
components: {
|
|
@@ -217,7 +208,7 @@ function prepareMergeConfigs({ nuxt, options }) {
|
|
|
217
208
|
}
|
|
218
209
|
}
|
|
219
210
|
});
|
|
220
|
-
nuxt.options.
|
|
211
|
+
nuxt.options.runtimeConfig.session = defu(nuxt.options.runtimeConfig.session || {}, {
|
|
221
212
|
name: `${options.name}-session`
|
|
222
213
|
});
|
|
223
214
|
nuxt.options.runtimeConfig.uplora = defu(nuxt.options.runtimeConfig.uplora || {}, {
|
|
@@ -452,6 +443,20 @@ export {}
|
|
|
452
443
|
`;
|
|
453
444
|
}
|
|
454
445
|
});
|
|
446
|
+
templates.push({
|
|
447
|
+
filename: "cms/config.ts",
|
|
448
|
+
write: true,
|
|
449
|
+
getContents: () => {
|
|
450
|
+
const config = {
|
|
451
|
+
name: options.name,
|
|
452
|
+
uploraUrl: options.uploraUrl,
|
|
453
|
+
fluxorUrl: options.fluxorUrl
|
|
454
|
+
};
|
|
455
|
+
return `const cmsConfig = ${JSON.stringify(config, null, 2)} as const
|
|
456
|
+
|
|
457
|
+
export const getCmsConfig = () => cmsConfig`;
|
|
458
|
+
}
|
|
459
|
+
});
|
|
455
460
|
return templates;
|
|
456
461
|
}
|
|
457
462
|
function getServerTemplates(_context) {
|
|
@@ -483,11 +488,16 @@ const module$1 = defineNuxtModule({
|
|
|
483
488
|
version,
|
|
484
489
|
configKey: "cms"
|
|
485
490
|
},
|
|
491
|
+
moduleDependencies: {
|
|
492
|
+
"@nuxt/ui": {},
|
|
493
|
+
"@nuxtjs/mdc": {},
|
|
494
|
+
"@vueuse/nuxt": {},
|
|
495
|
+
"nuxt-auth-utils": {}
|
|
496
|
+
},
|
|
486
497
|
defaults: defaultModuleOptions,
|
|
487
498
|
async setup(options, nuxt) {
|
|
488
499
|
const context = createContext(options, nuxt);
|
|
489
500
|
prepareMergeConfigs(context);
|
|
490
|
-
await prepareInstallModules();
|
|
491
501
|
prepareTemplates(context);
|
|
492
502
|
prepareAutoImports(context);
|
|
493
503
|
prepareServerRoutes(context);
|
|
@@ -59,12 +59,12 @@ export default function useTable(initialFilters, options) {
|
|
|
59
59
|
filters,
|
|
60
60
|
updateFilters
|
|
61
61
|
} = useTableFilters(initialFilters, options);
|
|
62
|
-
const { sorting } = useTableSort(
|
|
62
|
+
const { sort, sorting } = useTableSort();
|
|
63
63
|
const { pagination } = useTablePagination(options);
|
|
64
64
|
const query = computed(() => {
|
|
65
65
|
return {
|
|
66
66
|
...filters.value,
|
|
67
|
-
...
|
|
67
|
+
...sort.value,
|
|
68
68
|
...pagination.value
|
|
69
69
|
};
|
|
70
70
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { getCmsConfig } from "#imports";
|
|
1
2
|
import { kebabCase } from "scule";
|
|
2
|
-
const storagePrefix =
|
|
3
|
+
const storagePrefix = `${getCmsConfig().name}:`;
|
|
3
4
|
export const getCmsStorageKey = (key) => `${storagePrefix}${kebabCase(key)}`;
|
|
4
5
|
export function clearCmsStorage() {
|
|
5
6
|
for (const key in localStorage) {
|