catco 1.0.0 → 1.0.1

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/dist/index.cjs ADDED
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ var fs = require('node:fs');
4
+ var path = require('node:path');
5
+ var globby = require('globby');
6
+ var clipboard = require('clipboardy');
7
+
8
+ const minify = (content) => {
9
+ const minified = content.replace(/\s+/g, " ").replace(/\s*([\{\}\[\]\(\),;:])\s*/g, "$1").replace(/\s*=\s*/g, "=").replace(/\s*>\s*/g, ">").replace(/;\s*/g, ";").replace(/"\s+/g, '"').replace(/\s+"/g, '"').replace(/'\s+/g, "'").replace(/\s+'/g, "'").trim();
10
+ if (!minified) return "(EMPTY FILE)";
11
+ return minified;
12
+ };
13
+
14
+ const DEFAULT_ANTI_PATTERNS = [
15
+ "node_modules",
16
+ "node_modules/**",
17
+ ".git",
18
+ ".git/**",
19
+ ".github",
20
+ ".github/**",
21
+ "dist",
22
+ "dist/**",
23
+ "build",
24
+ "build/**",
25
+ "coverage",
26
+ "coverage/**",
27
+ ".next",
28
+ ".next/**",
29
+ ".vercel",
30
+ ".vercel/**",
31
+ ".turbo",
32
+ ".turbo/**",
33
+ ".DS_Store",
34
+ "*.log",
35
+ "npm-debug.log",
36
+ "yarn-error.log",
37
+ "pnpm-debug.log",
38
+ ".env",
39
+ ".env.*"
40
+ ];
41
+
42
+ const argv = process.argv.slice(2);
43
+ const getInput = () => {
44
+ let hasIgnorePassed = false;
45
+ const patterns = [];
46
+ const ignorePatterns = [];
47
+ for (const value of argv) {
48
+ if (value === "--ignore") {
49
+ hasIgnorePassed = true;
50
+ continue;
51
+ }
52
+ if (hasIgnorePassed) ignorePatterns.push(value);
53
+ if (!hasIgnorePassed) patterns.push(value);
54
+ }
55
+ const ignore = ignorePatterns.length ? ignorePatterns : DEFAULT_ANTI_PATTERNS;
56
+ return { patterns, ignore };
57
+ };
58
+ const input = getInput();
59
+
60
+ if (input.patterns.length === 0) {
61
+ console.log("[catco] usage: catco [...patterns]");
62
+ console.log("");
63
+ console.log("Examples:");
64
+ console.log(" catco ./");
65
+ console.log(' catco "./src/**/*.ts"');
66
+ console.log(' catco "./src/**/*.{js,ts}"');
67
+ console.log(' catco "./*.js"');
68
+ console.log(' catco "./src/**/index.ts"');
69
+ console.log(' catco "./src/**/*.test.ts"');
70
+ console.log(' catco "./**/*.md"');
71
+ console.log(' catco "./src/utils/*.ts" "./src/components/*.ts"');
72
+ console.log(' catco "./**/*" "!./node_modules"');
73
+ console.log(' catco "./src/**/*" --exclude="./src/**/*.spec.ts"');
74
+ console.log("");
75
+ console.log("Supports multiple patterns and globs. Use quotes for complex patterns.");
76
+ process.exit(1);
77
+ }
78
+ const createOutputContents = (filePath, content) => {
79
+ return `/* FILE: ${path.resolve(filePath)} */ ${content} `;
80
+ };
81
+ const catco = async () => {
82
+ const fileContentsList = [];
83
+ const options = { ignore: input.ignore };
84
+ const filePaths = await globby.globby(input.patterns, options);
85
+ console.log(`[catco] found ${filePaths.length} files.`);
86
+ for (const filePath of filePaths) {
87
+ const content = await fs.promises.readFile(filePath, "utf-8");
88
+ const final = createOutputContents(filePath, content);
89
+ fileContentsList.push(final);
90
+ }
91
+ if (fileContentsList.length) {
92
+ const joined = fileContentsList.join("\n");
93
+ const minified = minify(joined);
94
+ await clipboard.write(minified);
95
+ console.log(`[catco] pre-minified length: ${joined.length}`);
96
+ console.log(`[catco] post-minified length: ${minified.length}`);
97
+ console.log(`[catco] all files contents copied to clipboard!`);
98
+ }
99
+ if (!fileContentsList) {
100
+ console.warn(`[catco] no matching files found for patterns: ${input.patterns}`);
101
+ }
102
+ };
103
+ catco();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env bun
@@ -0,0 +1 @@
1
+ #!/usr/bin/env bun
package/dist/index.js ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { globby } from 'globby';
5
+ import clipboard from 'clipboardy';
6
+
7
+ const minify = (content) => {
8
+ const minified = content.replace(/\s+/g, " ").replace(/\s*([\{\}\[\]\(\),;:])\s*/g, "$1").replace(/\s*=\s*/g, "=").replace(/\s*>\s*/g, ">").replace(/;\s*/g, ";").replace(/"\s+/g, '"').replace(/\s+"/g, '"').replace(/'\s+/g, "'").replace(/\s+'/g, "'").trim();
9
+ if (!minified) return "(EMPTY FILE)";
10
+ return minified;
11
+ };
12
+
13
+ const DEFAULT_ANTI_PATTERNS = [
14
+ "node_modules",
15
+ "node_modules/**",
16
+ ".git",
17
+ ".git/**",
18
+ ".github",
19
+ ".github/**",
20
+ "dist",
21
+ "dist/**",
22
+ "build",
23
+ "build/**",
24
+ "coverage",
25
+ "coverage/**",
26
+ ".next",
27
+ ".next/**",
28
+ ".vercel",
29
+ ".vercel/**",
30
+ ".turbo",
31
+ ".turbo/**",
32
+ ".DS_Store",
33
+ "*.log",
34
+ "npm-debug.log",
35
+ "yarn-error.log",
36
+ "pnpm-debug.log",
37
+ ".env",
38
+ ".env.*"
39
+ ];
40
+
41
+ const argv = process.argv.slice(2);
42
+ const getInput = () => {
43
+ let hasIgnorePassed = false;
44
+ const patterns = [];
45
+ const ignorePatterns = [];
46
+ for (const value of argv) {
47
+ if (value === "--ignore") {
48
+ hasIgnorePassed = true;
49
+ continue;
50
+ }
51
+ if (hasIgnorePassed) ignorePatterns.push(value);
52
+ if (!hasIgnorePassed) patterns.push(value);
53
+ }
54
+ const ignore = ignorePatterns.length ? ignorePatterns : DEFAULT_ANTI_PATTERNS;
55
+ return { patterns, ignore };
56
+ };
57
+ const input = getInput();
58
+
59
+ if (input.patterns.length === 0) {
60
+ console.log("[catco] usage: catco [...patterns]");
61
+ console.log("");
62
+ console.log("Examples:");
63
+ console.log(" catco ./");
64
+ console.log(' catco "./src/**/*.ts"');
65
+ console.log(' catco "./src/**/*.{js,ts}"');
66
+ console.log(' catco "./*.js"');
67
+ console.log(' catco "./src/**/index.ts"');
68
+ console.log(' catco "./src/**/*.test.ts"');
69
+ console.log(' catco "./**/*.md"');
70
+ console.log(' catco "./src/utils/*.ts" "./src/components/*.ts"');
71
+ console.log(' catco "./**/*" "!./node_modules"');
72
+ console.log(' catco "./src/**/*" --exclude="./src/**/*.spec.ts"');
73
+ console.log("");
74
+ console.log("Supports multiple patterns and globs. Use quotes for complex patterns.");
75
+ process.exit(1);
76
+ }
77
+ const createOutputContents = (filePath, content) => {
78
+ return `/* FILE: ${path.resolve(filePath)} */ ${content} `;
79
+ };
80
+ const catco = async () => {
81
+ const fileContentsList = [];
82
+ const options = { ignore: input.ignore };
83
+ const filePaths = await globby(input.patterns, options);
84
+ console.log(`[catco] found ${filePaths.length} files.`);
85
+ for (const filePath of filePaths) {
86
+ const content = await fs.promises.readFile(filePath, "utf-8");
87
+ const final = createOutputContents(filePath, content);
88
+ fileContentsList.push(final);
89
+ }
90
+ if (fileContentsList.length) {
91
+ const joined = fileContentsList.join("\n");
92
+ const minified = minify(joined);
93
+ await clipboard.write(minified);
94
+ console.log(`[catco] pre-minified length: ${joined.length}`);
95
+ console.log(`[catco] post-minified length: ${minified.length}`);
96
+ console.log(`[catco] all files contents copied to clipboard!`);
97
+ }
98
+ if (!fileContentsList) {
99
+ console.warn(`[catco] no matching files found for patterns: ${input.patterns}`);
100
+ }
101
+ };
102
+ catco();
package/dist/index.mjs ADDED
@@ -0,0 +1,101 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { globby } from 'globby';
4
+ import clipboard from 'clipboardy';
5
+
6
+ const minify = (content) => {
7
+ const minified = content.replace(/\s+/g, " ").replace(/\s*([\{\}\[\]\(\),;:])\s*/g, "$1").replace(/\s*=\s*/g, "=").replace(/\s*>\s*/g, ">").replace(/;\s*/g, ";").replace(/"\s+/g, '"').replace(/\s+"/g, '"').replace(/'\s+/g, "'").replace(/\s+'/g, "'").trim();
8
+ if (!minified) return "(EMPTY FILE)";
9
+ return minified;
10
+ };
11
+
12
+ const DEFAULT_ANTI_PATTERNS = [
13
+ "node_modules",
14
+ "node_modules/**",
15
+ ".git",
16
+ ".git/**",
17
+ ".github",
18
+ ".github/**",
19
+ "dist",
20
+ "dist/**",
21
+ "build",
22
+ "build/**",
23
+ "coverage",
24
+ "coverage/**",
25
+ ".next",
26
+ ".next/**",
27
+ ".vercel",
28
+ ".vercel/**",
29
+ ".turbo",
30
+ ".turbo/**",
31
+ ".DS_Store",
32
+ "*.log",
33
+ "npm-debug.log",
34
+ "yarn-error.log",
35
+ "pnpm-debug.log",
36
+ ".env",
37
+ ".env.*"
38
+ ];
39
+
40
+ const argv = process.argv.slice(2);
41
+ const getInput = () => {
42
+ let hasIgnorePassed = false;
43
+ const patterns = [];
44
+ const ignorePatterns = [];
45
+ for (const value of argv) {
46
+ if (value === "--ignore") {
47
+ hasIgnorePassed = true;
48
+ continue;
49
+ }
50
+ if (hasIgnorePassed) ignorePatterns.push(value);
51
+ if (!hasIgnorePassed) patterns.push(value);
52
+ }
53
+ const ignore = ignorePatterns.length ? ignorePatterns : DEFAULT_ANTI_PATTERNS;
54
+ return { patterns, ignore };
55
+ };
56
+ const input = getInput();
57
+
58
+ if (input.patterns.length === 0) {
59
+ console.log("[catco] usage: catco [...patterns]");
60
+ console.log("");
61
+ console.log("Examples:");
62
+ console.log(" catco ./");
63
+ console.log(' catco "./src/**/*.ts"');
64
+ console.log(' catco "./src/**/*.{js,ts}"');
65
+ console.log(' catco "./*.js"');
66
+ console.log(' catco "./src/**/index.ts"');
67
+ console.log(' catco "./src/**/*.test.ts"');
68
+ console.log(' catco "./**/*.md"');
69
+ console.log(' catco "./src/utils/*.ts" "./src/components/*.ts"');
70
+ console.log(' catco "./**/*" "!./node_modules"');
71
+ console.log(' catco "./src/**/*" --exclude="./src/**/*.spec.ts"');
72
+ console.log("");
73
+ console.log("Supports multiple patterns and globs. Use quotes for complex patterns.");
74
+ process.exit(1);
75
+ }
76
+ const createOutputContents = (filePath, content) => {
77
+ return `/* FILE: ${path.resolve(filePath)} */ ${content} `;
78
+ };
79
+ const catco = async () => {
80
+ const fileContentsList = [];
81
+ const options = { ignore: input.ignore };
82
+ const filePaths = await globby(input.patterns, options);
83
+ console.log(`[catco] found ${filePaths.length} files.`);
84
+ for (const filePath of filePaths) {
85
+ const content = await fs.promises.readFile(filePath, "utf-8");
86
+ const final = createOutputContents(filePath, content);
87
+ fileContentsList.push(final);
88
+ }
89
+ if (fileContentsList.length) {
90
+ const joined = fileContentsList.join("\n");
91
+ const minified = minify(joined);
92
+ await clipboard.write(minified);
93
+ console.log(`[catco] pre-minified length: ${joined.length}`);
94
+ console.log(`[catco] post-minified length: ${minified.length}`);
95
+ console.log(`[catco] all files contents copied to clipboard!`);
96
+ }
97
+ if (!fileContentsList) {
98
+ console.warn(`[catco] no matching files found for patterns: ${input.patterns}`);
99
+ }
100
+ };
101
+ catco();
package/package.json CHANGED
@@ -1,33 +1,25 @@
1
1
  {
2
2
  "name": "catco",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
- "main": "./dist/index.cjs",
6
- "module": "./dist/index.js",
7
5
  "description": "Glob copy file contents to ya clipboard.",
8
- "exports": {
9
- "import": "./dist/index.js",
10
- "require": "./dist/index.cjs"
11
- },
12
6
  "scripts": {
13
- "build": "tsx",
7
+ "build": "pkgroll",
14
8
  "start": "tsx src/index.ts ./src/**/*.ts"
15
9
  },
16
10
  "files": [
17
11
  "dist"
18
12
  ],
19
- "keywords": [
20
- "ai",
21
- "ai-assistant",
22
- "ai-tools",
23
- "gpt",
24
- "copy",
25
- "clipboard",
26
- "claude",
27
- "chatgpt",
28
- "chatgpt4o",
29
- "chatgpt4o-mini"
30
- ],
13
+ "main": "./dist/index.cjs",
14
+ "module": "./dist/index.mjs",
15
+ "exports": {
16
+ "import": {
17
+ "default": "./dist/index.mjs"
18
+ },
19
+ "require": {
20
+ "default": "./dist/index.cjs"
21
+ }
22
+ },
31
23
  "bin": {
32
24
  "catco": "./dist/index.js"
33
25
  },
@@ -40,7 +32,7 @@
40
32
  "bugs": "https://github.com/tasteee/catco/issues",
41
33
  "author": "tasteink <rocolcleasure@gmail.com>",
42
34
  "devDependencies": {
43
- "@types/minimist": "^1.2.5",
35
+ "pkgroll": "^2.12.2",
44
36
  "prettier": "^3.5.3",
45
37
  "tsx": "^4.19.2",
46
38
  "typescript": "^5.6.3",
@@ -48,12 +40,21 @@
48
40
  },
49
41
  "dependencies": {
50
42
  "clipboardy": "^4.0.0",
51
- "globby": "^14.0.2",
52
- "meow": "^13.2.0",
53
- "minimist": "^1.2.8",
54
- "sade": "^1.8.1"
43
+ "globby": "^14.0.2"
55
44
  },
56
45
  "publishConfig": {
57
46
  "access": "public"
58
- }
47
+ },
48
+ "keywords": [
49
+ "ai",
50
+ "ai-assistant",
51
+ "ai-tools",
52
+ "gpt",
53
+ "copy",
54
+ "clipboard",
55
+ "claude",
56
+ "chatgpt",
57
+ "chatgpt4o",
58
+ "chatgpt4o-mini"
59
+ ]
59
60
  }