@tinacms/cli 1.5.11 → 1.5.12
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
|
@@ -28,13 +28,13 @@ __export(src_exports, {
|
|
|
28
28
|
default: () => src_default
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(src_exports);
|
|
31
|
-
var
|
|
31
|
+
var import_clipanion7 = require("clipanion");
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
|
-
var version = "1.5.
|
|
34
|
+
var version = "1.5.12";
|
|
35
35
|
|
|
36
36
|
// src/next/commands/dev-command/index.ts
|
|
37
|
-
var
|
|
37
|
+
var import_clipanion2 = require("clipanion");
|
|
38
38
|
var import_fs_extra4 = __toESM(require("fs-extra"));
|
|
39
39
|
var import_path7 = __toESM(require("path"));
|
|
40
40
|
var import_chokidar = __toESM(require("chokidar"));
|
|
@@ -92,15 +92,16 @@ ${message}
|
|
|
92
92
|
len - strip(ln).length
|
|
93
93
|
)}${import_chalk.default.gray(bar)}`
|
|
94
94
|
).join("\n");
|
|
95
|
+
const underscoreLen = len - title.length - 1 > 0 ? len - title.length - 1 : 0;
|
|
95
96
|
process.stdout.write(
|
|
96
97
|
`${import_chalk.default.gray(bar)}
|
|
97
98
|
${import_chalk.default.green("\u25CB")} ${import_chalk.default.reset(
|
|
98
99
|
title
|
|
99
|
-
)} ${import_chalk.default.gray(
|
|
100
|
-
"\u2500".repeat(len - title.length - 1) + "\u256E"
|
|
101
|
-
)}
|
|
100
|
+
)} ${import_chalk.default.gray("\u2500".repeat(underscoreLen) + "\u256E")}
|
|
102
101
|
${msg}
|
|
103
|
-
${import_chalk.default.gray(
|
|
102
|
+
${import_chalk.default.gray(
|
|
103
|
+
"\u251C" + "\u2500".repeat(len + 2) + "\u256F"
|
|
104
|
+
)}
|
|
104
105
|
`
|
|
105
106
|
);
|
|
106
107
|
};
|
|
@@ -451,6 +452,48 @@ var loaders = {
|
|
|
451
452
|
};
|
|
452
453
|
|
|
453
454
|
// src/next/commands/dev-command/html.ts
|
|
455
|
+
var errorHTML = `<style type="text/css">
|
|
456
|
+
#no-assets-placeholder body {
|
|
457
|
+
font-family: sans-serif;
|
|
458
|
+
font-size: 16px;
|
|
459
|
+
line-height: 1.4;
|
|
460
|
+
color: #333;
|
|
461
|
+
background-color: #f5f5f5;
|
|
462
|
+
}
|
|
463
|
+
#no-assets-placeholder {
|
|
464
|
+
max-width: 600px;
|
|
465
|
+
margin: 0 auto;
|
|
466
|
+
padding: 40px;
|
|
467
|
+
text-align: center;
|
|
468
|
+
background-color: #fff;
|
|
469
|
+
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
|
|
470
|
+
}
|
|
471
|
+
#no-assets-placeholder h1 {
|
|
472
|
+
font-size: 24px;
|
|
473
|
+
margin-bottom: 20px;
|
|
474
|
+
}
|
|
475
|
+
#no-assets-placeholder p {
|
|
476
|
+
margin-bottom: 10px;
|
|
477
|
+
}
|
|
478
|
+
#no-assets-placeholder a {
|
|
479
|
+
color: #0077cc;
|
|
480
|
+
text-decoration: none;
|
|
481
|
+
}
|
|
482
|
+
#no-assets-placeholder a:hover {
|
|
483
|
+
text-decoration: underline;
|
|
484
|
+
}
|
|
485
|
+
</style>
|
|
486
|
+
<div id="no-assets-placeholder">
|
|
487
|
+
<h1>Failed loading TinaCMS assets</h1>
|
|
488
|
+
<p>
|
|
489
|
+
Your TinaCMS configuration may be misconfigured, and we could not load
|
|
490
|
+
the assets for this page.
|
|
491
|
+
</p>
|
|
492
|
+
<p>
|
|
493
|
+
Please visit <a href="https://tina.io/docs/tina-cloud/faq/#how-do-i-resolve-failed-loading-tinacms-assets-error">this doc</a> for help.
|
|
494
|
+
</p>
|
|
495
|
+
</div>
|
|
496
|
+
</div>`.trim().replace(/[\r\n\s]+/g, " ");
|
|
454
497
|
var devHTML = (port) => `<!DOCTYPE html>
|
|
455
498
|
<html lang="en">
|
|
456
499
|
<head>
|
|
@@ -468,9 +511,16 @@ var devHTML = (port) => `<!DOCTYPE html>
|
|
|
468
511
|
window.__vite_plugin_react_preamble_installed__ = true
|
|
469
512
|
<\/script>
|
|
470
513
|
<script type="module" src="http://localhost:${port}/@vite/client"><\/script>
|
|
514
|
+
<script>
|
|
515
|
+
function handleLoadError() {
|
|
516
|
+
// Assets have failed to load
|
|
517
|
+
document.getElementById('root').innerHTML = '${errorHTML}';
|
|
518
|
+
}
|
|
519
|
+
<\/script>
|
|
471
520
|
<script
|
|
472
521
|
type="module"
|
|
473
522
|
src="http://localhost:${port}/src/main.tsx"
|
|
523
|
+
onerror="handleLoadError()"
|
|
474
524
|
><\/script>
|
|
475
525
|
<body class="tina-tailwind">
|
|
476
526
|
<div id="root"></div>
|
|
@@ -779,9 +829,15 @@ var createConfig = async ({
|
|
|
779
829
|
} else {
|
|
780
830
|
alias["CLIENT_IMPORT"] = configManager.isUsingTs() ? configManager.generatedTypesTSFilePath : configManager.generatedTypesJSFilePath;
|
|
781
831
|
}
|
|
832
|
+
let basePath;
|
|
833
|
+
if (configManager.config.build.basePath) {
|
|
834
|
+
basePath = configManager.config.build.basePath;
|
|
835
|
+
}
|
|
782
836
|
const config3 = {
|
|
783
837
|
root: configManager.spaRootPath,
|
|
784
|
-
base: `/${(0, import_normalize_path2.default)(
|
|
838
|
+
base: `/${basePath ? `${(0, import_normalize_path2.default)(basePath)}/` : ""}${(0, import_normalize_path2.default)(
|
|
839
|
+
configManager.config.build.outputFolder
|
|
840
|
+
)}/`,
|
|
785
841
|
appType: "spa",
|
|
786
842
|
resolve: {
|
|
787
843
|
alias,
|
|
@@ -1323,10 +1379,12 @@ var Codegen = class {
|
|
|
1323
1379
|
port,
|
|
1324
1380
|
queryDoc,
|
|
1325
1381
|
fragDoc,
|
|
1382
|
+
isLocal,
|
|
1326
1383
|
graphqlSchemaDoc,
|
|
1327
1384
|
tinaSchema,
|
|
1328
1385
|
lookup
|
|
1329
1386
|
}) {
|
|
1387
|
+
this.isLocal = isLocal;
|
|
1330
1388
|
this.graphqlSchemaDoc = graphqlSchemaDoc;
|
|
1331
1389
|
this.configManager = configManager;
|
|
1332
1390
|
this.port = port;
|
|
@@ -1359,7 +1417,6 @@ var Codegen = class {
|
|
|
1359
1417
|
await unlinkIfExists(this.configManager.generatedFragmentsFilePath);
|
|
1360
1418
|
}
|
|
1361
1419
|
async execute() {
|
|
1362
|
-
console.log("Generating Tina Files");
|
|
1363
1420
|
await this.writeConfigFile(
|
|
1364
1421
|
"_graphql.json",
|
|
1365
1422
|
JSON.stringify(this.graphqlSchemaDoc)
|
|
@@ -1369,7 +1426,10 @@ var Codegen = class {
|
|
|
1369
1426
|
JSON.stringify(this.tinaSchema.schema)
|
|
1370
1427
|
);
|
|
1371
1428
|
await this.writeConfigFile("_lookup.json", JSON.stringify(this.lookup));
|
|
1372
|
-
const apiURL = this.
|
|
1429
|
+
const { apiURL, localUrl, tinaCloudUrl } = this._createApiUrl();
|
|
1430
|
+
this.apiURL = apiURL;
|
|
1431
|
+
this.localUrl = localUrl;
|
|
1432
|
+
this.productionUrl = tinaCloudUrl;
|
|
1373
1433
|
if (this.configManager.shouldSkipSDK()) {
|
|
1374
1434
|
await this.removeGeneratedFilesIfExists();
|
|
1375
1435
|
return apiURL;
|
|
@@ -1420,7 +1480,7 @@ var Codegen = class {
|
|
|
1420
1480
|
}
|
|
1421
1481
|
return apiURL;
|
|
1422
1482
|
}
|
|
1423
|
-
|
|
1483
|
+
_createApiUrl() {
|
|
1424
1484
|
var _a, _b, _c, _d;
|
|
1425
1485
|
const branch = (_a = this.configManager.config) == null ? void 0 : _a.branch;
|
|
1426
1486
|
const clientId = (_b = this.configManager.config) == null ? void 0 : _b.clientId;
|
|
@@ -1441,11 +1501,20 @@ var Codegen = class {
|
|
|
1441
1501
|
)}. Please visit https://tina.io/docs/tina-cloud/connecting-site/ for more information`
|
|
1442
1502
|
);
|
|
1443
1503
|
}
|
|
1444
|
-
let
|
|
1504
|
+
let localUrl = `http://localhost:${this.port}/graphql`;
|
|
1505
|
+
let tinaCloudUrl = `${baseUrl}/${version2}/content/${clientId}/github/${branch}`;
|
|
1506
|
+
let apiURL = this.isLocal ? `http://localhost:${this.port}/graphql` : `${baseUrl}/${version2}/content/${clientId}/github/${branch}`;
|
|
1445
1507
|
if (this.configManager.config.contentApiUrlOverride) {
|
|
1446
1508
|
apiURL = this.configManager.config.contentApiUrlOverride;
|
|
1509
|
+
localUrl = apiURL;
|
|
1510
|
+
tinaCloudUrl = apiURL;
|
|
1447
1511
|
}
|
|
1448
|
-
return apiURL;
|
|
1512
|
+
return { apiURL, localUrl, tinaCloudUrl };
|
|
1513
|
+
}
|
|
1514
|
+
getApiURL() {
|
|
1515
|
+
if (!this.apiURL)
|
|
1516
|
+
throw new Error("apiURL not set. Please run execute() first");
|
|
1517
|
+
return this.apiURL;
|
|
1449
1518
|
}
|
|
1450
1519
|
async genClient() {
|
|
1451
1520
|
var _a;
|
|
@@ -1509,7 +1578,58 @@ var unlinkIfExists = async (filepath) => {
|
|
|
1509
1578
|
}
|
|
1510
1579
|
};
|
|
1511
1580
|
|
|
1512
|
-
// src/next/
|
|
1581
|
+
// src/next/database.ts
|
|
1582
|
+
var import_graphql7 = require("@tinacms/graphql");
|
|
1583
|
+
var import_readable_stream = require("readable-stream");
|
|
1584
|
+
var import_net = require("net");
|
|
1585
|
+
var import_many_level = require("many-level");
|
|
1586
|
+
var import_memory_level = require("memory-level");
|
|
1587
|
+
var createDBServer = (port) => {
|
|
1588
|
+
const levelHost = new import_many_level.ManyLevelHost(
|
|
1589
|
+
new import_memory_level.MemoryLevel({
|
|
1590
|
+
valueEncoding: "json"
|
|
1591
|
+
})
|
|
1592
|
+
);
|
|
1593
|
+
const dbServer = (0, import_net.createServer)(function(socket) {
|
|
1594
|
+
return (0, import_readable_stream.pipeline)(socket, levelHost.createRpcStream(), socket, () => {
|
|
1595
|
+
});
|
|
1596
|
+
});
|
|
1597
|
+
dbServer.once("error", (err) => {
|
|
1598
|
+
if ((err == null ? void 0 : err.code) === "EADDRINUSE") {
|
|
1599
|
+
throw new Error(
|
|
1600
|
+
`Tina Dev server is already in use. Datalayer server is busy on port ${port}`
|
|
1601
|
+
);
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
dbServer.listen(port);
|
|
1605
|
+
};
|
|
1606
|
+
async function createAndInitializeDatabase(configManager, datalayerPort, bridgeOverride) {
|
|
1607
|
+
let database;
|
|
1608
|
+
const bridge = bridgeOverride || new import_graphql7.FilesystemBridge(configManager.rootPath, configManager.contentRootPath);
|
|
1609
|
+
if (configManager.hasSelfHostedConfig() && configManager.config.contentApiUrlOverride) {
|
|
1610
|
+
database = await configManager.loadDatabaseFile();
|
|
1611
|
+
database.bridge = bridge;
|
|
1612
|
+
} else {
|
|
1613
|
+
if (configManager.hasSelfHostedConfig() && !configManager.config.contentApiUrlOverride) {
|
|
1614
|
+
logger.warn(
|
|
1615
|
+
`Found a database config file at ${configManager.printRelativePath(
|
|
1616
|
+
configManager.selfHostedDatabaseFilePath
|
|
1617
|
+
)} but there was no "contentApiUrlOverride" set. Falling back to built-in datalayer`
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
const level = new import_graphql7.TinaLevelClient(datalayerPort);
|
|
1621
|
+
level.openConnection();
|
|
1622
|
+
database = (0, import_graphql7.createDatabase)({
|
|
1623
|
+
bridge,
|
|
1624
|
+
level,
|
|
1625
|
+
tinaDirectory: configManager.isUsingLegacyFolder ? LEGACY_TINA_FOLDER : TINA_FOLDER
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
return database;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
// src/next/commands/baseCommands.ts
|
|
1632
|
+
var import_clipanion = require("clipanion");
|
|
1513
1633
|
var import_chalk4 = __toESM(require("chalk"));
|
|
1514
1634
|
|
|
1515
1635
|
// src/utils/start-subprocess.ts
|
|
@@ -1561,56 +1681,6 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
1561
1681
|
}
|
|
1562
1682
|
};
|
|
1563
1683
|
|
|
1564
|
-
// src/next/database.ts
|
|
1565
|
-
var import_graphql7 = require("@tinacms/graphql");
|
|
1566
|
-
var import_readable_stream = require("readable-stream");
|
|
1567
|
-
var import_net = require("net");
|
|
1568
|
-
var import_many_level = require("many-level");
|
|
1569
|
-
var import_memory_level = require("memory-level");
|
|
1570
|
-
var createDBServer = (port) => {
|
|
1571
|
-
const levelHost = new import_many_level.ManyLevelHost(
|
|
1572
|
-
new import_memory_level.MemoryLevel({
|
|
1573
|
-
valueEncoding: "json"
|
|
1574
|
-
})
|
|
1575
|
-
);
|
|
1576
|
-
const dbServer = (0, import_net.createServer)(function(socket) {
|
|
1577
|
-
return (0, import_readable_stream.pipeline)(socket, levelHost.createRpcStream(), socket, () => {
|
|
1578
|
-
});
|
|
1579
|
-
});
|
|
1580
|
-
dbServer.once("error", (err) => {
|
|
1581
|
-
if ((err == null ? void 0 : err.code) === "EADDRINUSE") {
|
|
1582
|
-
throw new Error(
|
|
1583
|
-
`Tina Dev server is already in use. Datalayer server is busy on port ${port}`
|
|
1584
|
-
);
|
|
1585
|
-
}
|
|
1586
|
-
});
|
|
1587
|
-
dbServer.listen(port);
|
|
1588
|
-
};
|
|
1589
|
-
async function createAndInitializeDatabase(configManager, datalayerPort, bridgeOverride) {
|
|
1590
|
-
let database;
|
|
1591
|
-
const bridge = bridgeOverride || new import_graphql7.FilesystemBridge(configManager.rootPath, configManager.contentRootPath);
|
|
1592
|
-
if (configManager.hasSelfHostedConfig() && configManager.config.contentApiUrlOverride) {
|
|
1593
|
-
database = await configManager.loadDatabaseFile();
|
|
1594
|
-
database.bridge = bridge;
|
|
1595
|
-
} else {
|
|
1596
|
-
if (configManager.hasSelfHostedConfig() && !configManager.config.contentApiUrlOverride) {
|
|
1597
|
-
logger.warn(
|
|
1598
|
-
`Found a database config file at ${configManager.printRelativePath(
|
|
1599
|
-
configManager.selfHostedDatabaseFilePath
|
|
1600
|
-
)} but there was no "contentApiUrlOverride" set. Falling back to built-in datalayer`
|
|
1601
|
-
);
|
|
1602
|
-
}
|
|
1603
|
-
const level = new import_graphql7.TinaLevelClient(datalayerPort);
|
|
1604
|
-
level.openConnection();
|
|
1605
|
-
database = (0, import_graphql7.createDatabase)({
|
|
1606
|
-
bridge,
|
|
1607
|
-
level,
|
|
1608
|
-
tinaDirectory: configManager.isUsingLegacyFolder ? LEGACY_TINA_FOLDER : TINA_FOLDER
|
|
1609
|
-
});
|
|
1610
|
-
}
|
|
1611
|
-
return database;
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
1684
|
// src/utils/spinner.ts
|
|
1615
1685
|
var import_cli_spinner = require("cli-spinner");
|
|
1616
1686
|
async function localSpin({
|
|
@@ -1647,10 +1717,16 @@ function spin({
|
|
|
1647
1717
|
}
|
|
1648
1718
|
}
|
|
1649
1719
|
|
|
1650
|
-
// src/next/commands/
|
|
1651
|
-
var
|
|
1720
|
+
// src/next/commands/baseCommands.ts
|
|
1721
|
+
var BaseCommand = class extends import_clipanion.Command {
|
|
1652
1722
|
constructor() {
|
|
1653
1723
|
super(...arguments);
|
|
1724
|
+
this.experimentalDataLayer = import_clipanion.Option.Boolean("--experimentalData", {
|
|
1725
|
+
description: "DEPRECATED - Build the server with additional data querying capabilities"
|
|
1726
|
+
});
|
|
1727
|
+
this.isomorphicGitBridge = import_clipanion.Option.Boolean("--isomorphicGitBridge", {
|
|
1728
|
+
description: "DEPRECATED - Enable Isomorphic Git Bridge Implementation"
|
|
1729
|
+
});
|
|
1654
1730
|
this.port = import_clipanion.Option.String("-p,--port", "4001", {
|
|
1655
1731
|
description: "Specify a port to run the server on. (default 4001)"
|
|
1656
1732
|
});
|
|
@@ -1663,21 +1739,9 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1663
1739
|
this.rootPath = import_clipanion.Option.String("--rootPath", {
|
|
1664
1740
|
description: "Specify the root directory to run the CLI from (defaults to current working directory)"
|
|
1665
1741
|
});
|
|
1666
|
-
this.watchFolders = import_clipanion.Option.String("-w,--watchFolders", {
|
|
1667
|
-
description: "DEPRECATED - a list of folders (relative to where this is being run) that the cli will watch for changes"
|
|
1668
|
-
});
|
|
1669
|
-
this.isomorphicGitBridge = import_clipanion.Option.Boolean("--isomorphicGitBridge", {
|
|
1670
|
-
description: "DEPRECATED - Enable Isomorphic Git Bridge Implementation"
|
|
1671
|
-
});
|
|
1672
|
-
this.experimentalDataLayer = import_clipanion.Option.Boolean("--experimentalData", {
|
|
1673
|
-
description: "DEPRECATED - Build the server with additional data querying capabilities"
|
|
1674
|
-
});
|
|
1675
1742
|
this.verbose = import_clipanion.Option.Boolean("-v,--verbose", false, {
|
|
1676
1743
|
description: "increase verbosity of logged output"
|
|
1677
1744
|
});
|
|
1678
|
-
this.noWatch = import_clipanion.Option.Boolean("--noWatch", false, {
|
|
1679
|
-
description: "Don't regenerate config on file changes"
|
|
1680
|
-
});
|
|
1681
1745
|
this.noSDK = import_clipanion.Option.Boolean("--noSDK", false, {
|
|
1682
1746
|
description: "DEPRECATED - This should now be set in the config at client.skip = true'. Don't generate the generated client SDK"
|
|
1683
1747
|
});
|
|
@@ -1685,17 +1749,25 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1685
1749
|
description: "Disable anonymous telemetry that is collected"
|
|
1686
1750
|
});
|
|
1687
1751
|
}
|
|
1688
|
-
async
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
async execute() {
|
|
1694
|
-
if (this.watchFolders) {
|
|
1695
|
-
logger.warn(
|
|
1696
|
-
"--watchFolders has been deprecated, imports from your Tina config file will be watched automatically. If you still need it please open a ticket at https://github.com/tinacms/tinacms/issues"
|
|
1697
|
-
);
|
|
1752
|
+
async startSubCommand() {
|
|
1753
|
+
let subProc;
|
|
1754
|
+
if (this.subCommand) {
|
|
1755
|
+
subProc = await startSubprocess2({ command: this.subCommand });
|
|
1756
|
+
logger.info(`Starting subprocess: ${import_chalk4.default.cyan(this.subCommand)}`);
|
|
1698
1757
|
}
|
|
1758
|
+
function exitHandler(options, exitCode) {
|
|
1759
|
+
if (subProc) {
|
|
1760
|
+
subProc.kill();
|
|
1761
|
+
}
|
|
1762
|
+
process.exit();
|
|
1763
|
+
}
|
|
1764
|
+
process.on("exit", exitHandler);
|
|
1765
|
+
process.on("SIGINT", exitHandler);
|
|
1766
|
+
process.on("SIGUSR1", exitHandler);
|
|
1767
|
+
process.on("SIGUSR2", exitHandler);
|
|
1768
|
+
process.on("uncaughtException", exitHandler);
|
|
1769
|
+
}
|
|
1770
|
+
logDeprecationWarnings() {
|
|
1699
1771
|
if (this.isomorphicGitBridge) {
|
|
1700
1772
|
logger.warn("--isomorphicGitBridge has been deprecated");
|
|
1701
1773
|
}
|
|
@@ -1709,11 +1781,63 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1709
1781
|
"--noSDK has been deprecated, and will be unsupported in a future release. This should be set in the config at client.skip = true"
|
|
1710
1782
|
);
|
|
1711
1783
|
}
|
|
1784
|
+
}
|
|
1785
|
+
async indexContentWithSpinner({
|
|
1786
|
+
database,
|
|
1787
|
+
graphQLSchema,
|
|
1788
|
+
tinaSchema
|
|
1789
|
+
}) {
|
|
1790
|
+
const warnings = [];
|
|
1791
|
+
await spin({
|
|
1792
|
+
waitFor: async () => {
|
|
1793
|
+
const res = await database.indexContent({
|
|
1794
|
+
graphQLSchema,
|
|
1795
|
+
tinaSchema
|
|
1796
|
+
});
|
|
1797
|
+
warnings.push(...res.warnings);
|
|
1798
|
+
},
|
|
1799
|
+
text: "Indexing local files"
|
|
1800
|
+
});
|
|
1801
|
+
if (warnings.length > 0) {
|
|
1802
|
+
logger.warn(`Indexing completed with ${warnings.length} warning(s)`);
|
|
1803
|
+
warnings.forEach((warning) => {
|
|
1804
|
+
logger.warn(warnText(`${warning}`));
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
};
|
|
1809
|
+
|
|
1810
|
+
// src/next/commands/dev-command/index.ts
|
|
1811
|
+
var DevCommand = class extends BaseCommand {
|
|
1812
|
+
constructor() {
|
|
1813
|
+
super(...arguments);
|
|
1814
|
+
this.watchFolders = import_clipanion2.Option.String("-w,--watchFolders", {
|
|
1815
|
+
description: "DEPRECATED - a list of folders (relative to where this is being run) that the cli will watch for changes"
|
|
1816
|
+
});
|
|
1817
|
+
this.noWatch = import_clipanion2.Option.Boolean("--noWatch", false, {
|
|
1818
|
+
description: "Don't regenerate config on file changes"
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
async catch(error) {
|
|
1822
|
+
logger.error("Error occured during tinacms dev");
|
|
1823
|
+
console.error(error);
|
|
1824
|
+
process.exit(1);
|
|
1825
|
+
}
|
|
1826
|
+
logDeprecationWarnings() {
|
|
1827
|
+
super.logDeprecationWarnings();
|
|
1828
|
+
if (this.watchFolders) {
|
|
1829
|
+
logger.warn(
|
|
1830
|
+
"--watchFolders has been deprecated, imports from your Tina config file will be watched automatically. If you still need it please open a ticket at https://github.com/tinacms/tinacms/issues"
|
|
1831
|
+
);
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
async execute() {
|
|
1712
1835
|
const configManager = new ConfigManager({
|
|
1713
1836
|
rootPath: this.rootPath,
|
|
1714
1837
|
legacyNoSDK: this.noSDK
|
|
1715
1838
|
});
|
|
1716
1839
|
logger.info("Starting Tina Dev Server");
|
|
1840
|
+
this.logDeprecationWarnings();
|
|
1717
1841
|
createDBServer(Number(this.datalayerPort));
|
|
1718
1842
|
let database = null;
|
|
1719
1843
|
const setup = async ({ firstTime }) => {
|
|
@@ -1741,6 +1865,7 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1741
1865
|
}
|
|
1742
1866
|
const { tinaSchema, graphQLSchema, lookup, queryDoc, fragDoc } = await (0, import_graphql8.buildSchema)(configManager.config);
|
|
1743
1867
|
const codegen2 = new Codegen({
|
|
1868
|
+
isLocal: true,
|
|
1744
1869
|
configManager,
|
|
1745
1870
|
port: Number(this.port),
|
|
1746
1871
|
queryDoc,
|
|
@@ -1769,24 +1894,11 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1769
1894
|
if (!this.noWatch) {
|
|
1770
1895
|
this.watchQueries(configManager, async () => await codegen2.execute());
|
|
1771
1896
|
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
graphQLSchema,
|
|
1777
|
-
tinaSchema,
|
|
1778
|
-
lookup
|
|
1779
|
-
});
|
|
1780
|
-
warnings.push(...res.warnings);
|
|
1781
|
-
},
|
|
1782
|
-
text: "Indexing local files"
|
|
1897
|
+
await this.indexContentWithSpinner({
|
|
1898
|
+
database,
|
|
1899
|
+
graphQLSchema,
|
|
1900
|
+
tinaSchema
|
|
1783
1901
|
});
|
|
1784
|
-
if (warnings.length > 0) {
|
|
1785
|
-
logger.warn(`Indexing completed with ${warnings.length} warning(s)`);
|
|
1786
|
-
warnings.forEach((warning) => {
|
|
1787
|
-
logger.warn(warnText(`${warning}`));
|
|
1788
|
-
});
|
|
1789
|
-
}
|
|
1790
1902
|
return { apiURL: apiURL2, database };
|
|
1791
1903
|
};
|
|
1792
1904
|
const { apiURL } = await setup({ firstTime: true });
|
|
@@ -1872,22 +1984,7 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1872
1984
|
...summaryItems
|
|
1873
1985
|
]
|
|
1874
1986
|
});
|
|
1875
|
-
|
|
1876
|
-
if (this.subCommand) {
|
|
1877
|
-
subProc = await startSubprocess2({ command: this.subCommand });
|
|
1878
|
-
logger.info(`Starting subprocess: ${import_chalk4.default.cyan(this.subCommand)}`);
|
|
1879
|
-
}
|
|
1880
|
-
function exitHandler(options, exitCode) {
|
|
1881
|
-
if (subProc) {
|
|
1882
|
-
subProc.kill();
|
|
1883
|
-
}
|
|
1884
|
-
process.exit();
|
|
1885
|
-
}
|
|
1886
|
-
process.on("exit", exitHandler);
|
|
1887
|
-
process.on("SIGINT", exitHandler);
|
|
1888
|
-
process.on("SIGUSR1", exitHandler);
|
|
1889
|
-
process.on("SIGUSR2", exitHandler);
|
|
1890
|
-
process.on("uncaughtException", exitHandler);
|
|
1987
|
+
await this.startSubCommand();
|
|
1891
1988
|
}
|
|
1892
1989
|
watchContentFiles(configManager, database) {
|
|
1893
1990
|
const collectionContentFiles = [];
|
|
@@ -1929,7 +2026,7 @@ var DevCommand = class extends import_clipanion.Command {
|
|
|
1929
2026
|
}
|
|
1930
2027
|
};
|
|
1931
2028
|
DevCommand.paths = [["dev"], ["server:start"]];
|
|
1932
|
-
DevCommand.usage =
|
|
2029
|
+
DevCommand.usage = import_clipanion2.Command.Usage({
|
|
1933
2030
|
category: `Commands`,
|
|
1934
2031
|
description: `Builds Tina and starts the dev server`,
|
|
1935
2032
|
examples: [
|
|
@@ -1940,7 +2037,7 @@ DevCommand.usage = import_clipanion.Command.Usage({
|
|
|
1940
2037
|
|
|
1941
2038
|
// src/next/commands/build-command/index.ts
|
|
1942
2039
|
var import_node_fetch2 = __toESM(require("node-fetch"));
|
|
1943
|
-
var
|
|
2040
|
+
var import_clipanion3 = require("clipanion");
|
|
1944
2041
|
var import_progress2 = __toESM(require("progress"));
|
|
1945
2042
|
var import_fs_extra5 = __toESM(require("fs-extra"));
|
|
1946
2043
|
var import_graphql9 = require("@tinacms/graphql");
|
|
@@ -2080,64 +2177,31 @@ var waitForDB = async (config3, apiUrl, verbose) => {
|
|
|
2080
2177
|
};
|
|
2081
2178
|
|
|
2082
2179
|
// src/next/commands/build-command/index.ts
|
|
2083
|
-
var BuildCommand = class extends
|
|
2180
|
+
var BuildCommand = class extends BaseCommand {
|
|
2084
2181
|
constructor() {
|
|
2085
2182
|
super(...arguments);
|
|
2086
|
-
this.
|
|
2087
|
-
description: "
|
|
2088
|
-
});
|
|
2089
|
-
this.verbose = import_clipanion2.Option.Boolean("-v,--verbose", false, {
|
|
2090
|
-
description: "increase verbosity of logged output"
|
|
2183
|
+
this.localOption = import_clipanion3.Option.Boolean("--local", {
|
|
2184
|
+
description: "Starts local Graphql server and builds the local client instead of production client"
|
|
2091
2185
|
});
|
|
2092
|
-
this.
|
|
2093
|
-
description: "DEPRECATED - This should now be set in the config at client.skip = true'. Don't generate the generated client SDK"
|
|
2094
|
-
});
|
|
2095
|
-
this.datalayerPort = import_clipanion2.Option.String("--datalayer-port", "9000", {
|
|
2096
|
-
description: "Specify a port to run the datalayer server on. (default 9000)"
|
|
2097
|
-
});
|
|
2098
|
-
this.isomorphicGitBridge = import_clipanion2.Option.Boolean("--isomorphicGitBridge", {
|
|
2099
|
-
description: "DEPRECATED - Enable Isomorphic Git Bridge Implementation"
|
|
2100
|
-
});
|
|
2101
|
-
this.localOption = import_clipanion2.Option.Boolean("--local", {
|
|
2102
|
-
description: "DEPRECATED: Uses the local file system graphql server"
|
|
2103
|
-
});
|
|
2104
|
-
this.experimentalDataLayer = import_clipanion2.Option.Boolean("--experimentalData", {
|
|
2105
|
-
description: "DEPRECATED - Build the server with additional data querying capabilities"
|
|
2106
|
-
});
|
|
2107
|
-
this.noTelemetry = import_clipanion2.Option.Boolean("--noTelemetry", false, {
|
|
2108
|
-
description: "Disable anonymous telemetry that is collected"
|
|
2109
|
-
});
|
|
2110
|
-
this.tinaGraphQLVersion = import_clipanion2.Option.String("--tina-graphql-version", {
|
|
2186
|
+
this.tinaGraphQLVersion = import_clipanion3.Option.String("--tina-graphql-version", {
|
|
2111
2187
|
description: "Specify the version of @tinacms/graphql to use (defaults to latest)"
|
|
2112
2188
|
});
|
|
2189
|
+
this.skipCloudChecks = import_clipanion3.Option.Boolean("--skip-cloud-checks", false, {
|
|
2190
|
+
description: "Skips checking the provided cloud config."
|
|
2191
|
+
});
|
|
2113
2192
|
}
|
|
2114
2193
|
async catch(error) {
|
|
2115
2194
|
console.error(error);
|
|
2116
2195
|
process.exit(1);
|
|
2117
2196
|
}
|
|
2118
2197
|
async execute() {
|
|
2198
|
+
logger.info("Starting Tina build");
|
|
2199
|
+
this.logDeprecationWarnings();
|
|
2119
2200
|
const configManager = new ConfigManager({
|
|
2120
2201
|
rootPath: this.rootPath,
|
|
2121
2202
|
tinaGraphQLVersion: this.tinaGraphQLVersion,
|
|
2122
2203
|
legacyNoSDK: this.noSDK
|
|
2123
2204
|
});
|
|
2124
|
-
logger.info("Starting Tina build");
|
|
2125
|
-
if (this.isomorphicGitBridge) {
|
|
2126
|
-
logger.warn("--isomorphicGitBridge has been deprecated");
|
|
2127
|
-
}
|
|
2128
|
-
if (this.experimentalDataLayer) {
|
|
2129
|
-
logger.warn(
|
|
2130
|
-
"--experimentalDataLayer has been deprecated, the data layer is now built-in automatically"
|
|
2131
|
-
);
|
|
2132
|
-
}
|
|
2133
|
-
if (this.localOption) {
|
|
2134
|
-
logger.warn("--local has been deprecated");
|
|
2135
|
-
}
|
|
2136
|
-
if (this.noSDK) {
|
|
2137
|
-
logger.warn(
|
|
2138
|
-
"--noSDK has been deprecated, and will be unsupported in a future release. This should be set in the config at client.skip = true"
|
|
2139
|
-
);
|
|
2140
|
-
}
|
|
2141
2205
|
try {
|
|
2142
2206
|
await configManager.processConfig();
|
|
2143
2207
|
} catch (e) {
|
|
@@ -2145,6 +2209,7 @@ var BuildCommand = class extends import_clipanion2.Command {
|
|
|
2145
2209
|
logger.error("Unable to build, please fix your Tina config and try again");
|
|
2146
2210
|
process.exit(1);
|
|
2147
2211
|
}
|
|
2212
|
+
let server;
|
|
2148
2213
|
createDBServer(Number(this.datalayerPort));
|
|
2149
2214
|
const database = await createAndInitializeDatabase(
|
|
2150
2215
|
configManager,
|
|
@@ -2153,6 +2218,8 @@ var BuildCommand = class extends import_clipanion2.Command {
|
|
|
2153
2218
|
const { queryDoc, fragDoc, graphQLSchema, tinaSchema, lookup } = await (0, import_graphql9.buildSchema)(configManager.config);
|
|
2154
2219
|
const codegen2 = new Codegen({
|
|
2155
2220
|
configManager,
|
|
2221
|
+
port: this.localOption ? Number(this.port) : void 0,
|
|
2222
|
+
isLocal: this.localOption,
|
|
2156
2223
|
queryDoc,
|
|
2157
2224
|
fragDoc,
|
|
2158
2225
|
graphqlSchemaDoc: graphQLSchema,
|
|
@@ -2160,12 +2227,27 @@ var BuildCommand = class extends import_clipanion2.Command {
|
|
|
2160
2227
|
lookup
|
|
2161
2228
|
});
|
|
2162
2229
|
const apiURL = await codegen2.execute();
|
|
2163
|
-
if (
|
|
2164
|
-
await this.
|
|
2165
|
-
|
|
2166
|
-
|
|
2230
|
+
if (this.localOption) {
|
|
2231
|
+
await this.indexContentWithSpinner({
|
|
2232
|
+
database,
|
|
2233
|
+
graphQLSchema,
|
|
2234
|
+
tinaSchema
|
|
2235
|
+
});
|
|
2236
|
+
server = await createDevServer(configManager, database, apiURL, true);
|
|
2237
|
+
await server.listen(Number(this.port));
|
|
2238
|
+
console.log("server listening on port", this.port);
|
|
2239
|
+
}
|
|
2240
|
+
const skipCloudChecks = this.skipCloudChecks || configManager.hasSelfHostedConfig();
|
|
2241
|
+
if (!skipCloudChecks) {
|
|
2242
|
+
await this.checkClientInfo(configManager, codegen2.productionUrl);
|
|
2243
|
+
await waitForDB(configManager.config, codegen2.productionUrl, false);
|
|
2244
|
+
await this.checkGraphqlSchema(
|
|
2245
|
+
configManager,
|
|
2246
|
+
database,
|
|
2247
|
+
codegen2.productionUrl
|
|
2248
|
+
);
|
|
2167
2249
|
}
|
|
2168
|
-
await buildProductionSpa(configManager, database,
|
|
2250
|
+
await buildProductionSpa(configManager, database, codegen2.productionUrl);
|
|
2169
2251
|
await import_fs_extra5.default.outputFile(
|
|
2170
2252
|
configManager.outputGitignorePath,
|
|
2171
2253
|
"index.html\nassets/"
|
|
@@ -2203,7 +2285,11 @@ var BuildCommand = class extends import_clipanion2.Command {
|
|
|
2203
2285
|
...summaryItems
|
|
2204
2286
|
]
|
|
2205
2287
|
});
|
|
2206
|
-
|
|
2288
|
+
if (this.subCommand) {
|
|
2289
|
+
await this.startSubCommand();
|
|
2290
|
+
} else {
|
|
2291
|
+
process.exit();
|
|
2292
|
+
}
|
|
2207
2293
|
}
|
|
2208
2294
|
async checkClientInfo(configManager, apiURL) {
|
|
2209
2295
|
const { config: config3 } = configManager;
|
|
@@ -2332,7 +2418,7 @@ Additional info: Branch: ${config3.branch}, Client ID: ${config3.clientId} `;
|
|
|
2332
2418
|
}
|
|
2333
2419
|
};
|
|
2334
2420
|
BuildCommand.paths = [["build"]];
|
|
2335
|
-
BuildCommand.usage =
|
|
2421
|
+
BuildCommand.usage = import_clipanion3.Command.Usage({
|
|
2336
2422
|
category: `Commands`,
|
|
2337
2423
|
description: `Build the CMS and autogenerated modules for usage with Tina Cloud`
|
|
2338
2424
|
});
|
|
@@ -2396,7 +2482,7 @@ var fetchRemoteGraphqlSchema = async ({
|
|
|
2396
2482
|
};
|
|
2397
2483
|
|
|
2398
2484
|
// src/next/commands/audit-command/index.ts
|
|
2399
|
-
var
|
|
2485
|
+
var import_clipanion4 = require("clipanion");
|
|
2400
2486
|
var import_graphql12 = require("@tinacms/graphql");
|
|
2401
2487
|
|
|
2402
2488
|
// src/next/commands/audit-command/audit.ts
|
|
@@ -2561,25 +2647,25 @@ function filterObject(obj) {
|
|
|
2561
2647
|
|
|
2562
2648
|
// src/next/commands/audit-command/index.ts
|
|
2563
2649
|
var import_graphql13 = require("@tinacms/graphql");
|
|
2564
|
-
var AuditCommand = class extends
|
|
2650
|
+
var AuditCommand = class extends import_clipanion4.Command {
|
|
2565
2651
|
constructor() {
|
|
2566
2652
|
super(...arguments);
|
|
2567
|
-
this.rootPath =
|
|
2653
|
+
this.rootPath = import_clipanion4.Option.String("--rootPath", {
|
|
2568
2654
|
description: "Specify the root directory to run the CLI from"
|
|
2569
2655
|
});
|
|
2570
|
-
this.verbose =
|
|
2656
|
+
this.verbose = import_clipanion4.Option.Boolean("-v,--verbose", false, {
|
|
2571
2657
|
description: "increase verbosity of logged output"
|
|
2572
2658
|
});
|
|
2573
|
-
this.clean =
|
|
2659
|
+
this.clean = import_clipanion4.Option.Boolean("--clean", false, {
|
|
2574
2660
|
description: "Clean the output"
|
|
2575
2661
|
});
|
|
2576
|
-
this.useDefaultValues =
|
|
2662
|
+
this.useDefaultValues = import_clipanion4.Option.Boolean("--useDefaultValues", false, {
|
|
2577
2663
|
description: "When cleaning the output, use defaults on the config"
|
|
2578
2664
|
});
|
|
2579
|
-
this.noTelemetry =
|
|
2665
|
+
this.noTelemetry = import_clipanion4.Option.Boolean("--noTelemetry", false, {
|
|
2580
2666
|
description: "Disable anonymous telemetry that is collected"
|
|
2581
2667
|
});
|
|
2582
|
-
this.datalayerPort =
|
|
2668
|
+
this.datalayerPort = import_clipanion4.Option.String("--datalayer-port", "9000", {
|
|
2583
2669
|
description: "Specify a port to run the datalayer server on. (default 9000)"
|
|
2584
2670
|
});
|
|
2585
2671
|
}
|
|
@@ -2637,13 +2723,13 @@ var AuditCommand = class extends import_clipanion3.Command {
|
|
|
2637
2723
|
}
|
|
2638
2724
|
};
|
|
2639
2725
|
AuditCommand.paths = [["audit"]];
|
|
2640
|
-
AuditCommand.usage =
|
|
2726
|
+
AuditCommand.usage = import_clipanion4.Command.Usage({
|
|
2641
2727
|
category: `Commands`,
|
|
2642
2728
|
description: `Audit config and content files`
|
|
2643
2729
|
});
|
|
2644
2730
|
|
|
2645
2731
|
// src/next/commands/init-command/index.ts
|
|
2646
|
-
var
|
|
2732
|
+
var import_clipanion6 = require("clipanion");
|
|
2647
2733
|
|
|
2648
2734
|
// src/cmds/init/index.ts
|
|
2649
2735
|
var import_path11 = __toESM(require("path"));
|
|
@@ -3763,16 +3849,16 @@ var rewriteTemplateKeysInDocs = (args) => {
|
|
|
3763
3849
|
};
|
|
3764
3850
|
|
|
3765
3851
|
// src/next/commands/codemod-command/index.ts
|
|
3766
|
-
var
|
|
3852
|
+
var import_clipanion5 = require("clipanion");
|
|
3767
3853
|
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
3768
3854
|
var import_path10 = __toESM(require("path"));
|
|
3769
|
-
var CodemodCommand = class extends
|
|
3855
|
+
var CodemodCommand = class extends import_clipanion5.Command {
|
|
3770
3856
|
constructor() {
|
|
3771
3857
|
super(...arguments);
|
|
3772
|
-
this.rootPath =
|
|
3858
|
+
this.rootPath = import_clipanion5.Option.String("--rootPath", {
|
|
3773
3859
|
description: "Specify the root directory to run the CLI from"
|
|
3774
3860
|
});
|
|
3775
|
-
this.verbose =
|
|
3861
|
+
this.verbose = import_clipanion5.Option.Boolean("-v,--verbose", false, {
|
|
3776
3862
|
description: "increase verbosity of logged output"
|
|
3777
3863
|
});
|
|
3778
3864
|
}
|
|
@@ -3797,7 +3883,7 @@ var CodemodCommand = class extends import_clipanion4.Command {
|
|
|
3797
3883
|
}
|
|
3798
3884
|
};
|
|
3799
3885
|
CodemodCommand.paths = [["codemod"], ["codemod", "move-tina-folder"]];
|
|
3800
|
-
CodemodCommand.usage =
|
|
3886
|
+
CodemodCommand.usage = import_clipanion5.Command.Usage({
|
|
3801
3887
|
category: `Commands`,
|
|
3802
3888
|
description: `Use codemods for various Tina tasks`
|
|
3803
3889
|
});
|
|
@@ -4285,16 +4371,16 @@ function execShellCommand(cmd) {
|
|
|
4285
4371
|
}
|
|
4286
4372
|
|
|
4287
4373
|
// src/next/commands/init-command/index.ts
|
|
4288
|
-
var InitCommand = class extends
|
|
4374
|
+
var InitCommand = class extends import_clipanion6.Command {
|
|
4289
4375
|
constructor() {
|
|
4290
4376
|
super(...arguments);
|
|
4291
|
-
this.pathToForestryConfig =
|
|
4377
|
+
this.pathToForestryConfig = import_clipanion6.Option.String("--forestryPath", {
|
|
4292
4378
|
description: "Specify the relative path to the .forestry directory, if importing an existing forestry site."
|
|
4293
4379
|
});
|
|
4294
|
-
this.rootPath =
|
|
4380
|
+
this.rootPath = import_clipanion6.Option.String("--rootPath", {
|
|
4295
4381
|
description: "Specify the root directory to run the CLI from (defaults to current working directory)"
|
|
4296
4382
|
});
|
|
4297
|
-
this.noTelemetry =
|
|
4383
|
+
this.noTelemetry = import_clipanion6.Option.Boolean("--noTelemetry", false, {
|
|
4298
4384
|
description: "Disable anonymous telemetry that is collected"
|
|
4299
4385
|
});
|
|
4300
4386
|
}
|
|
@@ -4314,13 +4400,13 @@ var InitCommand = class extends import_clipanion5.Command {
|
|
|
4314
4400
|
}
|
|
4315
4401
|
};
|
|
4316
4402
|
InitCommand.paths = [["init"]];
|
|
4317
|
-
InitCommand.usage =
|
|
4403
|
+
InitCommand.usage = import_clipanion6.Command.Usage({
|
|
4318
4404
|
category: `Commands`,
|
|
4319
4405
|
description: `Add Tina to an existing project`
|
|
4320
4406
|
});
|
|
4321
4407
|
|
|
4322
4408
|
// src/index.ts
|
|
4323
|
-
var cli = new
|
|
4409
|
+
var cli = new import_clipanion7.Cli({
|
|
4324
4410
|
binaryName: `tinacms`,
|
|
4325
4411
|
binaryLabel: `TinaCMS`,
|
|
4326
4412
|
binaryVersion: version
|
|
@@ -4330,9 +4416,9 @@ cli.register(BuildCommand);
|
|
|
4330
4416
|
cli.register(AuditCommand);
|
|
4331
4417
|
cli.register(InitCommand);
|
|
4332
4418
|
cli.register(CodemodCommand);
|
|
4333
|
-
cli.register(
|
|
4334
|
-
cli.register(
|
|
4335
|
-
cli.register(
|
|
4419
|
+
cli.register(import_clipanion7.Builtins.DefinitionsCommand);
|
|
4420
|
+
cli.register(import_clipanion7.Builtins.HelpCommand);
|
|
4421
|
+
cli.register(import_clipanion7.Builtins.VersionCommand);
|
|
4336
4422
|
var src_default = cli;
|
|
4337
4423
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4338
4424
|
0 && (module.exports = {});
|
|
@@ -8,17 +8,22 @@ export declare class Codegen {
|
|
|
8
8
|
schema: GraphQLSchema;
|
|
9
9
|
queryDoc: string;
|
|
10
10
|
fragDoc: string;
|
|
11
|
+
isLocal: boolean;
|
|
12
|
+
apiURL: string;
|
|
13
|
+
localUrl: string;
|
|
14
|
+
productionUrl: string;
|
|
11
15
|
graphqlSchemaDoc: {
|
|
12
16
|
kind: 'Document';
|
|
13
17
|
definitions: TypeDefinitionNode[];
|
|
14
18
|
};
|
|
15
19
|
tinaSchema: TinaSchema;
|
|
16
20
|
lookup: any;
|
|
17
|
-
constructor({ configManager, port, queryDoc, fragDoc, graphqlSchemaDoc, tinaSchema, lookup, }: {
|
|
21
|
+
constructor({ configManager, port, queryDoc, fragDoc, isLocal, graphqlSchemaDoc, tinaSchema, lookup, }: {
|
|
18
22
|
configManager: ConfigManager;
|
|
19
23
|
port?: number;
|
|
20
24
|
queryDoc: string;
|
|
21
25
|
fragDoc: string;
|
|
26
|
+
isLocal: boolean;
|
|
22
27
|
graphqlSchemaDoc: {
|
|
23
28
|
kind: 'Document';
|
|
24
29
|
definitions: TypeDefinitionNode[];
|
|
@@ -29,6 +34,7 @@ export declare class Codegen {
|
|
|
29
34
|
writeConfigFile(fileName: string, data: string): Promise<void>;
|
|
30
35
|
removeGeneratedFilesIfExists(): Promise<void>;
|
|
31
36
|
execute(): Promise<string>;
|
|
37
|
+
private _createApiUrl;
|
|
32
38
|
getApiURL(): string;
|
|
33
39
|
genClient(): Promise<{
|
|
34
40
|
apiURL: string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from 'clipanion';
|
|
2
|
+
import type { DocumentNode } from 'graphql';
|
|
3
|
+
import type { Database } from '@tinacms/graphql';
|
|
4
|
+
import type { TinaSchema } from '@tinacms/schema-tools';
|
|
5
|
+
/**
|
|
6
|
+
* Base Command for Dev and build
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class BaseCommand extends Command {
|
|
9
|
+
experimentalDataLayer: boolean;
|
|
10
|
+
isomorphicGitBridge: boolean;
|
|
11
|
+
port: string;
|
|
12
|
+
datalayerPort: string;
|
|
13
|
+
subCommand: string;
|
|
14
|
+
rootPath: string;
|
|
15
|
+
verbose: boolean;
|
|
16
|
+
noSDK: boolean;
|
|
17
|
+
noTelemetry: boolean;
|
|
18
|
+
abstract execute(): Promise<number | void>;
|
|
19
|
+
startSubCommand(): Promise<void>;
|
|
20
|
+
logDeprecationWarnings(): void;
|
|
21
|
+
indexContentWithSpinner({ database, graphQLSchema, tinaSchema, }: {
|
|
22
|
+
database: Database;
|
|
23
|
+
graphQLSchema: DocumentNode;
|
|
24
|
+
tinaSchema: TinaSchema;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { Command } from 'clipanion';
|
|
2
1
|
import { Database } from '@tinacms/graphql';
|
|
3
2
|
import { ConfigManager } from '../../config-manager';
|
|
4
|
-
|
|
3
|
+
import { BaseCommand } from '../baseCommands';
|
|
4
|
+
export declare class BuildCommand extends BaseCommand {
|
|
5
5
|
static paths: string[][];
|
|
6
|
-
rootPath: string;
|
|
7
|
-
verbose: boolean;
|
|
8
|
-
noSDK: boolean;
|
|
9
|
-
datalayerPort: string;
|
|
10
|
-
isomorphicGitBridge: boolean;
|
|
11
6
|
localOption: boolean;
|
|
12
|
-
experimentalDataLayer: boolean;
|
|
13
|
-
noTelemetry: boolean;
|
|
14
7
|
tinaGraphQLVersion: string;
|
|
8
|
+
/**
|
|
9
|
+
* This option allows the user to skip the tina cloud checks if they want to. This could be useful for mismatched GraphQL versions or if they want to build only using the local client and never connect to Tina Cloud
|
|
10
|
+
*/
|
|
11
|
+
skipCloudChecks: boolean;
|
|
15
12
|
static usage: import("clipanion").Usage;
|
|
16
13
|
catch(error: any): Promise<void>;
|
|
17
14
|
execute(): Promise<number | void>;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import { Command } from 'clipanion';
|
|
2
1
|
import { Database } from '@tinacms/graphql';
|
|
3
2
|
import { ConfigManager } from '../../config-manager';
|
|
4
|
-
|
|
3
|
+
import { BaseCommand } from '../baseCommands';
|
|
4
|
+
export declare class DevCommand extends BaseCommand {
|
|
5
5
|
static paths: string[][];
|
|
6
|
-
port: string;
|
|
7
|
-
datalayerPort: string;
|
|
8
|
-
subCommand: string;
|
|
9
|
-
rootPath: string;
|
|
10
6
|
watchFolders: string;
|
|
11
|
-
isomorphicGitBridge: boolean;
|
|
12
|
-
experimentalDataLayer: boolean;
|
|
13
|
-
verbose: boolean;
|
|
14
7
|
noWatch: boolean;
|
|
15
|
-
noSDK: boolean;
|
|
16
|
-
noTelemetry: boolean;
|
|
17
8
|
static usage: import("clipanion").Usage;
|
|
18
9
|
catch(error: any): Promise<void>;
|
|
10
|
+
logDeprecationWarnings(): void;
|
|
19
11
|
execute(): Promise<number | void>;
|
|
20
12
|
watchContentFiles(configManager: ConfigManager, database: Database): void;
|
|
21
13
|
watchQueries(configManager: ConfigManager, callback: () => Promise<string>): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.12",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"@tailwindcss/aspect-ratio": "^0.4.0",
|
|
59
59
|
"@tailwindcss/line-clamp": "^0.3.1",
|
|
60
60
|
"@tailwindcss/typography": "^0.5.9",
|
|
61
|
-
"@tinacms/app": "1.2.
|
|
62
|
-
"@tinacms/datalayer": "1.2.
|
|
63
|
-
"@tinacms/graphql": "1.4.
|
|
61
|
+
"@tinacms/app": "1.2.12",
|
|
62
|
+
"@tinacms/datalayer": "1.2.12",
|
|
63
|
+
"@tinacms/graphql": "1.4.12",
|
|
64
64
|
"@tinacms/metrics": "1.0.2",
|
|
65
|
-
"@tinacms/schema-tools": "1.4.
|
|
65
|
+
"@tinacms/schema-tools": "1.4.4",
|
|
66
66
|
"@vitejs/plugin-react": "3.1.0",
|
|
67
67
|
"ajv": "^6.12.3",
|
|
68
68
|
"altair-express-middleware": "4.0.6",
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
"chokidar": "^3.5.1",
|
|
75
75
|
"cli-spinner": "^0.2.10",
|
|
76
76
|
"clipanion": "^3.2.0",
|
|
77
|
-
"commander": "^9.0.0",
|
|
78
77
|
"cors": "^2.8.5",
|
|
79
78
|
"dotenv": "^16.0.1",
|
|
80
79
|
"esbuild": "^0.15.5",
|