@tinacms/cli 1.5.1 → 1.5.3
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.
|
@@ -76,7 +76,7 @@ declare const forestryFieldWithoutField: z.ZodObject<{
|
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
78
|
name?: string;
|
|
79
|
-
type?: "number" | "boolean" | "file" | "text" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "
|
|
79
|
+
type?: "number" | "boolean" | "file" | "text" | "include" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks" | "color";
|
|
80
80
|
label?: string;
|
|
81
81
|
template_types?: string[];
|
|
82
82
|
}, {
|
|
@@ -95,7 +95,7 @@ declare const forestryFieldWithoutField: z.ZodObject<{
|
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
97
|
name?: string;
|
|
98
|
-
type?: "number" | "boolean" | "file" | "text" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "
|
|
98
|
+
type?: "number" | "boolean" | "file" | "text" | "include" | "list" | "select" | "datetime" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks" | "color";
|
|
99
99
|
label?: string;
|
|
100
100
|
template_types?: string[];
|
|
101
101
|
}>;
|
|
@@ -150,10 +150,10 @@ export declare const parseSections: ({ val }: {
|
|
|
150
150
|
}) => {
|
|
151
151
|
sections?: {
|
|
152
152
|
match?: string;
|
|
153
|
+
exclude?: string;
|
|
153
154
|
path?: string;
|
|
154
155
|
type?: "directory" | "document" | "heading" | "jekyll-pages" | "jekyll-posts";
|
|
155
156
|
label?: string;
|
|
156
|
-
exclude?: string;
|
|
157
157
|
create?: "none" | "all" | "documents";
|
|
158
158
|
templates?: string[];
|
|
159
159
|
new_doc_ext?: string;
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
31
31
|
var import_clipanion6 = require("clipanion");
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
|
-
var version = "1.5.
|
|
34
|
+
var version = "1.5.3";
|
|
35
35
|
|
|
36
36
|
// src/next/commands/dev-command/index.ts
|
|
37
37
|
var import_clipanion = require("clipanion");
|
|
@@ -207,10 +207,6 @@ var ConfigManager = class {
|
|
|
207
207
|
import_path.default.join(this.tinaFolderPath, "database")
|
|
208
208
|
);
|
|
209
209
|
this.generatedFolderPath = import_path.default.join(this.tinaFolderPath, GENERATED_FOLDER);
|
|
210
|
-
this.config = await this.loadConfigFile(
|
|
211
|
-
this.generatedFolderPath,
|
|
212
|
-
this.tinaConfigFilePath
|
|
213
|
-
);
|
|
214
210
|
this.generatedGraphQLGQLPath = import_path.default.join(
|
|
215
211
|
this.generatedFolderPath,
|
|
216
212
|
GRAPHQL_GQL_FILE
|
|
@@ -235,16 +231,6 @@ var ConfigManager = class {
|
|
|
235
231
|
this.generatedFolderPath,
|
|
236
232
|
"frags.gql"
|
|
237
233
|
);
|
|
238
|
-
const fullLocalContentPath = import_path.default.join(
|
|
239
|
-
this.tinaFolderPath,
|
|
240
|
-
this.config.localContentPath || ""
|
|
241
|
-
);
|
|
242
|
-
if (this.config.localContentPath && await import_fs_extra.default.existsSync(fullLocalContentPath)) {
|
|
243
|
-
logger.info(`Using separate content repo at ${fullLocalContentPath}`);
|
|
244
|
-
this.contentRootPath = fullLocalContentPath;
|
|
245
|
-
} else {
|
|
246
|
-
this.contentRootPath = this.rootPath;
|
|
247
|
-
}
|
|
248
234
|
this.generatedTypesTSFilePath = import_path.default.join(
|
|
249
235
|
this.generatedFolderPath,
|
|
250
236
|
"types.ts"
|
|
@@ -273,6 +259,19 @@ var ConfigManager = class {
|
|
|
273
259
|
this.generatedFolderPath,
|
|
274
260
|
"client.js"
|
|
275
261
|
);
|
|
262
|
+
const clientExists = this.isUsingTs() ? await import_fs_extra.default.pathExists(this.generatedClientTSFilePath) : await import_fs_extra.default.pathExists(this.generatedClientJSFilePath);
|
|
263
|
+
if (!clientExists) {
|
|
264
|
+
const file = "export default ()=>({})\nexport const client = ()=>({})";
|
|
265
|
+
if (this.isUsingTs()) {
|
|
266
|
+
await import_fs_extra.default.outputFile(this.generatedClientTSFilePath, file);
|
|
267
|
+
} else {
|
|
268
|
+
await import_fs_extra.default.outputFile(this.generatedClientJSFilePath, file);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
this.config = await this.loadConfigFile(
|
|
272
|
+
this.generatedFolderPath,
|
|
273
|
+
this.tinaConfigFilePath
|
|
274
|
+
);
|
|
276
275
|
this.publicFolderPath = import_path.default.join(
|
|
277
276
|
this.rootPath,
|
|
278
277
|
this.config.build.publicFolder
|
|
@@ -283,6 +282,16 @@ var ConfigManager = class {
|
|
|
283
282
|
);
|
|
284
283
|
this.outputHTMLFilePath = import_path.default.join(this.outputFolderPath, "index.html");
|
|
285
284
|
this.outputGitignorePath = import_path.default.join(this.outputFolderPath, ".gitignore");
|
|
285
|
+
const fullLocalContentPath = import_path.default.join(
|
|
286
|
+
this.tinaFolderPath,
|
|
287
|
+
this.config.localContentPath || ""
|
|
288
|
+
);
|
|
289
|
+
if (this.config.localContentPath && await import_fs_extra.default.existsSync(fullLocalContentPath)) {
|
|
290
|
+
logger.info(`Using separate content repo at ${fullLocalContentPath}`);
|
|
291
|
+
this.contentRootPath = fullLocalContentPath;
|
|
292
|
+
} else {
|
|
293
|
+
this.contentRootPath = this.rootPath;
|
|
294
|
+
}
|
|
286
295
|
this.spaMainPath = require.resolve("@tinacms/app");
|
|
287
296
|
this.spaRootPath = import_path.default.join(this.spaMainPath, "..", "..");
|
|
288
297
|
}
|
|
@@ -364,7 +373,8 @@ var ConfigManager = class {
|
|
|
364
373
|
entryPoints: [this.selfHostedDatabaseFilePath],
|
|
365
374
|
bundle: true,
|
|
366
375
|
platform: "node",
|
|
367
|
-
outfile
|
|
376
|
+
outfile,
|
|
377
|
+
loader: loaders
|
|
368
378
|
});
|
|
369
379
|
const result = require(outfile);
|
|
370
380
|
await import_fs_extra.default.removeSync(outfile);
|
|
@@ -381,13 +391,15 @@ var ConfigManager = class {
|
|
|
381
391
|
bundle: true,
|
|
382
392
|
target: ["es2020"],
|
|
383
393
|
platform: "node",
|
|
384
|
-
outfile
|
|
394
|
+
outfile,
|
|
395
|
+
loader: loaders
|
|
385
396
|
});
|
|
386
397
|
await esbuild.build({
|
|
387
398
|
entryPoints: [outfile],
|
|
388
399
|
bundle: true,
|
|
389
400
|
platform: "node",
|
|
390
|
-
outfile: outfile2
|
|
401
|
+
outfile: outfile2,
|
|
402
|
+
loader: loaders
|
|
391
403
|
});
|
|
392
404
|
const result = require(outfile2);
|
|
393
405
|
await import_fs_extra.default.removeSync(outfile);
|
|
@@ -395,6 +407,31 @@ var ConfigManager = class {
|
|
|
395
407
|
return result.default;
|
|
396
408
|
}
|
|
397
409
|
};
|
|
410
|
+
var loaders = {
|
|
411
|
+
".aac": "file",
|
|
412
|
+
".css": "file",
|
|
413
|
+
".eot": "file",
|
|
414
|
+
".flac": "file",
|
|
415
|
+
".gif": "file",
|
|
416
|
+
".jpeg": "file",
|
|
417
|
+
".jpg": "file",
|
|
418
|
+
".json": "json",
|
|
419
|
+
".mp3": "file",
|
|
420
|
+
".mp4": "file",
|
|
421
|
+
".ogg": "file",
|
|
422
|
+
".otf": "file",
|
|
423
|
+
".png": "file",
|
|
424
|
+
".svg": "file",
|
|
425
|
+
".ttf": "file",
|
|
426
|
+
".wav": "file",
|
|
427
|
+
".webm": "file",
|
|
428
|
+
".webp": "file",
|
|
429
|
+
".woff": "file",
|
|
430
|
+
".woff2": "file",
|
|
431
|
+
".js": "jsx",
|
|
432
|
+
".jsx": "jsx",
|
|
433
|
+
".tsx": "tsx"
|
|
434
|
+
};
|
|
398
435
|
|
|
399
436
|
// src/next/commands/dev-command/html.ts
|
|
400
437
|
var devHTML = (port) => `<!DOCTYPE html>
|
|
@@ -424,7 +461,7 @@ var devHTML = (port) => `<!DOCTYPE html>
|
|
|
424
461
|
</html>`;
|
|
425
462
|
|
|
426
463
|
// src/next/commands/dev-command/server/index.ts
|
|
427
|
-
var
|
|
464
|
+
var import_vite3 = require("vite");
|
|
428
465
|
|
|
429
466
|
// src/next/vite/index.ts
|
|
430
467
|
var import_path3 = __toESM(require("path"));
|
|
@@ -768,6 +805,9 @@ var createConfig = async ({
|
|
|
768
805
|
};
|
|
769
806
|
|
|
770
807
|
// src/next/vite/plugins.ts
|
|
808
|
+
var import_pluginutils = require("@rollup/pluginutils");
|
|
809
|
+
var import_fs = __toESM(require("fs"));
|
|
810
|
+
var import_vite2 = require("vite");
|
|
771
811
|
var import_esbuild = require("esbuild");
|
|
772
812
|
var import_path5 = __toESM(require("path"));
|
|
773
813
|
var import_body_parser = __toESM(require("body-parser"));
|
|
@@ -1001,14 +1041,50 @@ var devServerEndPointsPlugin = ({
|
|
|
1001
1041
|
};
|
|
1002
1042
|
return plug;
|
|
1003
1043
|
};
|
|
1044
|
+
function viteTransformExtension({
|
|
1045
|
+
exportAsDefault = true,
|
|
1046
|
+
svgrOptions,
|
|
1047
|
+
esbuildOptions,
|
|
1048
|
+
include = "**/*.svg",
|
|
1049
|
+
exclude
|
|
1050
|
+
} = {}) {
|
|
1051
|
+
const filter = (0, import_pluginutils.createFilter)(include, exclude);
|
|
1052
|
+
return {
|
|
1053
|
+
name: "vite-plugin-svgr",
|
|
1054
|
+
async transform(code, id) {
|
|
1055
|
+
if (filter(id)) {
|
|
1056
|
+
const { transform: transform2 } = await Promise.resolve().then(() => __toESM(require("@svgr/core")));
|
|
1057
|
+
const svgCode = await import_fs.default.promises.readFile(
|
|
1058
|
+
id.replace(/\?.*$/, ""),
|
|
1059
|
+
"utf8"
|
|
1060
|
+
);
|
|
1061
|
+
const componentCode = await transform2(svgCode, svgrOptions, {
|
|
1062
|
+
filePath: id,
|
|
1063
|
+
caller: {
|
|
1064
|
+
previousExport: exportAsDefault ? null : code
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
const res = await (0, import_vite2.transformWithEsbuild)(componentCode, id, {
|
|
1068
|
+
loader: "jsx",
|
|
1069
|
+
...esbuildOptions
|
|
1070
|
+
});
|
|
1071
|
+
return {
|
|
1072
|
+
code: res.code,
|
|
1073
|
+
map: null
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1004
1079
|
|
|
1005
1080
|
// src/next/commands/dev-command/server/index.ts
|
|
1006
1081
|
var createDevServer = async (configManager, database, apiURL, noWatch) => {
|
|
1007
1082
|
const plugins = [
|
|
1008
1083
|
transformTsxPlugin({ configManager }),
|
|
1009
|
-
devServerEndPointsPlugin({ apiURL, configManager, database })
|
|
1084
|
+
devServerEndPointsPlugin({ apiURL, configManager, database }),
|
|
1085
|
+
viteTransformExtension()
|
|
1010
1086
|
];
|
|
1011
|
-
return (0,
|
|
1087
|
+
return (0, import_vite3.createServer)(
|
|
1012
1088
|
await createConfig({
|
|
1013
1089
|
configManager,
|
|
1014
1090
|
database,
|
|
@@ -1819,7 +1895,7 @@ var import_fs_extra5 = __toESM(require("fs-extra"));
|
|
|
1819
1895
|
var import_graphql9 = require("@tinacms/graphql");
|
|
1820
1896
|
|
|
1821
1897
|
// src/next/commands/build-command/server.ts
|
|
1822
|
-
var
|
|
1898
|
+
var import_vite5 = require("vite");
|
|
1823
1899
|
var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
1824
1900
|
const publicEnv = {};
|
|
1825
1901
|
Object.keys(process.env).forEach((key) => {
|
|
@@ -1839,13 +1915,13 @@ var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
|
1839
1915
|
}
|
|
1840
1916
|
});
|
|
1841
1917
|
const config3 = await createConfig({
|
|
1842
|
-
plugins: [transformTsxPlugin({ configManager })],
|
|
1918
|
+
plugins: [transformTsxPlugin({ configManager }), viteTransformExtension()],
|
|
1843
1919
|
configManager,
|
|
1844
1920
|
database,
|
|
1845
1921
|
apiURL,
|
|
1846
1922
|
noWatch: true
|
|
1847
1923
|
});
|
|
1848
|
-
return (0,
|
|
1924
|
+
return (0, import_vite5.build)(config3);
|
|
1849
1925
|
};
|
|
1850
1926
|
|
|
1851
1927
|
// src/next/commands/build-command/index.ts
|
|
@@ -3167,6 +3243,10 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
3167
3243
|
label: template2.label,
|
|
3168
3244
|
name: stringifyTemplateName(tem, tem)
|
|
3169
3245
|
};
|
|
3246
|
+
if (t.name != tem) {
|
|
3247
|
+
;
|
|
3248
|
+
t.nameOverride = tem;
|
|
3249
|
+
}
|
|
3170
3250
|
templates.push(t);
|
|
3171
3251
|
});
|
|
3172
3252
|
field = {
|
|
@@ -3253,7 +3333,11 @@ var transformForestryMatchToTinaMatch = (match) => {
|
|
|
3253
3333
|
var _a, _b;
|
|
3254
3334
|
const newMatch = (_b = (_a = match.replace(" ", "").replace(/\.?(mdx|md|json|yaml|yml|toml)/g, "")) == null ? void 0 : _a.replace(/\..*$/g, "")) == null ? void 0 : _b.replace("{}", "");
|
|
3255
3335
|
if (match !== newMatch) {
|
|
3256
|
-
logger.
|
|
3336
|
+
logger.info(
|
|
3337
|
+
`Info: Match ${match} was transformed to ${newMatch}. See ${linkText(
|
|
3338
|
+
"https://tina.io/docs/forestry/common-errors/#info-match-match-was-transformed-to-newmatch"
|
|
3339
|
+
)}`
|
|
3340
|
+
);
|
|
3257
3341
|
}
|
|
3258
3342
|
return newMatch;
|
|
3259
3343
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Database } from '@tinacms/graphql';
|
|
1
|
+
import type { Database } from '@tinacms/graphql';
|
|
2
2
|
import { ConfigManager } from '../../../config-manager';
|
|
3
3
|
export declare const createDevServer: (configManager: ConfigManager, database: Database, apiURL: string, noWatch: boolean) => Promise<import("vite").ViteDevServer>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Loader } from 'esbuild';
|
|
1
2
|
import { Config } from '@tinacms/schema-tools';
|
|
2
3
|
export declare const TINA_FOLDER = "tina";
|
|
3
4
|
export declare const LEGACY_TINA_FOLDER = ".tina";
|
|
@@ -58,3 +59,6 @@ export declare class ConfigManager {
|
|
|
58
59
|
loadDatabaseFile(): Promise<any>;
|
|
59
60
|
loadConfigFile(generatedFolderPath: string, configFilePath: string): Promise<any>;
|
|
60
61
|
}
|
|
62
|
+
export declare const loaders: {
|
|
63
|
+
[ext: string]: Loader;
|
|
64
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
3
|
+
import type { Config } from '@svgr/core';
|
|
4
|
+
import { transformWithEsbuild } from 'vite';
|
|
2
5
|
import type { Database } from '@tinacms/graphql';
|
|
3
6
|
import type { ConfigManager } from '../config-manager';
|
|
4
7
|
export declare const transformTsxPlugin: ({ configManager: _configManager, }: {
|
|
@@ -9,3 +12,17 @@ export declare const devServerEndPointsPlugin: ({ configManager, apiURL, databas
|
|
|
9
12
|
database: Database;
|
|
10
13
|
configManager: ConfigManager;
|
|
11
14
|
}) => Plugin;
|
|
15
|
+
export interface ViteSvgrOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Export React component as default. Notice that it will overrides
|
|
18
|
+
* the default behavior of Vite, which exports the URL as default
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
exportAsDefault?: boolean;
|
|
23
|
+
svgrOptions?: Config;
|
|
24
|
+
esbuildOptions?: Parameters<typeof transformWithEsbuild>[2];
|
|
25
|
+
exclude?: FilterPattern;
|
|
26
|
+
include?: FilterPattern;
|
|
27
|
+
}
|
|
28
|
+
export declare function viteTransformExtension({ exportAsDefault, svgrOptions, esbuildOptions, include, exclude, }?: ViteSvgrOptions): Plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -53,15 +53,17 @@
|
|
|
53
53
|
"@graphql-inspector/core": "^4.0.0",
|
|
54
54
|
"@graphql-tools/graphql-file-loader": "^7.2.0",
|
|
55
55
|
"@graphql-tools/load": "^7.3.2",
|
|
56
|
+
"@rollup/pluginutils": "^5.0.2",
|
|
57
|
+
"@svgr/core": "6.3.1",
|
|
56
58
|
"@tailwindcss/aspect-ratio": "^0.4.0",
|
|
57
59
|
"@tailwindcss/line-clamp": "^0.3.1",
|
|
58
60
|
"@tailwindcss/typography": "^0.5.9",
|
|
59
|
-
"@tinacms/app": "1.2.
|
|
60
|
-
"@tinacms/datalayer": "1.2.
|
|
61
|
-
"@tinacms/graphql": "1.4.
|
|
61
|
+
"@tinacms/app": "1.2.3",
|
|
62
|
+
"@tinacms/datalayer": "1.2.4",
|
|
63
|
+
"@tinacms/graphql": "1.4.4",
|
|
62
64
|
"@tinacms/metrics": "1.0.2",
|
|
63
65
|
"@tinacms/schema-tools": "1.4.2",
|
|
64
|
-
"@vitejs/plugin-react": "
|
|
66
|
+
"@vitejs/plugin-react": "3.1.0",
|
|
65
67
|
"ajv": "^6.12.3",
|
|
66
68
|
"altair-express-middleware": "4.0.6",
|
|
67
69
|
"auto-bind": "^4.0.0",
|