rwsdk 0.1.3 → 0.1.5

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.
@@ -55,17 +55,14 @@
55
55
  "0": {
56
56
  async up(db) {
57
57
  return [
58
- await db.schema
59
- .createTable("users")
60
- .addColumn("age", "integer")
61
- .execute(),
58
+ db.schema.createTable("users").addColumn("age", "integer").execute(),
62
59
  ];
63
60
  },
64
61
  },
65
62
  "1": {
66
63
  async up(db) {
67
64
  return [
68
- await db.schema
65
+ db.schema
69
66
  .alterTable("users")
70
67
  .alterColumn("age", (col) => col.setDataType("text"))
71
68
  .alterColumn("age", (col) => col.setDefault("unknown"))
@@ -1,6 +1,6 @@
1
1
  // context(justinvdm, 28 May 2025): This is the "bridge" between the RSC side
2
- // and and the SSR side, both run inside the same runtime environment. We have
3
- // this separation so that they can each be processed with their own respective
2
+ // and the SSR side, both run inside the same runtime environment. We have this
3
+ // separation so that they can each be processed with their own respective
4
4
  // import conditions and bundling logic
5
5
  //
6
6
  // **NOTE:** Any time we need to import from SSR side in RSC side, we need to
@@ -14,6 +14,12 @@ const promptForDeployment = async () => {
14
14
  output: process.stdout,
15
15
  });
16
16
  return new Promise((resolve) => {
17
+ // Handle Ctrl+C (SIGINT)
18
+ rl.on('SIGINT', () => {
19
+ rl.close();
20
+ console.log('\nDeployment cancelled.');
21
+ process.exit(1);
22
+ });
17
23
  rl.question("Do you want to proceed with deployment? (y/N): ", (answer) => {
18
24
  rl.close();
19
25
  resolve(answer.toLowerCase() === "y");
@@ -81,13 +87,13 @@ export const ensureDeployEnv = async () => {
81
87
  // todo(justinvdm): this is a hack to force the account selection prompt,
82
88
  // we need to find a better way
83
89
  if (!(await pathExists(accountCachePath))) {
84
- await $({ stdio: "inherit" }) `wrangler d1 list --json`;
90
+ await $({ stdio: "inherit" }) `npx wrangler d1 list --json`;
85
91
  }
86
92
  }
87
93
  // Create a no-op secret to ensure worker exists
88
94
  console.log(`Ensuring worker ${wranglerConfig.name} exists...`);
89
95
  await $({ stdio: "pipe" }) `echo "true"`
90
- .pipe `wrangler secret put TMP_WORKER_CREATED`;
96
+ .pipe `npx wrangler secret put TMP_WORKER_CREATED`;
91
97
  // Check D1 database setup
92
98
  const needsDatabase = await hasD1Database();
93
99
  if (!needsDatabase) {
@@ -115,7 +121,7 @@ export const ensureDeployEnv = async () => {
115
121
  console.log(`Creating D1 database: ${dbName}...`);
116
122
  const createResult = await $({
117
123
  stdio: "pipe",
118
- }) `wrangler d1 create ${dbName}`;
124
+ }) `npx wrangler d1 create ${dbName}`;
119
125
  // Log the result to the console
120
126
  console.log(createResult.stdout);
121
127
  // Parse all JSON objects from the output
@@ -161,7 +167,7 @@ export const ensureDeployEnv = async () => {
161
167
  catch (error) {
162
168
  console.error("Failed to create D1 database:", error instanceof Error ? error.message : String(error));
163
169
  console.error("Please create it manually:");
164
- console.error("1. Run: wrangler d1 create <your-db-name>");
170
+ console.error("1. Run: npx wrangler d1 create <your-db-name>");
165
171
  console.error("2. Update wrangler.jsonc with the database details");
166
172
  process.exit(1);
167
173
  }
@@ -169,7 +175,7 @@ export const ensureDeployEnv = async () => {
169
175
  }
170
176
  catch (error) {
171
177
  console.error("Failed to create D1 database. Please create it manually:");
172
- console.error("1. Run: wrangler d1 create <your-db-name>");
178
+ console.error("1. Run: npx wrangler d1 create <your-db-name>");
173
179
  console.error("2. Update wrangler.jsonc with the database details");
174
180
  process.exit(1);
175
181
  }
@@ -182,7 +188,7 @@ export const ensureDeployEnv = async () => {
182
188
  console.log("Found auth usage, checking secret setup...");
183
189
  try {
184
190
  // Get list of all secrets
185
- const secretsResult = await $ `wrangler secret list --format=json`;
191
+ const secretsResult = await $ `npx wrangler secret list --format=json`;
186
192
  const existingSecrets = parseJson(secretsResult.stdout, []).map((secret) => secret.name);
187
193
  // Check if AUTH_SECRET_KEY already exists
188
194
  if (existingSecrets.includes("AUTH_SECRET_KEY")) {
@@ -193,14 +199,14 @@ export const ensureDeployEnv = async () => {
193
199
  const secretKey = generateSecretKey();
194
200
  // Use the same pattern as TMP_WORKER_CREATED for consistency
195
201
  await $({ stdio: "pipe" }) `echo "${secretKey}"`
196
- .pipe `wrangler secret put AUTH_SECRET_KEY`;
202
+ .pipe `npx wrangler secret put AUTH_SECRET_KEY`;
197
203
  console.log("Set AUTH_SECRET_KEY secret");
198
204
  }
199
205
  }
200
206
  catch (error) {
201
207
  console.error("Failed to set up AUTH_SECRET_KEY. Please configure it manually:");
202
208
  console.error("1. Generate a secret key: node -e \"console.log(require('crypto').randomBytes(32).toString('base64'))\"");
203
- console.error("2. Set the secret: wrangler secret put AUTH_SECRET_KEY");
209
+ console.error("2. Set the secret: npx wrangler secret put AUTH_SECRET_KEY");
204
210
  process.exit(1);
205
211
  }
206
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rwsdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
5
5
  "type": "module",
6
6
  "bin": {