Skip to content

Commit 1465d18

Browse files
author
Mathieu-ai
committed
feat: - v.0.9.5
- formated files - hope this verison can be pushed
1 parent 1e7b5ed commit 1465d18

File tree

16 files changed

+582
-584
lines changed

16 files changed

+582
-584
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "generic-functions",
2+
"name": "generic-functions.mlai",
33
"repository": {
44
"type": "git",
55
"url": "https://github.com/Mathieu-ai/generic-functions.git"
66
},
7-
"version": "0.9.4",
7+
"version": "0.9.5",
88
"description": "A comprehensive, lightweight utility library",
99
"main": "dist/index.js",
1010
"types": "dist/index.d.ts",
@@ -109,9 +109,7 @@
109109
"url": "https://github.com/Mathieu-ai/generic-functions/issues"
110110
},
111111
"homepage": "https://github.com/Mathieu-ai/generic-functions#readme",
112-
113-
114-
"author": {
112+
"author": {
115113
"name": "Mathieu-ai",
116114
"email": "[email protected]",
117115
"url": "https://github.com/Mathieu-ai"

scripts/create-dist-package.cjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ function createDistPackage() {
3535
registry: "https://registry.npmjs.org/"
3636
}
3737
};
38-
38+
3939
// Ensure dist directory exists
4040
const distDir = path.join(__dirname, '..', 'dist');
4141
if (!fs.existsSync(distDir)) {
4242
fs.mkdirSync(distDir, { recursive: true });
4343
}
44-
44+
4545
// Write to dist directory
4646
const distPath = path.join(distDir, 'package.json');
4747
fs.writeFileSync(distPath, JSON.stringify(distPackage, null, 2));
48-
48+
4949
// Create a simple .npmignore for dist to avoid any unwanted files
5050
const distNpmIgnore = `# Only ignore potential temporary files
5151
*.tmp
@@ -54,23 +54,23 @@ function createDistPackage() {
5454
Thumbs.db
5555
`;
5656
fs.writeFileSync(path.join(distDir, '.npmignore'), distNpmIgnore);
57-
57+
5858
// Copy README if it exists
5959
const readmePath = path.join(__dirname, '..', 'README.md');
6060
const distReadmePath = path.join(distDir, 'README.md');
61-
61+
6262
if (fs.existsSync(readmePath)) {
6363
fs.copyFileSync(readmePath, distReadmePath);
6464
}
65-
65+
6666
// Copy LICENSE if it exists
6767
const licensePath = path.join(__dirname, '..', 'LICENSE');
6868
const distLicensePath = path.join(distDir, 'LICENSE');
69-
69+
7070
if (fs.existsSync(licensePath)) {
7171
fs.copyFileSync(licensePath, distLicensePath);
7272
}
73-
73+
7474
console.log(`✅ Distribution package created successfully!`);
7575
console.log(`📦 ${distPackage.name} v${distPackage.version}`);
7676
console.log(`👤 Author: ${typeof distPackage.author === 'string' ? distPackage.author : distPackage.author?.name || 'Unknown'}`);

scripts/extract-docs.cjs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ function processFile(filePath) {
162162
);
163163

164164
const functions = [];
165-
const category = path.basename(path.dirname(filePath)) === 'utils'
166-
? 'utility'
165+
const category = path.basename(path.dirname(filePath)) === 'utils'
166+
? 'utility'
167167
: path.basename(filePath, path.extname(filePath));
168168

169169
function visit(node) {
@@ -175,7 +175,7 @@ function processFile(filePath) {
175175

176176
if (hasExportModifier) {
177177
const functionName = node.name.getText(sourceFile);
178-
178+
179179
// Skip ignored functions
180180
if (CONFIG.ignoredFunctions.includes(functionName)) {
181181
return;
@@ -228,12 +228,12 @@ function processFile(filePath) {
228228

229229
if (hasExportModifier) {
230230
node.declarationList.declarations.forEach(declaration => {
231-
if (declaration.initializer &&
232-
(ts.isArrowFunction(declaration.initializer) ||
233-
ts.isFunctionExpression(declaration.initializer))) {
234-
231+
if (declaration.initializer &&
232+
(ts.isArrowFunction(declaration.initializer) ||
233+
ts.isFunctionExpression(declaration.initializer))) {
234+
235235
const functionName = declaration.name.getText(sourceFile);
236-
236+
237237
// Skip ignored functions
238238
if (CONFIG.ignoredFunctions.includes(functionName)) {
239239
return;
@@ -316,7 +316,7 @@ function processConstants(filePath) {
316316
node.declarationList.declarations.forEach(declaration => {
317317
if (declaration.initializer) {
318318
const constantName = declaration.name.getText(sourceFile);
319-
319+
320320
// Get JSDoc comment
321321
const jsDocNodes = ts.getJSDocCommentsAndTags(declaration);
322322
let jsDocText = '';
@@ -327,14 +327,14 @@ function processConstants(filePath) {
327327
}
328328

329329
const jsDoc = parseJSDoc(jsDocText);
330-
330+
331331
// Try to get the actual value structure
332332
let value = 'Object';
333333
let preview = '';
334-
334+
335335
try {
336336
const valueText = declaration.initializer.getText(sourceFile);
337-
337+
338338
// Simple preview generation
339339
if (valueText.includes('{') && valueText.includes('}')) {
340340
const keys = valueText.match(/(\w+):/g);
@@ -373,22 +373,22 @@ function processConstants(filePath) {
373373
// Process all files in a directory
374374
function processDirectory(dirPath) {
375375
const functions = [];
376-
376+
377377
if (!fs.existsSync(dirPath)) {
378378
console.warn(`Directory not found: ${dirPath}`);
379379
return functions;
380380
}
381381

382382
const files = fs.readdirSync(dirPath);
383-
383+
384384
files.forEach(file => {
385385
if (CONFIG.ignoredFiles.includes(file)) {
386386
return;
387387
}
388388

389389
const filePath = path.join(dirPath, file);
390390
const stat = fs.statSync(filePath);
391-
391+
392392
if (stat.isFile() && (file.endsWith('.ts') || file.endsWith('.js'))) {
393393
console.log(`Processing ${filePath}...`);
394394
try {
@@ -406,7 +406,7 @@ function processDirectory(dirPath) {
406406
// Main function
407407
function main() {
408408
console.log('Extracting function documentation...\n');
409-
409+
410410
let allFunctions = [];
411411
let allConstants = [];
412412

@@ -454,7 +454,7 @@ const packageInfo = ${JSON.stringify({
454454
repository: packageJson.repository,
455455
homepage: packageJson.homepage,
456456
bugs: packageJson.bugs
457-
}, null, 2)};
457+
}, null, 2)};
458458
459459
// Export for use in documentation
460460
if (typeof module !== 'undefined' && module.exports) {
@@ -469,16 +469,16 @@ if (typeof module !== 'undefined' && module.exports) {
469469

470470
// Write output file
471471
fs.writeFileSync(CONFIG.outputFile, output, 'utf-8');
472-
472+
473473
console.log(`\n✅ Generated documentation for ${allFunctions.length} functions and ${allConstants.length} constants`);
474474
console.log(`📁 Output written to ${CONFIG.outputFile}`);
475-
475+
476476
// Summary by category
477477
const categoryCounts = {};
478478
allFunctions.forEach(func => {
479479
categoryCounts[func.category] = (categoryCounts[func.category] || 0) + 1;
480480
});
481-
481+
482482
console.log('\nFunctions by category:');
483483
Object.entries(categoryCounts)
484484
.sort(([a], [b]) => a.localeCompare(b))

src/constants/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@
99
export const REGEX = {
1010
/** Match HTML tags */
1111
htmlTag: /.*?>([^<]*)/,
12-
12+
1313
/** Match content in brackets */
1414
inBrackets: /\[[^\[\]]*\]/,
15-
15+
1616
/** Match content in strings */
1717
inStrings: /.*?"([^"]*)/,
18-
18+
1919
/** Match HTML tags or arrays */
2020
tagRegex: /<([a-z][a-z0-9]*)[^>]*>([^<]*)<\/\1>|(\[(.*?)\])/i,
21-
21+
2222
/** Match opening parentheses */
2323
openParentheses: /^(.*?)\(/,
24-
24+
2525
/** Match all non-whitespace sequences */
2626
allSpaces: /\S+/g,
27-
27+
2828
/** Match datetime strings */
2929
datetime: /^((?:(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|[\+-]\d{2}:\d{2})?)$/,
30-
30+
3131
/** Match email addresses */
3232
email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
33-
33+
3434
/** Match URLs */
3535
url: /^https?:\/\/.+/,
36-
36+
3737
/** Match numbers */
3838
number: /^-?\d+(\.\d+)?$/
3939
} as const;

0 commit comments

Comments
 (0)