appflare 0.2.8 → 0.2.9

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.
@@ -93,7 +93,6 @@ export async function runMigrate(
93
93
  options: MigrateOptions = {},
94
94
  ): Promise<void> {
95
95
  const loadedConfig = await loadConfig(configPath);
96
- const npxCommand = process.platform === "win32" ? "npx.cmd" : "npx";
97
96
  const packageDir = findNearestPackageDir(process.cwd());
98
97
  const selectedTargetCount = [
99
98
  Boolean(options.local),
@@ -110,7 +109,7 @@ export async function runMigrate(
110
109
  "drizzle.config.ts",
111
110
  );
112
111
  const drizzleGenerate = Bun.spawn(
113
- [npxCommand, "drizzle-kit", "generate", "--config", drizzleConfigPath],
112
+ ["drizzle-kit", "generate", "--config", drizzleConfigPath],
114
113
  {
115
114
  cwd: packageDir,
116
115
  stdin: "inherit",
@@ -119,7 +118,6 @@ export async function runMigrate(
119
118
  },
120
119
  );
121
120
 
122
- console.log(`npx drizzle-kit generate --config ${drizzleConfigPath}`);
123
121
  const drizzleExitCode = await drizzleGenerate.exited;
124
122
  if (drizzleExitCode !== 0) {
125
123
  throw new Error(
@@ -128,14 +126,7 @@ export async function runMigrate(
128
126
  }
129
127
 
130
128
  const databaseName = loadedConfig.config.database[0].databaseName;
131
- const wranglerArgs = [
132
- npxCommand,
133
- "wrangler",
134
- "d1",
135
- "migrations",
136
- "apply",
137
- databaseName,
138
- ];
129
+ const wranglerArgs = ["wrangler", "d1", "migrations", "apply", databaseName];
139
130
 
140
131
  if (options.local) {
141
132
  wranglerArgs.push("--local");
@@ -171,7 +162,6 @@ export async function runAddAdmin(
171
162
  } = { name: "", email: "", password: "" },
172
163
  ): Promise<void> {
173
164
  const loadedConfig = await loadConfig(configPath);
174
- const npxCommand = process.platform === "win32" ? "npx.cmd" : "npx";
175
165
 
176
166
  const selectedTargetCount = [
177
167
  Boolean(options.local),
@@ -192,22 +182,20 @@ export async function runAddAdmin(
192
182
  const safeName = options.name.replace(/'/g, "''");
193
183
  const safeEmail = options.email.replace(/'/g, "''");
194
184
 
195
- const sqlQuery = `
196
- INSERT INTO users (id, name, email, email_verified, created_at, updated_at, role, banned)
197
- VALUES ('${userId}', '${safeName}', '${safeEmail}', 1, ${now}, ${now}, 'admin', 0);
198
- INSERT INTO accounts (id, account_id, provider_id, user_id, password, created_at, updated_at)
199
- VALUES ('${accountId}', '${safeEmail}', 'credential', '${userId}', '${passwordHash}', ${now}, ${now});
200
- `;
185
+ const sqlQuery = [
186
+ "INSERT INTO users (id, name, email, email_verified, created_at, updated_at, role, banned)",
187
+ `VALUES ('${userId}', '${safeName}', '${safeEmail}', 1, ${now}, ${now}, 'admin', 0);`,
188
+ "INSERT INTO accounts (id, account_id, provider_id, user_id, password, created_at, updated_at)",
189
+ `VALUES ('${accountId}', '${safeEmail}', 'credential', '${userId}', '${passwordHash}', ${now}, ${now});`,
190
+ ].join(" ");
201
191
 
202
192
  const databaseName = loadedConfig.config.database[0].databaseName;
203
193
  const wranglerArgs = [
204
- npxCommand,
205
194
  "wrangler",
206
195
  "d1",
207
196
  "execute",
208
197
  databaseName,
209
- "--command",
210
- sqlQuery,
198
+ `--command=${sqlQuery}`,
211
199
  ];
212
200
 
213
201
  if (options.local) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appflare",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "bin": {
5
5
  "appflare": "./cli/index.ts"
6
6
  },