@caiquecamargo/vite-plugin-netlify-cms 0.0.14 → 0.0.16
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/index.d.ts +523 -4
- package/dist/index.js +239 -0
- package/dist/index.js.map +1 -0
- package/package.json +31 -40
- package/dist/admin/config.yml +0 -70
- package/dist/index.es.js +0 -4800
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js +0 -135
- package/dist/index.umd.js.map +0 -1
- package/dist/src/demo.d.ts +0 -1
- package/dist/src/plugin.d.ts +0 -29
- package/dist/src/types.d.ts +0 -336
package/dist/index.js
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// src/plugin.ts
|
|
2
|
+
import { mkdir, readdir, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { loadConfigFromFile } from "vite";
|
|
5
|
+
import YAML from "yaml";
|
|
6
|
+
|
|
7
|
+
// src/index.template.ts
|
|
8
|
+
var index_template_default = `<!DOCTYPE html>
|
|
9
|
+
<html>
|
|
10
|
+
<head>
|
|
11
|
+
<meta charset="utf-8" />
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
13
|
+
<title>{{ title }}</title>
|
|
14
|
+
{{ icon }}
|
|
15
|
+
{{ identity }}
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<!-- Include the script that builds the page and powers Decap CMS -->
|
|
19
|
+
<script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
|
|
20
|
+
</body>
|
|
21
|
+
</html>`;
|
|
22
|
+
|
|
23
|
+
// src/plugin.ts
|
|
24
|
+
function defineConfig(config) {
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
function defineFolderCollection(collection) {
|
|
28
|
+
return collection;
|
|
29
|
+
}
|
|
30
|
+
var defineFileCollection = (collection) => collection;
|
|
31
|
+
var defineFileCollectionEntry = (collection) => collection;
|
|
32
|
+
function defineBooleanWidget(widget) {
|
|
33
|
+
return {
|
|
34
|
+
widget: "boolean",
|
|
35
|
+
...widget
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function defineCodeWidget(widget) {
|
|
39
|
+
return {
|
|
40
|
+
widget: "code",
|
|
41
|
+
...widget
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function defineColorWidget(widget) {
|
|
45
|
+
return {
|
|
46
|
+
widget: "color",
|
|
47
|
+
...widget
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function defineDateTimeWidget(widget) {
|
|
51
|
+
return { widget: "datetime", ...widget };
|
|
52
|
+
}
|
|
53
|
+
function defineHiddenWidget(widget) {
|
|
54
|
+
return {
|
|
55
|
+
widget: "hidden",
|
|
56
|
+
...widget
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function defineFileWidget(widget) {
|
|
60
|
+
return {
|
|
61
|
+
widget: "file",
|
|
62
|
+
...widget
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function defineImageWidget(widget) {
|
|
66
|
+
return {
|
|
67
|
+
widget: "image",
|
|
68
|
+
...widget
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function defineListWidget(widget) {
|
|
72
|
+
return {
|
|
73
|
+
widget: "list",
|
|
74
|
+
...widget
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function defineMapWidget(widget) {
|
|
78
|
+
return {
|
|
79
|
+
widget: "map",
|
|
80
|
+
...widget
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function defineNumberWidget(widget) {
|
|
84
|
+
return {
|
|
85
|
+
widget: "number",
|
|
86
|
+
...widget
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function defineObjectWidget(widget) {
|
|
90
|
+
return {
|
|
91
|
+
widget: "object",
|
|
92
|
+
...widget
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function defineRelationWidget(widget) {
|
|
96
|
+
return { widget: "relation", ...widget };
|
|
97
|
+
}
|
|
98
|
+
function defineSelectWidget(widget) {
|
|
99
|
+
return {
|
|
100
|
+
widget: "select",
|
|
101
|
+
...widget
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function defineStringWidget(widget) {
|
|
105
|
+
return {
|
|
106
|
+
widget: "string",
|
|
107
|
+
...widget
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function defineTextWidget(widget) {
|
|
111
|
+
return {
|
|
112
|
+
widget: "text",
|
|
113
|
+
...widget
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function defineMarkdownWidget(widget) {
|
|
117
|
+
return {
|
|
118
|
+
widget: "markdown",
|
|
119
|
+
...widget
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function createFolderIfNotExists(path2) {
|
|
123
|
+
try {
|
|
124
|
+
await readdir(path2);
|
|
125
|
+
} catch {
|
|
126
|
+
await mkdir(path2, { recursive: true });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function saveConfig(document, pathTo) {
|
|
130
|
+
await writeFile(pathTo, document);
|
|
131
|
+
}
|
|
132
|
+
function resolveConfigFilePath(configFile) {
|
|
133
|
+
const _path = configFile.startsWith(".") ? configFile.slice(2) : configFile;
|
|
134
|
+
if (!_path)
|
|
135
|
+
return configFile;
|
|
136
|
+
if (["ts", "js", "cjs", "mjs"].some((ext) => _path.includes(ext)))
|
|
137
|
+
return _path.split(".").slice(0, -1).join(".");
|
|
138
|
+
return _path;
|
|
139
|
+
}
|
|
140
|
+
async function getConfigFile(root, configFile) {
|
|
141
|
+
try {
|
|
142
|
+
const files = await readdir(root);
|
|
143
|
+
const configPath = resolveConfigFilePath(configFile);
|
|
144
|
+
if (configPath.includes("/")) {
|
|
145
|
+
const [folder, file2] = configPath.split("/");
|
|
146
|
+
return await getConfigFile(path.join(root, folder), file2);
|
|
147
|
+
}
|
|
148
|
+
const file = files.find((file2) => file2.startsWith(configPath));
|
|
149
|
+
if (!file)
|
|
150
|
+
throw new Error(`Config file not found`);
|
|
151
|
+
const { config } = await loadConfigFromFile(
|
|
152
|
+
{ command: "build", mode: "" },
|
|
153
|
+
path.join(root, file)
|
|
154
|
+
) ?? {};
|
|
155
|
+
if (!config)
|
|
156
|
+
throw new Error(`Config file not found`);
|
|
157
|
+
return config;
|
|
158
|
+
} catch {
|
|
159
|
+
throw new Error(`Config file not found`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function createIndex(title, iconUrl, useIdentityWidget) {
|
|
163
|
+
const icon = iconUrl ? `<link rel="icon" type="image/svg+xml" href="${iconUrl}" />` : "";
|
|
164
|
+
const identity = useIdentityWidget ? `<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>` : "";
|
|
165
|
+
const document = index_template_default.replace("{{ title }}", title).replace("{{ icon }}", icon).replace("{{ identity }}", identity);
|
|
166
|
+
return document;
|
|
167
|
+
}
|
|
168
|
+
async function createConfig(root, entry) {
|
|
169
|
+
const {
|
|
170
|
+
configFile = "cms.config",
|
|
171
|
+
config,
|
|
172
|
+
saveFolder = "./public/admin",
|
|
173
|
+
createIndexHTML = true,
|
|
174
|
+
title = "Admin",
|
|
175
|
+
iconUrl = "https://decapcms.org/img/decap-logo.svg",
|
|
176
|
+
useIdentityWidget = true
|
|
177
|
+
} = entry ?? {};
|
|
178
|
+
const resolvedConfig = config ?? await getConfigFile(root, configFile);
|
|
179
|
+
await createFolderIfNotExists(path.join(root, saveFolder));
|
|
180
|
+
const document = YAML.stringify(resolvedConfig);
|
|
181
|
+
await saveConfig(document, path.join(root, saveFolder, "config.yml"));
|
|
182
|
+
if (!createIndexHTML)
|
|
183
|
+
return;
|
|
184
|
+
const indexHTML = createIndex(title, iconUrl, useIdentityWidget);
|
|
185
|
+
await saveConfig(indexHTML, path.join(root, saveFolder, "index.html"));
|
|
186
|
+
}
|
|
187
|
+
async function plugin_default(entry) {
|
|
188
|
+
let root = "";
|
|
189
|
+
return {
|
|
190
|
+
name: "vite-plugin-netlify-cms",
|
|
191
|
+
configResolved: (config) => {
|
|
192
|
+
root = config.root;
|
|
193
|
+
},
|
|
194
|
+
buildStart: async () => {
|
|
195
|
+
try {
|
|
196
|
+
await createConfig(root, entry);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
console.log(error);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
handleHotUpdate: async ({ file }) => {
|
|
202
|
+
if (file.includes(entry?.configFile ?? "cms.config")) {
|
|
203
|
+
try {
|
|
204
|
+
await createConfig(root, entry);
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.log(error);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// index.ts
|
|
214
|
+
var vite_plugin_netlify_cms_default = plugin_default;
|
|
215
|
+
export {
|
|
216
|
+
createConfig,
|
|
217
|
+
vite_plugin_netlify_cms_default as default,
|
|
218
|
+
defineBooleanWidget,
|
|
219
|
+
defineCodeWidget,
|
|
220
|
+
defineColorWidget,
|
|
221
|
+
defineConfig,
|
|
222
|
+
defineDateTimeWidget,
|
|
223
|
+
defineFileCollection,
|
|
224
|
+
defineFileCollectionEntry,
|
|
225
|
+
defineFileWidget,
|
|
226
|
+
defineFolderCollection,
|
|
227
|
+
defineHiddenWidget,
|
|
228
|
+
defineImageWidget,
|
|
229
|
+
defineListWidget,
|
|
230
|
+
defineMapWidget,
|
|
231
|
+
defineMarkdownWidget,
|
|
232
|
+
defineNumberWidget,
|
|
233
|
+
defineObjectWidget,
|
|
234
|
+
defineRelationWidget,
|
|
235
|
+
defineSelectWidget,
|
|
236
|
+
defineStringWidget,
|
|
237
|
+
defineTextWidget
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts","../src/index.template.ts","../index.ts"],"sourcesContent":["import { mkdir, readdir, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport type { Plugin } from 'vite';\nimport { loadConfigFromFile } from 'vite';\nimport YAML from 'yaml';\nimport indexHTMLTemplate from './index.template';\nimport type {\n BooleanWidget,\n CodeWidget,\n ColorWidget,\n DateTimeWidget,\n FileCollection,\n FileCollectionEntry,\n FileWidget,\n FolderCollection,\n HiddenWidget,\n ImageWidget,\n ListWidget,\n MapWidget,\n MarkdownWidget,\n NetlifyCMSConfig,\n NumberWidget,\n ObjectWidget,\n RelationWidget,\n SelectWidget,\n StringWidget,\n TextWidget,\n} from './types';\n\nexport function defineConfig(config: NetlifyCMSConfig): NetlifyCMSConfig {\n return config;\n}\nexport function defineFolderCollection(collection: FolderCollection) {\n return collection;\n}\nexport const defineFileCollection = (collection: FileCollection) => collection;\nexport const defineFileCollectionEntry = (collection: FileCollectionEntry) => collection;\nexport function defineBooleanWidget(widget: Omit<BooleanWidget, 'widget'>): BooleanWidget {\n return {\n widget: 'boolean',\n ...widget,\n };\n}\nexport function defineCodeWidget(widget: Omit<CodeWidget, 'widget'>): CodeWidget {\n return {\n widget: 'code',\n ...widget,\n };\n}\nexport function defineColorWidget(widget: Omit<ColorWidget, 'widget'>): ColorWidget {\n return {\n widget: 'color',\n ...widget,\n };\n}\nexport function defineDateTimeWidget(widget: Omit<DateTimeWidget, 'widget'>): DateTimeWidget {\n return { widget: 'datetime', ...widget };\n}\nexport function defineHiddenWidget(widget: Omit<HiddenWidget, 'widget'>): HiddenWidget {\n return {\n widget: 'hidden',\n ...widget,\n };\n}\nexport function defineFileWidget(widget: Omit<FileWidget, 'widget'>): FileWidget {\n return {\n widget: 'file',\n ...widget,\n };\n}\nexport function defineImageWidget(widget: Omit<ImageWidget, 'widget'>): ImageWidget {\n return {\n widget: 'image',\n ...widget,\n };\n}\nexport function defineListWidget(widget: Omit<ListWidget, 'widget'>): ListWidget {\n return {\n widget: 'list',\n ...widget,\n };\n}\nexport function defineMapWidget(widget: Omit<MapWidget, 'widget'>): MapWidget {\n return {\n widget: 'map',\n ...widget,\n };\n}\nexport function defineNumberWidget(widget: Omit<NumberWidget, 'widget'>): NumberWidget {\n return {\n widget: 'number',\n ...widget,\n };\n}\nexport function defineObjectWidget(widget: Omit<ObjectWidget, 'widget'>): ObjectWidget {\n return {\n widget: 'object',\n ...widget,\n };\n}\nexport function defineRelationWidget(widget: Omit<RelationWidget, 'widget'>): RelationWidget {\n return { widget: 'relation', ...widget };\n}\nexport function defineSelectWidget(widget: Omit<SelectWidget, 'widget'>): SelectWidget {\n return {\n widget: 'select',\n ...widget,\n };\n}\nexport function defineStringWidget(widget: Omit<StringWidget, 'widget'>): StringWidget {\n return {\n widget: 'string',\n ...widget,\n };\n}\nexport function defineTextWidget(widget: Omit<TextWidget, 'widget'>): TextWidget {\n return {\n widget: 'text',\n ...widget,\n };\n}\nexport function defineMarkdownWidget(widget: Omit<MarkdownWidget, 'widget'>): MarkdownWidget {\n return {\n widget: 'markdown',\n ...widget,\n };\n}\n\nexport interface NetlifyCMSEntry {\n /**\n * Name of config file\n *\n * @default cms.config\n */\n configFile?: string;\n\n /**\n * Netlify CMS config object\n */\n config?: NetlifyCMSConfig;\n\n /**\n * Folder to save config file\n *\n * @default ./public/admin\n */\n saveFolder?: string;\n\n /**\n * If has to create index.html file in the save folder\n */\n createIndexHTML?: boolean;\n\n /**\n * Title of the admin page\n *\n * @default Admin\n */\n title?: string;\n\n /**\n * Icon URL of the admin page\n *\n * @default https://decapcms.org/img/decap-logo.svg\n */\n iconUrl?: string;\n\n /**\n * If has to use identity widget\n *\n * @default true\n */\n useIdentityWidget?: boolean;\n}\n\nasync function createFolderIfNotExists(path: string) {\n try {\n await readdir(path);\n }\n catch {\n await mkdir(path, { recursive: true });\n }\n}\n\nasync function saveConfig(document: string, pathTo: string) {\n await writeFile(pathTo, document);\n}\n\nfunction resolveConfigFilePath(configFile: string) {\n const _path = configFile.startsWith('.') ? configFile.slice(2) : configFile;\n\n if (!_path)\n return configFile;\n if (['ts', 'js', 'cjs', 'mjs'].some(ext => _path.includes(ext)))\n return _path.split('.').slice(0, -1).join('.');\n\n return _path;\n}\n\nasync function getConfigFile(root: string, configFile: string): Promise<NetlifyCMSConfig> {\n try {\n const files = await readdir(root);\n const configPath = resolveConfigFilePath(configFile);\n\n if (configPath.includes('/')) {\n const [folder, file] = configPath.split('/');\n return await getConfigFile(path.join(root, folder), file);\n }\n\n const file = files.find(file => file.startsWith(configPath));\n\n if (!file)\n throw new Error(`Config file not found`);\n\n const { config }\n = (await loadConfigFromFile(\n { command: 'build', mode: '' },\n path.join(root, file),\n )) ?? {};\n\n if (!config)\n throw new Error(`Config file not found`);\n\n return config as NetlifyCMSConfig;\n }\n catch {\n throw new Error(`Config file not found`);\n }\n}\n\nfunction createIndex(title: string, iconUrl: string, useIdentityWidget: boolean) {\n const icon = iconUrl ? `<link rel=\"icon\" type=\"image/svg+xml\" href=\"${iconUrl}\" />` : '';\n const identity = useIdentityWidget ? `<script src=\"https://identity.netlify.com/v1/netlify-identity-widget.js\"></script>` : '';\n\n const document = indexHTMLTemplate\n .replace('{{ title }}', title)\n .replace('{{ icon }}', icon)\n .replace('{{ identity }}', identity);\n\n return document;\n}\n\nexport async function createConfig(root: string, entry?: NetlifyCMSEntry) {\n const {\n configFile = 'cms.config',\n config,\n saveFolder = './public/admin',\n createIndexHTML = true,\n title = 'Admin',\n iconUrl = 'https://decapcms.org/img/decap-logo.svg',\n useIdentityWidget = true,\n } = entry ?? {};\n\n const resolvedConfig = config ?? (await getConfigFile(root, configFile));\n await createFolderIfNotExists(path.join(root, saveFolder));\n\n const document = YAML.stringify(resolvedConfig);\n await saveConfig(document, path.join(root, saveFolder, 'config.yml'));\n\n if (!createIndexHTML)\n return;\n\n const indexHTML = createIndex(title, iconUrl, useIdentityWidget);\n await saveConfig(indexHTML, path.join(root, saveFolder, 'index.html'));\n}\n\nexport default async function (entry?: NetlifyCMSEntry): Promise<Plugin> {\n let root = '';\n\n return {\n name: 'vite-plugin-netlify-cms',\n configResolved: (config) => {\n root = config.root;\n },\n buildStart: async () => {\n try {\n await createConfig(root, entry);\n }\n catch (error) {\n console.log(error);\n }\n },\n handleHotUpdate: async ({ file }) => {\n if (file.includes(entry?.configFile ?? 'cms.config')) {\n try {\n await createConfig(root, entry);\n }\n catch (error) {\n console.log(error);\n }\n }\n },\n };\n}\n","export default `<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>{{ title }}</title>\n {{ icon }}\n {{ identity }}\n </head>\n <body>\n <!-- Include the script that builds the page and powers Decap CMS -->\n <script src=\"https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js\"></script>\n </body>\n</html>`\n","export * from \"./src/plugin.js\";\nexport * from \"./src/types.js\";\nimport plugin from \"./src/plugin.js\";\n\nexport default plugin;\n"],"mappings":";AAAA,SAAS,OAAO,SAAS,iBAAiB;AAC1C,OAAO,UAAU;AAEjB,SAAS,0BAA0B;AACnC,OAAO,UAAU;;;ACJjB,IAAO,yBAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AD6BR,SAAS,aAAa,QAA4C;AACvE,SAAO;AACT;AACO,SAAS,uBAAuB,YAA8B;AACnE,SAAO;AACT;AACO,IAAM,uBAAuB,CAAC,eAA+B;AAC7D,IAAM,4BAA4B,CAAC,eAAoC;AACvE,SAAS,oBAAoB,QAAsD;AACxF,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,GAAG;AAAA,EACL;AACF;AACO,SAAS,iBAAiB,QAAgD;AAC/E,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,GAAG;AAAA,EACL;AACF;AACO,SAAS,kBAAkB,QAAkD;AAClF,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,GAAG;AAAA,EACL;AACF;AACO,SAAS,qBAAqB,QAAwD;AAC3F,SAAO,EAAE,QAAQ,YAAY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module",
|
|
4
|
+
"version": "0.0.16",
|
|
2
5
|
"author": "Caique de Camargo",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"happy-dom": "^8.9.0",
|
|
8
|
-
"nodemon": "^2.0.22",
|
|
9
|
-
"ts-node": "^10.9.1",
|
|
10
|
-
"tslib": "^2.5.0",
|
|
11
|
-
"ttypescript": "^1.5.15",
|
|
12
|
-
"typescript": "^4.9.5",
|
|
13
|
-
"typia": "^3.6.9",
|
|
14
|
-
"vite": "^4.2.1",
|
|
15
|
-
"vitest": "^0.29.7",
|
|
16
|
-
"yaml": "^2.2.1"
|
|
17
|
-
},
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"vite": "^3.0.0 || ^4.0.0"
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/caiquecamargo/vite-plugin-netlify-cms.git"
|
|
20
10
|
},
|
|
11
|
+
"keywords": [],
|
|
21
12
|
"exports": {
|
|
22
13
|
".": {
|
|
23
|
-
"
|
|
24
|
-
"import": "./dist/index.
|
|
25
|
-
"
|
|
26
|
-
"types": "./dist/index.d.ts"
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.js"
|
|
27
17
|
}
|
|
28
18
|
},
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"module": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
29
22
|
"files": [
|
|
30
23
|
"dist"
|
|
31
24
|
],
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"vite": "^4.0.0 || ^5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"yaml": "^2.3.4"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@antfu/eslint-config": "^2.12.1",
|
|
33
|
+
"@types/node": "^20.10.5",
|
|
34
|
+
"eslint": "^8.57.0",
|
|
35
|
+
"tsup": "^8.0.1",
|
|
36
|
+
"typescript": "^5.3.3"
|
|
37
|
+
},
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"access": "public",
|
|
39
40
|
"registry": "https://registry.npmjs.org/"
|
|
40
41
|
},
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "https://github.com/caiquecamargo/vite-plugin-netlify-cms.git"
|
|
44
|
-
},
|
|
45
|
-
"type": "module",
|
|
46
|
-
"types": "./dist/index.d.ts",
|
|
47
|
-
"version": "0.0.14",
|
|
48
42
|
"scripts": {
|
|
49
|
-
"build": "
|
|
50
|
-
"dev": "
|
|
43
|
+
"build": "tsup",
|
|
44
|
+
"dev:watch": "tsup --watch",
|
|
45
|
+
"dev": "tsup",
|
|
51
46
|
"package": "pnpm build",
|
|
52
|
-
"pub": "pnpm publish"
|
|
53
|
-
"serve": "vite preview --host 0.0.0.0",
|
|
54
|
-
"test": "vitest run",
|
|
55
|
-
"test:coverage": "vitest --coverage",
|
|
56
|
-
"test:watch": "vitest watch"
|
|
47
|
+
"pub": "pnpm publish"
|
|
57
48
|
}
|
|
58
49
|
}
|
package/dist/admin/config.yml
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
backend:
|
|
2
|
-
name: git-gateway
|
|
3
|
-
branch: main
|
|
4
|
-
locale: pt-BR
|
|
5
|
-
site_url: https://www.giomurakami.des.br
|
|
6
|
-
display_url: https://www.giomurakami.des.br
|
|
7
|
-
logo_url: https://www.giomurakami.des.br/pendente.svg
|
|
8
|
-
media_folder: public/images
|
|
9
|
-
public_folder: /images
|
|
10
|
-
media_library:
|
|
11
|
-
name: uploadcare
|
|
12
|
-
config:
|
|
13
|
-
publicKey: f07c3de16a476579b849
|
|
14
|
-
multiple: true
|
|
15
|
-
crop: free
|
|
16
|
-
locale: pt
|
|
17
|
-
collections:
|
|
18
|
-
- name: config
|
|
19
|
-
label: Configurações
|
|
20
|
-
files:
|
|
21
|
-
- name: about
|
|
22
|
-
label: Sobre
|
|
23
|
-
file: src/content/config/about.md
|
|
24
|
-
extension: md
|
|
25
|
-
editor:
|
|
26
|
-
preview: false
|
|
27
|
-
fields:
|
|
28
|
-
- widget: string
|
|
29
|
-
label: Título
|
|
30
|
-
name: title
|
|
31
|
-
default: Quem sou eu
|
|
32
|
-
- widget: markdown
|
|
33
|
-
label: Conteúdo
|
|
34
|
-
name: body
|
|
35
|
-
- widget: image
|
|
36
|
-
label: Foto
|
|
37
|
-
name: image
|
|
38
|
-
media_library:
|
|
39
|
-
config:
|
|
40
|
-
multiple: false
|
|
41
|
-
- name: budget
|
|
42
|
-
label: Orçamento
|
|
43
|
-
file: src/content/config/form-entries.json
|
|
44
|
-
extension: json
|
|
45
|
-
editor:
|
|
46
|
-
preview: false
|
|
47
|
-
fields:
|
|
48
|
-
- widget: string
|
|
49
|
-
label: Título
|
|
50
|
-
name: title
|
|
51
|
-
default: Formulário de orçamento
|
|
52
|
-
- name: color
|
|
53
|
-
label: Cores
|
|
54
|
-
file: src/content/config/color.json
|
|
55
|
-
extension: json
|
|
56
|
-
editor:
|
|
57
|
-
preview: false
|
|
58
|
-
fields:
|
|
59
|
-
- widget: color
|
|
60
|
-
label: Padrão
|
|
61
|
-
name: default
|
|
62
|
-
allowInput: true
|
|
63
|
-
- widget: color
|
|
64
|
-
label: Escura
|
|
65
|
-
name: dark
|
|
66
|
-
allowInput: true
|
|
67
|
-
- widget: color
|
|
68
|
-
label: Clara
|
|
69
|
-
name: light
|
|
70
|
-
allowInput: true
|