drizzle-auto 1.1.26 → 1.1.27

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/index.js +12 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * 🍵 Drizzle-Auto v2.3 - Flexible Config + Fail-Fast
5
- * 🔹 Detects any drizzle.config.{js,ts,mjs,cjs,mts} automatically
6
- * 🔹 Stops immediately if config or schema missing
7
- * 🔹 Beginner-friendly logs
4
+ * 🍵 Drizzle-Auto v2.2 - Beginner-Friendly Fail-Fast
5
+ * 🔹 Checks config & schema before running anything
6
+ * 🔹 Stops immediately if anything is missing or fails
7
+ * 🔹 Shows simple, clear messages
8
8
  */
9
9
 
10
10
  const { spawn } = require("child_process");
11
11
  const path = require("path");
12
12
  const fs = require("fs");
13
13
 
14
- // TS support
14
+ // Optional TypeScript support for config
15
15
  try { require("ts-node").register({ transpileOnly: true }); } catch(e){}
16
16
 
17
17
  // ---------------- COLORS ----------------
@@ -59,13 +59,12 @@ function addTeaScript(){
59
59
  } catch(e){}
60
60
  }
61
61
 
62
- // ---------------- FIND ANY DRIZZLE CONFIG ----------------
62
+ // ---------------- FIND CONFIG ----------------
63
63
  function findConfig(){
64
- const allowedExts = ["js","ts","mjs","cjs","mts"];
65
- const rootFiles = fs.readdirSync(process.cwd());
66
- for(const file of rootFiles){
67
- const match = file.match(/^drizzle\.config\.(.+)$/i);
68
- if(match && allowedExts.includes(match[1])) return path.join(process.cwd(),file);
64
+ const allowed = ["drizzle.config.js","drizzle.config.ts","drizzle.config.mjs","drizzle.config.cjs"];
65
+ for(const file of allowed){
66
+ const full = path.join(process.cwd(), file);
67
+ if(fs.existsSync(full)) return full;
69
68
  }
70
69
  return null;
71
70
  }
@@ -77,7 +76,7 @@ function checkSchema(configPath){
77
76
  const schemaPath = cfg.default?.schema || cfg.schema;
78
77
  if(!schemaPath){
79
78
  console.log(`${T.yellow}⚠ Warning: schema not defined in ${path.basename(configPath)}${T.reset}`);
80
- return true; // optional
79
+ return true; // allow if schema optional
81
80
  }
82
81
  const fullSchema = path.resolve(path.dirname(configPath), schemaPath);
83
82
  if(!fs.existsSync(fullSchema)){
@@ -122,8 +121,7 @@ async function triggerEngine(){
122
121
 
123
122
  const configPath = findConfig();
124
123
  if(!configPath){
125
- console.log(`${T.red}❌ ERROR: No drizzle config found!${T.reset}`);
126
- console.log(`${T.yellow}Expected one of: drizzle.config.js/ts/mjs/cjs/mts${T.reset}`);
124
+ console.log(`${T.red}❌ ERROR: No drizzle config found. Expected one of: drizzle.config.js/ts/mjs/cjs${T.reset}`);
127
125
  process.exit(1);
128
126
  }
129
127
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-auto",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "pavel ahmmed hridoy",