Skip to content

Commit 5a7ca8d

Browse files
authored
chore: update readme (#9)
* fix(cli): always create new sandboxes * chore: remove console.log * update version * chore: update readme timings Feels good!
1 parent 59755b8 commit 5a7ca8d

File tree

4 files changed

+9
-34
lines changed

4 files changed

+9
-34
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ CodeSandbox SDK enables you to programmatically spin up development environments
66

77
Under the hood, the SDK uses the microVM infrastructure of CodeSandbox to spin up sandboxes. It supports:
88

9-
- Starting fresh VMs within 4 seconds
109
- Snapshotting/restoring VMs (checkpointing) at any point in time
11-
- With snapshot restore times of less than 2 seconds
12-
- Cloning VMs within 3 seconds
10+
- With snapshot restore times within 1 second
11+
- Cloning VMs & Snapshots within 2 seconds
1312
- Source control (git, GitHub, CodeSandbox SCM)
1413
- Running any Dockerfile
1514

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": "0.0.7",
3+
"version": "0.0.9",
44
"description": "The CodeSandbox SDK",
55
"author": "CodeSandbox",
66
"license": "MIT",

src/bin/commands/build.ts

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { hashDirectory } from "../utils/hash";
1515

1616
export type BuildCommandArgs = {
1717
path: string;
18-
force?: boolean;
1918
ipCountry?: string;
2019
fromSandbox?: string;
2120
skipFiles?: boolean;
@@ -31,12 +30,6 @@ export const buildCommand: yargs.CommandModule<
3130
"Build an efficient memory snapshot from a directory. This snapshot can be used to create sandboxes quickly.",
3231
builder: (yargs: yargs.Argv) =>
3332
yargs
34-
.option("force", {
35-
alias: "f",
36-
describe:
37-
"Force the creation of a new sandbox, normally a sandbox is reused if it already exists for the given folder (if the files are the same)",
38-
type: "boolean",
39-
})
4033
.option("ip-country", {
4134
describe:
4235
"Cluster closest to this country to create the snapshot in, this ensures that sandboxes created of this snapshot will be created in the same cluster",
@@ -101,7 +94,7 @@ export const buildCommand: yargs.CommandModule<
10194
alreadyExists: true,
10295
sandboxId: argv.fromSandbox,
10396
}
104-
: await getOrCreateSandbox(apiClient, tag, argv.force);
97+
: await createSandbox(apiClient, tag);
10598

10699
if (alreadyExists && !argv.fromSandbox) {
107100
spinner.succeed("Sandbox snapshot has been created before:");
@@ -276,7 +269,9 @@ export const buildCommand: yargs.CommandModule<
276269

277270
spinner.succeed("All ports are open");
278271
} else {
279-
spinner.succeed("No ports to open, waiting 5 seconds for tasks to run...");
272+
spinner.succeed(
273+
"No ports to open, waiting 5 seconds for tasks to run..."
274+
);
280275
await new Promise((resolve) => setTimeout(resolve, 5000));
281276
}
282277

@@ -297,31 +292,13 @@ export const buildCommand: yargs.CommandModule<
297292
},
298293
};
299294

300-
async function getOrCreateSandbox(
295+
async function createSandbox(
301296
apiClient: Client,
302-
shaTag: string,
303-
force = false
297+
shaTag: string
304298
): Promise<{
305299
alreadyExists: boolean;
306300
sandboxId: string;
307301
}> {
308-
if (!force) {
309-
const res = handleResponse(
310-
await sandboxList({
311-
query: {
312-
page_size: 1,
313-
tags: shaTag,
314-
},
315-
client: apiClient,
316-
}),
317-
"Failed to get sandboxes from API"
318-
);
319-
320-
if (res.sandboxes.length > 0) {
321-
return { alreadyExists: true, sandboxId: res.sandboxes[0].id };
322-
}
323-
}
324-
325302
const sandbox = handleResponse(
326303
await sandboxCreate({
327304
client: apiClient,

src/sandbox-client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ export class SandboxClient {
285285
});
286286

287287
const sandbox = handleResponse(result, "Failed to create sandbox");
288-
console.log(sandbox);
289288

290289
return this.connectToSandbox(sandbox.id, () => {
291290
if (sandbox.start_response) {

0 commit comments

Comments
 (0)