@tinacms/cli 0.0.0-af4eb2c-20250514032536 → 0.0.0-b012b6c-20250808011625
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 +137 -114
- package/dist/next/commands/build-command/index.d.ts +3 -0
- package/dist/utils/sleep.d.ts +1 -0
- package/package.json +8 -8
|
@@ -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.
|
|
38
|
+
var version = "1.10.2";
|
|
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
|
|
@@ -1926,7 +1926,8 @@ var createConfig = async ({
|
|
|
1926
1926
|
babel: {
|
|
1927
1927
|
// Supresses the warning [NOTE] babel The code generator has deoptimised the styling of
|
|
1928
1928
|
compact: true
|
|
1929
|
-
}
|
|
1929
|
+
},
|
|
1930
|
+
fastRefresh: false
|
|
1930
1931
|
}),
|
|
1931
1932
|
(0, import_vite.splitVendorChunkPlugin)(),
|
|
1932
1933
|
tinaTailwind(configManager.spaRootPath, configManager.prebuildFilePath),
|
|
@@ -2942,45 +2943,63 @@ ${dangerText(e.message)}
|
|
|
2942
2943
|
}
|
|
2943
2944
|
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2944
2945
|
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
|
-
)}`
|
|
2946
|
+
try {
|
|
2947
|
+
const clientInfo = await this.checkClientInfo(
|
|
2948
|
+
configManager,
|
|
2949
|
+
codegen2.productionUrl,
|
|
2950
|
+
this.previewBaseBranch
|
|
2955
2951
|
);
|
|
2952
|
+
if (clientInfo.detectedBotBranch) {
|
|
2953
|
+
logger.warn(
|
|
2954
|
+
`${warnText(
|
|
2955
|
+
`WARN: Detected bot branch. Using schema/content from default branch '${clientInfo.defaultBranch}' instead of '${configManager.config.branch}'.`
|
|
2956
|
+
)}`
|
|
2957
|
+
);
|
|
2958
|
+
}
|
|
2959
|
+
if (!clientInfo.hasUpstream && this.upstreamBranch) {
|
|
2960
|
+
logger.warn(
|
|
2961
|
+
`${dangerText(
|
|
2962
|
+
`WARN: Upstream branch '${this.upstreamBranch}' specified but no upstream project was found.`
|
|
2963
|
+
)}`
|
|
2964
|
+
);
|
|
2965
|
+
}
|
|
2966
|
+
if (clientInfo.hasUpstream || this.previewBaseBranch && this.previewName) {
|
|
2967
|
+
await this.syncProject(configManager, codegen2.productionUrl, {
|
|
2968
|
+
upstreamBranch: this.upstreamBranch,
|
|
2969
|
+
previewBaseBranch: this.previewBaseBranch,
|
|
2970
|
+
previewName: this.previewName
|
|
2971
|
+
});
|
|
2972
|
+
}
|
|
2973
|
+
await waitForDB(
|
|
2974
|
+
configManager.config,
|
|
2975
|
+
codegen2.productionUrl,
|
|
2976
|
+
this.previewName,
|
|
2977
|
+
false
|
|
2978
|
+
);
|
|
2979
|
+
await this.checkGraphqlSchema(
|
|
2980
|
+
configManager,
|
|
2981
|
+
database,
|
|
2982
|
+
codegen2.productionUrl,
|
|
2983
|
+
clientInfo.timestamp
|
|
2984
|
+
);
|
|
2985
|
+
await this.checkTinaSchema(
|
|
2986
|
+
configManager,
|
|
2987
|
+
database,
|
|
2988
|
+
codegen2.productionUrl,
|
|
2989
|
+
this.previewName,
|
|
2990
|
+
this.verbose,
|
|
2991
|
+
clientInfo.timestamp
|
|
2992
|
+
);
|
|
2993
|
+
} catch (e) {
|
|
2994
|
+
logger.error(`
|
|
2995
|
+
|
|
2996
|
+
${dangerText(e.message)}
|
|
2997
|
+
`);
|
|
2998
|
+
if (this.verbose) {
|
|
2999
|
+
console.error(e);
|
|
3000
|
+
}
|
|
3001
|
+
process.exit(1);
|
|
2956
3002
|
}
|
|
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
3003
|
}
|
|
2985
3004
|
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
2986
3005
|
await import_fs_extra7.default.outputFile(
|
|
@@ -3093,86 +3112,88 @@ ${dangerText(e.message)}
|
|
|
3093
3112
|
}
|
|
3094
3113
|
}
|
|
3095
3114
|
async checkClientInfo(configManager, apiURL, previewBaseBranch) {
|
|
3115
|
+
const MAX_RETRIES = 5;
|
|
3096
3116
|
const { config: config2 } = configManager;
|
|
3097
3117
|
const token = config2.token;
|
|
3098
3118
|
const { clientId, branch, host } = (0, import_schema_tools2.parseURL)(apiURL);
|
|
3099
|
-
const url = `https://${host}/db/${clientId}/status/${previewBaseBranch || branch}`;
|
|
3100
3119
|
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
|
-
|
|
3120
|
+
const getBranchInfo = async () => {
|
|
3121
|
+
const url = `https://${host}/db/${clientId}/status/${previewBaseBranch || branch}`;
|
|
3122
|
+
const branchInfo2 = {
|
|
3123
|
+
status: "unknown",
|
|
3124
|
+
branchKnown: false,
|
|
3125
|
+
hasUpstream: false,
|
|
3126
|
+
timestamp: 0,
|
|
3127
|
+
detectedBotBranch: false,
|
|
3128
|
+
defaultBranch: void 0
|
|
3129
|
+
};
|
|
3130
|
+
try {
|
|
3131
|
+
const res = await request({
|
|
3132
|
+
token,
|
|
3133
|
+
url
|
|
3134
|
+
});
|
|
3135
|
+
branchInfo2.status = res.status;
|
|
3136
|
+
branchInfo2.branchKnown = res.status !== "unknown";
|
|
3137
|
+
branchInfo2.timestamp = res.timestamp || 0;
|
|
3138
|
+
branchInfo2.hasUpstream = res.hasUpstream;
|
|
3139
|
+
branchInfo2.detectedBotBranch = res.json.detectedBotBranch;
|
|
3140
|
+
branchInfo2.defaultBranch = res.json.defaultBranch;
|
|
3141
|
+
} catch (e) {
|
|
3142
|
+
summary({
|
|
3143
|
+
heading: "Error when checking client information",
|
|
3144
|
+
items: [
|
|
3145
|
+
{
|
|
3146
|
+
emoji: "\u274C",
|
|
3147
|
+
heading: "You provided",
|
|
3148
|
+
subItems: [
|
|
3149
|
+
{
|
|
3150
|
+
key: "clientId",
|
|
3151
|
+
value: config2.clientId
|
|
3152
|
+
},
|
|
3153
|
+
{
|
|
3154
|
+
key: "branch",
|
|
3155
|
+
value: config2.branch
|
|
3156
|
+
},
|
|
3157
|
+
{
|
|
3158
|
+
key: "token",
|
|
3159
|
+
value: config2.token
|
|
3160
|
+
}
|
|
3161
|
+
]
|
|
3162
|
+
}
|
|
3163
|
+
]
|
|
3164
|
+
});
|
|
3165
|
+
throw e;
|
|
3118
3166
|
}
|
|
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) {
|
|
3167
|
+
return branchInfo2;
|
|
3168
|
+
};
|
|
3169
|
+
const branchInfo = await getBranchInfo();
|
|
3170
|
+
bar2.tick({
|
|
3171
|
+
prog: "\u2705"
|
|
3172
|
+
});
|
|
3173
|
+
const branchBar = new import_progress2.default(
|
|
3174
|
+
`Checking branch '${config2.branch}' is on TinaCloud. :prog`,
|
|
3175
|
+
1
|
|
3176
|
+
);
|
|
3177
|
+
if (branchInfo.branchKnown) {
|
|
3147
3178
|
branchBar.tick({
|
|
3148
3179
|
prog: "\u2705"
|
|
3149
3180
|
});
|
|
3150
|
-
return
|
|
3151
|
-
hasUpstream,
|
|
3152
|
-
timestamp
|
|
3153
|
-
};
|
|
3181
|
+
return branchInfo;
|
|
3154
3182
|
}
|
|
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
|
-
});
|
|
3183
|
+
for (let i = 1; i <= MAX_RETRIES; i++) {
|
|
3184
|
+
await timeout(5e3);
|
|
3185
|
+
const branchInfo2 = await getBranchInfo();
|
|
3186
|
+
if (this.verbose) {
|
|
3187
|
+
logger.info(
|
|
3188
|
+
`Branch status: ${branchInfo2.status}. Attempt: ${i}. Trying again in 5 seconds.`
|
|
3189
|
+
);
|
|
3190
|
+
}
|
|
3191
|
+
if (branchInfo2.branchKnown) {
|
|
3192
|
+
branchBar.tick({
|
|
3193
|
+
prog: "\u2705"
|
|
3194
|
+
});
|
|
3195
|
+
return branchInfo2;
|
|
3196
|
+
}
|
|
3176
3197
|
}
|
|
3177
3198
|
branchBar.tick({
|
|
3178
3199
|
prog: "\u274C"
|
|
@@ -3180,7 +3201,7 @@ ${dangerText(e.message)}
|
|
|
3180
3201
|
logger.error(
|
|
3181
3202
|
`${dangerText(
|
|
3182
3203
|
`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
|
|
3204
|
+
)} 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
3205
|
`https://app.tina.io/projects/${clientId}/configuration`
|
|
3185
3206
|
)}`
|
|
3186
3207
|
);
|
|
@@ -3417,7 +3438,8 @@ Message from server: ${json.message}`;
|
|
|
3417
3438
|
return {
|
|
3418
3439
|
status: json?.status,
|
|
3419
3440
|
timestamp: json?.timestamp,
|
|
3420
|
-
hasUpstream: json?.hasUpstream || false
|
|
3441
|
+
hasUpstream: json?.hasUpstream || false,
|
|
3442
|
+
json
|
|
3421
3443
|
};
|
|
3422
3444
|
}
|
|
3423
3445
|
var fetchRemoteGraphqlSchema = async ({
|
|
@@ -4463,6 +4485,7 @@ var import_path9 = __toESM(require("path"));
|
|
|
4463
4485
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
|
4464
4486
|
var import_minimatch = __toESM(require("minimatch"));
|
|
4465
4487
|
var import_graphql16 = require("@tinacms/graphql");
|
|
4488
|
+
var import_schema_tools3 = require("@tinacms/schema-tools");
|
|
4466
4489
|
|
|
4467
4490
|
// src/cmds/forestry-migrate/util/index.ts
|
|
4468
4491
|
var import_fs_extra9 = __toESM(require("fs-extra"));
|
|
@@ -4956,7 +4979,7 @@ var transformForestryMatchToTinaMatch = (match) => {
|
|
|
4956
4979
|
};
|
|
4957
4980
|
function checkExt(ext) {
|
|
4958
4981
|
const extReal = ext.replace(".", "");
|
|
4959
|
-
if (
|
|
4982
|
+
if (import_schema_tools3.CONTENT_FORMATS.includes(extReal)) {
|
|
4960
4983
|
return extReal;
|
|
4961
4984
|
} else {
|
|
4962
4985
|
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-b012b6c-20250808011625",
|
|
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.4.0"
|
|
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/
|
|
93
|
-
"@tinacms/
|
|
94
|
-
"@tinacms/
|
|
95
|
-
"
|
|
96
|
-
"@tinacms/
|
|
97
|
-
"tinacms": "
|
|
92
|
+
"@tinacms/graphql": "1.6.1",
|
|
93
|
+
"@tinacms/metrics": "1.1.0",
|
|
94
|
+
"@tinacms/schema-tools": "1.9.1",
|
|
95
|
+
"tinacms": "0.0.0-b012b6c-20250808011625",
|
|
96
|
+
"@tinacms/app": "0.0.0-b012b6c-20250808011625",
|
|
97
|
+
"@tinacms/search": "1.1.1"
|
|
98
98
|
},
|
|
99
99
|
"publishConfig": {
|
|
100
100
|
"registry": "https://registry.npmjs.org"
|