@tinacms/cli 0.60.9 → 0.60.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# tinacms-cli
|
|
2
2
|
|
|
3
|
+
## 0.60.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6154d12b8: Check for appropriate versions of react and react-dom before initializing with tinacms init
|
|
8
|
+
- 8c23d69a2: Adds an MDX example when you run @tinacms/cli init
|
|
9
|
+
- abf25c673: The schema can now to used on the frontend (optional for now but will be the main path moving forward).
|
|
10
|
+
|
|
11
|
+
### How to migrate.
|
|
12
|
+
|
|
13
|
+
If you gone though the `tinacms init` process there should be a file called `.tina/components/TinaProvider`. In that file you can import the schema from `schema.ts` and add it to the TinaCMS wrapper component.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import TinaCMS from 'tinacms'
|
|
17
|
+
import schema, { tinaConfig } from '../schema.ts'
|
|
18
|
+
|
|
19
|
+
// Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.
|
|
20
|
+
// Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @private Do not import this directly, please import the dynamic provider instead
|
|
24
|
+
*/
|
|
25
|
+
const TinaProvider = ({ children }) => {
|
|
26
|
+
return (
|
|
27
|
+
<TinaCMS {...tinaConfig} schema={schema}>
|
|
28
|
+
{children}
|
|
29
|
+
</TinaCMS>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default TinaProvider
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [8b3be903f]
|
|
37
|
+
- Updated dependencies [82174ff50]
|
|
38
|
+
- Updated dependencies [a87e1e6fa]
|
|
39
|
+
- Updated dependencies [abf25c673]
|
|
40
|
+
- Updated dependencies [591640db0]
|
|
41
|
+
- Updated dependencies [e8b0de1f7]
|
|
42
|
+
- Updated dependencies [b01f2e382]
|
|
43
|
+
- @tinacms/datalayer@0.1.0
|
|
44
|
+
- @tinacms/graphql@0.59.9
|
|
45
|
+
|
|
3
46
|
## 0.60.9
|
|
4
47
|
|
|
5
48
|
### 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, 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: \"
|
|
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: \"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\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 return cms;\n },\n});\n";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare function initTina(ctx: any, next: () => void, options: any): Promise<void>;
|
|
2
|
+
export declare const MIN_REACT_VERSION = ">=16.14.0";
|
|
3
|
+
export declare function checkDeps(ctx: any, next: () => void, options: any): Promise<void>;
|
|
4
|
+
export declare const checkPackage: (packageJSON: any, packageName: any) => boolean;
|
|
2
5
|
export declare function installDeps(ctx: any, next: () => void, options: any): Promise<void>;
|
|
3
6
|
export declare function tinaSetup(_ctx: any, next: () => void, _options: any): Promise<void>;
|
|
4
7
|
export declare function successMessage(ctx: any, next: () => void, options: any): Promise<void>;
|
|
@@ -11,6 +11,6 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
export declare const adminPage = "import { TinaAdmin } from 'tinacms';\nexport default TinaAdmin;\n";
|
|
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
|
|
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<PageSection heading=\"Oscula mihi\" content=\"Lorem 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
16
|
export declare const AppJsContent: (usingSrc: boolean, extraImports?: string) => string;
|
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.10";
|
|
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"));
|
|
@@ -417,13 +417,31 @@ export default defineSchema({
|
|
|
417
417
|
name: "title",
|
|
418
418
|
},
|
|
419
419
|
{
|
|
420
|
-
type: "
|
|
420
|
+
type: "rich-text",
|
|
421
421
|
label: "Blog Post Body",
|
|
422
422
|
name: "body",
|
|
423
423
|
isBody: true,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
424
|
+
templates: [
|
|
425
|
+
{
|
|
426
|
+
name: "PageSection",
|
|
427
|
+
label: "Page Section",
|
|
428
|
+
fields: [
|
|
429
|
+
{
|
|
430
|
+
type: "string",
|
|
431
|
+
name: "heading",
|
|
432
|
+
label: "Heading",
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
type: "string",
|
|
436
|
+
name: "content",
|
|
437
|
+
label: "Content",
|
|
438
|
+
ui: {
|
|
439
|
+
component: "textarea"
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
},
|
|
444
|
+
]
|
|
427
445
|
},
|
|
428
446
|
],
|
|
429
447
|
},
|
|
@@ -840,14 +858,12 @@ title: Vote For Pedro
|
|
|
840
858
|
|
|
841
859
|
# Dixi gaude Arethusa
|
|
842
860
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
Lorem markdownum numerabilis armentorum platanus, cultros coniunx sibi per
|
|
861
|
+
<PageSection heading="Oscula mihi" content="Lorem markdownum numerabilis armentorum platanus, cultros coniunx sibi per
|
|
846
862
|
silvas, nostris clausit sequemur diverso scopulosque. Fecit tum alta sed non
|
|
847
863
|
falcato murmura, geminas donata Amyntore, quoque Nox. Invitam inquit, modo
|
|
848
864
|
nocte; ut ignis faciemque manes in imagine sinistra ut mucrone non ramos
|
|
849
865
|
sepulcro supplex. Crescentesque populos motura, fit cumque. Verumque est; retro
|
|
850
|
-
sibi tristia bracchia Aetola telae caruerunt et.
|
|
866
|
+
sibi tristia bracchia Aetola telae caruerunt et."/>
|
|
851
867
|
|
|
852
868
|
|
|
853
869
|
## Mutato fefellimus sit demisit aut alterius sollicito
|
|
@@ -868,6 +884,7 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
868
884
|
import Head from "next/head";
|
|
869
885
|
import { createGlobalStyle } from "styled-components";
|
|
870
886
|
import { useTina } from "tinacms/dist/edit-state";
|
|
887
|
+
import { TinaMarkdown } from 'tinacms/dist/rich-text'
|
|
871
888
|
|
|
872
889
|
const query = gql\`
|
|
873
890
|
query BlogPostQuery($relativePath: String!) {
|
|
@@ -913,8 +930,7 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
913
930
|
text-decoration: underline;
|
|
914
931
|
}
|
|
915
932
|
\`;
|
|
916
|
-
|
|
917
|
-
// Use the props returned by get static props (this can be deleted when the edit provider and tina-wrapper are moved to _app.js)
|
|
933
|
+
|
|
918
934
|
const BlogPage = (props) => {
|
|
919
935
|
const { data } = useTina({
|
|
920
936
|
query,
|
|
@@ -933,12 +949,6 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
933
949
|
crossOrigin="anonymous"
|
|
934
950
|
referrerPolicy="no-referrer"
|
|
935
951
|
/>
|
|
936
|
-
{/* Marked CDN */}
|
|
937
|
-
<script
|
|
938
|
-
type="text/javascript"
|
|
939
|
-
crossOrigin="anonymous"
|
|
940
|
-
src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.0.0/marked.min.js"
|
|
941
|
-
/>
|
|
942
952
|
</Head>
|
|
943
953
|
<div>
|
|
944
954
|
<div
|
|
@@ -949,12 +959,9 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
949
959
|
<h1 className="text-3xl m-8 text-center leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl">
|
|
950
960
|
{data.getPostsDocument.data.title}
|
|
951
961
|
</h1>
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
content={window.marked.parse(data.getPostsDocument.data.body)}
|
|
956
|
-
></ContentSection>
|
|
957
|
-
)}
|
|
962
|
+
<ContentSection
|
|
963
|
+
content={data.getPostsDocument.data.body}
|
|
964
|
+
></ContentSection>
|
|
958
965
|
</div>
|
|
959
966
|
<div className="bg-green-100 text-center">
|
|
960
967
|
Lost and looking for a place to start?
|
|
@@ -1019,6 +1026,19 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
1019
1026
|
};
|
|
1020
1027
|
|
|
1021
1028
|
export default BlogPage;
|
|
1029
|
+
|
|
1030
|
+
const PageSection = props => {
|
|
1031
|
+
return (
|
|
1032
|
+
<>
|
|
1033
|
+
<h2>{ props.heading }</h2>
|
|
1034
|
+
<p>{ props.content }</p>
|
|
1035
|
+
</>
|
|
1036
|
+
)
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
const components = {
|
|
1040
|
+
PageSection: PageSection,
|
|
1041
|
+
}
|
|
1022
1042
|
|
|
1023
1043
|
const ContentSection = ({ content }) => {
|
|
1024
1044
|
return (
|
|
@@ -1128,7 +1148,7 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
1128
1148
|
</div>
|
|
1129
1149
|
<div className="relative px-4 sm:px-6 lg:px-8">
|
|
1130
1150
|
<div className="text-lg max-w-prose mx-auto">
|
|
1131
|
-
<
|
|
1151
|
+
<TinaMarkdown components={components} content={content}/>
|
|
1132
1152
|
<GlobalStyle />
|
|
1133
1153
|
</div>
|
|
1134
1154
|
</div>
|
|
@@ -1218,6 +1238,60 @@ async function initTina(ctx, next, options) {
|
|
|
1218
1238
|
logger.info(successText("Setting up Tina..."));
|
|
1219
1239
|
next();
|
|
1220
1240
|
}
|
|
1241
|
+
var MIN_REACT_VERSION = ">=16.14.0";
|
|
1242
|
+
async function checkDeps(ctx, next, options) {
|
|
1243
|
+
const bar = new import_progress.default("Checking dependencies. :prog", 1);
|
|
1244
|
+
const packageJSON = JSON.parse((await import_fs_extra4.default.readFileSync(packageJSONPath)).toString());
|
|
1245
|
+
if (!checkPackage(packageJSON, "react") || !checkPackage(packageJSON, "react-dom")) {
|
|
1246
|
+
const message = `Unable to initialize Tina due to outdated dependencies, try upgrading the following packages:
|
|
1247
|
+
"react@${MIN_REACT_VERSION}"
|
|
1248
|
+
"react-dom@${MIN_REACT_VERSION}"
|
|
1249
|
+
|
|
1250
|
+
Then re-rerun "@tinacms/cli init"`;
|
|
1251
|
+
throw new Error(message);
|
|
1252
|
+
}
|
|
1253
|
+
bar.tick({
|
|
1254
|
+
prog: "\u2705"
|
|
1255
|
+
});
|
|
1256
|
+
logger.level = "fatal";
|
|
1257
|
+
next();
|
|
1258
|
+
}
|
|
1259
|
+
var checkPackage = (packageJSON, packageName) => {
|
|
1260
|
+
let strippedVersion;
|
|
1261
|
+
Object.entries(packageJSON.dependencies).map(([depPackageName, version2]) => {
|
|
1262
|
+
if (depPackageName === packageName) {
|
|
1263
|
+
strippedVersion = version2.replace(/^[^a-zA-Z0-9]*|[^a-zA-Z0-9]*$/g, "");
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
return checkVersion(strippedVersion);
|
|
1267
|
+
};
|
|
1268
|
+
var checkVersion = (version2) => {
|
|
1269
|
+
const majorMin = 16;
|
|
1270
|
+
const minorMin = 14;
|
|
1271
|
+
const parts = version2.split(".");
|
|
1272
|
+
const major = Number(parts[0]);
|
|
1273
|
+
const minor = Number(parts[1]);
|
|
1274
|
+
if (parts.length === 1) {
|
|
1275
|
+
if (isNaN(major)) {
|
|
1276
|
+
return true;
|
|
1277
|
+
} else if (major > majorMin) {
|
|
1278
|
+
return true;
|
|
1279
|
+
} else {
|
|
1280
|
+
return false;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
if (major > majorMin) {
|
|
1284
|
+
return true;
|
|
1285
|
+
} else if (major === majorMin) {
|
|
1286
|
+
if (minor >= minorMin) {
|
|
1287
|
+
return true;
|
|
1288
|
+
} else {
|
|
1289
|
+
return false;
|
|
1290
|
+
}
|
|
1291
|
+
} else {
|
|
1292
|
+
return false;
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1221
1295
|
async function installDeps(ctx, next, options) {
|
|
1222
1296
|
const bar = new import_progress.default("Installing Tina packages. This might take a moment... :prog", 2);
|
|
1223
1297
|
const deps = ["tinacms", "styled-components", "@tinacms/cli"];
|
|
@@ -1233,6 +1307,7 @@ async function installDeps(ctx, next, options) {
|
|
|
1233
1307
|
next();
|
|
1234
1308
|
}
|
|
1235
1309
|
var baseDir = process.cwd();
|
|
1310
|
+
var packageJSONPath = import_path5.default.join(baseDir, "package.json");
|
|
1236
1311
|
var blogContentPath = import_path5.default.join(baseDir, "content", "posts");
|
|
1237
1312
|
var blogPostPath = import_path5.default.join(blogContentPath, "HelloWorld.md");
|
|
1238
1313
|
var TinaFolder = import_path5.default.join(baseDir, ".tina");
|
|
@@ -1633,6 +1708,7 @@ var baseCmds = [
|
|
|
1633
1708
|
options: [experimentalDatalayer, noTelemetryOption],
|
|
1634
1709
|
description: "Add Tina Cloud to an existing project",
|
|
1635
1710
|
action: (options) => chain([
|
|
1711
|
+
checkDeps,
|
|
1636
1712
|
initTina,
|
|
1637
1713
|
installDeps,
|
|
1638
1714
|
async (_ctx, next) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@graphql-codegen/visitor-plugin-common": "^2.4.0",
|
|
58
58
|
"@graphql-tools/graphql-file-loader": "^7.2.0",
|
|
59
59
|
"@graphql-tools/load": "^7.3.2",
|
|
60
|
-
"@tinacms/datalayer": "0.0
|
|
61
|
-
"@tinacms/graphql": "0.59.
|
|
60
|
+
"@tinacms/datalayer": "0.1.0",
|
|
61
|
+
"@tinacms/graphql": "0.59.9",
|
|
62
62
|
"@tinacms/metrics": "0.0.2",
|
|
63
63
|
"@yarnpkg/esbuild-plugin-pnp": "^2.0.1-rc.3",
|
|
64
64
|
"add": "^2.0.6",
|