@tinacms/cli 0.61.9 → 0.61.10
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/buildTina/attachPath.d.ts +1 -0
- package/dist/buildTina/index.d.ts +37 -19
- package/dist/cmds/compile/defaultSchema.d.ts +1 -1
- package/dist/cmds/compile/index.d.ts +5 -3
- package/dist/cmds/query-gen/index.d.ts +0 -1
- package/dist/cmds/start-server/index.d.ts +9 -3
- package/dist/index.js +230 -280
- package/package.json +4 -5
- package/dist/cmds/query-gen/attachSchema.d.ts +0 -13
|
@@ -10,24 +10,17 @@
|
|
|
10
10
|
See the License for the specific language governing permissions and
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
interface
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
store: Store;
|
|
19
|
-
bridge: Bridge;
|
|
20
|
-
/** In some cases (like audit) there's no need to build the SPA */
|
|
21
|
-
buildFrontend?: boolean;
|
|
22
|
-
noWatch?: boolean;
|
|
23
|
-
isomorphicGitBridge?: boolean;
|
|
13
|
+
import { Database } from '@tinacms/graphql';
|
|
14
|
+
import { DocumentNode } from 'graphql';
|
|
15
|
+
interface ClientGenOptions {
|
|
16
|
+
noSDK?: boolean;
|
|
17
|
+
local?: boolean;
|
|
24
18
|
verbose?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface BuildOptions {
|
|
25
21
|
dev?: boolean;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
beforeBuild?: () => Promise<any>;
|
|
29
|
-
afterBuild?: () => Promise<any>;
|
|
30
|
-
skipIndex?: boolean;
|
|
22
|
+
verbose?: boolean;
|
|
23
|
+
rootPath?: string;
|
|
31
24
|
}
|
|
32
25
|
interface BuildSetupOptions {
|
|
33
26
|
isomorphicGitBridge?: boolean;
|
|
@@ -38,7 +31,32 @@ export declare const buildSetupCmdServerStart: (ctx: any, next: () => void, opts
|
|
|
38
31
|
export declare const buildSetupCmdAudit: (ctx: any, next: () => void, options: {
|
|
39
32
|
clean: boolean;
|
|
40
33
|
}) => Promise<void>;
|
|
41
|
-
export declare const buildCmdBuild: (ctx:
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
export declare const buildCmdBuild: (ctx: {
|
|
35
|
+
builder: ConfigBuilder;
|
|
36
|
+
rootPath: string;
|
|
37
|
+
usingTs: boolean;
|
|
38
|
+
}, next: () => void, options: Omit<BuildOptions & BuildSetupOptions & ClientGenOptions, 'bridge' | 'database' | 'store'>) => Promise<void>;
|
|
39
|
+
export declare const auditCmdBuild: (ctx: {
|
|
40
|
+
builder: ConfigBuilder;
|
|
41
|
+
rootPath: string;
|
|
42
|
+
database: Database;
|
|
43
|
+
}, next: () => void, options: Omit<BuildOptions & BuildSetupOptions, 'bridge' | 'database' | 'store'>) => Promise<void>;
|
|
44
|
+
export declare class ConfigBuilder {
|
|
45
|
+
private database;
|
|
46
|
+
constructor(database: Database);
|
|
47
|
+
build({ dev, verbose, rootPath }: BuildOptions): Promise<{
|
|
48
|
+
schema: any;
|
|
49
|
+
graphQLSchema: DocumentNode;
|
|
50
|
+
tinaSchema: any;
|
|
51
|
+
}>;
|
|
52
|
+
genTypedClient({ usingTs, compiledSchema, noSDK, verbose, local, }: ClientGenOptions & {
|
|
53
|
+
usingTs: boolean;
|
|
54
|
+
compiledSchema: any;
|
|
55
|
+
}): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export declare const buildAdmin: ({ schema, local, rootPath, }: {
|
|
58
|
+
schema: any;
|
|
59
|
+
local: boolean;
|
|
60
|
+
rootPath: string;
|
|
61
|
+
}) => Promise<void>;
|
|
44
62
|
export {};
|
|
@@ -10,4 +10,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
10
10
|
See the License for the specific language governing permissions and
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
|
-
export declare const defaultSchema = "\nimport { defineSchema, defineConfig } from 'tinacms'\nimport { client } from './__generated__/client'\n\n\nconst branch =\n process.env.NEXT_PUBLIC_TINA_BRANCH ||\n process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF ||\n process.env.HEAD ||\n 'main'\nconst schema = defineSchema({\n // See https://tina.io/docs/tina-cloud/connecting-site/ for more information about this config\n config: {\n token: '<Your Read Only Token>', // generated on app.tina.io,\n clientId: '<Your Client ID>', // generated on app.tina.io\n branch,\n },\n collections: [\n {\n label: 'Blog Posts',\n name: 'post',\n path: 'content/posts',\n format: 'mdx',\n fields: [\n {\n type: 'string',\n label: 'Title',\n name: 'title',\n },\n {\n type: 'rich-text',\n label: 'Blog Post Body',\n name: 'body',\n isBody: true,\n templates: [\n {\n name: 'PageSection',\n label: 'Page Section',\n fields: [\n {\n type: 'string',\n name: 'heading',\n label: 'Heading',\n },\n {\n type: 'string',\n name: 'content',\n label: 'Content',\n ui: {\n component: 'textarea',\n },\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n})\n\nexport default schema\n\n// Your tina config\n\nexport const tinaConfig = defineConfig({\n client,\n schema,\n
|
|
13
|
+
export declare const defaultSchema = "\nimport { defineSchema, defineConfig } from 'tinacms'\nimport { client } from './__generated__/client'\n\n\nconst branch =\n process.env.NEXT_PUBLIC_TINA_BRANCH ||\n process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF ||\n process.env.HEAD ||\n 'main'\nconst schema = defineSchema({\n // See https://tina.io/docs/tina-cloud/connecting-site/ for more information about this config\n config: {\n token: '<Your Read Only Token>', // generated on app.tina.io,\n clientId: '<Your Client ID>', // generated on app.tina.io\n branch,\n },\n collections: [\n {\n label: 'Blog Posts',\n name: 'post',\n path: 'content/posts',\n format: 'mdx',\n ui: {\n router: ({ document }) => {\n // This can be used to add contextual editing to your site. See https://tina.io/docs/tinacms-context/#accessing-contextual-editing-from-the-cms for more information.\n return `/demo/blog/${document._sys.filename}`\n },\n },\n fields: [\n {\n type: 'string',\n label: 'Title',\n name: 'title',\n },\n {\n type: 'rich-text',\n label: 'Blog Post Body',\n name: 'body',\n isBody: true,\n templates: [\n {\n name: 'PageSection',\n label: 'Page Section',\n fields: [\n {\n type: 'string',\n name: 'heading',\n label: 'Heading',\n },\n {\n type: 'string',\n name: 'content',\n label: 'Content',\n ui: {\n component: 'textarea',\n },\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n})\n\nexport default schema\n\n// Your tina config\n\nexport const tinaConfig = defineConfig({\n client,\n schema,\n})\n\n";
|
|
@@ -20,14 +20,16 @@ export declare const compileClient: (ctx: any, next: any, options: {
|
|
|
20
20
|
verbose?: boolean;
|
|
21
21
|
dev?: boolean;
|
|
22
22
|
}) => Promise<any>;
|
|
23
|
-
export declare const compileFile: (
|
|
23
|
+
export declare const compileFile: (options: {
|
|
24
24
|
schemaFileType?: string;
|
|
25
25
|
verbose?: boolean;
|
|
26
26
|
dev?: boolean;
|
|
27
|
+
rootPath: string;
|
|
27
28
|
}, fileName: string) => Promise<{}>;
|
|
28
|
-
export declare const compileSchema: (
|
|
29
|
+
export declare const compileSchema: (options: {
|
|
29
30
|
schemaFileType?: string;
|
|
30
31
|
verbose?: boolean;
|
|
31
32
|
dev?: boolean;
|
|
32
|
-
|
|
33
|
+
rootPath;
|
|
34
|
+
}) => Promise<any>;
|
|
33
35
|
export declare const defineSchema: (config: TinaCloudSchema) => TinaCloudSchema;
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
See the License for the specific language governing permissions and
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
|
+
import type { Bridge, Database } from '@tinacms/graphql';
|
|
14
|
+
import { ConfigBuilder } from '../../buildTina';
|
|
13
15
|
interface Options {
|
|
14
16
|
port?: number;
|
|
15
17
|
command?: string;
|
|
16
18
|
watchFolders?: string[];
|
|
17
|
-
experimentalData?: boolean;
|
|
18
|
-
isomorphicGitBridge?: boolean;
|
|
19
19
|
noWatch?: boolean;
|
|
20
20
|
noSDK: boolean;
|
|
21
21
|
noTelemetry: boolean;
|
|
@@ -23,5 +23,11 @@ interface Options {
|
|
|
23
23
|
dev?: boolean;
|
|
24
24
|
local: boolean;
|
|
25
25
|
}
|
|
26
|
-
export declare function startServer(ctx:
|
|
26
|
+
export declare function startServer(ctx: {
|
|
27
|
+
builder: ConfigBuilder;
|
|
28
|
+
rootPath: string;
|
|
29
|
+
database: Database;
|
|
30
|
+
bridge: Bridge;
|
|
31
|
+
usingTs: boolean;
|
|
32
|
+
}, next: any, { port, noWatch, noSDK, noTelemetry, watchFolders, verbose, dev, }: Options): Promise<void>;
|
|
27
33
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -70,11 +70,11 @@ var init_utils = __esm({
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
// src/server/models/media.ts
|
|
73
|
-
var
|
|
73
|
+
var import_fs_extra8, import_path10, MediaModel;
|
|
74
74
|
var init_media = __esm({
|
|
75
75
|
"src/server/models/media.ts"() {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
import_fs_extra8 = __toModule(require("fs-extra"));
|
|
77
|
+
import_path10 = __toModule(require("path"));
|
|
78
78
|
init_utils();
|
|
79
79
|
MediaModel = class {
|
|
80
80
|
constructor({ publicFolder, mediaRoot }) {
|
|
@@ -83,12 +83,12 @@ var init_media = __esm({
|
|
|
83
83
|
}
|
|
84
84
|
async listMedia(args) {
|
|
85
85
|
try {
|
|
86
|
-
const folderPath = (0,
|
|
86
|
+
const folderPath = (0, import_path10.join)(this.publicFolder, this.mediaRoot, args.searchPath);
|
|
87
87
|
const searchPath = parseMediaFolder(args.searchPath);
|
|
88
|
-
const filesStr = await
|
|
88
|
+
const filesStr = await import_fs_extra8.default.readdir(folderPath);
|
|
89
89
|
const filesProm = filesStr.map(async (file) => {
|
|
90
|
-
const filePath = (0,
|
|
91
|
-
const stat = await
|
|
90
|
+
const filePath = (0, import_path10.join)(folderPath, file);
|
|
91
|
+
const stat = await import_fs_extra8.default.stat(filePath);
|
|
92
92
|
let src = `/${file}`;
|
|
93
93
|
const isFile = stat.isFile();
|
|
94
94
|
if (!isFile) {
|
|
@@ -144,9 +144,9 @@ var init_media = __esm({
|
|
|
144
144
|
}
|
|
145
145
|
async deleteMedia(args) {
|
|
146
146
|
try {
|
|
147
|
-
const file = (0,
|
|
148
|
-
await
|
|
149
|
-
await
|
|
147
|
+
const file = (0, import_path10.join)(this.publicFolder, this.mediaRoot, args.searchPath);
|
|
148
|
+
await import_fs_extra8.default.stat(file);
|
|
149
|
+
await import_fs_extra8.default.remove(file);
|
|
150
150
|
return { ok: true };
|
|
151
151
|
} catch (error) {
|
|
152
152
|
console.error(error);
|
|
@@ -158,15 +158,15 @@ var init_media = __esm({
|
|
|
158
158
|
});
|
|
159
159
|
|
|
160
160
|
// src/server/routes/index.ts
|
|
161
|
-
var import_express,
|
|
161
|
+
var import_express, import_path11, import_multer, createMediaRouter;
|
|
162
162
|
var init_routes = __esm({
|
|
163
163
|
"src/server/routes/index.ts"() {
|
|
164
164
|
import_express = __toModule(require("express"));
|
|
165
|
-
|
|
165
|
+
import_path11 = __toModule(require("path"));
|
|
166
166
|
import_multer = __toModule(require("multer"));
|
|
167
167
|
init_media();
|
|
168
168
|
createMediaRouter = (config) => {
|
|
169
|
-
const mediaFolder = (0,
|
|
169
|
+
const mediaFolder = (0, import_path11.join)(process.cwd(), config.publicFolder, config.mediaRoot);
|
|
170
170
|
const storage = import_multer.default.diskStorage({
|
|
171
171
|
destination: function(req, file, cb) {
|
|
172
172
|
cb(null, mediaFolder);
|
|
@@ -293,7 +293,7 @@ var commander = __toModule(require("commander"));
|
|
|
293
293
|
|
|
294
294
|
// package.json
|
|
295
295
|
var name = "@tinacms/cli";
|
|
296
|
-
var version = "0.61.
|
|
296
|
+
var version = "0.61.10";
|
|
297
297
|
|
|
298
298
|
// src/cmds/audit/audit.ts
|
|
299
299
|
var import_graphql = __toModule(require("@tinacms/graphql"));
|
|
@@ -992,7 +992,7 @@ async function tinaSetup(_ctx, next, _options) {
|
|
|
992
992
|
}
|
|
993
993
|
if (!import_fs_extra.default.existsSync(TinaProviderPath) && !import_fs_extra.default.existsSync(TinaDynamicProvider)) {
|
|
994
994
|
import_fs_extra.default.mkdirpSync(componentFolder);
|
|
995
|
-
import_fs_extra.default.writeFileSync(TinaProviderPath, TinaProvider.replace(/'\.\.\/schema\.ts'/, `'../schema.${_ctx.
|
|
995
|
+
import_fs_extra.default.writeFileSync(TinaProviderPath, TinaProvider.replace(/'\.\.\/schema\.ts'/, `'../schema.${_ctx.usingTs ? "ts" : "js"}'`));
|
|
996
996
|
import_fs_extra.default.writeFileSync(TinaDynamicProvider, TinaProviderDynamic);
|
|
997
997
|
}
|
|
998
998
|
logger.level = "info";
|
|
@@ -1085,6 +1085,9 @@ var chain = async (cmds, options) => {
|
|
|
1085
1085
|
await cmds[middlewareIndex](ctx, () => next(middlewareIndex + 1), options || {});
|
|
1086
1086
|
} catch (err) {
|
|
1087
1087
|
console.error(` ${dangerText(err)}`);
|
|
1088
|
+
if (err.stack) {
|
|
1089
|
+
console.log(err.stack);
|
|
1090
|
+
}
|
|
1088
1091
|
process.exit(1);
|
|
1089
1092
|
}
|
|
1090
1093
|
};
|
|
@@ -1163,6 +1166,12 @@ const schema = defineSchema({
|
|
|
1163
1166
|
name: 'post',
|
|
1164
1167
|
path: 'content/posts',
|
|
1165
1168
|
format: 'mdx',
|
|
1169
|
+
ui: {
|
|
1170
|
+
router: ({ document }) => {
|
|
1171
|
+
// This can be used to add contextual editing to your site. See https://tina.io/docs/tinacms-context/#accessing-contextual-editing-from-the-cms for more information.
|
|
1172
|
+
return \`/demo/blog/\${document._sys.filename}\`
|
|
1173
|
+
},
|
|
1174
|
+
},
|
|
1166
1175
|
fields: [
|
|
1167
1176
|
{
|
|
1168
1177
|
type: 'string',
|
|
@@ -1208,28 +1217,6 @@ export default schema
|
|
|
1208
1217
|
export const tinaConfig = defineConfig({
|
|
1209
1218
|
client,
|
|
1210
1219
|
schema,
|
|
1211
|
-
cmsCallback: (cms) => {
|
|
1212
|
-
// add your CMS callback code here (if you want)
|
|
1213
|
-
|
|
1214
|
-
// The Route Mapper
|
|
1215
|
-
/**
|
|
1216
|
-
* 1. Import \`tinacms\` and \`RouteMappingPlugin\`
|
|
1217
|
-
**/
|
|
1218
|
-
import('tinacms').then(({ RouteMappingPlugin }) => {
|
|
1219
|
-
/**
|
|
1220
|
-
* 2. Define the \`RouteMappingPlugin\` see https://tina.io/docs/tinacms-context/#the-routemappingplugin for more details
|
|
1221
|
-
**/
|
|
1222
|
-
const RouteMapping = new RouteMappingPlugin((collection, document) => {
|
|
1223
|
-
return undefined
|
|
1224
|
-
})
|
|
1225
|
-
/**
|
|
1226
|
-
* 3. Add the \`RouteMappingPlugin\` to the \`cms\`.
|
|
1227
|
-
**/
|
|
1228
|
-
cms.plugins.add(RouteMapping)
|
|
1229
|
-
})
|
|
1230
|
-
|
|
1231
|
-
return cms
|
|
1232
|
-
},
|
|
1233
1220
|
})
|
|
1234
1221
|
|
|
1235
1222
|
`;
|
|
@@ -1369,8 +1356,8 @@ var compileClient = async (ctx, next, options) => {
|
|
|
1369
1356
|
}
|
|
1370
1357
|
return next();
|
|
1371
1358
|
};
|
|
1372
|
-
var compileFile = async (
|
|
1373
|
-
const root2 =
|
|
1359
|
+
var compileFile = async (options, fileName) => {
|
|
1360
|
+
const root2 = options.rootPath;
|
|
1374
1361
|
if (!root2) {
|
|
1375
1362
|
throw new Error("ctx.rootPath has not been attached");
|
|
1376
1363
|
}
|
|
@@ -1391,9 +1378,6 @@ var compileFile = async (ctx, _next, options, fileName) => {
|
|
|
1391
1378
|
if (!schemaFileType2) {
|
|
1392
1379
|
throw new Error(`Requested schema file type '${requestedSchemaFileType}' is not valid. Supported schema file types: 'ts, js, tsx, jsx'`);
|
|
1393
1380
|
}
|
|
1394
|
-
if (ctx) {
|
|
1395
|
-
ctx.schemaFileType = schemaFileType2;
|
|
1396
|
-
}
|
|
1397
1381
|
let schemaExists = true;
|
|
1398
1382
|
try {
|
|
1399
1383
|
getPath({
|
|
@@ -1451,14 +1435,14 @@ var compileFile = async (ctx, _next, options, fileName) => {
|
|
|
1451
1435
|
}
|
|
1452
1436
|
return returnObject;
|
|
1453
1437
|
};
|
|
1454
|
-
var compileSchema = async (
|
|
1455
|
-
const root2 =
|
|
1438
|
+
var compileSchema = async (options) => {
|
|
1439
|
+
const root2 = options.rootPath;
|
|
1456
1440
|
const tinaPath = import_path4.default.join(root2, ".tina");
|
|
1457
1441
|
const tinaGeneratedPath = import_path4.default.join(tinaPath, "__generated__");
|
|
1458
1442
|
const tinaConfigPath = import_path4.default.join(tinaGeneratedPath, "config");
|
|
1459
|
-
let schema = await compileFile(
|
|
1443
|
+
let schema = await compileFile(options, "schema");
|
|
1460
1444
|
try {
|
|
1461
|
-
const config = await compileFile(
|
|
1445
|
+
const config = await compileFile(options, "config");
|
|
1462
1446
|
const configCopy = _.cloneDeep(config);
|
|
1463
1447
|
delete configCopy.schema;
|
|
1464
1448
|
if (config == null ? void 0 : config.schema) {
|
|
@@ -1466,8 +1450,8 @@ var compileSchema = async (ctx, _next, options) => {
|
|
|
1466
1450
|
}
|
|
1467
1451
|
} catch (e) {
|
|
1468
1452
|
}
|
|
1469
|
-
ctx.schema = schema;
|
|
1470
1453
|
await import_fs_extra3.default.outputFile(import_path4.default.join(tinaConfigPath, `schema.json`), JSON.stringify(schema, null, 2));
|
|
1454
|
+
return schema;
|
|
1471
1455
|
};
|
|
1472
1456
|
var transpile = async (inputFile, outputFile, tempDir, verbose, define, packageJSONFilePath) => {
|
|
1473
1457
|
if (verbose)
|
|
@@ -1537,29 +1521,36 @@ var loaders = {
|
|
|
1537
1521
|
};
|
|
1538
1522
|
|
|
1539
1523
|
// src/cmds/start-server/index.ts
|
|
1540
|
-
var
|
|
1524
|
+
var import_path12 = __toModule(require("path"));
|
|
1541
1525
|
var import_chalk6 = __toModule(require("chalk"));
|
|
1542
1526
|
var import_chokidar = __toModule(require("chokidar"));
|
|
1543
1527
|
var import_metrics3 = __toModule(require("@tinacms/metrics"));
|
|
1544
1528
|
|
|
1545
|
-
// src/
|
|
1546
|
-
var
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1529
|
+
// src/cmds/start-server/lock.ts
|
|
1530
|
+
var AsyncLock = class {
|
|
1531
|
+
constructor() {
|
|
1532
|
+
this.disable = () => {
|
|
1533
|
+
};
|
|
1534
|
+
this.promise = Promise.resolve();
|
|
1535
|
+
}
|
|
1536
|
+
enable() {
|
|
1537
|
+
this.promise = new Promise((resolve2) => this.disable = resolve2);
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1551
1540
|
|
|
1552
|
-
// src/
|
|
1553
|
-
var
|
|
1541
|
+
// src/buildTina/index.ts
|
|
1542
|
+
var import_fs_extra7 = __toModule(require("fs-extra"));
|
|
1543
|
+
var import_graphql9 = __toModule(require("@tinacms/graphql"));
|
|
1554
1544
|
var import_datalayer = __toModule(require("@tinacms/datalayer"));
|
|
1545
|
+
var import_path9 = __toModule(require("path"));
|
|
1555
1546
|
|
|
1556
1547
|
// src/cmds/query-gen/genTypes.ts
|
|
1557
|
-
var
|
|
1548
|
+
var import_graphql8 = __toModule(require("graphql"));
|
|
1558
1549
|
var import_fs_extra4 = __toModule(require("fs-extra"));
|
|
1559
1550
|
var import_path6 = __toModule(require("path"));
|
|
1560
1551
|
|
|
1561
1552
|
// src/codegen/index.ts
|
|
1562
|
-
var
|
|
1553
|
+
var import_graphql7 = __toModule(require("graphql"));
|
|
1563
1554
|
|
|
1564
1555
|
// src/codegen/plugin.ts
|
|
1565
1556
|
var AddGeneratedClientFunc = (_schema, _documents, _config, _info) => {
|
|
@@ -1611,14 +1602,14 @@ var import_typescript_operations = __toModule(require("@graphql-codegen/typescri
|
|
|
1611
1602
|
var import_typescript = __toModule(require("@graphql-codegen/typescript"));
|
|
1612
1603
|
|
|
1613
1604
|
// src/codegen/sdkPlugin/index.ts
|
|
1605
|
+
var import_graphql5 = __toModule(require("graphql"));
|
|
1614
1606
|
var import_graphql6 = __toModule(require("graphql"));
|
|
1615
|
-
var import_graphql7 = __toModule(require("graphql"));
|
|
1616
1607
|
var import_path5 = __toModule(require("path"));
|
|
1617
1608
|
|
|
1618
1609
|
// src/codegen/sdkPlugin/visitor.ts
|
|
1619
1610
|
var import_visitor_plugin_common = __toModule(require("@graphql-codegen/visitor-plugin-common"));
|
|
1620
1611
|
var import_auto_bind = __toModule(require("auto-bind"));
|
|
1621
|
-
var
|
|
1612
|
+
var import_graphql4 = __toModule(require("graphql"));
|
|
1622
1613
|
var GenericSdkVisitor = class extends import_visitor_plugin_common.ClientSideBaseVisitor {
|
|
1623
1614
|
constructor(schema, fragments, rawConfig) {
|
|
1624
1615
|
super(schema, fragments, rawConfig, {
|
|
@@ -1634,7 +1625,7 @@ var GenericSdkVisitor = class extends import_visitor_plugin_common.ClientSideBas
|
|
|
1634
1625
|
}
|
|
1635
1626
|
buildOperation(node, documentVariableName, operationType, operationResultType, operationVariablesTypes) {
|
|
1636
1627
|
if (node.name == null) {
|
|
1637
|
-
throw new Error("Plugin 'generic-sdk' cannot generate SDK for unnamed operation.\n\n" + (0,
|
|
1628
|
+
throw new Error("Plugin 'generic-sdk' cannot generate SDK for unnamed operation.\n\n" + (0, import_graphql4.print)(node));
|
|
1638
1629
|
} else {
|
|
1639
1630
|
this._operationsToInclude.push({
|
|
1640
1631
|
node,
|
|
@@ -1649,7 +1640,7 @@ var GenericSdkVisitor = class extends import_visitor_plugin_common.ClientSideBas
|
|
|
1649
1640
|
get sdkContent() {
|
|
1650
1641
|
const usingObservable = !!this.config.usingObservableFrom;
|
|
1651
1642
|
const allPossibleActions = this._operationsToInclude.map((o) => {
|
|
1652
|
-
const optionalVariables = !o.node.variableDefinitions || o.node.variableDefinitions.length === 0 || o.node.variableDefinitions.every((v) => v.type.kind !==
|
|
1643
|
+
const optionalVariables = !o.node.variableDefinitions || o.node.variableDefinitions.length === 0 || o.node.variableDefinitions.every((v) => v.type.kind !== import_graphql4.Kind.NON_NULL_TYPE || v.defaultValue);
|
|
1653
1644
|
const returnType = usingObservable && o.operationType === "Subscription" ? "Observable" : "Promise";
|
|
1654
1645
|
return `${o.node.name.value}(variables${optionalVariables ? "?" : ""}: ${o.operationVariablesTypes}, options?: C): ${returnType}<${o.operationResultType}> {
|
|
1655
1646
|
return requester<${o.operationResultType}, ${o.operationVariablesTypes}>(${o.documentVariableName}, variables, options);
|
|
@@ -1667,11 +1658,11 @@ var GenericSdkVisitor = class extends import_visitor_plugin_common.ClientSideBas
|
|
|
1667
1658
|
|
|
1668
1659
|
// src/codegen/sdkPlugin/index.ts
|
|
1669
1660
|
var plugin = (schema, documents, config) => {
|
|
1670
|
-
const allAst = (0,
|
|
1661
|
+
const allAst = (0, import_graphql6.concatAST)(documents.reduce((prev, v) => {
|
|
1671
1662
|
return [...prev, v.document];
|
|
1672
1663
|
}, []));
|
|
1673
1664
|
const allFragments = [
|
|
1674
|
-
...allAst.definitions.filter((d) => d.kind ===
|
|
1665
|
+
...allAst.definitions.filter((d) => d.kind === import_graphql6.Kind.FRAGMENT_DEFINITION).map((fragmentDef) => ({
|
|
1675
1666
|
node: fragmentDef,
|
|
1676
1667
|
name: fragmentDef.name.value,
|
|
1677
1668
|
onType: fragmentDef.typeCondition.name.value,
|
|
@@ -1680,7 +1671,7 @@ var plugin = (schema, documents, config) => {
|
|
|
1680
1671
|
...config.externalFragments || []
|
|
1681
1672
|
];
|
|
1682
1673
|
const visitor = new GenericSdkVisitor(schema, allFragments, config);
|
|
1683
|
-
const visitorResult = (0,
|
|
1674
|
+
const visitorResult = (0, import_graphql5.visit)(allAst, { leave: visitor });
|
|
1684
1675
|
return {
|
|
1685
1676
|
content: [
|
|
1686
1677
|
visitor.fragments,
|
|
@@ -1697,64 +1688,53 @@ var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath =
|
|
|
1697
1688
|
}) => {
|
|
1698
1689
|
if (options.verbose)
|
|
1699
1690
|
logger.info("Generating types...");
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1691
|
+
let docs = [];
|
|
1692
|
+
let fragDocs = [];
|
|
1693
|
+
if (!options.noSDK) {
|
|
1694
|
+
docs = await loadGraphQLDocuments(queryPathGlob);
|
|
1695
|
+
fragDocs = await loadGraphQLDocuments(fragDocPath);
|
|
1696
|
+
}
|
|
1697
|
+
const res = await (0, import_core.codegen)({
|
|
1698
|
+
filename: process.cwd(),
|
|
1699
|
+
schema: (0, import_graphql7.parse)((0, import_graphql7.printSchema)(schema)),
|
|
1700
|
+
documents: [...docs, ...fragDocs],
|
|
1701
|
+
config: {},
|
|
1702
|
+
plugins: [
|
|
1703
|
+
{ typescript: {} },
|
|
1704
|
+
{ typescriptOperations: {} },
|
|
1705
|
+
{
|
|
1706
|
+
typescriptSdk: {}
|
|
1707
|
+
},
|
|
1708
|
+
{ AddGeneratedClient: {} }
|
|
1709
|
+
],
|
|
1710
|
+
pluginMap: {
|
|
1711
|
+
typescript: {
|
|
1712
|
+
plugin: import_typescript.plugin
|
|
1713
|
+
},
|
|
1714
|
+
typescriptOperations: {
|
|
1715
|
+
plugin: import_typescript_operations.plugin
|
|
1716
|
+
},
|
|
1717
|
+
typescriptSdk: {
|
|
1718
|
+
plugin
|
|
1719
|
+
},
|
|
1720
|
+
AddGeneratedClient
|
|
1727
1721
|
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
{
|
|
1737
|
-
typescriptSdk: {}
|
|
1738
|
-
},
|
|
1739
|
-
{ AddGeneratedClient: {} }
|
|
1740
|
-
],
|
|
1741
|
-
pluginMap: {
|
|
1742
|
-
typescript: {
|
|
1743
|
-
plugin: import_typescript.plugin
|
|
1744
|
-
},
|
|
1745
|
-
typescriptOperations: {
|
|
1746
|
-
plugin: import_typescript_operations.plugin
|
|
1747
|
-
},
|
|
1748
|
-
typescriptSdk: {
|
|
1749
|
-
plugin
|
|
1750
|
-
},
|
|
1751
|
-
AddGeneratedClient
|
|
1752
|
-
}
|
|
1722
|
+
});
|
|
1723
|
+
return res;
|
|
1724
|
+
};
|
|
1725
|
+
var loadGraphQLDocuments = async (globPath) => {
|
|
1726
|
+
let result = [];
|
|
1727
|
+
try {
|
|
1728
|
+
result = await (0, import_load.loadDocuments)(globPath, {
|
|
1729
|
+
loaders: [new import_graphql_file_loader.GraphQLFileLoader()]
|
|
1753
1730
|
});
|
|
1754
|
-
return res;
|
|
1755
1731
|
} catch (e) {
|
|
1756
|
-
|
|
1732
|
+
if ((e.message || "").includes("Unable to find any GraphQL type definitions for the following pointers:")) {
|
|
1733
|
+
} else {
|
|
1734
|
+
throw e;
|
|
1735
|
+
}
|
|
1757
1736
|
}
|
|
1737
|
+
return result;
|
|
1758
1738
|
};
|
|
1759
1739
|
|
|
1760
1740
|
// src/cmds/query-gen/genTypes.ts
|
|
@@ -1815,7 +1795,7 @@ async function genTypes({ schema, usingTs }, next, options) {
|
|
|
1815
1795
|
const jsCode = await (0, import_esbuild2.transform)(code, { loader: "ts" });
|
|
1816
1796
|
await import_fs_extra4.default.outputFile(typesJSPath, jsCode.code);
|
|
1817
1797
|
}
|
|
1818
|
-
const schemaString = await (0,
|
|
1798
|
+
const schemaString = await (0, import_graphql8.printSchema)(schema);
|
|
1819
1799
|
const schemaPath = process.cwd() + "/.tina/__generated__/schema.gql";
|
|
1820
1800
|
await import_fs_extra4.default.outputFile(schemaPath, `# DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
|
|
1821
1801
|
${schemaString}
|
|
@@ -1919,161 +1899,156 @@ async function spin({
|
|
|
1919
1899
|
return res;
|
|
1920
1900
|
}
|
|
1921
1901
|
|
|
1902
|
+
// src/buildTina/attachPath.ts
|
|
1903
|
+
var import_fs_extra6 = __toModule(require("fs-extra"));
|
|
1904
|
+
var import_path8 = __toModule(require("path"));
|
|
1905
|
+
var attachPath = async (ctx, next, _options) => {
|
|
1906
|
+
ctx.rootPath = process.cwd();
|
|
1907
|
+
ctx.usingTs = await isProjectTs(ctx.rootPath);
|
|
1908
|
+
next();
|
|
1909
|
+
};
|
|
1910
|
+
var isProjectTs = async (rootPath2) => {
|
|
1911
|
+
const tinaPath = import_path8.default.join(rootPath2, ".tina");
|
|
1912
|
+
return await (0, import_fs_extra6.pathExists)(import_path8.default.join(tinaPath, "schema.ts")) || await (0, import_fs_extra6.pathExists)(import_path8.default.join(tinaPath, "schema.tsx"));
|
|
1913
|
+
};
|
|
1914
|
+
|
|
1922
1915
|
// src/buildTina/index.ts
|
|
1923
1916
|
var buildSetupCmdBuild = async (ctx, next, opts) => {
|
|
1924
1917
|
const rootPath2 = ctx.rootPath;
|
|
1925
|
-
const { bridge, database
|
|
1918
|
+
const { bridge, database } = await buildSetup(__spreadProps(__spreadValues({}, opts), {
|
|
1926
1919
|
rootPath: rootPath2,
|
|
1927
1920
|
useMemoryStore: true
|
|
1928
1921
|
}));
|
|
1929
1922
|
ctx.bridge = bridge;
|
|
1930
1923
|
ctx.database = database;
|
|
1931
|
-
ctx.
|
|
1924
|
+
ctx.builder = new ConfigBuilder(database);
|
|
1932
1925
|
next();
|
|
1933
1926
|
};
|
|
1934
1927
|
var buildSetupCmdServerStart = async (ctx, next, opts) => {
|
|
1935
1928
|
const rootPath2 = ctx.rootPath;
|
|
1936
|
-
const { bridge, database
|
|
1929
|
+
const { bridge, database } = await buildSetup(__spreadProps(__spreadValues({}, opts), {
|
|
1937
1930
|
rootPath: rootPath2,
|
|
1938
1931
|
useMemoryStore: false
|
|
1939
1932
|
}));
|
|
1940
1933
|
ctx.bridge = bridge;
|
|
1941
1934
|
ctx.database = database;
|
|
1942
|
-
ctx.
|
|
1935
|
+
ctx.builder = new ConfigBuilder(database);
|
|
1943
1936
|
next();
|
|
1944
1937
|
};
|
|
1945
1938
|
var buildSetupCmdAudit = async (ctx, next, options) => {
|
|
1946
1939
|
const rootPath2 = ctx.rootPath;
|
|
1947
|
-
const bridge = options.clean ? new
|
|
1948
|
-
const store = new
|
|
1949
|
-
const database = await (0,
|
|
1940
|
+
const bridge = options.clean ? new import_datalayer.FilesystemBridge(rootPath2) : new import_datalayer.AuditFileSystemBridge(rootPath2);
|
|
1941
|
+
const store = new import_datalayer.LevelStore(rootPath2, false);
|
|
1942
|
+
const database = await (0, import_graphql9.createDatabase)({ store, bridge });
|
|
1950
1943
|
ctx.bridge = bridge;
|
|
1951
1944
|
ctx.database = database;
|
|
1952
|
-
ctx.
|
|
1945
|
+
ctx.builder = new ConfigBuilder(database);
|
|
1953
1946
|
next();
|
|
1954
1947
|
};
|
|
1955
1948
|
var buildSetup = async ({
|
|
1956
1949
|
isomorphicGitBridge: isomorphicGitBridge2,
|
|
1957
|
-
experimentalData,
|
|
1958
1950
|
rootPath: rootPath2,
|
|
1959
1951
|
useMemoryStore
|
|
1960
1952
|
}) => {
|
|
1961
|
-
const fsBridge = new
|
|
1953
|
+
const fsBridge = new import_datalayer.FilesystemBridge(rootPath2);
|
|
1962
1954
|
const isomorphicOptions = isomorphicGitBridge2 && await makeIsomorphicOptions(fsBridge);
|
|
1963
|
-
const bridge = isomorphicGitBridge2 ? new
|
|
1964
|
-
const store = new
|
|
1965
|
-
const database = await (0,
|
|
1955
|
+
const bridge = isomorphicGitBridge2 ? new import_datalayer.IsomorphicBridge(rootPath2, isomorphicOptions) : fsBridge;
|
|
1956
|
+
const store = new import_datalayer.LevelStore(rootPath2, useMemoryStore);
|
|
1957
|
+
const database = await (0, import_graphql9.createDatabase)({ store, bridge });
|
|
1966
1958
|
return { database, bridge, store };
|
|
1967
1959
|
};
|
|
1968
1960
|
var buildCmdBuild = async (ctx, next, options) => {
|
|
1969
|
-
const
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
await
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
})
|
|
1961
|
+
const { schema } = await ctx.builder.build(__spreadValues({
|
|
1962
|
+
rootPath: ctx.rootPath
|
|
1963
|
+
}, options));
|
|
1964
|
+
await ctx.builder.genTypedClient({
|
|
1965
|
+
compiledSchema: schema,
|
|
1966
|
+
local: options.local,
|
|
1967
|
+
noSDK: options.noSDK,
|
|
1968
|
+
verbose: options.verbose,
|
|
1969
|
+
usingTs: ctx.usingTs
|
|
1970
|
+
});
|
|
1971
|
+
await buildAdmin({
|
|
1972
|
+
local: options.local,
|
|
1973
|
+
rootPath: ctx.rootPath,
|
|
1974
|
+
schema
|
|
1975
|
+
});
|
|
1979
1976
|
next();
|
|
1980
1977
|
};
|
|
1981
1978
|
var auditCmdBuild = async (ctx, next, options) => {
|
|
1982
|
-
const
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
local: true,
|
|
1987
|
-
verbose: true,
|
|
1988
|
-
bridge,
|
|
1989
|
-
database,
|
|
1990
|
-
store,
|
|
1991
|
-
buildFrontend: false,
|
|
1992
|
-
ctx
|
|
1979
|
+
const { graphQLSchema, tinaSchema } = await ctx.builder.build(__spreadProps(__spreadValues({
|
|
1980
|
+
rootPath: ctx.rootPath
|
|
1981
|
+
}, options), {
|
|
1982
|
+
verbose: true
|
|
1993
1983
|
}));
|
|
1984
|
+
await ctx.database.indexContent({ graphQLSchema, tinaSchema });
|
|
1994
1985
|
next();
|
|
1995
1986
|
};
|
|
1996
|
-
var
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
bridge,
|
|
2000
|
-
database,
|
|
2001
|
-
store,
|
|
2002
|
-
beforeBuild,
|
|
2003
|
-
afterBuild,
|
|
2004
|
-
dev,
|
|
2005
|
-
local,
|
|
2006
|
-
verbose,
|
|
2007
|
-
buildFrontend = true,
|
|
2008
|
-
noSDK,
|
|
2009
|
-
skipIndex
|
|
2010
|
-
}) => {
|
|
2011
|
-
var _a, _b;
|
|
2012
|
-
const rootPath2 = ctx.rootPath;
|
|
2013
|
-
if (!rootPath2) {
|
|
2014
|
-
throw new Error("Root path has not been attached");
|
|
2015
|
-
}
|
|
2016
|
-
const tinaGeneratedPath = import_path8.default.join(rootPath2, ".tina", "__generated__");
|
|
2017
|
-
database.clearCache();
|
|
2018
|
-
if (beforeBuild) {
|
|
2019
|
-
await beforeBuild();
|
|
1987
|
+
var ConfigBuilder = class {
|
|
1988
|
+
constructor(database) {
|
|
1989
|
+
this.database = database;
|
|
2020
1990
|
}
|
|
2021
|
-
|
|
2022
|
-
await
|
|
2023
|
-
|
|
1991
|
+
async build({ dev, verbose, rootPath: rootPath2 }) {
|
|
1992
|
+
const usingTs = await isProjectTs(rootPath2);
|
|
1993
|
+
if (!rootPath2) {
|
|
1994
|
+
throw new Error("Root path has not been attached");
|
|
1995
|
+
}
|
|
1996
|
+
const tinaGeneratedPath = import_path9.default.join(rootPath2, ".tina", "__generated__");
|
|
1997
|
+
this.database.clearCache();
|
|
1998
|
+
await import_fs_extra7.default.mkdirp(tinaGeneratedPath);
|
|
1999
|
+
await this.database.store.close();
|
|
2024
2000
|
await resetGeneratedFolder({
|
|
2025
2001
|
tinaGeneratedPath,
|
|
2026
|
-
usingTs
|
|
2002
|
+
usingTs
|
|
2027
2003
|
});
|
|
2028
|
-
await store.open();
|
|
2029
|
-
const
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
const
|
|
2035
|
-
|
|
2004
|
+
await this.database.store.open();
|
|
2005
|
+
const compiledSchema = await compileSchema({
|
|
2006
|
+
verbose,
|
|
2007
|
+
dev,
|
|
2008
|
+
rootPath: rootPath2
|
|
2009
|
+
});
|
|
2010
|
+
const { graphQLSchema, tinaSchema } = await (0, import_graphql9.buildSchema)(rootPath2, this.database, ["experimentalData", "isomorphicGitBridge"]);
|
|
2011
|
+
return { schema: compiledSchema, graphQLSchema, tinaSchema };
|
|
2012
|
+
}
|
|
2013
|
+
async genTypedClient({
|
|
2014
|
+
usingTs,
|
|
2015
|
+
compiledSchema,
|
|
2016
|
+
noSDK,
|
|
2017
|
+
verbose,
|
|
2018
|
+
local
|
|
2019
|
+
}) {
|
|
2020
|
+
const astSchema = await (0, import_graphql9.getASTSchema)(this.database);
|
|
2021
|
+
await genTypes({ schema: astSchema, usingTs }, () => {
|
|
2036
2022
|
}, {
|
|
2037
2023
|
noSDK,
|
|
2038
2024
|
verbose
|
|
2039
2025
|
});
|
|
2040
|
-
await genClient({ tinaSchema:
|
|
2026
|
+
await genClient({ tinaSchema: compiledSchema, usingTs }, () => {
|
|
2041
2027
|
}, {
|
|
2042
2028
|
local
|
|
2043
2029
|
});
|
|
2044
|
-
if (buildFrontend && ((_b = (_a = ctx.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.build)) {
|
|
2045
|
-
await spin({
|
|
2046
|
-
text: "Building static site",
|
|
2047
|
-
waitFor: async () => {
|
|
2048
|
-
var _a2, _b2, _c, _d, _e, _f;
|
|
2049
|
-
await (0, import_app.viteBuild)({
|
|
2050
|
-
local,
|
|
2051
|
-
rootPath: rootPath2,
|
|
2052
|
-
outputFolder: (_c = (_b2 = (_a2 = ctx.schema) == null ? void 0 : _a2.config) == null ? void 0 : _b2.build) == null ? void 0 : _c.outputFolder,
|
|
2053
|
-
publicFolder: (_f = (_e = (_d = ctx.schema) == null ? void 0 : _d.config) == null ? void 0 : _e.build) == null ? void 0 : _f.publicFolder
|
|
2054
|
-
});
|
|
2055
|
-
}
|
|
2056
|
-
});
|
|
2057
|
-
console.log("\nDone building static site");
|
|
2058
|
-
}
|
|
2059
|
-
} catch (error) {
|
|
2060
|
-
throw error;
|
|
2061
|
-
} finally {
|
|
2062
|
-
if (afterBuild) {
|
|
2063
|
-
await afterBuild();
|
|
2064
|
-
}
|
|
2065
2030
|
}
|
|
2066
2031
|
};
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2032
|
+
var buildAdmin = async ({
|
|
2033
|
+
schema,
|
|
2034
|
+
local,
|
|
2035
|
+
rootPath: rootPath2
|
|
2036
|
+
}) => {
|
|
2037
|
+
var _a;
|
|
2038
|
+
if ((_a = schema == null ? void 0 : schema.config) == null ? void 0 : _a.build) {
|
|
2039
|
+
await spin({
|
|
2040
|
+
text: "Building static site",
|
|
2041
|
+
waitFor: async () => {
|
|
2042
|
+
var _a2, _b, _c, _d;
|
|
2043
|
+
await (0, import_app.viteBuild)({
|
|
2044
|
+
local,
|
|
2045
|
+
rootPath: rootPath2,
|
|
2046
|
+
outputFolder: (_b = (_a2 = schema == null ? void 0 : schema.config) == null ? void 0 : _a2.build) == null ? void 0 : _b.outputFolder,
|
|
2047
|
+
publicFolder: (_d = (_c = schema == null ? void 0 : schema.config) == null ? void 0 : _c.build) == null ? void 0 : _d.publicFolder
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
});
|
|
2051
|
+
console.log("\nDone building static site");
|
|
2077
2052
|
}
|
|
2078
2053
|
};
|
|
2079
2054
|
|
|
@@ -2084,13 +2059,11 @@ var gqlPackageFile = require.resolve("@tinacms/graphql");
|
|
|
2084
2059
|
async function startServer(ctx, next, {
|
|
2085
2060
|
port = 4001,
|
|
2086
2061
|
noWatch,
|
|
2087
|
-
isomorphicGitBridge: isomorphicGitBridge2,
|
|
2088
2062
|
noSDK,
|
|
2089
2063
|
noTelemetry,
|
|
2090
2064
|
watchFolders,
|
|
2091
2065
|
verbose,
|
|
2092
|
-
dev
|
|
2093
|
-
local
|
|
2066
|
+
dev
|
|
2094
2067
|
}) {
|
|
2095
2068
|
buildLock.disable();
|
|
2096
2069
|
reBuildLock.disable();
|
|
@@ -2103,7 +2076,6 @@ async function startServer(ctx, next, {
|
|
|
2103
2076
|
});
|
|
2104
2077
|
const bridge = ctx.bridge;
|
|
2105
2078
|
const database = ctx.database;
|
|
2106
|
-
const store = ctx.store;
|
|
2107
2079
|
const shouldBuild = bridge.supportsBuilding();
|
|
2108
2080
|
let ready = false;
|
|
2109
2081
|
const state = {
|
|
@@ -2166,7 +2138,34 @@ or`);
|
|
|
2166
2138
|
});
|
|
2167
2139
|
});
|
|
2168
2140
|
};
|
|
2169
|
-
const
|
|
2141
|
+
const build2 = async () => {
|
|
2142
|
+
try {
|
|
2143
|
+
await beforeBuild();
|
|
2144
|
+
const { schema, graphQLSchema, tinaSchema } = await ctx.builder.build({
|
|
2145
|
+
rootPath: ctx.rootPath,
|
|
2146
|
+
dev,
|
|
2147
|
+
verbose
|
|
2148
|
+
});
|
|
2149
|
+
await ctx.builder.genTypedClient({
|
|
2150
|
+
compiledSchema: schema,
|
|
2151
|
+
local: true,
|
|
2152
|
+
noSDK,
|
|
2153
|
+
verbose,
|
|
2154
|
+
usingTs: ctx.usingTs
|
|
2155
|
+
});
|
|
2156
|
+
await ctx.database.indexContent({ graphQLSchema, tinaSchema });
|
|
2157
|
+
await buildAdmin({
|
|
2158
|
+
local: true,
|
|
2159
|
+
rootPath: ctx.rootPath,
|
|
2160
|
+
schema
|
|
2161
|
+
});
|
|
2162
|
+
} catch (error) {
|
|
2163
|
+
throw error;
|
|
2164
|
+
} finally {
|
|
2165
|
+
await afterBuild();
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
const foldersToWatch = (watchFolders || []).map((x) => import_path12.default.join(rootPath2, x));
|
|
2170
2169
|
if (!noWatch && !process.env.CI) {
|
|
2171
2170
|
import_chokidar.default.watch([
|
|
2172
2171
|
...foldersToWatch,
|
|
@@ -2176,27 +2175,14 @@ or`);
|
|
|
2176
2175
|
ignored: [
|
|
2177
2176
|
"**/node_modules/**/*",
|
|
2178
2177
|
"**/.next/**/*",
|
|
2179
|
-
`${
|
|
2178
|
+
`${import_path12.default.resolve(rootPath2)}/.tina/__generated__/**/*`
|
|
2180
2179
|
]
|
|
2181
2180
|
}).on("ready", async () => {
|
|
2182
2181
|
if (verbose)
|
|
2183
2182
|
console.log("Generating Tina config");
|
|
2184
2183
|
try {
|
|
2185
2184
|
if (shouldBuild) {
|
|
2186
|
-
await build2(
|
|
2187
|
-
bridge,
|
|
2188
|
-
ctx,
|
|
2189
|
-
database,
|
|
2190
|
-
store,
|
|
2191
|
-
dev,
|
|
2192
|
-
isomorphicGitBridge: isomorphicGitBridge2,
|
|
2193
|
-
local: true,
|
|
2194
|
-
noSDK,
|
|
2195
|
-
noWatch,
|
|
2196
|
-
verbose,
|
|
2197
|
-
beforeBuild,
|
|
2198
|
-
afterBuild
|
|
2199
|
-
});
|
|
2185
|
+
await build2();
|
|
2200
2186
|
}
|
|
2201
2187
|
ready = true;
|
|
2202
2188
|
isReady = true;
|
|
@@ -2214,20 +2200,7 @@ or`);
|
|
|
2214
2200
|
logger.info("Tina change detected, regenerating config");
|
|
2215
2201
|
try {
|
|
2216
2202
|
if (shouldBuild) {
|
|
2217
|
-
await build2(
|
|
2218
|
-
bridge,
|
|
2219
|
-
ctx,
|
|
2220
|
-
database,
|
|
2221
|
-
store,
|
|
2222
|
-
dev,
|
|
2223
|
-
isomorphicGitBridge: isomorphicGitBridge2,
|
|
2224
|
-
local: true,
|
|
2225
|
-
noSDK,
|
|
2226
|
-
noWatch,
|
|
2227
|
-
verbose,
|
|
2228
|
-
beforeBuild,
|
|
2229
|
-
afterBuild
|
|
2230
|
-
});
|
|
2203
|
+
await build2();
|
|
2231
2204
|
}
|
|
2232
2205
|
if (isReady) {
|
|
2233
2206
|
await restart();
|
|
@@ -2250,20 +2223,7 @@ or`);
|
|
|
2250
2223
|
logger.info("Detected CI environment, omitting watch commands...");
|
|
2251
2224
|
}
|
|
2252
2225
|
if (shouldBuild) {
|
|
2253
|
-
await build2(
|
|
2254
|
-
bridge,
|
|
2255
|
-
ctx,
|
|
2256
|
-
database,
|
|
2257
|
-
store,
|
|
2258
|
-
dev,
|
|
2259
|
-
isomorphicGitBridge: isomorphicGitBridge2,
|
|
2260
|
-
local: true,
|
|
2261
|
-
noSDK,
|
|
2262
|
-
noWatch,
|
|
2263
|
-
verbose,
|
|
2264
|
-
beforeBuild,
|
|
2265
|
-
afterBuild
|
|
2266
|
-
});
|
|
2226
|
+
await build2();
|
|
2267
2227
|
}
|
|
2268
2228
|
await start();
|
|
2269
2229
|
next();
|
|
@@ -2369,16 +2329,6 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
2369
2329
|
}
|
|
2370
2330
|
};
|
|
2371
2331
|
|
|
2372
|
-
// src/buildTina/attachPath.ts
|
|
2373
|
-
var import_fs_extra8 = __toModule(require("fs-extra"));
|
|
2374
|
-
var import_path12 = __toModule(require("path"));
|
|
2375
|
-
var attachPath = async (ctx, next, _options) => {
|
|
2376
|
-
ctx.rootPath = process.cwd();
|
|
2377
|
-
const tinaPath = import_path12.default.join(ctx.rootPath, ".tina");
|
|
2378
|
-
ctx.usingTs = await (0, import_fs_extra8.pathExists)(import_path12.default.join(tinaPath, "schema.ts")) || await (0, import_fs_extra8.pathExists)(import_path12.default.join(tinaPath, "schema.tsx"));
|
|
2379
|
-
next();
|
|
2380
|
-
};
|
|
2381
|
-
|
|
2382
2332
|
// src/cmds/baseCmds.ts
|
|
2383
2333
|
var CMD_START_SERVER = "server:start";
|
|
2384
2334
|
var CMD_DEV = "dev";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -52,15 +52,14 @@
|
|
|
52
52
|
"@graphql-codegen/visitor-plugin-common": "^2.4.0",
|
|
53
53
|
"@graphql-tools/graphql-file-loader": "^7.2.0",
|
|
54
54
|
"@graphql-tools/load": "^7.3.2",
|
|
55
|
-
"@tinacms/app": "0.0.
|
|
55
|
+
"@tinacms/app": "0.0.10",
|
|
56
56
|
"@tinacms/datalayer": "0.2.3",
|
|
57
|
-
"@tinacms/graphql": "0.63.
|
|
57
|
+
"@tinacms/graphql": "0.63.6",
|
|
58
58
|
"@tinacms/metrics": "0.0.3",
|
|
59
|
-
"@tinacms/schema-tools": "0.1.
|
|
59
|
+
"@tinacms/schema-tools": "0.1.1",
|
|
60
60
|
"add": "^2.0.6",
|
|
61
61
|
"ajv": "^6.12.3",
|
|
62
62
|
"altair-express-middleware": "4.0.6",
|
|
63
|
-
"async-retry": "^1.3.3",
|
|
64
63
|
"auto-bind": "^4.0.0",
|
|
65
64
|
"axios": "0.21.2",
|
|
66
65
|
"body-parser": "^1.19.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
-
See the License for the specific language governing permissions and
|
|
11
|
-
limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
export declare function attachSchema(ctx: any, next: () => void, options: any): Promise<void>;
|