@tinacms/cli 1.2.2 → 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/cmds/audit/audit.d.ts +2 -2
- package/dist/cmds/compile/index.d.ts +2 -2
- package/dist/cmds/forestry-migrate/index.d.ts +3 -3
- package/dist/cmds/forestry-migrate/util/index.d.ts +11 -4
- package/dist/cmds/query-gen/genTypes.d.ts +2 -2
- package/dist/cmds/start-server/index.d.ts +2 -2
- package/dist/cmds/statusChecks/checkClientInformation.d.ts +3 -3
- package/dist/cmds/statusChecks/waitForIndexing.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +74 -60
- package/package.json +6 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
|
-
import type { Database,
|
|
4
|
+
import type { Database, Collection } from '@tinacms/graphql';
|
|
5
5
|
declare type AuditArgs = {
|
|
6
|
-
collection:
|
|
6
|
+
collection: Collection<true>;
|
|
7
7
|
database: Database;
|
|
8
8
|
rootPath: string;
|
|
9
9
|
documents: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
4
|
import { Platform } from 'esbuild';
|
|
5
|
-
import type {
|
|
5
|
+
import type { Schema } from '@tinacms/graphql';
|
|
6
6
|
export declare const resetGeneratedFolder: ({ tinaGeneratedPath, usingTs, isBuild, }: {
|
|
7
7
|
tinaGeneratedPath: string;
|
|
8
8
|
usingTs: boolean;
|
|
@@ -21,4 +21,4 @@ export declare const compileSchema: (options: {
|
|
|
21
21
|
rootPath: string;
|
|
22
22
|
}) => Promise<any>;
|
|
23
23
|
export declare const transpile: (inputFile: any, outputFile: any, tempDir: any, verbose: any, define: any, packageJSONFilePath: string, platform?: Platform) => Promise<void>;
|
|
24
|
-
export declare const defineSchema: (config:
|
|
24
|
+
export declare const defineSchema: (config: Schema) => Schema<false>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Collection, TinaField } from '@tinacms/schema-tools';
|
|
5
5
|
export declare const generateAllCollections: ({ rootPath, }: {
|
|
6
6
|
rootPath: string;
|
|
7
7
|
}) => Promise<Map<string, {
|
|
8
|
-
fields:
|
|
8
|
+
fields: TinaField[];
|
|
9
9
|
templateObj: any;
|
|
10
10
|
}>>;
|
|
11
11
|
export declare const generateCollections: ({ forestryPath, rootPath, }: {
|
|
12
12
|
forestryPath: string;
|
|
13
13
|
rootPath: string;
|
|
14
|
-
}) => Promise<
|
|
14
|
+
}) => Promise<Collection<false>[]>;
|
|
@@ -2,8 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
4
|
import z from 'zod';
|
|
5
|
-
import type {
|
|
6
|
-
export declare const
|
|
5
|
+
import type { TinaField } from '@tinacms/schema-tools';
|
|
6
|
+
export declare const getTinaFieldsFromName: (name: string) => {
|
|
7
|
+
name: string;
|
|
8
|
+
nameOverride: string;
|
|
9
|
+
} | {
|
|
10
|
+
name: string;
|
|
11
|
+
nameOverride?: undefined;
|
|
12
|
+
};
|
|
13
|
+
export declare const stringifyTemplateName: (name: string, template: string) => string;
|
|
7
14
|
declare const forestryFieldWithoutField: z.ZodObject<{
|
|
8
15
|
type: z.ZodUnion<[z.ZodLiteral<"text">, z.ZodLiteral<"datetime">, z.ZodLiteral<"list">, z.ZodLiteral<"file">, z.ZodLiteral<"image_gallery">, z.ZodLiteral<"textarea">, z.ZodLiteral<"tag_list">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"field_group">, z.ZodLiteral<"field_group_list">, z.ZodLiteral<"select">, z.ZodLiteral<"include">, z.ZodLiteral<"blocks">, z.ZodLiteral<"color">]>;
|
|
9
16
|
template_types: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
@@ -114,13 +121,13 @@ export declare const transformForestryFieldsToTinaFields: ({ fields, rootPath, t
|
|
|
114
121
|
rootPath: string;
|
|
115
122
|
template: string;
|
|
116
123
|
skipBlocks?: boolean;
|
|
117
|
-
}) =>
|
|
124
|
+
}) => TinaField<false>[];
|
|
118
125
|
export declare const getFieldsFromTemplates: (_args: {
|
|
119
126
|
tem: string;
|
|
120
127
|
rootPath: string;
|
|
121
128
|
skipBlocks?: boolean;
|
|
122
129
|
}) => {
|
|
123
|
-
fields:
|
|
130
|
+
fields: TinaField[];
|
|
124
131
|
templateObj: any;
|
|
125
132
|
template: {
|
|
126
133
|
label?: string;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
4
|
import { GraphQLSchema } from 'graphql';
|
|
5
|
-
import {
|
|
5
|
+
import { Schema } from '@tinacms/schema-tools';
|
|
6
6
|
export declare const TINA_HOST = "content.tinajs.io";
|
|
7
7
|
export declare function genClient({ tinaSchema, usingTs, rootPath, }: {
|
|
8
|
-
tinaSchema:
|
|
8
|
+
tinaSchema: Schema;
|
|
9
9
|
usingTs?: boolean;
|
|
10
10
|
rootPath: string;
|
|
11
11
|
}, options: any): Promise<string>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Bridge } from '@tinacms/datalayer';
|
|
5
5
|
import type { Database } from '@tinacms/graphql';
|
|
6
6
|
import { ConfigBuilder } from '../../buildTina';
|
|
7
|
-
import type {
|
|
7
|
+
import type { Schema } from '@tinacms/schema-tools';
|
|
8
8
|
interface Options {
|
|
9
9
|
port?: number;
|
|
10
10
|
command?: string;
|
|
@@ -22,6 +22,6 @@ export declare function startServer(ctx: {
|
|
|
22
22
|
database: Database;
|
|
23
23
|
bridge: Bridge;
|
|
24
24
|
usingTs: boolean;
|
|
25
|
-
schema?:
|
|
25
|
+
schema?: Schema;
|
|
26
26
|
}, next: any, { port, noWatch, noSDK, noTelemetry, watchFolders, verbose, dev, }: Options): Promise<void>;
|
|
27
27
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Bridge } from '@tinacms/datalayer';
|
|
2
2
|
import type { Database } from '@tinacms/graphql';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Schema } from '@tinacms/schema-tools';
|
|
4
4
|
import { ConfigBuilder } from '../../buildTina';
|
|
5
5
|
export declare const checkClientInfo: (ctx: {
|
|
6
6
|
builder: ConfigBuilder;
|
|
@@ -8,7 +8,7 @@ export declare const checkClientInfo: (ctx: {
|
|
|
8
8
|
database: Database;
|
|
9
9
|
bridge: Bridge;
|
|
10
10
|
usingTs: boolean;
|
|
11
|
-
schema?:
|
|
11
|
+
schema?: Schema;
|
|
12
12
|
apiUrl: string;
|
|
13
13
|
isSelfHostedDatabase: boolean;
|
|
14
14
|
}, next: any, _options: {
|
|
@@ -24,7 +24,7 @@ export declare const checkGraphqlSchema: (ctx: {
|
|
|
24
24
|
database: Database;
|
|
25
25
|
bridge: Bridge;
|
|
26
26
|
usingTs: boolean;
|
|
27
|
-
schema?:
|
|
27
|
+
schema?: Schema;
|
|
28
28
|
apiUrl: string;
|
|
29
29
|
isSelfHostedDatabase: boolean;
|
|
30
30
|
}, next: any, _options: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Schema } from '@tinacms/schema-tools';
|
|
5
5
|
export declare const waitForDB: (ctx: {
|
|
6
|
-
schema?:
|
|
6
|
+
schema?: Schema<true>;
|
|
7
7
|
apiUrl: string;
|
|
8
8
|
isSelfHostedDatabase?: boolean;
|
|
9
9
|
}, next: any, options: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { defineSchema } from './cmds/compile';
|
|
2
|
-
export type {
|
|
2
|
+
export type { Schema, TinaSchema, Collection, TinaTemplate, } from '@tinacms/graphql';
|
|
3
3
|
export declare function init(args: any): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -304,7 +304,7 @@ var commander = __toModule(require("commander"));
|
|
|
304
304
|
|
|
305
305
|
// package.json
|
|
306
306
|
var name = "@tinacms/cli";
|
|
307
|
-
var version = "1.
|
|
307
|
+
var version = "1.3.0";
|
|
308
308
|
|
|
309
309
|
// src/cmds/audit/audit.ts
|
|
310
310
|
var import_graphql = __toModule(require("@tinacms/graphql"));
|
|
@@ -2065,13 +2065,27 @@ var ErrorSingleton = class {
|
|
|
2065
2065
|
|
|
2066
2066
|
// src/cmds/forestry-migrate/util/index.ts
|
|
2067
2067
|
var errorSingletonInstance = ErrorSingleton.getInstance();
|
|
2068
|
-
var
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
if (
|
|
2068
|
+
var NAME_TEST_REGEX = /^[a-zA-Z0-9_]*$/;
|
|
2069
|
+
var NAME_UPDATE_REGEX = /[^a-zA-Z0-9]/g;
|
|
2070
|
+
var getTinaFieldsFromName = (name2) => {
|
|
2071
|
+
if (name2 == "id") {
|
|
2072
|
+
return { name: "custom_id", nameOverride: "id" };
|
|
2073
|
+
} else {
|
|
2074
|
+
if (NAME_TEST_REGEX.test(name2)) {
|
|
2075
|
+
return { name: name2 };
|
|
2076
|
+
} else {
|
|
2077
|
+
return {
|
|
2078
|
+
name: name2.replace(NAME_UPDATE_REGEX, "_"),
|
|
2079
|
+
nameOverride: name2
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
var stringifyTemplateName = (name2, template) => {
|
|
2085
|
+
if (NAME_TEST_REGEX.test(name2)) {
|
|
2072
2086
|
return name2;
|
|
2073
2087
|
} else {
|
|
2074
|
-
const newName = name2.replace(
|
|
2088
|
+
const newName = name2.replace(NAME_UPDATE_REGEX, "_");
|
|
2075
2089
|
errorSingletonInstance.addErrorName({ name: name2, newName, template });
|
|
2076
2090
|
return newName;
|
|
2077
2091
|
}
|
|
@@ -2161,98 +2175,98 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
2161
2175
|
let field;
|
|
2162
2176
|
switch (forestryField2.type) {
|
|
2163
2177
|
case "text":
|
|
2164
|
-
field = {
|
|
2165
|
-
type: "string"
|
|
2166
|
-
|
|
2178
|
+
field = __spreadProps(__spreadValues({
|
|
2179
|
+
type: "string"
|
|
2180
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2167
2181
|
label: forestryField2.label
|
|
2168
|
-
};
|
|
2182
|
+
});
|
|
2169
2183
|
break;
|
|
2170
2184
|
case "textarea":
|
|
2171
|
-
field = {
|
|
2172
|
-
type: "string"
|
|
2173
|
-
|
|
2185
|
+
field = __spreadProps(__spreadValues({
|
|
2186
|
+
type: "string"
|
|
2187
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2174
2188
|
label: forestryField2.label,
|
|
2175
2189
|
ui: {
|
|
2176
2190
|
component: "textarea"
|
|
2177
2191
|
}
|
|
2178
|
-
};
|
|
2192
|
+
});
|
|
2179
2193
|
break;
|
|
2180
2194
|
case "datetime":
|
|
2181
|
-
field = {
|
|
2182
|
-
type: forestryField2.type
|
|
2183
|
-
|
|
2195
|
+
field = __spreadProps(__spreadValues({
|
|
2196
|
+
type: forestryField2.type
|
|
2197
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2184
2198
|
label: forestryField2.label
|
|
2185
|
-
};
|
|
2199
|
+
});
|
|
2186
2200
|
break;
|
|
2187
2201
|
case "number":
|
|
2188
|
-
field = {
|
|
2189
|
-
type: "number"
|
|
2190
|
-
|
|
2202
|
+
field = __spreadProps(__spreadValues({
|
|
2203
|
+
type: "number"
|
|
2204
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2191
2205
|
label: forestryField2.label
|
|
2192
|
-
};
|
|
2206
|
+
});
|
|
2193
2207
|
break;
|
|
2194
2208
|
case "boolean":
|
|
2195
|
-
field = {
|
|
2196
|
-
type: "boolean"
|
|
2197
|
-
|
|
2209
|
+
field = __spreadProps(__spreadValues({
|
|
2210
|
+
type: "boolean"
|
|
2211
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2198
2212
|
label: forestryField2.label
|
|
2199
|
-
};
|
|
2213
|
+
});
|
|
2200
2214
|
break;
|
|
2201
2215
|
case "color":
|
|
2202
|
-
field = {
|
|
2203
|
-
type: "string"
|
|
2204
|
-
|
|
2216
|
+
field = __spreadProps(__spreadValues({
|
|
2217
|
+
type: "string"
|
|
2218
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2205
2219
|
label: forestryField2.label,
|
|
2206
2220
|
ui: {
|
|
2207
2221
|
component: "color"
|
|
2208
2222
|
}
|
|
2209
|
-
};
|
|
2223
|
+
});
|
|
2210
2224
|
break;
|
|
2211
2225
|
case "file":
|
|
2212
|
-
field = {
|
|
2213
|
-
type: "image"
|
|
2214
|
-
|
|
2226
|
+
field = __spreadProps(__spreadValues({
|
|
2227
|
+
type: "image"
|
|
2228
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2215
2229
|
label: forestryField2.label
|
|
2216
|
-
};
|
|
2230
|
+
});
|
|
2217
2231
|
break;
|
|
2218
2232
|
case "select":
|
|
2219
2233
|
if ((_a = forestryField2.config) == null ? void 0 : _a.options) {
|
|
2220
|
-
field = {
|
|
2221
|
-
type: "string"
|
|
2222
|
-
|
|
2234
|
+
field = __spreadProps(__spreadValues({
|
|
2235
|
+
type: "string"
|
|
2236
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2223
2237
|
label: forestryField2.label,
|
|
2224
2238
|
options: ((_b = forestryField2.config) == null ? void 0 : _b.options) || []
|
|
2225
|
-
};
|
|
2239
|
+
});
|
|
2226
2240
|
} else {
|
|
2227
2241
|
logger.info(warnText(`Warning in template ${template}.yaml . "select" field migration has only been implemented for simple select. Other versions of select have not been implemented yet. To make your \`${forestryField2.name}\` field work, you will need to manually add it to your schema.`));
|
|
2228
2242
|
}
|
|
2229
2243
|
break;
|
|
2230
2244
|
case "list":
|
|
2231
|
-
field = {
|
|
2232
|
-
type: "string"
|
|
2233
|
-
|
|
2245
|
+
field = __spreadProps(__spreadValues({
|
|
2246
|
+
type: "string"
|
|
2247
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2234
2248
|
label: forestryField2.label,
|
|
2235
2249
|
list: true
|
|
2236
|
-
};
|
|
2250
|
+
});
|
|
2237
2251
|
if ((_c = forestryField2.config) == null ? void 0 : _c.options) {
|
|
2238
2252
|
field.options = forestryField2.config.options;
|
|
2239
2253
|
}
|
|
2240
2254
|
break;
|
|
2241
2255
|
case "tag_list":
|
|
2242
|
-
field = {
|
|
2243
|
-
type: "string"
|
|
2244
|
-
|
|
2256
|
+
field = __spreadProps(__spreadValues({
|
|
2257
|
+
type: "string"
|
|
2258
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2245
2259
|
label: forestryField2.label,
|
|
2246
2260
|
list: true,
|
|
2247
2261
|
ui: {
|
|
2248
2262
|
component: "tags"
|
|
2249
2263
|
}
|
|
2250
|
-
};
|
|
2264
|
+
});
|
|
2251
2265
|
break;
|
|
2252
2266
|
case "field_group":
|
|
2253
|
-
field = {
|
|
2254
|
-
type: "object"
|
|
2255
|
-
|
|
2267
|
+
field = __spreadProps(__spreadValues({
|
|
2268
|
+
type: "object"
|
|
2269
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2256
2270
|
label: forestryField2.label,
|
|
2257
2271
|
fields: transformForestryFieldsToTinaFields({
|
|
2258
2272
|
fields: forestryField2.fields,
|
|
@@ -2260,12 +2274,12 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
2260
2274
|
template,
|
|
2261
2275
|
skipBlocks
|
|
2262
2276
|
})
|
|
2263
|
-
};
|
|
2277
|
+
});
|
|
2264
2278
|
break;
|
|
2265
2279
|
case "field_group_list":
|
|
2266
|
-
field = {
|
|
2267
|
-
type: "object"
|
|
2268
|
-
|
|
2280
|
+
field = __spreadProps(__spreadValues({
|
|
2281
|
+
type: "object"
|
|
2282
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2269
2283
|
label: forestryField2.label,
|
|
2270
2284
|
list: true,
|
|
2271
2285
|
fields: transformForestryFieldsToTinaFields({
|
|
@@ -2274,7 +2288,7 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
2274
2288
|
rootPath: rootPath2,
|
|
2275
2289
|
skipBlocks
|
|
2276
2290
|
})
|
|
2277
|
-
};
|
|
2291
|
+
});
|
|
2278
2292
|
break;
|
|
2279
2293
|
case "blocks":
|
|
2280
2294
|
if (skipBlocks)
|
|
@@ -2289,17 +2303,17 @@ var transformForestryFieldsToTinaFields = ({
|
|
|
2289
2303
|
const t = {
|
|
2290
2304
|
fields: fields2,
|
|
2291
2305
|
label: template2.label,
|
|
2292
|
-
name:
|
|
2306
|
+
name: stringifyTemplateName(tem, tem)
|
|
2293
2307
|
};
|
|
2294
2308
|
templates.push(t);
|
|
2295
2309
|
});
|
|
2296
|
-
field = {
|
|
2310
|
+
field = __spreadProps(__spreadValues({
|
|
2297
2311
|
type: "object",
|
|
2298
2312
|
list: true,
|
|
2299
|
-
label: forestryField2.label
|
|
2300
|
-
|
|
2313
|
+
label: forestryField2.label
|
|
2314
|
+
}, getTinaFieldsFromName(forestryField2.name)), {
|
|
2301
2315
|
templates
|
|
2302
|
-
};
|
|
2316
|
+
});
|
|
2303
2317
|
break;
|
|
2304
2318
|
case "image_gallery":
|
|
2305
2319
|
case "include":
|
|
@@ -3110,7 +3124,7 @@ var checkGraphqlSchema = async (ctx, next, _options) => {
|
|
|
3110
3124
|
if (config2 == null ? void 0 : config2.branch) {
|
|
3111
3125
|
errorMessage += `
|
|
3112
3126
|
|
|
3113
|
-
|
|
3127
|
+
Additional info: Branch: ${config2.branch}, Client ID: ${config2.clientId} `;
|
|
3114
3128
|
}
|
|
3115
3129
|
throw new Error(errorMessage);
|
|
3116
3130
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@tinacms/scripts": "1.0.
|
|
24
|
+
"@tinacms/scripts": "1.0.3",
|
|
25
25
|
"@types/clear": "0.1.0",
|
|
26
26
|
"@types/cli-spinner": "^0.2.1",
|
|
27
27
|
"@types/cors": "2.8.5",
|
|
@@ -53,11 +53,11 @@
|
|
|
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
|
-
"@tinacms/app": "1.1.
|
|
57
|
-
"@tinacms/datalayer": "1.1.
|
|
58
|
-
"@tinacms/graphql": "1.3.
|
|
56
|
+
"@tinacms/app": "1.1.2",
|
|
57
|
+
"@tinacms/datalayer": "1.1.4",
|
|
58
|
+
"@tinacms/graphql": "1.3.3",
|
|
59
59
|
"@tinacms/metrics": "1.0.2",
|
|
60
|
-
"@tinacms/schema-tools": "1.3.
|
|
60
|
+
"@tinacms/schema-tools": "1.3.3",
|
|
61
61
|
"ajv": "^6.12.3",
|
|
62
62
|
"altair-express-middleware": "4.0.6",
|
|
63
63
|
"auto-bind": "^4.0.0",
|