Skip to content

Commit 29cad67

Browse files
Better output for template creation, also creating Sandbox to verify
1 parent 2cbc69e commit 29cad67

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codesandbox/sdk",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "The CodeSandbox SDK",
55
"author": "CodeSandbox",
66
"license": "MIT",

src/bin/commands/build.ts

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,21 @@ export const buildCommand: yargs.CommandModule<
377377
);
378378
})
379379
);
380-
spinner.succeed(`\n${spinnerMessages.join("\n")}`);
380+
spinner.start(`\n${spinnerMessages.join("\n")}`);
381381
} else {
382-
spinner.succeed(`\n${spinnerMessages.join("\n")}`);
382+
spinner.start(`\n${spinnerMessages.join("\n")}`);
383383
}
384384
}
385385

386+
spinner.start(
387+
`\n${spinnerMessages.join(
388+
"\n"
389+
)}\n\nCreating template reference and example...`
390+
);
391+
392+
let referenceString;
393+
let id;
394+
386395
if (alias) {
387396
await vmAssignTagAlias({
388397
client: apiClient,
@@ -395,13 +404,26 @@ export const buildCommand: yargs.CommandModule<
395404
},
396405
});
397406

398-
console.log(
399-
`Alias ${alias.namespace}@${alias.alias} updated to: ${templateData.tag}`
400-
);
401-
process.exit(0);
407+
id = `${alias.namespace}@${alias.alias}`;
408+
referenceString = `Alias ${id} now referencing: ${templateData.tag}`;
409+
} else {
410+
id = templateData.tag;
411+
referenceString = `Template created with tag: ${templateData.tag}`;
402412
}
403413

404-
console.log("Template created: " + templateData.tag);
414+
const sandbox = await sdk.sandboxes.create({
415+
id,
416+
});
417+
418+
spinner.succeed(
419+
`\n${spinnerMessages.join("\n")}\n\n${referenceString}
420+
421+
sdk.sandboxes.create({
422+
id: "${id}"
423+
})
424+
425+
Verify Sandbox at: https://codesandbox.io/s/${sandbox.id}`
426+
);
405427

406428
process.exit(0);
407429
} catch (error) {

0 commit comments

Comments
 (0)