@tinacms/cli 2.1.4 → 2.1.6
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/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Cli, Builtins } from "clipanion";
|
|
3
3
|
|
|
4
4
|
// package.json
|
|
5
|
-
var version = "2.1.
|
|
5
|
+
var version = "2.1.6";
|
|
6
6
|
|
|
7
7
|
// src/next/commands/dev-command/index.ts
|
|
8
8
|
import path8 from "path";
|
|
@@ -417,6 +417,38 @@ var loadGraphQLDocuments = async (globPath) => {
|
|
|
417
417
|
import { transform } from "esbuild";
|
|
418
418
|
import { mapUserFields } from "@tinacms/graphql";
|
|
419
419
|
import normalizePath from "normalize-path";
|
|
420
|
+
|
|
421
|
+
// src/next/codegen/stripSearchTokenFromConfig.ts
|
|
422
|
+
function stripSearchTokenFromConfig(config2) {
|
|
423
|
+
const cfg = config2;
|
|
424
|
+
if (!cfg?.search) {
|
|
425
|
+
return config2;
|
|
426
|
+
}
|
|
427
|
+
const search = cfg.search;
|
|
428
|
+
const tina = search?.tina;
|
|
429
|
+
if (tina) {
|
|
430
|
+
const { indexerToken, ...safeSearchConfig } = tina;
|
|
431
|
+
const newConfig = {};
|
|
432
|
+
for (const key of Object.keys(cfg)) {
|
|
433
|
+
if (key === "search") {
|
|
434
|
+
newConfig.search = { tina: safeSearchConfig };
|
|
435
|
+
} else {
|
|
436
|
+
newConfig[key] = cfg[key];
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return newConfig;
|
|
440
|
+
} else {
|
|
441
|
+
const newConfig = {};
|
|
442
|
+
for (const key of Object.keys(cfg)) {
|
|
443
|
+
if (key !== "search") {
|
|
444
|
+
newConfig[key] = cfg[key];
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return newConfig;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// src/next/codegen/index.ts
|
|
420
452
|
var TINA_HOST = "content.tinajs.io";
|
|
421
453
|
var Codegen = class {
|
|
422
454
|
configManager;
|
|
@@ -487,16 +519,9 @@ var Codegen = class {
|
|
|
487
519
|
"_graphql.json",
|
|
488
520
|
JSON.stringify(this.graphqlSchemaDoc)
|
|
489
521
|
);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
this.tinaSchema.schema.config = {
|
|
494
|
-
...rest,
|
|
495
|
-
search: { tina: safeSearchConfig }
|
|
496
|
-
};
|
|
497
|
-
} else {
|
|
498
|
-
this.tinaSchema.schema.config = rest;
|
|
499
|
-
}
|
|
522
|
+
this.tinaSchema.schema.config = stripSearchTokenFromConfig(
|
|
523
|
+
this.tinaSchema.schema.config
|
|
524
|
+
);
|
|
500
525
|
await this.writeConfigFile(
|
|
501
526
|
"_schema.json",
|
|
502
527
|
JSON.stringify(this.tinaSchema.schema)
|
|
@@ -1006,13 +1031,15 @@ var ConfigManager = class {
|
|
|
1006
1031
|
this.contentRootPath = this.rootPath;
|
|
1007
1032
|
}
|
|
1008
1033
|
this.generatedFolderPathContentRepo = path3.join(
|
|
1009
|
-
await this.getTinaFolderPath(this.contentRootPath
|
|
1034
|
+
await this.getTinaFolderPath(this.contentRootPath, {
|
|
1035
|
+
isContentRoot: this.hasSeparateContentRoot()
|
|
1036
|
+
}),
|
|
1010
1037
|
GENERATED_FOLDER
|
|
1011
1038
|
);
|
|
1012
1039
|
this.spaMainPath = require2.resolve("@tinacms/app");
|
|
1013
1040
|
this.spaRootPath = path3.join(this.spaMainPath, "..", "..");
|
|
1014
1041
|
}
|
|
1015
|
-
async getTinaFolderPath(rootPath) {
|
|
1042
|
+
async getTinaFolderPath(rootPath, { isContentRoot } = {}) {
|
|
1016
1043
|
const tinaFolderPath = path3.join(rootPath, TINA_FOLDER);
|
|
1017
1044
|
const tinaFolderExists = await fs2.pathExists(tinaFolderPath);
|
|
1018
1045
|
if (tinaFolderExists) {
|
|
@@ -1025,6 +1052,11 @@ var ConfigManager = class {
|
|
|
1025
1052
|
this.isUsingLegacyFolder = true;
|
|
1026
1053
|
return legacyFolderPath;
|
|
1027
1054
|
}
|
|
1055
|
+
if (isContentRoot) {
|
|
1056
|
+
throw new Error(
|
|
1057
|
+
`Unable to find a ${chalk3.cyan("tina/")} folder in your content root at ${chalk3.cyan(rootPath)}. When using localContentPath, the content directory must contain a ${chalk3.cyan("tina/")} folder for generated files. Create one with: mkdir ${path3.join(rootPath, TINA_FOLDER)}`
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1028
1060
|
throw new Error(
|
|
1029
1061
|
`Unable to find Tina folder, if you're working in folder outside of the Tina config be sure to specify --rootPath`
|
|
1030
1062
|
);
|
|
@@ -1546,6 +1578,29 @@ import {
|
|
|
1546
1578
|
splitVendorChunkPlugin
|
|
1547
1579
|
} from "vite";
|
|
1548
1580
|
|
|
1581
|
+
// src/next/vite/filterPublicEnv.ts
|
|
1582
|
+
function filterPublicEnv(env = process.env) {
|
|
1583
|
+
const publicEnv = {};
|
|
1584
|
+
Object.keys(env).forEach((key) => {
|
|
1585
|
+
if (key.startsWith("TINA_PUBLIC_") || key.startsWith("NEXT_PUBLIC_") || key === "NODE_ENV" || key === "HEAD") {
|
|
1586
|
+
try {
|
|
1587
|
+
const value = env[key];
|
|
1588
|
+
if (typeof value === "string") {
|
|
1589
|
+
publicEnv[key] = value;
|
|
1590
|
+
} else {
|
|
1591
|
+
publicEnv[key] = JSON.stringify(value);
|
|
1592
|
+
}
|
|
1593
|
+
} catch (error) {
|
|
1594
|
+
console.warn(
|
|
1595
|
+
`Could not stringify public env process.env.${key} env variable`
|
|
1596
|
+
);
|
|
1597
|
+
console.warn(error);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
return publicEnv;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1549
1604
|
// src/next/vite/tailwind.ts
|
|
1550
1605
|
import path4 from "node:path";
|
|
1551
1606
|
import aspectRatio from "@tailwindcss/aspect-ratio";
|
|
@@ -1878,23 +1933,7 @@ var createConfig = async ({
|
|
|
1878
1933
|
noWatch,
|
|
1879
1934
|
rollupOptions
|
|
1880
1935
|
}) => {
|
|
1881
|
-
const publicEnv =
|
|
1882
|
-
Object.keys(process.env).forEach((key) => {
|
|
1883
|
-
if (key.startsWith("TINA_PUBLIC_") || key.startsWith("NEXT_PUBLIC_") || key === "NODE_ENV" || key === "HEAD") {
|
|
1884
|
-
try {
|
|
1885
|
-
if (typeof process.env[key] === "string") {
|
|
1886
|
-
publicEnv[key] = process.env[key];
|
|
1887
|
-
} else {
|
|
1888
|
-
publicEnv[key] = JSON.stringify(process.env[key]);
|
|
1889
|
-
}
|
|
1890
|
-
} catch (error) {
|
|
1891
|
-
console.warn(
|
|
1892
|
-
`Could not stringify public env process.env.${key} env variable`
|
|
1893
|
-
);
|
|
1894
|
-
console.warn(error);
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
});
|
|
1936
|
+
const publicEnv = filterPublicEnv();
|
|
1898
1937
|
const staticMediaPath = path5.join(
|
|
1899
1938
|
configManager.generatedFolderPath,
|
|
1900
1939
|
"static-media.json"
|
|
@@ -2544,7 +2583,8 @@ var DevCommand = class extends BaseCommand {
|
|
|
2544
2583
|
);
|
|
2545
2584
|
if (configManager.hasSeparateContentRoot()) {
|
|
2546
2585
|
const rootPath = await configManager.getTinaFolderPath(
|
|
2547
|
-
configManager.contentRootPath
|
|
2586
|
+
configManager.contentRootPath,
|
|
2587
|
+
{ isContentRoot: true }
|
|
2548
2588
|
);
|
|
2549
2589
|
const filePath = path8.join(rootPath, tinaLockFilename);
|
|
2550
2590
|
await fs7.ensureFile(filePath);
|
|
@@ -2720,6 +2760,13 @@ ${dangerText(e.message)}
|
|
|
2720
2760
|
// },
|
|
2721
2761
|
]
|
|
2722
2762
|
});
|
|
2763
|
+
if (configManager?.config?.telemetry === "anonymous") {
|
|
2764
|
+
logger.info(
|
|
2765
|
+
`
|
|
2766
|
+
\u{1F4CA} Note: TinaCMS now collects anonymous telemetry regarding usage. More information on TinaCMS Telemetry: https://tina.io/telemetry
|
|
2767
|
+
`
|
|
2768
|
+
);
|
|
2769
|
+
}
|
|
2723
2770
|
await this.startSubCommand();
|
|
2724
2771
|
}
|
|
2725
2772
|
watchContentFiles(configManager, database, databaseLock, searchIndexer) {
|
|
@@ -2820,23 +2867,6 @@ async function sleepAndCallFunc({
|
|
|
2820
2867
|
// src/next/commands/build-command/server.ts
|
|
2821
2868
|
import { build as build2 } from "vite";
|
|
2822
2869
|
var buildProductionSpa = async (configManager, database, apiURL) => {
|
|
2823
|
-
const publicEnv = {};
|
|
2824
|
-
Object.keys(process.env).forEach((key) => {
|
|
2825
|
-
if (key.startsWith("TINA_PUBLIC_") || key.startsWith("NEXT_PUBLIC_") || key === "NODE_ENV" || key === "HEAD") {
|
|
2826
|
-
try {
|
|
2827
|
-
if (typeof process.env[key] === "string") {
|
|
2828
|
-
publicEnv[key] = process.env[key];
|
|
2829
|
-
} else {
|
|
2830
|
-
publicEnv[key] = JSON.stringify(process.env[key]);
|
|
2831
|
-
}
|
|
2832
|
-
} catch (error) {
|
|
2833
|
-
console.warn(
|
|
2834
|
-
`Could not stringify public env process.env.${key} env variable`
|
|
2835
|
-
);
|
|
2836
|
-
console.warn(error);
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
});
|
|
2840
2870
|
const config2 = await createConfig({
|
|
2841
2871
|
plugins: [transformTsxPlugin({ configManager }), viteTransformExtension()],
|
|
2842
2872
|
configManager,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strips `indexerToken` from `search.tina` before serialization to
|
|
3
|
+
* _schema.json / tina-lock.json.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/tinacms/tinacms/security/advisories/GHSA-4qrm-9h4r-v2fx
|
|
6
|
+
*/
|
|
7
|
+
export declare function stripSearchTokenFromConfig<T extends object>(config: T): T;
|
|
@@ -54,7 +54,9 @@ export declare class ConfigManager {
|
|
|
54
54
|
hasSeparateContentRoot(): boolean;
|
|
55
55
|
shouldSkipSDK(): boolean;
|
|
56
56
|
processConfig(): Promise<void>;
|
|
57
|
-
getTinaFolderPath(rootPath:
|
|
57
|
+
getTinaFolderPath(rootPath: string, { isContentRoot }?: {
|
|
58
|
+
isContentRoot?: boolean;
|
|
59
|
+
}): Promise<string>;
|
|
58
60
|
getTinaGraphQLVersion(): {
|
|
59
61
|
fullVersion: string;
|
|
60
62
|
major: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filters env vars to only those safe for client-side bundles.
|
|
3
|
+
*
|
|
4
|
+
* Allows: TINA_PUBLIC_*, NEXT_PUBLIC_*, NODE_ENV, HEAD.
|
|
5
|
+
* Everything else is excluded to prevent leaking secrets.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/tinacms/tinacms/security/advisories/GHSA-pc2q-jcxq-rjrr
|
|
8
|
+
*/
|
|
9
|
+
export declare function filterPublicEnv(env?: Record<string, string | undefined>): Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.6",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/progress": "^2.0.7",
|
|
42
42
|
"@types/prompts": "^2.4.9",
|
|
43
43
|
"jest": "^29.7.0",
|
|
44
|
-
"@tinacms/scripts": "1.
|
|
44
|
+
"@tinacms/scripts": "1.5.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@graphql-codegen/core": "^2.6.8",
|
|
@@ -88,12 +88,12 @@
|
|
|
88
88
|
"vite": "^4.5.9",
|
|
89
89
|
"yup": "^1.6.1",
|
|
90
90
|
"zod": "^3.24.2",
|
|
91
|
-
"@tinacms/
|
|
91
|
+
"@tinacms/app": "2.3.25",
|
|
92
|
+
"@tinacms/schema-tools": "2.6.0",
|
|
93
|
+
"@tinacms/graphql": "2.1.2",
|
|
92
94
|
"@tinacms/metrics": "2.0.1",
|
|
93
|
-
"@tinacms/
|
|
94
|
-
"
|
|
95
|
-
"@tinacms/search": "1.2.2",
|
|
96
|
-
"tinacms": "3.4.1"
|
|
95
|
+
"@tinacms/search": "1.2.3",
|
|
96
|
+
"tinacms": "3.5.0"
|
|
97
97
|
},
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"registry": "https://registry.npmjs.org"
|