create-tina-app 2.1.8 → 2.1.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/dist/index.js +37 -10
- package/dist/util/install.d.ts +3 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -157,17 +157,40 @@ async function updateTelemetryConfig(dir, mode) {
|
|
|
157
157
|
// src/util/install.ts
|
|
158
158
|
import spawn from "cross-spawn";
|
|
159
159
|
var MAX_OUTPUT_CHARS = 4e3;
|
|
160
|
-
|
|
160
|
+
var STREAM_FLAGS = {
|
|
161
|
+
npm: ["--loglevel", "http"]
|
|
162
|
+
};
|
|
163
|
+
function install(packageManager, verboseOutput, onOutput) {
|
|
164
|
+
const args = [
|
|
165
|
+
"install",
|
|
166
|
+
...verboseOutput ? [] : STREAM_FLAGS[packageManager] ?? []
|
|
167
|
+
];
|
|
161
168
|
const command = `${packageManager} install`;
|
|
162
169
|
return new Promise((resolve, reject) => {
|
|
163
|
-
const child = spawn(packageManager,
|
|
164
|
-
stdio: verboseOutput ? "inherit" : ["ignore", "
|
|
165
|
-
env: {
|
|
170
|
+
const child = spawn(packageManager, args, {
|
|
171
|
+
stdio: verboseOutput ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
172
|
+
env: {
|
|
173
|
+
...process.env,
|
|
174
|
+
ADBLOCK: "1",
|
|
175
|
+
DISABLE_OPENCOLLECTIVE: "1",
|
|
176
|
+
// Non-verbose: force plain text so captured lines carry no color codes.
|
|
177
|
+
...verboseOutput ? {} : { NO_COLOR: "1" }
|
|
178
|
+
}
|
|
166
179
|
});
|
|
167
180
|
let captured = "";
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
181
|
+
let pending = "";
|
|
182
|
+
const onChunk = (chunk) => {
|
|
183
|
+
const text = chunk.toString();
|
|
184
|
+
captured = (captured + text).slice(-MAX_OUTPUT_CHARS);
|
|
185
|
+
if (!onOutput) return;
|
|
186
|
+
pending += text;
|
|
187
|
+
const lines = pending.split(/[\r\n]+/);
|
|
188
|
+
pending = lines.pop() ?? "";
|
|
189
|
+
const line = lines.map((l) => l.trim()).filter(Boolean).pop();
|
|
190
|
+
if (line) onOutput(line);
|
|
191
|
+
};
|
|
192
|
+
child.stdout?.on("data", onChunk);
|
|
193
|
+
child.stderr?.on("data", onChunk);
|
|
171
194
|
child.on("error", (err) => {
|
|
172
195
|
reject(
|
|
173
196
|
new Error(`Failed to run "${command}": ${err.message}`)
|
|
@@ -506,7 +529,7 @@ import { Command } from "commander";
|
|
|
506
529
|
|
|
507
530
|
// package.json
|
|
508
531
|
var name = "create-tina-app";
|
|
509
|
-
var version = "2.1.
|
|
532
|
+
var version = "2.1.10";
|
|
510
533
|
|
|
511
534
|
// src/util/packageManagers.ts
|
|
512
535
|
var PKG_MANAGERS = ["pnpm", "yarn", "bun", "npm"];
|
|
@@ -922,6 +945,7 @@ async function fetchPostHogConfig(endpointUrl) {
|
|
|
922
945
|
import { osInfo as getOsSystemInfo } from "systeminformation";
|
|
923
946
|
var DISCORD_SUPPORT_URL = "https://discord.com/invite/zumN63Ybpf";
|
|
924
947
|
var FAQ_URL = "https://tina.io/docs/faq";
|
|
948
|
+
var MAX_ACTIVITY_LINE = 56;
|
|
925
949
|
var posthogClient = null;
|
|
926
950
|
async function initializePostHog(configEndpoint, disableGeoip) {
|
|
927
951
|
let apiKey;
|
|
@@ -1273,8 +1297,11 @@ Need more help? Reach out to the TinaCMS community at ${TextStyles.link(
|
|
|
1273
1297
|
}
|
|
1274
1298
|
spinner.start("Installing packages.");
|
|
1275
1299
|
try {
|
|
1276
|
-
await install(pkgManager, opts.verbose)
|
|
1277
|
-
|
|
1300
|
+
await install(pkgManager, opts.verbose, (line) => {
|
|
1301
|
+
const text = line.length > MAX_ACTIVITY_LINE ? `${line.slice(0, MAX_ACTIVITY_LINE - 1)}\u2026` : line;
|
|
1302
|
+
spinner.text = `Installing packages, ${text}`;
|
|
1303
|
+
});
|
|
1304
|
+
spinner.succeed("Installing packages.");
|
|
1278
1305
|
} catch (err) {
|
|
1279
1306
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
1280
1307
|
const reason = error.message || String(err);
|
package/dist/util/install.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { PackageManager } from './packageManagers';
|
|
|
2
2
|
/**
|
|
3
3
|
* Spawn a package manager installation.
|
|
4
4
|
*
|
|
5
|
+
* @param onOutput Called with the latest complete line of install output
|
|
6
|
+
* (non-verbose only) so the caller can show it as live activity.
|
|
5
7
|
* @returns A Promise that resolves once the installation is finished.
|
|
6
8
|
* On failure it rejects with an `Error` whose message includes the command,
|
|
7
9
|
* the exit code, and the tail of the captured output.
|
|
8
10
|
*/
|
|
9
|
-
export declare function install(packageManager: PackageManager, verboseOutput: boolean): Promise<void>;
|
|
11
|
+
export declare function install(packageManager: PackageManager, verboseOutput: boolean, onOutput?: (line: string) => void): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tina-app",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"examples",
|
|
9
9
|
"bin/*"
|
|
10
10
|
],
|
|
11
|
-
"bin": "bin/create-tina-app",
|
|
12
11
|
"typings": "dist/index.d.ts",
|
|
13
12
|
"license": "Apache-2.0",
|
|
14
13
|
"buildConfig": {
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"@types/prompts": "^2.4.9",
|
|
37
36
|
"@types/tar": "6.1.13",
|
|
38
37
|
"typescript": "^5.7.3",
|
|
39
|
-
"@tinacms/scripts": "1.6.
|
|
38
|
+
"@tinacms/scripts": "1.6.2"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
41
|
"chalk": "^5.4.1",
|
|
@@ -53,5 +52,8 @@
|
|
|
53
52
|
"types": "pnpm tsc",
|
|
54
53
|
"build": "tinacms-scripts build",
|
|
55
54
|
"test-run-bin": "pnpm create-tina-app"
|
|
55
|
+
},
|
|
56
|
+
"bin": {
|
|
57
|
+
"create-tina-app": "bin/create-tina-app"
|
|
56
58
|
}
|
|
57
59
|
}
|