@tinacms/cli 0.60.5 → 0.60.8
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/CHANGELOG.md +36 -0
- package/dist/cmds/compile/defaultSchema.d.ts +1 -1
- package/dist/cmds/init/index.d.ts +1 -1
- package/dist/cmds/init/setup-files/index.d.ts +1 -1
- package/dist/cmds/init/setup-files/tinaProvider.d.ts +14 -0
- package/dist/cmds/start-server/errors/index.d.ts +19 -0
- package/dist/cmds/start-server/index.d.ts +2 -1
- package/dist/cmds/start-server/lock.d.ts +18 -0
- package/dist/index.js +332 -125
- package/dist/lib/getSchemaPath.d.ts +15 -0
- package/dist/lib/index.d.ts +13 -0
- package/dist/utils/script-helpers.d.ts +19 -0
- package/package.json +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# tinacms-cli
|
|
2
2
|
|
|
3
|
+
## 0.60.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 919f5cb6c: use standard next script names
|
|
8
|
+
|
|
9
|
+
## 0.60.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 9e436f145: Update CLI to use defineConfig
|
|
14
|
+
- 851e4be73: Update tina init to use the new way of laying out tina config
|
|
15
|
+
- cc99e4309: update admin file path to /pages/admin.js to support the hash router
|
|
16
|
+
- @tinacms/datalayer@0.0.2
|
|
17
|
+
- @tinacms/graphql@0.59.7
|
|
18
|
+
- @tinacms/metrics@0.0.2
|
|
19
|
+
|
|
20
|
+
## 0.60.6
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 98622111d: Use [esbuild](https://esbuild.github.io/) to build the schema instead of typescript.
|
|
25
|
+
|
|
26
|
+
This allows the user to
|
|
27
|
+
|
|
28
|
+
- use non typescript files like JS, JSX, TS
|
|
29
|
+
- Import from outside of the tina folder
|
|
30
|
+
|
|
31
|
+
The downside
|
|
32
|
+
|
|
33
|
+
- Now type errors will still pass (The schema will compile) and one will get an error at runtime instead of compile time
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [c730fa1dd]
|
|
36
|
+
- Updated dependencies [cd0f6f022]
|
|
37
|
+
- @tinacms/graphql@0.59.7
|
|
38
|
+
|
|
3
39
|
## 0.60.5
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -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 } from \"
|
|
13
|
+
export declare const defaultSchema = "\nimport { defineSchema, defineConfig } from \"tinacms\";\n\nexport default defineSchema({\n collections: [\n {\n label: \"Blog Posts\",\n name: \"posts\",\n path: \"content/posts\",\n fields: [\n {\n type: \"string\",\n label: \"Title\",\n name: \"title\",\n },\n {\n type: \"string\",\n label: \"Blog Post Body\",\n name: \"body\",\n isBody: true,\n ui: {\n component: \"textarea\"\n },\n },\n ],\n },\n ],\n});\n\n\n\n\n// Your tina config\n// ==============\nconst branch = 'main'\n// When working locally, hit our local filesystem.\n// On a Vercel deployment, hit the Tina Cloud API\nconst apiURL =\n process.env.NODE_ENV == 'development'\n ? 'http://localhost:4001/graphql'\n : `https://content.tinajs.io/content/${process.env.NEXT_PUBLIC_TINA_CLIENT_ID}/github/${branch}`\n\nexport const tinaConfig = defineConfig({\n apiURL,\n cmsCallback: (cms) => {\n // add your CMS callback code here (if you want)\n\n // The Route Mapper\n /**\n * 1. Import `tinacms` and `RouteMappingPlugin`\n **/\n import(\"tinacms\").then(({ RouteMappingPlugin }) => {\n /**\n * 2. Define the `RouteMappingPlugin` see https://tina.io/docs/tinacms-context/#the-routemappingplugin for more details\n **/\n const RouteMapping = new RouteMappingPlugin((collection, document) => {\n return undefined;\n });\n /**\n * 3. Add the `RouteMappingPlugin` to the `cms`.\n **/\n cms.plugins.add(RouteMapping);\n });\n },\n});\n";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function initTina(ctx: any, next: () => void, options: any): Promise<void>;
|
|
2
2
|
export declare function installDeps(ctx: any, next: () => void, options: any): Promise<void>;
|
|
3
|
-
export declare function tinaSetup(
|
|
3
|
+
export declare function tinaSetup(_ctx: any, next: () => void, _options: any): Promise<void>;
|
|
4
4
|
export declare function successMessage(ctx: any, next: () => void, options: any): Promise<void>;
|
|
@@ -13,4 +13,4 @@ limitations under the License.
|
|
|
13
13
|
export declare const adminPage = "import { TinaAdmin } from 'tinacms';\nexport default TinaAdmin;\n";
|
|
14
14
|
export declare const blogPost = "---\ntitle: Vote For Pedro\n---\n# Welcome to the blog.\n\n> To edit this site head over to the [`/admin`](/admin) route. Then click the pencil icon in the bottom lefthand corner to start editing \uD83E\uDD99. \n\n# Dixi gaude Arethusa\n\n## Oscula mihi\n\nLorem markdownum numerabilis armentorum platanus, cultros coniunx sibi per\nsilvas, nostris clausit sequemur diverso scopulosque. Fecit tum alta sed non\nfalcato murmura, geminas donata Amyntore, quoque Nox. Invitam inquit, modo\nnocte; ut ignis faciemque manes in imagine sinistra ut mucrone non ramos\nsepulcro supplex. Crescentesque populos motura, fit cumque. Verumque est; retro\nsibi tristia bracchia Aetola telae caruerunt et.\n\n\n## Mutato fefellimus sit demisit aut alterius sollicito\n\nPhaethonteos vestes quem involvite iuvenca; furiali anne: sati totumque,\n**corpora** cum rapacibus nunc! Nervis repetatne, miserabile doleas, deprensum\nhunc, fluctus Threicio, ad urbes, magicaeque, quid. Per credensque series adicis\npoteram [quidem](#)! Iam uni mensas victrix\nvittas ut flumina Satyri adulter; bellum iacet domitae repercusso truncis urnis\nmille rigidi sub taurum.\n\n\n";
|
|
15
15
|
export declare const nextPostPage: () => string;
|
|
16
|
-
export declare const AppJsContent: (extraImports?: string) => string;
|
|
16
|
+
export declare const AppJsContent: (usingSrc: boolean, extraImports?: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 const TinaProvider = "import TinaCMS from 'tinacms'\nimport { tinaConfig } from '../schema.ts'\n\n// Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.\n// Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode\n/**\n *\n * @private Do not import this directly, please import the dynamic provider instead\n */\nconst TinaProvider = ({ children }) => {\n return <TinaCMS {...tinaConfig}>{children}</TinaCMS>\n}\n\nexport default TinaProvider\n";
|
|
14
|
+
export declare const TinaProviderDynamic = "import dynamic from 'next/dynamic'\nconst TinaProvider = dynamic(() => import('./TinaProvider'), { ssr: false })\nimport { TinaEditProvider } from 'tinacms/dist/edit-state'\n\nconst DynamicTina = ({ children }) => {\n return (\n <>\n <TinaEditProvider editMode={<TinaProvider>{children}</TinaProvider>}>\n {children}\n </TinaEditProvider>\n </>\n )\n}\n\nexport default DynamicTina\n";
|
|
@@ -0,0 +1,19 @@
|
|
|
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 class BuildSchemaError extends Error {
|
|
14
|
+
constructor(message: any);
|
|
15
|
+
}
|
|
16
|
+
export declare class ExecuteSchemaError extends Error {
|
|
17
|
+
constructor(message: any);
|
|
18
|
+
}
|
|
19
|
+
export declare const handleServerErrors: (e: Error) => void;
|
|
@@ -13,10 +13,11 @@ limitations under the License.
|
|
|
13
13
|
interface Options {
|
|
14
14
|
port?: number;
|
|
15
15
|
command?: string;
|
|
16
|
+
watchFolders?: string[];
|
|
16
17
|
experimentalData?: boolean;
|
|
17
18
|
noWatch?: boolean;
|
|
18
19
|
noSDK: boolean;
|
|
19
20
|
noTelemetry: boolean;
|
|
20
21
|
}
|
|
21
|
-
export declare function startServer(_ctx: any, _next: any, { port, command, noWatch, experimentalData, noSDK, noTelemetry, }: Options): Promise<void>;
|
|
22
|
+
export declare function startServer(_ctx: any, _next: any, { port, command, noWatch, experimentalData, noSDK, noTelemetry, watchFolders, }: Options): Promise<void>;
|
|
22
23
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
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 class AsyncLock {
|
|
14
|
+
disable: any;
|
|
15
|
+
promise: any;
|
|
16
|
+
constructor();
|
|
17
|
+
enable(): void;
|
|
18
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -114,7 +114,7 @@ var commander = __toModule(require("commander"));
|
|
|
114
114
|
|
|
115
115
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/package.json
|
|
116
116
|
var name = "@tinacms/cli";
|
|
117
|
-
var version = "0.60.
|
|
117
|
+
var version = "0.60.8";
|
|
118
118
|
|
|
119
119
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/utils/theme.ts
|
|
120
120
|
var import_chalk = __toModule(require("chalk"));
|
|
@@ -391,20 +391,18 @@ schema {
|
|
|
391
391
|
|
|
392
392
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
|
|
393
393
|
var import_child_process = __toModule(require("child_process"));
|
|
394
|
-
var
|
|
394
|
+
var import_path4 = __toModule(require("path"));
|
|
395
395
|
var import_graphql7 = __toModule(require("@tinacms/graphql"));
|
|
396
396
|
var import_datalayer2 = __toModule(require("@tinacms/datalayer"));
|
|
397
397
|
|
|
398
398
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/index.ts
|
|
399
|
-
var
|
|
400
|
-
var
|
|
401
|
-
var
|
|
402
|
-
var import_fs_extra2 = __toModule(require("fs-extra"));
|
|
403
|
-
var ts = __toModule(require("typescript"));
|
|
399
|
+
var import_path3 = __toModule(require("path"));
|
|
400
|
+
var import_fs_extra3 = __toModule(require("fs-extra"));
|
|
401
|
+
var import_esbuild = __toModule(require("esbuild"));
|
|
404
402
|
|
|
405
403
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/defaultSchema.ts
|
|
406
404
|
var defaultSchema = `
|
|
407
|
-
import { defineSchema } from "
|
|
405
|
+
import { defineSchema, defineConfig } from "tinacms";
|
|
408
406
|
|
|
409
407
|
export default defineSchema({
|
|
410
408
|
collections: [
|
|
@@ -431,70 +429,227 @@ export default defineSchema({
|
|
|
431
429
|
},
|
|
432
430
|
],
|
|
433
431
|
});
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
// Your tina config
|
|
437
|
+
// ==============
|
|
438
|
+
const branch = 'main'
|
|
439
|
+
// When working locally, hit our local filesystem.
|
|
440
|
+
// On a Vercel deployment, hit the Tina Cloud API
|
|
441
|
+
const apiURL =
|
|
442
|
+
process.env.NODE_ENV == 'development'
|
|
443
|
+
? 'http://localhost:4001/graphql'
|
|
444
|
+
: \`https://content.tinajs.io/content/\${process.env.NEXT_PUBLIC_TINA_CLIENT_ID}/github/\${branch}\`
|
|
445
|
+
|
|
446
|
+
export const tinaConfig = defineConfig({
|
|
447
|
+
apiURL,
|
|
448
|
+
cmsCallback: (cms) => {
|
|
449
|
+
// add your CMS callback code here (if you want)
|
|
450
|
+
|
|
451
|
+
// The Route Mapper
|
|
452
|
+
/**
|
|
453
|
+
* 1. Import \`tinacms\` and \`RouteMappingPlugin\`
|
|
454
|
+
**/
|
|
455
|
+
import("tinacms").then(({ RouteMappingPlugin }) => {
|
|
456
|
+
/**
|
|
457
|
+
* 2. Define the \`RouteMappingPlugin\` see https://tina.io/docs/tinacms-context/#the-routemappingplugin for more details
|
|
458
|
+
**/
|
|
459
|
+
const RouteMapping = new RouteMappingPlugin((collection, document) => {
|
|
460
|
+
return undefined;
|
|
461
|
+
});
|
|
462
|
+
/**
|
|
463
|
+
* 3. Add the \`RouteMappingPlugin\` to the \`cms\`.
|
|
464
|
+
**/
|
|
465
|
+
cms.plugins.add(RouteMapping);
|
|
466
|
+
});
|
|
467
|
+
},
|
|
468
|
+
});
|
|
434
469
|
`;
|
|
435
470
|
|
|
471
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/lib/getSchemaPath.ts
|
|
472
|
+
var import_path2 = __toModule(require("path"));
|
|
473
|
+
var import_fs_extra2 = __toModule(require("fs-extra"));
|
|
474
|
+
var ErrorMessage = "Must provide a `.tina/schema.{ts,js,tsx,jsx}`";
|
|
475
|
+
var getSchemaPath = ({ projectDir }) => {
|
|
476
|
+
if (!import_fs_extra2.default.existsSync(projectDir)) {
|
|
477
|
+
throw new Error(ErrorMessage);
|
|
478
|
+
}
|
|
479
|
+
const inputPathTS = import_path2.default.join(projectDir, "schema.ts");
|
|
480
|
+
const inputPathJS = import_path2.default.join(projectDir, "schema.js");
|
|
481
|
+
const inputPathTSX = import_path2.default.join(projectDir, "schema.tsx");
|
|
482
|
+
const inputPathJSX = import_path2.default.join(projectDir, "schema.jsx");
|
|
483
|
+
let inputFile;
|
|
484
|
+
if (import_fs_extra2.default.existsSync(inputPathTS)) {
|
|
485
|
+
inputFile = inputPathTS;
|
|
486
|
+
} else if (import_fs_extra2.default.existsSync(inputPathJS)) {
|
|
487
|
+
inputFile = inputPathJS;
|
|
488
|
+
} else if (import_fs_extra2.default.existsSync(inputPathTSX)) {
|
|
489
|
+
inputFile = inputPathTSX;
|
|
490
|
+
} else if (import_fs_extra2.default.existsSync(inputPathJSX)) {
|
|
491
|
+
inputFile = inputPathJSX;
|
|
492
|
+
}
|
|
493
|
+
if (!inputFile) {
|
|
494
|
+
throw new Error(ErrorMessage);
|
|
495
|
+
}
|
|
496
|
+
return inputFile;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/errors/index.ts
|
|
500
|
+
var BuildSchemaError = class extends Error {
|
|
501
|
+
constructor(message) {
|
|
502
|
+
super(message);
|
|
503
|
+
this.name = "BuildSchemaError";
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
var ExecuteSchemaError = class extends Error {
|
|
507
|
+
constructor(message) {
|
|
508
|
+
super(message);
|
|
509
|
+
this.name = "ExecuteSchemaError";
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
var handleServerErrors = (e) => {
|
|
513
|
+
if (e instanceof BuildSchemaError) {
|
|
514
|
+
logger.error(`${dangerText("ERROR: your schema was not successfully built: see https://tina.io/docs/errors/esbuild-error/ for more details")}
|
|
515
|
+
Error Message Below
|
|
516
|
+
${e}`);
|
|
517
|
+
} else if (e instanceof ExecuteSchemaError) {
|
|
518
|
+
logger.error(`${dangerText("ERROR: your schema was not successfully executed: see https://tina.io/docs/errors/esbuild-error/ for more details")}
|
|
519
|
+
Error Message Below
|
|
520
|
+
${e}`);
|
|
521
|
+
} else {
|
|
522
|
+
logger.info(dangerText("Compilation failed with errors. Server has not been restarted.") + ` see error below
|
|
523
|
+
${e.message}`);
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
|
|
436
527
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/index.ts
|
|
437
|
-
var tinaPath =
|
|
438
|
-
var
|
|
439
|
-
var
|
|
440
|
-
var
|
|
528
|
+
var tinaPath = import_path3.default.join(process.cwd(), ".tina");
|
|
529
|
+
var packageJSONFilePath = import_path3.default.join(process.cwd(), "package.json");
|
|
530
|
+
var tinaGeneratedPath = import_path3.default.join(tinaPath, "__generated__");
|
|
531
|
+
var tinaTempPath = import_path3.default.join(tinaGeneratedPath, "temp");
|
|
532
|
+
var tinaConfigPath = import_path3.default.join(tinaGeneratedPath, "config");
|
|
441
533
|
var resetGeneratedFolder = async () => {
|
|
442
534
|
try {
|
|
443
|
-
await
|
|
535
|
+
await import_fs_extra3.default.rmdir(tinaGeneratedPath, {
|
|
444
536
|
recursive: true
|
|
445
537
|
});
|
|
446
538
|
} catch (e) {
|
|
447
539
|
console.log(e);
|
|
448
540
|
}
|
|
449
|
-
await
|
|
450
|
-
await
|
|
541
|
+
await import_fs_extra3.default.mkdir(tinaGeneratedPath);
|
|
542
|
+
await import_fs_extra3.default.outputFile(import_path3.default.join(tinaGeneratedPath, ".gitignore"), "db");
|
|
543
|
+
};
|
|
544
|
+
var cleanup = async ({ tinaTempPath: tinaTempPath2 }) => {
|
|
545
|
+
await import_fs_extra3.default.remove(tinaTempPath2);
|
|
451
546
|
};
|
|
452
547
|
var compile = async (_ctx, _next) => {
|
|
453
548
|
logger.info(logText("Compiling..."));
|
|
454
|
-
|
|
549
|
+
let schemaExists = true;
|
|
550
|
+
try {
|
|
551
|
+
getSchemaPath({ projectDir: tinaPath });
|
|
552
|
+
} catch {
|
|
553
|
+
schemaExists = false;
|
|
554
|
+
}
|
|
555
|
+
if (!schemaExists) {
|
|
455
556
|
logger.info(dangerText(`
|
|
456
557
|
.tina/schema.ts not found, Creating one for you...
|
|
457
558
|
See Documentation: https://tina.io/docs/tina-cloud/cli/#getting-started"
|
|
458
559
|
`));
|
|
459
|
-
const file =
|
|
460
|
-
await
|
|
461
|
-
await
|
|
560
|
+
const file = import_path3.default.join(tinaPath, "schema.ts");
|
|
561
|
+
await import_fs_extra3.default.ensureFile(file);
|
|
562
|
+
await import_fs_extra3.default.writeFile(file, defaultSchema);
|
|
563
|
+
}
|
|
564
|
+
try {
|
|
565
|
+
await transpile(tinaPath, tinaTempPath);
|
|
566
|
+
} catch (e) {
|
|
567
|
+
await cleanup({ tinaTempPath });
|
|
568
|
+
throw new BuildSchemaError(e);
|
|
462
569
|
}
|
|
463
|
-
await transpile2(tinaPath, tinaTempPath);
|
|
464
570
|
Object.keys(require.cache).map((key) => {
|
|
465
571
|
if (key.startsWith(tinaTempPath)) {
|
|
466
572
|
delete require.cache[require.resolve(key)];
|
|
467
573
|
}
|
|
468
574
|
});
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
575
|
+
try {
|
|
576
|
+
const schemaFunc = require(import_path3.default.join(tinaTempPath, "schema.js"));
|
|
577
|
+
const schemaObject = schemaFunc.default;
|
|
578
|
+
await import_fs_extra3.default.outputFile(import_path3.default.join(tinaConfigPath, "schema.json"), JSON.stringify(schemaObject, null, 2));
|
|
579
|
+
await cleanup({ tinaTempPath });
|
|
580
|
+
} catch (e) {
|
|
581
|
+
await cleanup({ tinaTempPath });
|
|
582
|
+
throw new ExecuteSchemaError(e);
|
|
583
|
+
}
|
|
473
584
|
};
|
|
474
|
-
var
|
|
475
|
-
logger.info(logText("
|
|
476
|
-
const
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
585
|
+
var transpile = async (projectDir, tempDir) => {
|
|
586
|
+
logger.info(logText("Building javascript..."));
|
|
587
|
+
const packageJSON = JSON.parse(import_fs_extra3.default.readFileSync(packageJSONFilePath).toString() || "{}");
|
|
588
|
+
const deps = (packageJSON == null ? void 0 : packageJSON.dependencies) || [];
|
|
589
|
+
const peerDeps = (packageJSON == null ? void 0 : packageJSON.peerDependencies) || [];
|
|
590
|
+
const devDeps = (packageJSON == null ? void 0 : packageJSON.devDependencies) || [];
|
|
591
|
+
const external = Object.keys(__spreadValues(__spreadValues(__spreadValues({}, deps), peerDeps), devDeps));
|
|
592
|
+
const inputFile = getSchemaPath({ projectDir });
|
|
593
|
+
const outputPath = import_path3.default.join(tempDir, "schema.js");
|
|
594
|
+
await (0, import_esbuild.build)({
|
|
595
|
+
bundle: true,
|
|
596
|
+
platform: "neutral",
|
|
597
|
+
target: ["node10.4"],
|
|
598
|
+
entryPoints: [inputFile],
|
|
599
|
+
treeShaking: true,
|
|
600
|
+
external: [...external, "./node_modules/*"],
|
|
601
|
+
loader: loaders,
|
|
602
|
+
outfile: outputPath
|
|
603
|
+
});
|
|
604
|
+
logger.info(logText(`Javascript built`));
|
|
490
605
|
};
|
|
491
606
|
var defineSchema = (config) => {
|
|
492
607
|
return config;
|
|
493
608
|
};
|
|
609
|
+
var loaders = {
|
|
610
|
+
".aac": "file",
|
|
611
|
+
".css": "file",
|
|
612
|
+
".eot": "file",
|
|
613
|
+
".flac": "file",
|
|
614
|
+
".gif": "file",
|
|
615
|
+
".jpeg": "file",
|
|
616
|
+
".jpg": "file",
|
|
617
|
+
".json": "json",
|
|
618
|
+
".mp3": "file",
|
|
619
|
+
".mp4": "file",
|
|
620
|
+
".ogg": "file",
|
|
621
|
+
".otf": "file",
|
|
622
|
+
".png": "file",
|
|
623
|
+
".svg": "file",
|
|
624
|
+
".ttf": "file",
|
|
625
|
+
".wav": "file",
|
|
626
|
+
".webm": "file",
|
|
627
|
+
".webp": "file",
|
|
628
|
+
".woff": "file",
|
|
629
|
+
".woff2": "file",
|
|
630
|
+
".js": "jsx",
|
|
631
|
+
".jsx": "jsx",
|
|
632
|
+
".tsx": "tsx"
|
|
633
|
+
};
|
|
494
634
|
|
|
495
635
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
|
|
496
636
|
var import_chokidar = __toModule(require("chokidar"));
|
|
497
637
|
var import_metrics = __toModule(require("@tinacms/metrics"));
|
|
638
|
+
|
|
639
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/lock.ts
|
|
640
|
+
var AsyncLock = class {
|
|
641
|
+
constructor() {
|
|
642
|
+
this.disable = () => {
|
|
643
|
+
};
|
|
644
|
+
this.promise = Promise.resolve();
|
|
645
|
+
}
|
|
646
|
+
enable() {
|
|
647
|
+
this.promise = new Promise((resolve2) => this.disable = resolve2);
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
|
|
652
|
+
var lock = new AsyncLock();
|
|
498
653
|
var gqlPackageFile = require.resolve("@tinacms/graphql");
|
|
499
654
|
async function startServer(_ctx, _next, {
|
|
500
655
|
port = 4001,
|
|
@@ -502,8 +657,10 @@ async function startServer(_ctx, _next, {
|
|
|
502
657
|
noWatch,
|
|
503
658
|
experimentalData,
|
|
504
659
|
noSDK,
|
|
505
|
-
noTelemetry
|
|
660
|
+
noTelemetry,
|
|
661
|
+
watchFolders
|
|
506
662
|
}) {
|
|
663
|
+
lock.disable();
|
|
507
664
|
const rootPath2 = process.cwd();
|
|
508
665
|
const t = new import_metrics.Telemetry({ disabled: Boolean(noTelemetry) });
|
|
509
666
|
t.submitRecord({
|
|
@@ -541,29 +698,45 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
541
698
|
}
|
|
542
699
|
};
|
|
543
700
|
let ready = false;
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
701
|
+
const build2 = async (noSDK2) => {
|
|
702
|
+
await lock.promise;
|
|
703
|
+
lock.enable();
|
|
704
|
+
try {
|
|
705
|
+
if (!process.env.CI && !noWatch) {
|
|
706
|
+
await resetGeneratedFolder();
|
|
707
|
+
}
|
|
708
|
+
const database2 = await (0, import_graphql7.createDatabase)({ store, bridge });
|
|
709
|
+
await compile(null, null);
|
|
710
|
+
const schema = await (0, import_graphql7.buildSchema)(rootPath2, database2);
|
|
711
|
+
await genTypes({ schema }, () => {
|
|
712
|
+
}, { noSDK: noSDK2 });
|
|
713
|
+
} catch (error) {
|
|
714
|
+
throw error;
|
|
715
|
+
} finally {
|
|
716
|
+
lock.disable();
|
|
547
717
|
}
|
|
548
|
-
const database2 = await (0, import_graphql7.createDatabase)({ store, bridge });
|
|
549
|
-
await compile(null, null);
|
|
550
|
-
const schema = await (0, import_graphql7.buildSchema)(rootPath2, database2);
|
|
551
|
-
await genTypes({ schema }, () => {
|
|
552
|
-
}, { noSDK: noSDK2 });
|
|
553
718
|
};
|
|
719
|
+
const foldersToWatch = (watchFolders || []).map((x) => import_path4.default.join(rootPath2, x));
|
|
554
720
|
if (!noWatch && !process.env.CI) {
|
|
555
|
-
import_chokidar.default.watch([
|
|
556
|
-
|
|
721
|
+
import_chokidar.default.watch([
|
|
722
|
+
...foldersToWatch,
|
|
723
|
+
`${rootPath2}/.tina/**/*.{ts,gql,graphql,js,tsx,jsx}`
|
|
724
|
+
], {
|
|
725
|
+
ignored: [
|
|
726
|
+
"**/node_modules/**/*",
|
|
727
|
+
"**/.next/**/*",
|
|
728
|
+
`${import_path4.default.resolve(rootPath2)}/.tina/__generated__/**/*`
|
|
729
|
+
]
|
|
557
730
|
}).on("ready", async () => {
|
|
558
731
|
console.log("Generating Tina config");
|
|
559
732
|
try {
|
|
560
733
|
if (shouldBuild) {
|
|
561
|
-
await
|
|
734
|
+
await build2(noSDK);
|
|
562
735
|
}
|
|
563
736
|
ready = true;
|
|
564
737
|
startSubprocess();
|
|
565
738
|
} catch (e) {
|
|
566
|
-
|
|
739
|
+
handleServerErrors(e);
|
|
567
740
|
console.log(e);
|
|
568
741
|
process.exit(0);
|
|
569
742
|
}
|
|
@@ -572,11 +745,10 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
572
745
|
logger.info("Tina change detected, regenerating config");
|
|
573
746
|
try {
|
|
574
747
|
if (shouldBuild) {
|
|
575
|
-
await
|
|
748
|
+
await build2(noSDK);
|
|
576
749
|
}
|
|
577
750
|
} catch (e) {
|
|
578
|
-
|
|
579
|
-
${e.message}`);
|
|
751
|
+
handleServerErrors(e);
|
|
580
752
|
t.submitRecord({
|
|
581
753
|
event: {
|
|
582
754
|
name: "tinacms:cli:server:error",
|
|
@@ -588,7 +760,7 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
588
760
|
});
|
|
589
761
|
} else {
|
|
590
762
|
if (shouldBuild) {
|
|
591
|
-
await
|
|
763
|
+
await build2(noSDK);
|
|
592
764
|
}
|
|
593
765
|
}
|
|
594
766
|
const state = {
|
|
@@ -647,8 +819,8 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
647
819
|
}
|
|
648
820
|
|
|
649
821
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
650
|
-
var
|
|
651
|
-
var
|
|
822
|
+
var import_fs_extra4 = __toModule(require("fs-extra"));
|
|
823
|
+
var import_path5 = __toModule(require("path"));
|
|
652
824
|
var import_progress = __toModule(require("progress"));
|
|
653
825
|
var import_prompts = __toModule(require("prompts"));
|
|
654
826
|
var import_metrics2 = __toModule(require("@tinacms/metrics"));
|
|
@@ -963,41 +1135,70 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
963
1135
|
};
|
|
964
1136
|
|
|
965
1137
|
`;
|
|
966
|
-
var AppJsContent = (extraImports) => `import
|
|
967
|
-
|
|
968
|
-
const TinaCMS = dynamic(() => import('tinacms'), { ssr: false })
|
|
1138
|
+
var AppJsContent = (usingSrc, extraImports) => `import Tina from '${usingSrc ? "../" : ""}../.tina/components/TinaDynamicProvider.js'
|
|
1139
|
+
|
|
969
1140
|
${extraImports || ""}
|
|
1141
|
+
const App = ({ Component, pageProps }) => {
|
|
1142
|
+
return (
|
|
1143
|
+
<Tina>
|
|
1144
|
+
<Component {...pageProps} />
|
|
1145
|
+
</Tina>
|
|
1146
|
+
)
|
|
1147
|
+
}
|
|
970
1148
|
|
|
971
|
-
|
|
972
|
-
const apiURL =
|
|
973
|
-
process.env.NODE_ENV == "development"
|
|
974
|
-
? "http://localhost:4001/graphql"
|
|
975
|
-
: \`https://content.tinajs.io/content/\${process.env.NEXT_PUBLIC_TINA_CLIENT_ID}/github/\${branch}\`;
|
|
1149
|
+
export default App
|
|
976
1150
|
|
|
977
|
-
|
|
1151
|
+
`;
|
|
1152
|
+
|
|
1153
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
1154
|
+
var import_chalk2 = __toModule(require("chalk"));
|
|
1155
|
+
|
|
1156
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/setup-files/tinaProvider.ts
|
|
1157
|
+
var TinaProvider = `import TinaCMS from 'tinacms'
|
|
1158
|
+
import { tinaConfig } from '../schema.ts'
|
|
1159
|
+
|
|
1160
|
+
// Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.
|
|
1161
|
+
// Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode
|
|
1162
|
+
/**
|
|
1163
|
+
*
|
|
1164
|
+
* @private Do not import this directly, please import the dynamic provider instead
|
|
1165
|
+
*/
|
|
1166
|
+
const TinaProvider = ({ children }) => {
|
|
1167
|
+
return <TinaCMS {...tinaConfig}>{children}</TinaCMS>
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
export default TinaProvider
|
|
1171
|
+
`;
|
|
1172
|
+
var TinaProviderDynamic = `import dynamic from 'next/dynamic'
|
|
1173
|
+
const TinaProvider = dynamic(() => import('./TinaProvider'), { ssr: false })
|
|
1174
|
+
import { TinaEditProvider } from 'tinacms/dist/edit-state'
|
|
1175
|
+
|
|
1176
|
+
const DynamicTina = ({ children }) => {
|
|
978
1177
|
return (
|
|
979
1178
|
<>
|
|
980
|
-
<TinaEditProvider
|
|
981
|
-
|
|
982
|
-
<TinaCMS
|
|
983
|
-
apiURL={apiURL}
|
|
984
|
-
|
|
985
|
-
>
|
|
986
|
-
<Component {...pageProps} />
|
|
987
|
-
</TinaCMS>
|
|
988
|
-
}
|
|
989
|
-
>
|
|
990
|
-
<Component {...pageProps} />
|
|
1179
|
+
<TinaEditProvider editMode={<TinaProvider>{children}</TinaProvider>}>
|
|
1180
|
+
{children}
|
|
991
1181
|
</TinaEditProvider>
|
|
992
1182
|
</>
|
|
993
1183
|
)
|
|
994
1184
|
}
|
|
995
1185
|
|
|
996
|
-
export default
|
|
1186
|
+
export default DynamicTina
|
|
997
1187
|
`;
|
|
998
1188
|
|
|
1189
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/utils/script-helpers.ts
|
|
1190
|
+
function generateGqlScript(scriptValue) {
|
|
1191
|
+
return `tinacms server:start -c "${scriptValue}"`;
|
|
1192
|
+
}
|
|
1193
|
+
function extendNextScripts(scripts) {
|
|
1194
|
+
return __spreadProps(__spreadValues({}, scripts), {
|
|
1195
|
+
dev: generateGqlScript(scripts.dev || "next dev"),
|
|
1196
|
+
build: generateGqlScript(scripts.build || "next build"),
|
|
1197
|
+
start: generateGqlScript(scripts.start || "next start")
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
|
|
999
1201
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
1000
|
-
var import_chalk2 = __toModule(require("chalk"));
|
|
1001
1202
|
function execShellCommand(cmd) {
|
|
1002
1203
|
const exec = require("child_process").exec;
|
|
1003
1204
|
return new Promise((resolve2, _reject) => {
|
|
@@ -1030,26 +1231,32 @@ async function installDeps(ctx, next, options) {
|
|
|
1030
1231
|
next();
|
|
1031
1232
|
}
|
|
1032
1233
|
var baseDir = process.cwd();
|
|
1033
|
-
var
|
|
1034
|
-
var
|
|
1035
|
-
var
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1234
|
+
var blogContentPath = import_path5.default.join(baseDir, "content", "posts");
|
|
1235
|
+
var blogPostPath = import_path5.default.join(blogContentPath, "HelloWorld.md");
|
|
1236
|
+
var TinaFolder = import_path5.default.join(baseDir, ".tina");
|
|
1237
|
+
var componentFolder = import_path5.default.join(TinaFolder, "components");
|
|
1238
|
+
var TinaProviderPath = import_path5.default.join(componentFolder, "TinaProvider.js");
|
|
1239
|
+
var TinaDynamicProvider = import_path5.default.join(componentFolder, "TinaDynamicProvider.js");
|
|
1240
|
+
async function tinaSetup(_ctx, next, _options) {
|
|
1241
|
+
const useingSrc = import_fs_extra4.default.pathExistsSync(import_path5.default.join(baseDir, "src"));
|
|
1242
|
+
if (!import_fs_extra4.default.pathExistsSync(blogPostPath)) {
|
|
1040
1243
|
logger.info(logText("Adding a content folder..."));
|
|
1041
|
-
|
|
1042
|
-
|
|
1244
|
+
import_fs_extra4.default.mkdirpSync(blogContentPath);
|
|
1245
|
+
import_fs_extra4.default.writeFileSync(blogPostPath, blogPost);
|
|
1246
|
+
}
|
|
1247
|
+
if (!import_fs_extra4.default.existsSync(TinaProviderPath) && !import_fs_extra4.default.existsSync(TinaDynamicProvider)) {
|
|
1248
|
+
import_fs_extra4.default.mkdirpSync(componentFolder);
|
|
1249
|
+
import_fs_extra4.default.writeFileSync(TinaProviderPath, TinaProvider);
|
|
1250
|
+
import_fs_extra4.default.writeFileSync(TinaDynamicProvider, TinaProviderDynamic);
|
|
1043
1251
|
}
|
|
1044
1252
|
logger.level = "info";
|
|
1045
|
-
const pagesPath =
|
|
1046
|
-
const appPath =
|
|
1047
|
-
const appPathTS =
|
|
1048
|
-
const appExtension =
|
|
1049
|
-
|
|
1050
|
-
if (!import_fs_extra3.default.pathExistsSync(appPath) && !import_fs_extra3.default.pathExistsSync(appPathTS)) {
|
|
1253
|
+
const pagesPath = import_path5.default.join(baseDir, useingSrc ? "src" : "", "pages");
|
|
1254
|
+
const appPath = import_path5.default.join(pagesPath, "_app.js");
|
|
1255
|
+
const appPathTS = import_path5.default.join(pagesPath, "_app.tsx");
|
|
1256
|
+
const appExtension = import_fs_extra4.default.existsSync(appPath) ? ".js" : ".tsx";
|
|
1257
|
+
if (!import_fs_extra4.default.pathExistsSync(appPath) && !import_fs_extra4.default.pathExistsSync(appPathTS)) {
|
|
1051
1258
|
logger.info(logText("Adding _app.js ... \u2705"));
|
|
1052
|
-
|
|
1259
|
+
import_fs_extra4.default.writeFileSync(appPath, AppJsContent(useingSrc));
|
|
1053
1260
|
} else {
|
|
1054
1261
|
const override = await (0, import_prompts.default)({
|
|
1055
1262
|
name: "res",
|
|
@@ -1058,49 +1265,44 @@ async function tinaSetup(ctx, next, options) {
|
|
|
1058
1265
|
});
|
|
1059
1266
|
if (override.res) {
|
|
1060
1267
|
logger.info(logText(`Adding _app${appExtension} ... \u2705`));
|
|
1061
|
-
const appPathWithExtension =
|
|
1062
|
-
const fileContent =
|
|
1268
|
+
const appPathWithExtension = import_path5.default.join(pagesPath, `_app${appExtension}`);
|
|
1269
|
+
const fileContent = import_fs_extra4.default.pathExistsSync(appPath) ? (0, import_fs_extra4.readFileSync)(appPath) : (0, import_fs_extra4.readFileSync)(appPathTS);
|
|
1063
1270
|
const matches = [
|
|
1064
1271
|
...fileContent.toString().matchAll(/^.*import.*\.css("|').*$/gm)
|
|
1065
1272
|
];
|
|
1066
1273
|
const primaryMatches = matches.map((x) => x[0]);
|
|
1067
|
-
|
|
1274
|
+
import_fs_extra4.default.writeFileSync(appPathWithExtension, AppJsContent(useingSrc, primaryMatches.join("\n")));
|
|
1068
1275
|
} else {
|
|
1069
|
-
wrapper = true;
|
|
1070
1276
|
logger.info(dangerText(`Heads up, to enable live-editing you'll need to wrap your page or site in Tina:
|
|
1071
|
-
`, warnText(AppJsContent())));
|
|
1277
|
+
`, warnText(AppJsContent(useingSrc))));
|
|
1072
1278
|
}
|
|
1073
1279
|
}
|
|
1074
|
-
const tinaBlogPagePath =
|
|
1075
|
-
const tinaBlogPagePathFile =
|
|
1076
|
-
if (!
|
|
1077
|
-
|
|
1078
|
-
|
|
1280
|
+
const tinaBlogPagePath = import_path5.default.join(pagesPath, "demo", "blog");
|
|
1281
|
+
const tinaBlogPagePathFile = import_path5.default.join(tinaBlogPagePath, "[filename].js");
|
|
1282
|
+
if (!import_fs_extra4.default.pathExistsSync(tinaBlogPagePathFile)) {
|
|
1283
|
+
import_fs_extra4.default.mkdirpSync(tinaBlogPagePath);
|
|
1284
|
+
import_fs_extra4.default.writeFileSync(tinaBlogPagePathFile, nextPostPage());
|
|
1079
1285
|
}
|
|
1080
1286
|
logger.info("Adding a content folder... \u2705");
|
|
1081
|
-
const packagePath =
|
|
1082
|
-
const pack = JSON.parse((0,
|
|
1287
|
+
const packagePath = import_path5.default.join(baseDir, "package.json");
|
|
1288
|
+
const pack = JSON.parse((0, import_fs_extra4.readFileSync)(packagePath).toString());
|
|
1083
1289
|
const oldScripts = pack.scripts || {};
|
|
1084
1290
|
const newPack = JSON.stringify(__spreadProps(__spreadValues({}, pack), {
|
|
1085
|
-
scripts:
|
|
1086
|
-
"tina-dev": 'yarn tinacms server:start -c "next dev"',
|
|
1087
|
-
"tina-build": 'yarn tinacms server:start -c "next build"',
|
|
1088
|
-
"tina-start": 'yarn tinacms server:start -c "next start"'
|
|
1089
|
-
})
|
|
1291
|
+
scripts: extendNextScripts(oldScripts)
|
|
1090
1292
|
}), null, 2);
|
|
1091
|
-
(0,
|
|
1092
|
-
const adminPath =
|
|
1093
|
-
if (
|
|
1094
|
-
logger.warn(`Unable to add /pages/admin
|
|
1293
|
+
(0, import_fs_extra4.writeFileSync)(packagePath, newPack);
|
|
1294
|
+
const adminPath = import_path5.default.join(pagesPath, "admin.js");
|
|
1295
|
+
if (import_fs_extra4.default.pathExistsSync(import_path5.default.join(pagesPath, "admin"))) {
|
|
1296
|
+
logger.warn(`Unable to add /pages/admin.js, this path already exists.
|
|
1095
1297
|
Learn more about toggling edit-mode at https://tina.io/docs/tinacms-context/#manually-toggling-edit-mode`);
|
|
1096
1298
|
return next();
|
|
1097
1299
|
}
|
|
1098
|
-
(0,
|
|
1300
|
+
(0, import_fs_extra4.outputFileSync)(adminPath, adminPage);
|
|
1099
1301
|
next();
|
|
1100
1302
|
}
|
|
1101
1303
|
async function successMessage(ctx, next, options) {
|
|
1102
1304
|
logger.info(`Tina setup ${import_chalk2.default.underline.green("done")} \u2705
|
|
1103
|
-
Start your dev server with ${successText(`yarn
|
|
1305
|
+
Start your dev server with ${successText(`yarn dev`)} and go to http://localhost:3000/demo/blog/HelloWorld to ${successText("check it out the page that was created for you")}
|
|
1104
1306
|
Enjoy Tina \u{1F999} !
|
|
1105
1307
|
`);
|
|
1106
1308
|
next();
|
|
@@ -1112,7 +1314,7 @@ var import_datalayer3 = __toModule(require("@tinacms/datalayer"));
|
|
|
1112
1314
|
|
|
1113
1315
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/audit/audit.ts
|
|
1114
1316
|
var import_graphql8 = __toModule(require("@tinacms/graphql"));
|
|
1115
|
-
var
|
|
1317
|
+
var import_path6 = __toModule(require("path"));
|
|
1116
1318
|
var import_graphql9 = __toModule(require("@tinacms/graphql"));
|
|
1117
1319
|
var import_chalk3 = __toModule(require("chalk"));
|
|
1118
1320
|
var auditCollection = async (args) => {
|
|
@@ -1150,7 +1352,7 @@ var auditCollection = async (args) => {
|
|
|
1150
1352
|
warning = true;
|
|
1151
1353
|
logger.warn(import_chalk3.default.yellowBright(`WARNING: there is a file with extension \`${node.sys.extension}\` but in your schema it is defined to be \`.${format}\`
|
|
1152
1354
|
|
|
1153
|
-
location: ${
|
|
1355
|
+
location: ${import_path6.default.join(rootPath2, node.sys.path)}`));
|
|
1154
1356
|
}
|
|
1155
1357
|
});
|
|
1156
1358
|
return warning;
|
|
@@ -1186,7 +1388,7 @@ var auditDocuments = async (args) => {
|
|
|
1186
1388
|
const documents = result.data.getCollection.documents.edges;
|
|
1187
1389
|
for (let i = 0; i < documents.length; i++) {
|
|
1188
1390
|
const node = documents[i].node;
|
|
1189
|
-
const fullPath =
|
|
1391
|
+
const fullPath = import_path6.default.join(rootPath2, node.sys.path);
|
|
1190
1392
|
logger.info(`Checking document: ${fullPath}`);
|
|
1191
1393
|
const documentQuery = `query {
|
|
1192
1394
|
getDocument(collection: "${collection.name}", relativePath: "${node.sys.relativePath}") {
|
|
@@ -1383,7 +1585,7 @@ var noSDKCodegenOption = {
|
|
|
1383
1585
|
};
|
|
1384
1586
|
var cleanOption = {
|
|
1385
1587
|
name: "--clean",
|
|
1386
|
-
description: "
|
|
1588
|
+
description: "Updates all content files to remove any data not explicitly permitted by the current schema definition"
|
|
1387
1589
|
};
|
|
1388
1590
|
var useDefaultValuesOption = {
|
|
1389
1591
|
name: "--useDefaultValues",
|
|
@@ -1393,6 +1595,10 @@ var noTelemetryOption = {
|
|
|
1393
1595
|
name: "--noTelemetry",
|
|
1394
1596
|
description: "Disable anonymous telemetry that is collected"
|
|
1395
1597
|
};
|
|
1598
|
+
var watchFileOption = {
|
|
1599
|
+
name: "-w, --watchFolders [folders...]",
|
|
1600
|
+
description: "a list of folders (relative to where this is being run) that the cli will watch for changes"
|
|
1601
|
+
};
|
|
1396
1602
|
var baseCmds = [
|
|
1397
1603
|
{
|
|
1398
1604
|
command: CMD_START_SERVER,
|
|
@@ -1403,7 +1609,8 @@ var baseCmds = [
|
|
|
1403
1609
|
experimentalDatalayer,
|
|
1404
1610
|
noWatchOption,
|
|
1405
1611
|
noSDKCodegenOption,
|
|
1406
|
-
noTelemetryOption
|
|
1612
|
+
noTelemetryOption,
|
|
1613
|
+
watchFileOption
|
|
1407
1614
|
],
|
|
1408
1615
|
action: (options) => chain([startServer], options)
|
|
1409
1616
|
},
|
|
@@ -0,0 +1,15 @@
|
|
|
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 const getSchemaPath: ({ projectDir }: {
|
|
14
|
+
projectDir: string;
|
|
15
|
+
}) => any;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 * from './getSchemaPath';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
Copyright 2021 Forestry.io Holdings, Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateGqlScript(scriptValue: any): string;
|
|
19
|
+
export declare function extendNextScripts(scripts: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.8",
|
|
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": "0.50.
|
|
24
|
+
"@tinacms/scripts": "0.50.7",
|
|
25
25
|
"@types/clear": "0.1.0",
|
|
26
26
|
"@types/cors": "2.8.5",
|
|
27
27
|
"@types/express": "^4.17.7",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"@types/progress": "^2.0.3",
|
|
39
39
|
"@types/prompts": "^2.0.13",
|
|
40
40
|
"@types/yup": "^0.29.11",
|
|
41
|
-
"jest": "^27.0.6"
|
|
41
|
+
"jest": "^27.0.6",
|
|
42
|
+
"typescript": "^4.3.5"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "echo \"Run `yarn build` from the root of the repository instead\"",
|
|
@@ -57,8 +58,10 @@
|
|
|
57
58
|
"@graphql-tools/graphql-file-loader": "^7.2.0",
|
|
58
59
|
"@graphql-tools/load": "^7.3.2",
|
|
59
60
|
"@tinacms/datalayer": "0.0.2",
|
|
60
|
-
"@tinacms/graphql": "0.59.
|
|
61
|
+
"@tinacms/graphql": "0.59.7",
|
|
61
62
|
"@tinacms/metrics": "0.0.2",
|
|
63
|
+
"@yarnpkg/esbuild-plugin-pnp": "^2.0.1-rc.3",
|
|
64
|
+
"add": "^2.0.6",
|
|
62
65
|
"ajv": "^6.12.3",
|
|
63
66
|
"altair-express-middleware": "4.0.6",
|
|
64
67
|
"auto-bind": "^4.0.0",
|
|
@@ -66,8 +69,9 @@
|
|
|
66
69
|
"body-parser": "^1.19.0",
|
|
67
70
|
"chalk": "^2.4.2",
|
|
68
71
|
"chokidar": "^3.5.1",
|
|
69
|
-
"commander": "
|
|
72
|
+
"commander": "^9.0.0",
|
|
70
73
|
"cors": "^2.8.5",
|
|
74
|
+
"esbuild": "^0.14.20",
|
|
71
75
|
"esm": "3.2.25",
|
|
72
76
|
"express": "^4.17.1",
|
|
73
77
|
"fast-glob": "^3.2.4",
|
|
@@ -80,7 +84,7 @@
|
|
|
80
84
|
"normalize-path": "^3.0.0",
|
|
81
85
|
"progress": "^2.0.3",
|
|
82
86
|
"prompts": "^2.4.1",
|
|
83
|
-
"
|
|
87
|
+
"yarn": "^1.22.17",
|
|
84
88
|
"yup": "^0.32.9"
|
|
85
89
|
},
|
|
86
90
|
"publishConfig": {
|