@tinacms/cli 1.5.31 → 1.5.33
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/util/index.d.ts +4 -7
- package/dist/cmds/index.d.ts +12 -0
- package/dist/cmds/init/apply.d.ts +19 -0
- package/dist/cmds/init/codegen/index.d.ts +3 -0
- package/dist/cmds/init/codegen/util.d.ts +4 -0
- package/dist/cmds/init/configure.d.ts +7 -0
- package/dist/cmds/init/detectEnvironment.d.ts +9 -0
- package/dist/cmds/init/index.d.ts +43 -24
- package/dist/cmds/init/prompts/askTinaCloudSetup.d.ts +4 -0
- package/dist/cmds/init/prompts/authProvider.d.ts +6 -0
- package/dist/cmds/init/prompts/databaseAdapter.d.ts +6 -0
- package/dist/cmds/init/prompts/generatedFiles.d.ts +6 -0
- package/dist/cmds/init/prompts/gitProvider.d.ts +4 -0
- package/dist/cmds/init/prompts/index.d.ts +29 -0
- package/dist/cmds/init/prompts/types.d.ts +42 -0
- package/dist/cmds/init/templates/config.d.ts +11 -0
- package/dist/cmds/init/templates/content.d.ts +1 -0
- package/dist/cmds/init/templates/database.d.ts +8 -0
- package/dist/cmds/init/templates/next.d.ts +8 -0
- package/dist/cmds/init/templates/tinaNextRoute.d.ts +6 -0
- package/dist/index.js +2138 -824
- package/dist/lib/getPath.d.ts +0 -3
- package/dist/next/codegen/index.d.ts +1 -0
- package/dist/next/commands/init-command/index.d.ts +2 -0
- package/dist/next/config-manager.d.ts +5 -1
- package/dist/utils/script-helpers.d.ts +7 -2
- package/package.json +12 -11
- package/dist/cmds/init/setup-files/config.d.ts +0 -9
- package/dist/cmds/init/setup-files/index.d.ts +0 -6
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
1
|
import z from 'zod';
|
|
5
2
|
import type { TinaField } from '@tinacms/schema-tools';
|
|
6
3
|
export declare const getTinaFieldsFromName: (name: string) => {
|
|
@@ -111,12 +108,12 @@ declare const FrontmatterTemplateSchema: z.ZodObject<{
|
|
|
111
108
|
hide_body: z.ZodOptional<z.ZodBoolean>;
|
|
112
109
|
fields: z.ZodOptional<z.ZodArray<z.ZodType<ForestryFieldType, z.ZodTypeDef, ForestryFieldType>, "many">>;
|
|
113
110
|
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
label?: string;
|
|
115
111
|
fields?: ForestryFieldType[];
|
|
112
|
+
label?: string;
|
|
116
113
|
hide_body?: boolean;
|
|
117
114
|
}, {
|
|
118
|
-
label?: string;
|
|
119
115
|
fields?: ForestryFieldType[];
|
|
116
|
+
label?: string;
|
|
120
117
|
hide_body?: boolean;
|
|
121
118
|
}>;
|
|
122
119
|
export declare const transformForestryFieldsToTinaFields: ({ fields, pathToForestryConfig, template, skipBlocks, }: {
|
|
@@ -141,8 +138,8 @@ export declare const getFieldsFromTemplates: (_args: {
|
|
|
141
138
|
export declare const parseTemplates: ({ val }: {
|
|
142
139
|
val: unknown;
|
|
143
140
|
}) => {
|
|
144
|
-
label?: string;
|
|
145
141
|
fields?: ForestryFieldType[];
|
|
142
|
+
label?: string;
|
|
146
143
|
hide_body?: boolean;
|
|
147
144
|
};
|
|
148
145
|
export declare const checkForestrySettingsPath: ({ forestryPath, }: {
|
|
@@ -154,11 +151,11 @@ export declare const parseSections: ({ val }: {
|
|
|
154
151
|
sections?: {
|
|
155
152
|
match?: string;
|
|
156
153
|
exclude?: string;
|
|
154
|
+
templates?: string[];
|
|
157
155
|
path?: string;
|
|
158
156
|
type?: "directory" | "document" | "heading" | "jekyll-pages" | "jekyll-posts";
|
|
159
157
|
label?: string;
|
|
160
158
|
create?: "none" | "all" | "documents";
|
|
161
|
-
templates?: string[];
|
|
162
159
|
new_doc_ext?: string;
|
|
163
160
|
read_only?: boolean;
|
|
164
161
|
}[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface CommandHandler<Environment, Parameters> {
|
|
2
|
+
setup(p: Parameters): Promise<void>;
|
|
3
|
+
detectEnvironment(p: Parameters): Promise<Environment>;
|
|
4
|
+
configure(e: Environment, p: Parameters): Promise<Record<any, any>>;
|
|
5
|
+
apply(Record: any, e: Environment, p: Parameters): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class CLICommand<Environment, Parameters> {
|
|
8
|
+
private readonly handler;
|
|
9
|
+
constructor(handler: CommandHandler<Environment, Parameters>);
|
|
10
|
+
execute(params: Parameters): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GeneratedFile, InitEnvironment, InitParams } from './index';
|
|
2
|
+
import { Config } from './prompts';
|
|
3
|
+
declare function apply({ env, params, config, }: {
|
|
4
|
+
env: InitEnvironment;
|
|
5
|
+
params: InitParams;
|
|
6
|
+
config: Config;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare const addTemplateFile: ({ content, generatedFile, config, }: {
|
|
9
|
+
content: string;
|
|
10
|
+
generatedFile: GeneratedFile;
|
|
11
|
+
config: Config;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Executes a shell command and return it as a Promise.
|
|
15
|
+
* @param cmd {string}
|
|
16
|
+
* @return {Promise<string>}
|
|
17
|
+
*/
|
|
18
|
+
export declare function execShellCommand(cmd: any): Promise<string>;
|
|
19
|
+
export default apply;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
export declare const makeTransformer: <T extends ts.Node>(makeVisitor: (ctx: ts.TransformationContext) => ts.Visitor) => ts.TransformerFactory<T>;
|
|
3
|
+
export declare function parseExpression(expression: string): [ts.SourceFile, ts.Expression];
|
|
4
|
+
export declare function parseVariableStatement(stmt: string): [ts.SourceFile, ts.VariableStatement];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InitEnvironment } from './index';
|
|
2
|
+
declare const detectEnvironment: ({ baseDir, pathToForestryConfig, rootPath, debug, }: {
|
|
3
|
+
baseDir?: string;
|
|
4
|
+
pathToForestryConfig: string;
|
|
5
|
+
rootPath: string;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
tinaVersion?: string;
|
|
8
|
+
}) => Promise<InitEnvironment>;
|
|
9
|
+
export default detectEnvironment;
|
|
@@ -1,31 +1,50 @@
|
|
|
1
|
+
import { CLICommand } from '../index';
|
|
1
2
|
export interface Framework {
|
|
2
3
|
name: 'next' | 'hugo' | 'jekyll' | 'other';
|
|
3
4
|
reactive: boolean;
|
|
4
5
|
}
|
|
5
|
-
export declare
|
|
6
|
+
export declare type ReactiveFramework = 'next';
|
|
7
|
+
export declare type GeneratedFileType = 'next-api-handler' | 'config' | 'database' | 'templates' | 'reactive-example' | 'sample-content' | 'users-json';
|
|
8
|
+
export declare type GeneratedFile = {
|
|
9
|
+
fullPathJS: string;
|
|
10
|
+
fullPathTS: string;
|
|
11
|
+
fullPathOverride?: string;
|
|
12
|
+
generatedFileType: GeneratedFileType;
|
|
13
|
+
name: string;
|
|
14
|
+
parentPath: string;
|
|
15
|
+
typescriptExists: boolean;
|
|
16
|
+
javascriptExists: boolean;
|
|
17
|
+
resolve: (typescript: boolean) => {
|
|
18
|
+
exists: boolean;
|
|
19
|
+
path: string;
|
|
20
|
+
parentPath: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare type FrontmatterFormat = 'yaml' | 'toml' | 'json';
|
|
24
|
+
export declare type InitEnvironment = {
|
|
25
|
+
hasTinaDeps: boolean;
|
|
26
|
+
forestryConfigExists: boolean;
|
|
27
|
+
frontMatterFormat: FrontmatterFormat;
|
|
28
|
+
gitIgnoreExists: boolean;
|
|
29
|
+
gitIgnoreNodeModulesExists: boolean;
|
|
30
|
+
gitIgnoreTinaEnvExists: boolean;
|
|
31
|
+
gitIgnoreEnvExists: boolean;
|
|
32
|
+
packageJSONExists: boolean;
|
|
33
|
+
sampleContentExists: boolean;
|
|
34
|
+
sampleContentPath: string;
|
|
35
|
+
generatedFiles?: {
|
|
36
|
+
[key in GeneratedFileType]: GeneratedFile;
|
|
37
|
+
};
|
|
38
|
+
usingSrc: boolean;
|
|
39
|
+
tinaConfigExists: boolean;
|
|
40
|
+
};
|
|
41
|
+
export declare type InitParams = {
|
|
6
42
|
rootPath: string;
|
|
7
43
|
pathToForestryConfig: string;
|
|
8
44
|
noTelemetry: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
framework: Framework;
|
|
16
|
-
collections?: string;
|
|
17
|
-
token?: string;
|
|
18
|
-
clientId?: string;
|
|
19
|
-
isForestryMigration?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare const addTemplateFile: (args: {
|
|
22
|
-
templateCode: string;
|
|
23
|
-
baseDir: string;
|
|
24
|
-
usingTypescript: boolean;
|
|
25
|
-
}) => Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Executes a shell command and return it as a Promise.
|
|
28
|
-
* @param cmd {string}
|
|
29
|
-
* @return {Promise<string>}
|
|
30
|
-
*/
|
|
31
|
-
export declare function execShellCommand(cmd: any): Promise<string>;
|
|
45
|
+
isBackendInit: boolean;
|
|
46
|
+
baseDir?: string;
|
|
47
|
+
debug?: boolean;
|
|
48
|
+
tinaVersion?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare const command: CLICommand<InitEnvironment, InitParams>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GeneratedFile, GeneratedFileType } from '..';
|
|
2
|
+
import type { Config } from './types';
|
|
3
|
+
export declare const askOverwriteGenerateFiles: ({ config, generatedFiles, }: {
|
|
4
|
+
generatedFiles: GeneratedFile[];
|
|
5
|
+
config: Config;
|
|
6
|
+
}) => Promise<GeneratedFileType[]>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Framework, InitEnvironment } from '../';
|
|
2
|
+
import { Config, ImportStatement } from './types';
|
|
3
|
+
export * from './askTinaCloudSetup';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './gitProvider';
|
|
6
|
+
export * from './databaseAdapter';
|
|
7
|
+
export * from './authProvider';
|
|
8
|
+
export declare const askCommonSetUp: () => Promise<{
|
|
9
|
+
framework: Framework;
|
|
10
|
+
packageManager: 'pnpm' | 'yarn' | 'npm';
|
|
11
|
+
}>;
|
|
12
|
+
export declare const askForestryMigrate: ({ framework, env, }: {
|
|
13
|
+
framework: Framework;
|
|
14
|
+
env: InitEnvironment;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
forestryMigrate: boolean;
|
|
17
|
+
frontMatterFormat?: 'yaml' | 'toml' | 'json';
|
|
18
|
+
}>;
|
|
19
|
+
export declare const askTinaSetupPrompts: (params: {
|
|
20
|
+
frameworkName: string;
|
|
21
|
+
config: Config;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
typescript: boolean;
|
|
24
|
+
publicFolder?: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const askIfUsingSelfHosted: () => Promise<{
|
|
27
|
+
hosting: 'tina-cloud' | 'self-host';
|
|
28
|
+
}>;
|
|
29
|
+
export declare const makeImportString: (imports?: ImportStatement[]) => string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Framework, GeneratedFileType } from '../';
|
|
2
|
+
export declare type Config = {
|
|
3
|
+
typescript: boolean;
|
|
4
|
+
publicFolder?: string;
|
|
5
|
+
framework: Framework;
|
|
6
|
+
packageManager: 'pnpm' | 'yarn' | 'npm';
|
|
7
|
+
forestryMigrate: boolean;
|
|
8
|
+
frontMatterFormat?: 'yaml' | 'toml' | 'json';
|
|
9
|
+
hosting?: 'tina-cloud' | 'self-host';
|
|
10
|
+
gitProvider?: PromptGitProvider;
|
|
11
|
+
databaseAdapter?: PromptDatabaseAdapter;
|
|
12
|
+
authProvider?: PromptAuthProvider;
|
|
13
|
+
nextAuthCredentialsProviderName?: string;
|
|
14
|
+
isLocalEnvVarName: string;
|
|
15
|
+
envVars: {
|
|
16
|
+
key: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
overwriteList?: GeneratedFileType[];
|
|
20
|
+
};
|
|
21
|
+
export interface ImportStatement {
|
|
22
|
+
imported: string[];
|
|
23
|
+
from: string;
|
|
24
|
+
packageName: string;
|
|
25
|
+
}
|
|
26
|
+
export interface PromptGitProvider {
|
|
27
|
+
gitProviderClassText: string;
|
|
28
|
+
imports?: ImportStatement[];
|
|
29
|
+
}
|
|
30
|
+
export interface PromptDatabaseAdapter {
|
|
31
|
+
databaseAdapterClassText: string;
|
|
32
|
+
imports?: ImportStatement[];
|
|
33
|
+
}
|
|
34
|
+
export interface PromptAuthProvider {
|
|
35
|
+
name: string;
|
|
36
|
+
configAuthProviderClass?: string;
|
|
37
|
+
configImports?: ImportStatement[];
|
|
38
|
+
extraTinaCollections?: string[];
|
|
39
|
+
backendAuthProvider?: string;
|
|
40
|
+
backendAuthProviderImports?: ImportStatement[];
|
|
41
|
+
peerDependencies?: string[];
|
|
42
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Config } from '../prompts';
|
|
2
|
+
export declare type ConfigTemplateArgs = {
|
|
3
|
+
extraText?: string;
|
|
4
|
+
publicFolder: string;
|
|
5
|
+
collections?: string;
|
|
6
|
+
isLocalEnvVarName?: string;
|
|
7
|
+
config: Config;
|
|
8
|
+
isForestryMigration?: boolean;
|
|
9
|
+
selfHosted?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const generateConfig: (args: ConfigTemplateArgs) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const helloWorldPost = "---\ntitle: Hello, World!\n---\n\n## Hello World!\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Ut non lorem diam. Quisque vulputate nibh sodales eros pretium tincidunt. Aenean porttitor efficitur convallis. Nulla sagittis finibus convallis. Phasellus in fermentum quam, eu egestas tortor. Maecenas ac mollis leo. Integer maximus eu nisl vel sagittis.\n\nSuspendisse facilisis, mi ac scelerisque interdum, ligula ex imperdiet felis, a posuere eros justo nec sem. Nullam laoreet accumsan metus, sit amet tincidunt orci egestas nec. Pellentesque ut aliquet ante, at tristique nunc. Donec non massa nibh. Ut posuere lacus non aliquam laoreet. Fusce pharetra ligula a felis porttitor, at mollis ipsum maximus. Donec quam tortor, vehicula a magna sit amet, tincidunt dictum enim. In hac habitasse platea dictumst. Mauris sit amet ornare ligula, blandit consequat risus. Duis malesuada pellentesque lectus, non feugiat turpis eleifend a. Nullam tempus ante et diam pretium, ac faucibus ligula interdum.\n";
|