rwsdk 0.1.4 → 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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// context(justinvdm, 28 May 2025): This is the "bridge" between the RSC side
|
|
2
|
-
// and
|
|
3
|
-
//
|
|
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
|
|
@@ -87,13 +87,13 @@ export const ensureDeployEnv = async () => {
|
|
|
87
87
|
// todo(justinvdm): this is a hack to force the account selection prompt,
|
|
88
88
|
// we need to find a better way
|
|
89
89
|
if (!(await pathExists(accountCachePath))) {
|
|
90
|
-
await $({ stdio: "inherit" }) `wrangler d1 list --json`;
|
|
90
|
+
await $({ stdio: "inherit" }) `npx wrangler d1 list --json`;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
// Create a no-op secret to ensure worker exists
|
|
94
94
|
console.log(`Ensuring worker ${wranglerConfig.name} exists...`);
|
|
95
95
|
await $({ stdio: "pipe" }) `echo "true"`
|
|
96
|
-
.pipe `wrangler secret put TMP_WORKER_CREATED`;
|
|
96
|
+
.pipe `npx wrangler secret put TMP_WORKER_CREATED`;
|
|
97
97
|
// Check D1 database setup
|
|
98
98
|
const needsDatabase = await hasD1Database();
|
|
99
99
|
if (!needsDatabase) {
|
|
@@ -121,7 +121,7 @@ export const ensureDeployEnv = async () => {
|
|
|
121
121
|
console.log(`Creating D1 database: ${dbName}...`);
|
|
122
122
|
const createResult = await $({
|
|
123
123
|
stdio: "pipe",
|
|
124
|
-
}) `wrangler d1 create ${dbName}`;
|
|
124
|
+
}) `npx wrangler d1 create ${dbName}`;
|
|
125
125
|
// Log the result to the console
|
|
126
126
|
console.log(createResult.stdout);
|
|
127
127
|
// Parse all JSON objects from the output
|
|
@@ -167,7 +167,7 @@ export const ensureDeployEnv = async () => {
|
|
|
167
167
|
catch (error) {
|
|
168
168
|
console.error("Failed to create D1 database:", error instanceof Error ? error.message : String(error));
|
|
169
169
|
console.error("Please create it manually:");
|
|
170
|
-
console.error("1. Run: wrangler d1 create <your-db-name>");
|
|
170
|
+
console.error("1. Run: npx wrangler d1 create <your-db-name>");
|
|
171
171
|
console.error("2. Update wrangler.jsonc with the database details");
|
|
172
172
|
process.exit(1);
|
|
173
173
|
}
|
|
@@ -175,7 +175,7 @@ export const ensureDeployEnv = async () => {
|
|
|
175
175
|
}
|
|
176
176
|
catch (error) {
|
|
177
177
|
console.error("Failed to create D1 database. Please create it manually:");
|
|
178
|
-
console.error("1. Run: wrangler d1 create <your-db-name>");
|
|
178
|
+
console.error("1. Run: npx wrangler d1 create <your-db-name>");
|
|
179
179
|
console.error("2. Update wrangler.jsonc with the database details");
|
|
180
180
|
process.exit(1);
|
|
181
181
|
}
|
|
@@ -188,7 +188,7 @@ export const ensureDeployEnv = async () => {
|
|
|
188
188
|
console.log("Found auth usage, checking secret setup...");
|
|
189
189
|
try {
|
|
190
190
|
// Get list of all secrets
|
|
191
|
-
const secretsResult = await $ `wrangler secret list --format=json`;
|
|
191
|
+
const secretsResult = await $ `npx wrangler secret list --format=json`;
|
|
192
192
|
const existingSecrets = parseJson(secretsResult.stdout, []).map((secret) => secret.name);
|
|
193
193
|
// Check if AUTH_SECRET_KEY already exists
|
|
194
194
|
if (existingSecrets.includes("AUTH_SECRET_KEY")) {
|
|
@@ -199,14 +199,14 @@ export const ensureDeployEnv = async () => {
|
|
|
199
199
|
const secretKey = generateSecretKey();
|
|
200
200
|
// Use the same pattern as TMP_WORKER_CREATED for consistency
|
|
201
201
|
await $({ stdio: "pipe" }) `echo "${secretKey}"`
|
|
202
|
-
.pipe `wrangler secret put AUTH_SECRET_KEY`;
|
|
202
|
+
.pipe `npx wrangler secret put AUTH_SECRET_KEY`;
|
|
203
203
|
console.log("Set AUTH_SECRET_KEY secret");
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
catch (error) {
|
|
207
207
|
console.error("Failed to set up AUTH_SECRET_KEY. Please configure it manually:");
|
|
208
208
|
console.error("1. Generate a secret key: node -e \"console.log(require('crypto').randomBytes(32).toString('base64'))\"");
|
|
209
|
-
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");
|
|
210
210
|
process.exit(1);
|
|
211
211
|
}
|
|
212
212
|
}
|