@tinacms/cli 0.60.6 → 0.60.7
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,16 @@
|
|
|
1
1
|
# tinacms-cli
|
|
2
2
|
|
|
3
|
+
## 0.60.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9e436f145: Update CLI to use defineConfig
|
|
8
|
+
- 851e4be73: Update tina init to use the new way of laying out tina config
|
|
9
|
+
- cc99e4309: update admin file path to /pages/admin.js to support the hash router
|
|
10
|
+
- @tinacms/datalayer@0.0.2
|
|
11
|
+
- @tinacms/graphql@0.59.7
|
|
12
|
+
- @tinacms/metrics@0.0.2
|
|
13
|
+
|
|
3
14
|
## 0.60.6
|
|
4
15
|
|
|
5
16
|
### 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";
|
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.7";
|
|
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"));
|
|
@@ -402,7 +402,7 @@ var import_esbuild = __toModule(require("esbuild"));
|
|
|
402
402
|
|
|
403
403
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/defaultSchema.ts
|
|
404
404
|
var defaultSchema = `
|
|
405
|
-
import { defineSchema } from "
|
|
405
|
+
import { defineSchema, defineConfig } from "tinacms";
|
|
406
406
|
|
|
407
407
|
export default defineSchema({
|
|
408
408
|
collections: [
|
|
@@ -429,6 +429,43 @@ export default defineSchema({
|
|
|
429
429
|
},
|
|
430
430
|
],
|
|
431
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
|
+
});
|
|
432
469
|
`;
|
|
433
470
|
|
|
434
471
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/lib/getSchemaPath.ts
|
|
@@ -1098,41 +1135,58 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
1098
1135
|
};
|
|
1099
1136
|
|
|
1100
1137
|
`;
|
|
1101
|
-
var AppJsContent = (extraImports) => `import
|
|
1102
|
-
|
|
1103
|
-
const TinaCMS = dynamic(() => import('tinacms'), { ssr: false })
|
|
1138
|
+
var AppJsContent = (usingSrc, extraImports) => `import Tina from '${usingSrc ? "../" : ""}../.tina/components/TinaDynamicProvider.js'
|
|
1139
|
+
|
|
1104
1140
|
${extraImports || ""}
|
|
1141
|
+
const App = ({ Component, pageProps }) => {
|
|
1142
|
+
return (
|
|
1143
|
+
<Tina>
|
|
1144
|
+
<Component {...pageProps} />
|
|
1145
|
+
</Tina>
|
|
1146
|
+
)
|
|
1147
|
+
}
|
|
1105
1148
|
|
|
1106
|
-
|
|
1107
|
-
const apiURL =
|
|
1108
|
-
process.env.NODE_ENV == "development"
|
|
1109
|
-
? "http://localhost:4001/graphql"
|
|
1110
|
-
: \`https://content.tinajs.io/content/\${process.env.NEXT_PUBLIC_TINA_CLIENT_ID}/github/\${branch}\`;
|
|
1149
|
+
export default App
|
|
1111
1150
|
|
|
1112
|
-
|
|
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 }) => {
|
|
1113
1177
|
return (
|
|
1114
1178
|
<>
|
|
1115
|
-
<TinaEditProvider
|
|
1116
|
-
|
|
1117
|
-
<TinaCMS
|
|
1118
|
-
apiURL={apiURL}
|
|
1119
|
-
|
|
1120
|
-
>
|
|
1121
|
-
<Component {...pageProps} />
|
|
1122
|
-
</TinaCMS>
|
|
1123
|
-
}
|
|
1124
|
-
>
|
|
1125
|
-
<Component {...pageProps} />
|
|
1179
|
+
<TinaEditProvider editMode={<TinaProvider>{children}</TinaProvider>}>
|
|
1180
|
+
{children}
|
|
1126
1181
|
</TinaEditProvider>
|
|
1127
1182
|
</>
|
|
1128
1183
|
)
|
|
1129
1184
|
}
|
|
1130
1185
|
|
|
1131
|
-
export default
|
|
1186
|
+
export default DynamicTina
|
|
1132
1187
|
`;
|
|
1133
1188
|
|
|
1134
1189
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
1135
|
-
var import_chalk2 = __toModule(require("chalk"));
|
|
1136
1190
|
function execShellCommand(cmd) {
|
|
1137
1191
|
const exec = require("child_process").exec;
|
|
1138
1192
|
return new Promise((resolve2, _reject) => {
|
|
@@ -1165,26 +1219,32 @@ async function installDeps(ctx, next, options) {
|
|
|
1165
1219
|
next();
|
|
1166
1220
|
}
|
|
1167
1221
|
var baseDir = process.cwd();
|
|
1168
|
-
var TinaWrapperPathDir = import_path5.default.join(baseDir, "components");
|
|
1169
|
-
var TinaWrapperPath = import_path5.default.join(TinaWrapperPathDir, "tina-wrapper.tsx");
|
|
1170
1222
|
var blogContentPath = import_path5.default.join(baseDir, "content", "posts");
|
|
1171
1223
|
var blogPostPath = import_path5.default.join(blogContentPath, "HelloWorld.md");
|
|
1172
|
-
|
|
1224
|
+
var TinaFolder = import_path5.default.join(baseDir, ".tina");
|
|
1225
|
+
var componentFolder = import_path5.default.join(TinaFolder, "components");
|
|
1226
|
+
var TinaProviderPath = import_path5.default.join(componentFolder, "TinaProvider.js");
|
|
1227
|
+
var TinaDynamicProvider = import_path5.default.join(componentFolder, "TinaDynamicProvider.js");
|
|
1228
|
+
async function tinaSetup(_ctx, next, _options) {
|
|
1173
1229
|
const useingSrc = import_fs_extra4.default.pathExistsSync(import_path5.default.join(baseDir, "src"));
|
|
1174
1230
|
if (!import_fs_extra4.default.pathExistsSync(blogPostPath)) {
|
|
1175
1231
|
logger.info(logText("Adding a content folder..."));
|
|
1176
1232
|
import_fs_extra4.default.mkdirpSync(blogContentPath);
|
|
1177
1233
|
import_fs_extra4.default.writeFileSync(blogPostPath, blogPost);
|
|
1178
1234
|
}
|
|
1235
|
+
if (!import_fs_extra4.default.existsSync(TinaProviderPath) && !import_fs_extra4.default.existsSync(TinaDynamicProvider)) {
|
|
1236
|
+
import_fs_extra4.default.mkdirpSync(componentFolder);
|
|
1237
|
+
import_fs_extra4.default.writeFileSync(TinaProviderPath, TinaProvider);
|
|
1238
|
+
import_fs_extra4.default.writeFileSync(TinaDynamicProvider, TinaProviderDynamic);
|
|
1239
|
+
}
|
|
1179
1240
|
logger.level = "info";
|
|
1180
1241
|
const pagesPath = import_path5.default.join(baseDir, useingSrc ? "src" : "", "pages");
|
|
1181
1242
|
const appPath = import_path5.default.join(pagesPath, "_app.js");
|
|
1182
1243
|
const appPathTS = import_path5.default.join(pagesPath, "_app.tsx");
|
|
1183
1244
|
const appExtension = import_fs_extra4.default.existsSync(appPath) ? ".js" : ".tsx";
|
|
1184
|
-
let wrapper = false;
|
|
1185
1245
|
if (!import_fs_extra4.default.pathExistsSync(appPath) && !import_fs_extra4.default.pathExistsSync(appPathTS)) {
|
|
1186
1246
|
logger.info(logText("Adding _app.js ... \u2705"));
|
|
1187
|
-
import_fs_extra4.default.writeFileSync(appPath, AppJsContent());
|
|
1247
|
+
import_fs_extra4.default.writeFileSync(appPath, AppJsContent(useingSrc));
|
|
1188
1248
|
} else {
|
|
1189
1249
|
const override = await (0, import_prompts.default)({
|
|
1190
1250
|
name: "res",
|
|
@@ -1199,11 +1259,10 @@ async function tinaSetup(ctx, next, options) {
|
|
|
1199
1259
|
...fileContent.toString().matchAll(/^.*import.*\.css("|').*$/gm)
|
|
1200
1260
|
];
|
|
1201
1261
|
const primaryMatches = matches.map((x) => x[0]);
|
|
1202
|
-
import_fs_extra4.default.writeFileSync(appPathWithExtension, AppJsContent(primaryMatches.join("\n")));
|
|
1262
|
+
import_fs_extra4.default.writeFileSync(appPathWithExtension, AppJsContent(useingSrc, primaryMatches.join("\n")));
|
|
1203
1263
|
} else {
|
|
1204
|
-
wrapper = true;
|
|
1205
1264
|
logger.info(dangerText(`Heads up, to enable live-editing you'll need to wrap your page or site in Tina:
|
|
1206
|
-
`, warnText(AppJsContent())));
|
|
1265
|
+
`, warnText(AppJsContent(useingSrc))));
|
|
1207
1266
|
}
|
|
1208
1267
|
}
|
|
1209
1268
|
const tinaBlogPagePath = import_path5.default.join(pagesPath, "demo", "blog");
|
|
@@ -1224,9 +1283,9 @@ async function tinaSetup(ctx, next, options) {
|
|
|
1224
1283
|
})
|
|
1225
1284
|
}), null, 2);
|
|
1226
1285
|
(0, import_fs_extra4.writeFileSync)(packagePath, newPack);
|
|
1227
|
-
const adminPath = import_path5.default.join(pagesPath, "admin
|
|
1286
|
+
const adminPath = import_path5.default.join(pagesPath, "admin.js");
|
|
1228
1287
|
if (import_fs_extra4.default.pathExistsSync(import_path5.default.join(pagesPath, "admin"))) {
|
|
1229
|
-
logger.warn(`Unable to add /pages/admin
|
|
1288
|
+
logger.warn(`Unable to add /pages/admin.js, this path already exists.
|
|
1230
1289
|
Learn more about toggling edit-mode at https://tina.io/docs/tinacms-context/#manually-toggling-edit-mode`);
|
|
1231
1290
|
return next();
|
|
1232
1291
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.7",
|
|
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",
|