@tgcloud/cli 0.1.0 → 0.1.1
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/package.json +1 -1
- package/src/commands/deploy.js +13 -3
- package/src/commands/init.js +4 -4
- package/src/core/credentials.js +10 -1
package/package.json
CHANGED
package/src/commands/deploy.js
CHANGED
|
@@ -190,14 +190,23 @@ export function registerDeploy(program) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
// 4. Send the batch (with automatic re-auth on 401/403).
|
|
193
|
+
// One "Deploying N changes..." line carries both phases: the spinner shows
|
|
194
|
+
// it live during the request, then (once ora has erased the spinner line)
|
|
195
|
+
// we reprint it persistently as the header above the ✓ results. This keeps
|
|
196
|
+
// a labeled separator between the "what will change" preview and the "what
|
|
197
|
+
// happened" results — without it the two file lists butt together and read
|
|
198
|
+
// as the same paths twice — while avoiding a second, redundant activity
|
|
199
|
+
// line. Count includes deletions, so it matches the results below.
|
|
200
|
+
const changeCount = changedPaths.length + deletedPaths.length;
|
|
201
|
+
const deployingLine = `Deploying ${changeCount} change${changeCount === 1 ? '' : 's'}...`;
|
|
202
|
+
console.log(''); // blank line stays put whether or not the spinner renders
|
|
203
|
+
|
|
193
204
|
const startTime = Date.now();
|
|
194
205
|
let response;
|
|
195
206
|
try {
|
|
196
207
|
response = await retryOnAuthError(async () => {
|
|
197
208
|
const token = await resolveToken();
|
|
198
|
-
const spinner = createSpinner(
|
|
199
|
-
`Deploying ${changedPaths.length} change${changedPaths.length === 1 ? '' : 's'}...`
|
|
200
|
-
);
|
|
209
|
+
const spinner = createSpinner(deployingLine);
|
|
201
210
|
spinner.start();
|
|
202
211
|
try {
|
|
203
212
|
const r = await batchDeploy(token, { expected_revision, manifest, changed_sources });
|
|
@@ -219,6 +228,7 @@ export function registerDeploy(program) {
|
|
|
219
228
|
process.exit(1);
|
|
220
229
|
}
|
|
221
230
|
|
|
231
|
+
console.log(deployingLine); // persistent header (spinner line was erased on stop)
|
|
222
232
|
for (const p of changedPaths) done(p);
|
|
223
233
|
for (const p of deletedPaths) done(p, 'deleted');
|
|
224
234
|
|
package/src/commands/init.js
CHANGED
|
@@ -213,11 +213,11 @@ export function registerInit(program) {
|
|
|
213
213
|
|
|
214
214
|
// "Project ready" + the files note is always init's — it owns the scaffold,
|
|
215
215
|
// so the description stays here (generic, no hardcoded names, survives new
|
|
216
|
-
// directories the platform may add).
|
|
217
|
-
// when
|
|
218
|
-
//
|
|
216
|
+
// directories the platform may add). The "Next steps" block is suppressed
|
|
217
|
+
// when create-bot delegates; it prints its own. TGCLOUD_INIT_QUIET_NEXT is
|
|
218
|
+
// the legacy flag name, read for back-compat with an older cached create-bot.
|
|
219
219
|
info('\nProject ready. The scaffolded files are a starting point — edit or delete as you like.');
|
|
220
|
-
if (!process.env.TGCLOUD_INIT_QUIET_NEXT) {
|
|
220
|
+
if (!process.env.TGCLOUD_VIA_CREATE && !process.env.TGCLOUD_INIT_QUIET_NEXT) {
|
|
221
221
|
info('\nNext steps:');
|
|
222
222
|
info(` ${chalk.cyan('tgcloud login')} ${chalk.dim('# link this project to a bot')}`);
|
|
223
223
|
info(` ${chalk.cyan('tgcloud push')} ${chalk.dim('# deploy to the cloud')}`);
|
package/src/core/credentials.js
CHANGED
|
@@ -138,7 +138,16 @@ function isValidFormat(token) {
|
|
|
138
138
|
* Loops on invalid input until the user provides a working token or aborts (Ctrl-C).
|
|
139
139
|
*/
|
|
140
140
|
export async function loginInteractive() {
|
|
141
|
-
|
|
141
|
+
// create-bot already asked "Link your bot now?" right before delegating here,
|
|
142
|
+
// so repeating the "Link this project to a bot." intro is redundant. Under the
|
|
143
|
+
// create-bot bootstrap (TGCLOUD_VIA_CREATE) drop the intro and lead with a blank
|
|
144
|
+
// line so the token instructions get some room under the prompt above.
|
|
145
|
+
// Standalone `tgcloud login` keeps the intro.
|
|
146
|
+
if (process.env.TGCLOUD_VIA_CREATE) {
|
|
147
|
+
console.log('');
|
|
148
|
+
} else {
|
|
149
|
+
console.log('Link this project to a bot.');
|
|
150
|
+
}
|
|
142
151
|
console.log('Get your CLI access token from @BotFather: your bot → Serverless → CLI Access → Access token.');
|
|
143
152
|
|
|
144
153
|
while (true) {
|