nuxt-google-sheets-import 0.1.24 → 0.1.25
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.mjs +16 -15
- package/package.json +1 -1
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, extendPages, addServerHandler, addImportsDir, addComponentsDir, addImports, addServerImports
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
1
|
+
import { defineNuxtModule, createResolver, addTemplate, extendPages, addServerHandler, addImportsDir, addComponentsDir, addImports, addServerImports } from '@nuxt/kit';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
3
4
|
|
|
4
5
|
const module$1 = defineNuxtModule({
|
|
5
6
|
meta: {
|
|
@@ -18,18 +19,6 @@ const module$1 = defineNuxtModule({
|
|
|
18
19
|
// version: '>=4',
|
|
19
20
|
// },
|
|
20
21
|
},
|
|
21
|
-
onInstall() {
|
|
22
|
-
const resolver = createResolver(import.meta.url);
|
|
23
|
-
const templatePathTs = resolver.resolve("./runtime/app/examples/googleSheetsImportSchemas.ts");
|
|
24
|
-
const templatePathJs = resolver.resolve("./runtime/app/examples/googleSheetsImportSchemas.js");
|
|
25
|
-
const templateSource = existsSync(templatePathTs) ? templatePathTs : templatePathJs;
|
|
26
|
-
addTemplate({
|
|
27
|
-
filename: "googleSheetsImportSchemas",
|
|
28
|
-
src: templateSource,
|
|
29
|
-
dst: "app/utils/googleSheetsImportSchemas.ts",
|
|
30
|
-
write: true
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
22
|
defaults: {
|
|
34
23
|
apiBase: "/api/google-sheets-import",
|
|
35
24
|
defaultContentDir: "content/data",
|
|
@@ -37,6 +26,18 @@ const module$1 = defineNuxtModule({
|
|
|
37
26
|
},
|
|
38
27
|
setup(options, nuxt) {
|
|
39
28
|
const resolver = createResolver(import.meta.url);
|
|
29
|
+
const userSchemaPath = resolve(nuxt.options.rootDir, "app/utils/googleSheetsImportSchemas.ts");
|
|
30
|
+
if (!existsSync(userSchemaPath)) {
|
|
31
|
+
const templatePathTs = resolver.resolve("./runtime/app/examples/googleSheetsImportSchemas.ts");
|
|
32
|
+
const templatePathJs = resolver.resolve("./runtime/app/examples/googleSheetsImportSchemas.js");
|
|
33
|
+
const templateSource = existsSync(templatePathTs) ? templatePathTs : templatePathJs;
|
|
34
|
+
addTemplate({
|
|
35
|
+
filename: "googleSheetsImportSchemas.ts",
|
|
36
|
+
getContents: () => readFileSync(templateSource, "utf8"),
|
|
37
|
+
dst: "app/utils/googleSheetsImportSchemas.ts",
|
|
38
|
+
write: true
|
|
39
|
+
});
|
|
40
|
+
}
|
|
40
41
|
nuxt.options.runtimeConfig.googleSheetsImport = {
|
|
41
42
|
...nuxt.options.runtimeConfig.googleSheetsImport,
|
|
42
43
|
apiBase: options.apiBase,
|
|
@@ -120,7 +121,7 @@ const module$1 = defineNuxtModule({
|
|
|
120
121
|
]);
|
|
121
122
|
addServerImports([
|
|
122
123
|
{
|
|
123
|
-
from: "~/utils/googleSheetsImportSchemas
|
|
124
|
+
from: "~/utils/googleSheetsImportSchemas",
|
|
124
125
|
name: "googleSheetsImportSchemas",
|
|
125
126
|
as: "googleSheetsImportSchemas"
|
|
126
127
|
}
|
package/package.json
CHANGED