@yassidev/nuxt-directus 0.0.30 → 0.0.31
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 +1 -1
- package/dist/module.mjs +13 -6
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1866,7 +1866,7 @@ function normalizeConfig(options, nuxt) {
|
|
|
1866
1866
|
url: process.env.DIRECTUS_URL ?? "http://localhost:8055",
|
|
1867
1867
|
accessToken: process.env.DIRECTUS_ACCESS_TOKEN || process.env.DIRECTUS_ADMIN_TOKEN || "",
|
|
1868
1868
|
i18n: { enabled: hasNuxtModule("@nuxtjs/i18n"), sync: nuxt.options.dev, prefix: void 0 },
|
|
1869
|
-
types: { enabled: nuxt.options.dev, transform: [] },
|
|
1869
|
+
types: { enabled: nuxt.options.dev || nuxt.options._prepare, transform: [] },
|
|
1870
1870
|
proxy: { enabled: true, path: "/directus", options: {} },
|
|
1871
1871
|
image: { enabled: hasNuxtModule("@nuxt/image"), alias: "directus" }
|
|
1872
1872
|
});
|
|
@@ -1918,11 +1918,18 @@ async function setupTypes(config, nuxt, logger) {
|
|
|
1918
1918
|
addTypeTemplate({
|
|
1919
1919
|
filename: "directus/types.d.ts",
|
|
1920
1920
|
getContents: async () => {
|
|
1921
|
-
let types =
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1921
|
+
let types = "";
|
|
1922
|
+
try {
|
|
1923
|
+
types = await generateDirectusTypes({
|
|
1924
|
+
directusUrl: withoutTrailingSlash(config.url),
|
|
1925
|
+
outputPath: "",
|
|
1926
|
+
directusToken: config.accessToken
|
|
1927
|
+
});
|
|
1928
|
+
} catch (error) {
|
|
1929
|
+
if (!nuxt.options._prepare) {
|
|
1930
|
+
logger.error("Failed to generate Directus types:", error);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1926
1933
|
if (config.types.transform && config.types.transform.length > 0) {
|
|
1927
1934
|
for (const { from, to } of config.types.transform) {
|
|
1928
1935
|
const regex = typeof from === "string" ? new RegExp(from, "g") : from;
|