@better-auth/cli 1.3.8-beta.6 → 1.3.8-beta.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.
Files changed (2) hide show
  1. package/dist/index.mjs +7 -14
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -176,22 +176,15 @@ async function generateAuthConfig({
176
176
  insert_content: `${opts.pluginFunctionName}(${opts.pluginContents}),`
177
177
  });
178
178
  } else {
179
- let has_found_comma = false;
180
- const str = opts.config.slice(start_of_plugins.index, end_of_plugins.index).split("").reverse();
181
- for (let index = 0; index < str.length; index++) {
182
- const char = str[index];
183
- if (char === ",") {
184
- has_found_comma = true;
185
- }
186
- if (char === ")") {
187
- break;
188
- }
189
- }
179
+ const pluginArrayContent = opts.config.slice(start_of_plugins.index, end_of_plugins.index).trim();
180
+ const isPluginArrayEmpty = pluginArrayContent === "";
181
+ const isPluginArrayEndsWithComma = pluginArrayContent.endsWith(",");
182
+ const needsComma = !isPluginArrayEmpty && !isPluginArrayEndsWithComma;
190
183
  new_content = insertContent({
191
184
  line: end_of_plugins.line,
192
185
  character: end_of_plugins.character,
193
186
  content: opts.config,
194
- insert_content: `${!has_found_comma ? "," : ""}${opts.pluginFunctionName}(${opts.pluginContents})`
187
+ insert_content: `${needsComma ? "," : ""}${opts.pluginFunctionName}(${opts.pluginContents})`
195
188
  });
196
189
  }
197
190
  try {
@@ -202,7 +195,7 @@ async function generateAuthConfig({
202
195
  `Failed to generate new auth config during plugin addition phase.`
203
196
  );
204
197
  }
205
- return { code: await new_content, dependencies: [], envs: [] };
198
+ return { code: new_content, dependencies: [], envs: [] };
206
199
  },
207
200
  add_import: async (opts) => {
208
201
  let importString = "";
@@ -1272,7 +1265,7 @@ async function initAction(opts) {
1272
1265
  const { dependencies, envs, generatedCode } = await generateAuthConfig({
1273
1266
  current_user_config,
1274
1267
  format: format$1,
1275
- //@ts-ignore
1268
+ //@ts-expect-error
1276
1269
  s,
1277
1270
  plugins: add_plugins,
1278
1271
  database
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/cli",
3
- "version": "1.3.8-beta.6",
3
+ "version": "1.3.8-beta.9",
4
4
  "description": "The CLI for Better Auth",
5
5
  "module": "dist/index.mjs",
6
6
  "repository": {
@@ -54,7 +54,7 @@
54
54
  "tinyexec": "^0.3.1",
55
55
  "yocto-spinner": "^0.1.1",
56
56
  "zod": "^4.0.0",
57
- "better-auth": "1.3.8-beta.6"
57
+ "better-auth": "1.3.8-beta.9"
58
58
  },
59
59
  "files": [
60
60
  "dist"