@tinacms/cli 0.0.0-af4eb2c-20250514032536 → 0.0.0-b25c5f0-20250618074247
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/forestry-migrate/index.d.ts +2 -2
- package/dist/cmds/init/index.d.ts +2 -2
- package/dist/cmds/init/prompts/index.d.ts +2 -1
- package/dist/cmds/init/prompts/types.d.ts +2 -1
- package/dist/index.js +135 -113
- package/dist/next/commands/build-command/index.d.ts +3 -0
- package/dist/utils/sleep.d.ts +1 -0
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Collection, TinaField } from '@tinacms/schema-tools';
|
|
1
|
+
import type { Collection, TinaField, ContentFrontmatterFormat } from '@tinacms/schema-tools';
|
|
2
2
|
export declare const stringifyLabel: (label: string) => string;
|
|
3
3
|
export declare const stringifyLabelWithField: (label: string) => string;
|
|
4
4
|
export declare const generateAllTemplates: ({ pathToForestryConfig, }: {
|
|
@@ -8,7 +8,7 @@ export declare const generateAllTemplates: ({ pathToForestryConfig, }: {
|
|
|
8
8
|
templateObj: any;
|
|
9
9
|
}>>;
|
|
10
10
|
export declare const generateCollections: ({ pathToForestryConfig, usingTypescript, frontMatterFormat, }: {
|
|
11
|
-
frontMatterFormat?:
|
|
11
|
+
frontMatterFormat?: ContentFrontmatterFormat;
|
|
12
12
|
pathToForestryConfig: string;
|
|
13
13
|
usingTypescript: boolean;
|
|
14
14
|
}) => Promise<{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CLICommand } from '../index';
|
|
2
|
+
import { ContentFrontmatterFormat } from '@tinacms/schema-tools';
|
|
2
3
|
export interface Framework {
|
|
3
4
|
name: 'next' | 'hugo' | 'jekyll' | 'other';
|
|
4
5
|
reactive: boolean;
|
|
@@ -20,11 +21,10 @@ export type GeneratedFile = {
|
|
|
20
21
|
parentPath: string;
|
|
21
22
|
};
|
|
22
23
|
};
|
|
23
|
-
export type FrontmatterFormat = 'yaml' | 'toml' | 'json';
|
|
24
24
|
export type InitEnvironment = {
|
|
25
25
|
hasTinaDeps: boolean;
|
|
26
26
|
forestryConfigExists: boolean;
|
|
27
|
-
frontMatterFormat:
|
|
27
|
+
frontMatterFormat: ContentFrontmatterFormat;
|
|
28
28
|
gitIgnoreExists: boolean;
|
|
29
29
|
gitIgnoreNodeModulesExists: boolean;
|
|
30
30
|
gitIgnoreTinaEnvExists: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Framework, InitEnvironment } from '../';
|
|
2
2
|
import { Config, ImportStatement } from './types';
|
|
3
|
+
import { ContentFrontmatterFormat } from '@tinacms/schema-tools';
|
|
3
4
|
export * from './askTinaCloudSetup';
|
|
4
5
|
export * from './types';
|
|
5
6
|
export * from './gitProvider';
|
|
@@ -14,7 +15,7 @@ export declare const askForestryMigrate: ({ framework, env, }: {
|
|
|
14
15
|
env: InitEnvironment;
|
|
15
16
|
}) => Promise<{
|
|
16
17
|
forestryMigrate: boolean;
|
|
17
|
-
frontMatterFormat?:
|
|
18
|
+
frontMatterFormat?: ContentFrontmatterFormat;
|
|
18
19
|
}>;
|
|
19
20
|
export declare const askTinaSetupPrompts: (params: {
|
|
20
21
|
frameworkName: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContentFrontmatterFormat } from '@tinacms/schema-tools';
|
|
1
2
|
import { Framework, GeneratedFileType } from '../';
|
|
2
3
|
export type Config = {
|
|
3
4
|
typescript: boolean;
|
|
@@ -5,7 +6,7 @@ export type Config = {
|
|
|
5
6
|
framework: Framework;
|
|
6
7
|
packageManager: 'pnpm' | 'yarn' | 'npm';
|
|
7
8
|
forestryMigrate: boolean;
|
|
8
|
-
frontMatterFormat?:
|
|
9
|
+
frontMatterFormat?: ContentFrontmatterFormat;
|
|
9
10
|
hosting?: 'tina-cloud' | 'self-host';
|
|
10
11
|
gitProvider?: PromptGitProvider;
|
|
11
12
|
databaseAdapter?: PromptDatabaseAdapter;
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
35
35
|
var import_clipanion8 = require("clipanion");
|
|
36
36
|
|
|
37
37
|
// package.json
|
|
38
|
-
var version = "1.9.
|
|
38
|
+
var version = "1.9.8";
|
|
39
39
|
|
|
40
40
|
// src/next/commands/dev-command/index.ts
|
|
41
41
|
var import_path5 = __toESM(require("path"));
|
|
@@ -1912,7 +1912,7 @@ var createConfig = async ({
|
|
|
1912
1912
|
}
|
|
1913
1913
|
},
|
|
1914
1914
|
build: {
|
|
1915
|
-
sourcemap:
|
|
1915
|
+
sourcemap: false,
|
|
1916
1916
|
outDir: configManager.outputFolderPath,
|
|
1917
1917
|
emptyOutDir: true,
|
|
1918
1918
|
rollupOptions
|
|
@@ -2942,45 +2942,63 @@ ${dangerText(e.message)}
|
|
|
2942
2942
|
}
|
|
2943
2943
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2944
2944
|
if (!skipCloudChecks) {
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
if (!hasUpstream && this.upstreamBranch) {
|
|
2951
|
-
logger.warn(
|
|
2952
|
-
`${dangerText(
|
|
2953
|
-
`WARN: Upstream branch '${this.upstreamBranch}' specified but no upstream project was found.`
|
|
2954
|
-
)}`
|
|
2945
|
+
try {
|
|
2946
|
+
const clientInfo = await this.checkClientInfo(
|
|
2947
|
+
configManager,
|
|
2948
|
+
codegen2.productionUrl,
|
|
2949
|
+
this.previewBaseBranch
|
|
2955
2950
|
);
|
|
2951
|
+
if (clientInfo.detectedBotBranch) {
|
|
2952
|
+
logger.warn(
|
|
2953
|
+
`${warnText(
|
|
2954
|
+
`WARN: Detected bot branch. Using schema/content from default branch '${clientInfo.defaultBranch}' instead of '${configManager.config.branch}'.`
|
|
2955
|
+
)}`
|
|
2956
|
+
);
|
|
2957
|
+
}
|
|
2958
|
+
if (!clientInfo.hasUpstream && this.upstreamBranch) {
|
|
2959
|
+
logger.warn(
|
|
2960
|
+
`${dangerText(
|
|
2961
|
+
`WARN: Upstream branch '${this.upstreamBranch}' specified but no upstream project was found.`
|
|
2962
|
+
)}`
|
|
2963
|
+
);
|
|
2964
|
+
}
|
|
2965
|
+
if (clientInfo.hasUpstream || this.previewBaseBranch && this.previewName) {
|
|
2966
|
+
await this.syncProject(configManager, codegen2.productionUrl, {
|
|
2967
|
+
upstreamBranch: this.upstreamBranch,
|
|
2968
|
+
previewBaseBranch: this.previewBaseBranch,
|
|
2969
|
+
previewName: this.previewName
|
|
2970
|
+
});
|
|
2971
|
+
}
|
|
2972
|
+
await waitForDB(
|
|
2973
|
+
configManager.config,
|
|
2974
|
+
codegen2.productionUrl,
|
|
2975
|
+
this.previewName,
|
|
2976
|
+
false
|
|
2977
|
+
);
|
|
2978
|
+
await this.checkGraphqlSchema(
|
|
2979
|
+
configManager,
|
|
2980
|
+
database,
|
|
2981
|
+
codegen2.productionUrl,
|
|
2982
|
+
clientInfo.timestamp
|
|
2983
|
+
);
|
|
2984
|
+
await this.checkTinaSchema(
|
|
2985
|
+
configManager,
|
|
2986
|
+
database,
|
|
2987
|
+
codegen2.productionUrl,
|
|
2988
|
+
this.previewName,
|
|
2989
|
+
this.verbose,
|
|
2990
|
+
clientInfo.timestamp
|
|
2991
|
+
);
|
|
2992
|
+
} catch (e) {
|
|
2993
|
+
logger.error(`
|
|
2994
|
+
|
|
2995
|
+
${dangerText(e.message)}
|
|
2996
|
+
`);
|
|
2997
|
+
if (this.verbose) {
|
|
2998
|
+
console.error(e);
|
|
2999
|
+
}
|
|
3000
|
+
process.exit(1);
|
|
2956
3001
|
}
|
|
2957
|
-
if (hasUpstream || this.previewBaseBranch && this.previewName) {
|
|
2958
|
-
await this.syncProject(configManager, codegen2.productionUrl, {
|
|
2959
|
-
upstreamBranch: this.upstreamBranch,
|
|
2960
|
-
previewBaseBranch: this.previewBaseBranch,
|
|
2961
|
-
previewName: this.previewName
|
|
2962
|
-
});
|
|
2963
|
-
}
|
|
2964
|
-
await waitForDB(
|
|
2965
|
-
configManager.config,
|
|
2966
|
-
codegen2.productionUrl,
|
|
2967
|
-
this.previewName,
|
|
2968
|
-
false
|
|
2969
|
-
);
|
|
2970
|
-
await this.checkGraphqlSchema(
|
|
2971
|
-
configManager,
|
|
2972
|
-
database,
|
|
2973
|
-
codegen2.productionUrl,
|
|
2974
|
-
timestamp
|
|
2975
|
-
);
|
|
2976
|
-
await this.checkTinaSchema(
|
|
2977
|
-
configManager,
|
|
2978
|
-
database,
|
|
2979
|
-
codegen2.productionUrl,
|
|
2980
|
-
this.previewName,
|
|
2981
|
-
this.verbose,
|
|
2982
|
-
timestamp
|
|
2983
|
-
);
|
|
2984
3002
|
}
|
|
2985
3003
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
2986
3004
|
await import_fs_extra7.default.outputFile(
|
|
@@ -3093,86 +3111,88 @@ ${dangerText(e.message)}
|
|
|
3093
3111
|
}
|
|
3094
3112
|
}
|
|
3095
3113
|
async checkClientInfo(configManager, apiURL, previewBaseBranch) {
|
|
3114
|
+
const MAX_RETRIES = 5;
|
|
3096
3115
|
const { config: config2 } = configManager;
|
|
3097
3116
|
const token = config2.token;
|
|
3098
3117
|
const { clientId, branch, host } = (0, import_schema_tools2.parseURL)(apiURL);
|
|
3099
|
-
const url = `https://${host}/db/${clientId}/status/${previewBaseBranch || branch}`;
|
|
3100
3118
|
const bar2 = new import_progress2.default("Checking clientId and token. :prog", 1);
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3119
|
+
const getBranchInfo = async () => {
|
|
3120
|
+
const url = `https://${host}/db/${clientId}/status/${previewBaseBranch || branch}`;
|
|
3121
|
+
const branchInfo2 = {
|
|
3122
|
+
status: "unknown",
|
|
3123
|
+
branchKnown: false,
|
|
3124
|
+
hasUpstream: false,
|
|
3125
|
+
timestamp: 0,
|
|
3126
|
+
detectedBotBranch: false,
|
|
3127
|
+
defaultBranch: void 0
|
|
3128
|
+
};
|
|
3129
|
+
try {
|
|
3130
|
+
const res = await request({
|
|
3131
|
+
token,
|
|
3132
|
+
url
|
|
3133
|
+
});
|
|
3134
|
+
branchInfo2.status = res.status;
|
|
3135
|
+
branchInfo2.branchKnown = res.status !== "unknown";
|
|
3136
|
+
branchInfo2.timestamp = res.timestamp || 0;
|
|
3137
|
+
branchInfo2.hasUpstream = res.hasUpstream;
|
|
3138
|
+
branchInfo2.detectedBotBranch = res.json.detectedBotBranch;
|
|
3139
|
+
branchInfo2.defaultBranch = res.json.defaultBranch;
|
|
3140
|
+
} catch (e) {
|
|
3141
|
+
summary({
|
|
3142
|
+
heading: "Error when checking client information",
|
|
3143
|
+
items: [
|
|
3144
|
+
{
|
|
3145
|
+
emoji: "\u274C",
|
|
3146
|
+
heading: "You provided",
|
|
3147
|
+
subItems: [
|
|
3148
|
+
{
|
|
3149
|
+
key: "clientId",
|
|
3150
|
+
value: config2.clientId
|
|
3151
|
+
},
|
|
3152
|
+
{
|
|
3153
|
+
key: "branch",
|
|
3154
|
+
value: config2.branch
|
|
3155
|
+
},
|
|
3156
|
+
{
|
|
3157
|
+
key: "token",
|
|
3158
|
+
value: config2.token
|
|
3159
|
+
}
|
|
3160
|
+
]
|
|
3161
|
+
}
|
|
3162
|
+
]
|
|
3163
|
+
});
|
|
3164
|
+
throw e;
|
|
3118
3165
|
}
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
},
|
|
3131
|
-
{
|
|
3132
|
-
key: "branch",
|
|
3133
|
-
value: config2.branch
|
|
3134
|
-
},
|
|
3135
|
-
{
|
|
3136
|
-
key: "token",
|
|
3137
|
-
value: config2.token
|
|
3138
|
-
}
|
|
3139
|
-
]
|
|
3140
|
-
}
|
|
3141
|
-
]
|
|
3142
|
-
});
|
|
3143
|
-
throw e;
|
|
3144
|
-
}
|
|
3145
|
-
const branchBar = new import_progress2.default("Checking branch is on TinaCloud. :prog", 1);
|
|
3146
|
-
if (branchKnown) {
|
|
3166
|
+
return branchInfo2;
|
|
3167
|
+
};
|
|
3168
|
+
const branchInfo = await getBranchInfo();
|
|
3169
|
+
bar2.tick({
|
|
3170
|
+
prog: "\u2705"
|
|
3171
|
+
});
|
|
3172
|
+
const branchBar = new import_progress2.default(
|
|
3173
|
+
`Checking branch '${config2.branch}' is on TinaCloud. :prog`,
|
|
3174
|
+
1
|
|
3175
|
+
);
|
|
3176
|
+
if (branchInfo.branchKnown) {
|
|
3147
3177
|
branchBar.tick({
|
|
3148
3178
|
prog: "\u2705"
|
|
3149
3179
|
});
|
|
3150
|
-
return
|
|
3151
|
-
hasUpstream,
|
|
3152
|
-
timestamp
|
|
3153
|
-
};
|
|
3180
|
+
return branchInfo;
|
|
3154
3181
|
}
|
|
3155
|
-
for (let i =
|
|
3156
|
-
await
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
prog: "\u2705"
|
|
3170
|
-
});
|
|
3171
|
-
return;
|
|
3172
|
-
}
|
|
3173
|
-
},
|
|
3174
|
-
ms: 5e3
|
|
3175
|
-
});
|
|
3182
|
+
for (let i = 1; i <= MAX_RETRIES; i++) {
|
|
3183
|
+
await timeout(5e3);
|
|
3184
|
+
const branchInfo2 = await getBranchInfo();
|
|
3185
|
+
if (this.verbose) {
|
|
3186
|
+
logger.info(
|
|
3187
|
+
`Branch status: ${branchInfo2.status}. Attempt: ${i}. Trying again in 5 seconds.`
|
|
3188
|
+
);
|
|
3189
|
+
}
|
|
3190
|
+
if (branchInfo2.branchKnown) {
|
|
3191
|
+
branchBar.tick({
|
|
3192
|
+
prog: "\u2705"
|
|
3193
|
+
});
|
|
3194
|
+
return branchInfo2;
|
|
3195
|
+
}
|
|
3176
3196
|
}
|
|
3177
3197
|
branchBar.tick({
|
|
3178
3198
|
prog: "\u274C"
|
|
@@ -3180,7 +3200,7 @@ ${dangerText(e.message)}
|
|
|
3180
3200
|
logger.error(
|
|
3181
3201
|
`${dangerText(
|
|
3182
3202
|
`ERROR: Branch '${branch}' is not on TinaCloud.`
|
|
3183
|
-
)} Please make sure that branch '${branch}' exists in your repository and that you have pushed your all changes to the remote. View all
|
|
3203
|
+
)} Please make sure that branch '${branch}' exists in your repository and that you have pushed your all changes to the remote. View all branches and their current status here: ${linkText(
|
|
3184
3204
|
`https://app.tina.io/projects/${clientId}/configuration`
|
|
3185
3205
|
)}`
|
|
3186
3206
|
);
|
|
@@ -3417,7 +3437,8 @@ Message from server: ${json.message}`;
|
|
|
3417
3437
|
return {
|
|
3418
3438
|
status: json?.status,
|
|
3419
3439
|
timestamp: json?.timestamp,
|
|
3420
|
-
hasUpstream: json?.hasUpstream || false
|
|
3440
|
+
hasUpstream: json?.hasUpstream || false,
|
|
3441
|
+
json
|
|
3421
3442
|
};
|
|
3422
3443
|
}
|
|
3423
3444
|
var fetchRemoteGraphqlSchema = async ({
|
|
@@ -4463,6 +4484,7 @@ var import_path9 = __toESM(require("path"));
|
|
|
4463
4484
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
|
4464
4485
|
var import_minimatch = __toESM(require("minimatch"));
|
|
4465
4486
|
var import_graphql16 = require("@tinacms/graphql");
|
|
4487
|
+
var import_schema_tools3 = require("@tinacms/schema-tools");
|
|
4466
4488
|
|
|
4467
4489
|
// src/cmds/forestry-migrate/util/index.ts
|
|
4468
4490
|
var import_fs_extra9 = __toESM(require("fs-extra"));
|
|
@@ -4956,7 +4978,7 @@ var transformForestryMatchToTinaMatch = (match) => {
|
|
|
4956
4978
|
};
|
|
4957
4979
|
function checkExt(ext) {
|
|
4958
4980
|
const extReal = ext.replace(".", "");
|
|
4959
|
-
if (
|
|
4981
|
+
if (import_schema_tools3.CONTENT_FORMATS.includes(extReal)) {
|
|
4960
4982
|
return extReal;
|
|
4961
4983
|
} else {
|
|
4962
4984
|
return false;
|
|
@@ -20,8 +20,11 @@ export declare class BuildCommand extends BaseCommand {
|
|
|
20
20
|
catch(error: any): Promise<void>;
|
|
21
21
|
execute(): Promise<number | void>;
|
|
22
22
|
checkClientInfo(configManager: ConfigManager, apiURL: string, previewBaseBranch?: string): Promise<{
|
|
23
|
+
branchKnown: boolean;
|
|
23
24
|
hasUpstream: boolean;
|
|
24
25
|
timestamp: number;
|
|
26
|
+
detectedBotBranch: boolean;
|
|
27
|
+
defaultBranch: string | undefined;
|
|
25
28
|
}>;
|
|
26
29
|
syncProject(configManager: ConfigManager, apiURL: string, options?: {
|
|
27
30
|
upstreamBranch?: string;
|
package/dist/utils/sleep.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-b25c5f0-20250618074247",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/prompts": "^2.4.9",
|
|
42
42
|
"@types/yup": "^0.32.0",
|
|
43
43
|
"jest": "^29.7.0",
|
|
44
|
-
"@tinacms/scripts": "
|
|
44
|
+
"@tinacms/scripts": "1.3.5"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@graphql-codegen/core": "^2.6.8",
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
"vite": "^4.5.9",
|
|
90
90
|
"yup": "^1.6.1",
|
|
91
91
|
"zod": "^3.24.2",
|
|
92
|
-
"@tinacms/app": "
|
|
93
|
-
"@tinacms/graphql": "
|
|
92
|
+
"@tinacms/app": "0.0.0-b25c5f0-20250618074247",
|
|
93
|
+
"@tinacms/graphql": "0.0.0-b25c5f0-20250618074247",
|
|
94
94
|
"@tinacms/metrics": "1.0.9",
|
|
95
|
-
"@tinacms/schema-tools": "
|
|
96
|
-
"@tinacms/search": "
|
|
97
|
-
"tinacms": "
|
|
95
|
+
"@tinacms/schema-tools": "0.0.0-b25c5f0-20250618074247",
|
|
96
|
+
"@tinacms/search": "0.0.0-b25c5f0-20250618074247",
|
|
97
|
+
"tinacms": "0.0.0-b25c5f0-20250618074247"
|
|
98
98
|
},
|
|
99
99
|
"publishConfig": {
|
|
100
100
|
"registry": "https://registry.npmjs.org"
|