@bemedev/codebase 1.0.0 → 1.1.0
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/README.md +9 -9
- package/lib/analyse.cjs +5 -3
- package/lib/analyse.cjs.map +1 -1
- package/lib/analyse.d.ts +2 -2
- package/lib/analyse.d.ts.map +1 -1
- package/lib/analyse.js +5 -3
- package/lib/analyse.js.map +1 -1
- package/lib/cli/cli.cjs +2 -1
- package/lib/cli/cli.cjs.map +1 -1
- package/lib/cli/cli.d.ts.map +1 -1
- package/lib/cli/cli.js +2 -1
- package/lib/cli/cli.js.map +1 -1
- package/lib/utils.cjs +1 -1
- package/lib/utils.cjs.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -51,16 +51,16 @@ pnpm add -D @bemedev/codebase
|
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
# Basic analysis - generates a codebase.json file
|
|
54
|
-
|
|
54
|
+
codebase
|
|
55
55
|
|
|
56
56
|
# Specify a custom output file
|
|
57
|
-
|
|
57
|
+
codebase --output my-analysis.json
|
|
58
58
|
|
|
59
59
|
# Exclude specific files
|
|
60
|
-
|
|
60
|
+
codebase --exclude node_modules dist lib build
|
|
61
61
|
|
|
62
62
|
# Use short options
|
|
63
|
-
|
|
63
|
+
codebase -o output.json node_modules dist
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
#### Available options
|
|
@@ -127,7 +127,7 @@ src/
|
|
|
127
127
|
│ ├── generate.ts # Generate analysis
|
|
128
128
|
│ ├── init.ts # Initialization
|
|
129
129
|
│ └── remove.ts # Removal
|
|
130
|
-
├──
|
|
130
|
+
├── analyse.ts # Analysis engine
|
|
131
131
|
├── types.ts # TypeScript definitions
|
|
132
132
|
└── constants.ts # Global constants
|
|
133
133
|
```
|
|
@@ -153,13 +153,13 @@ pnpm dev
|
|
|
153
153
|
### Analyze a React project
|
|
154
154
|
|
|
155
155
|
```bash
|
|
156
|
-
|
|
156
|
+
codebase -o react-analysis.json node_modules public build
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
### Analyze a Node.js project
|
|
160
160
|
|
|
161
161
|
```bash
|
|
162
|
-
|
|
162
|
+
codebase -o backend-analysis.json node_modules dist coverage
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
### Integrate into an NPM script
|
|
@@ -167,8 +167,8 @@ pnpm dev
|
|
|
167
167
|
```json
|
|
168
168
|
{
|
|
169
169
|
"scripts": {
|
|
170
|
-
"analyze": "
|
|
171
|
-
"analyze:clean": "
|
|
170
|
+
"analyze": "codebase -o analysis/codebase.json",
|
|
171
|
+
"analyze:clean": "codebase -o analysis/clean.json node_modules dist lib build"
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
```
|
package/lib/analyse.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_utils = require("./utils.cjs");
|
|
4
|
-
const require_constants = require("./constants.cjs");
|
|
5
4
|
const require_schemas = require("./schemas.cjs");
|
|
6
5
|
const require_analyse_utils = require("./analyse.utils.cjs");
|
|
7
6
|
const require_exports = require("./exports.cjs");
|
|
@@ -15,13 +14,16 @@ let ts_morph = require("ts-morph");
|
|
|
15
14
|
/**
|
|
16
15
|
* Analyzes all TypeScript files in src/ (except src/scripts/)
|
|
17
16
|
*/
|
|
18
|
-
const analyze = ({ src
|
|
17
|
+
const analyze = ({ src, excludes: _excludes }) => {
|
|
19
18
|
console.log("🔍 Codebase analysis in progress...");
|
|
20
19
|
const excludes = require_helpers.toArray(_excludes);
|
|
21
20
|
const sourceFiles = new ts_morph.Project({ tsConfigFilePath: (0, path.join)(process.cwd(), "tsconfig.json") }).addSourceFilesAtPaths([
|
|
22
21
|
`${src}/**/*.ts`,
|
|
22
|
+
`${src}/**/*.tsx`,
|
|
23
23
|
`!${src}/**/*.test.ts`,
|
|
24
|
-
`!${src}/**/*.
|
|
24
|
+
`!${src}/**/*.test.tsx`,
|
|
25
|
+
`!${src}/**/*.spec.ts`,
|
|
26
|
+
`!${src}/**/*.spec.tsx`
|
|
25
27
|
].concat(excludes.map((exclude) => `!${exclude}`)));
|
|
26
28
|
const analysis = {};
|
|
27
29
|
let processedCount = 0;
|
package/lib/analyse.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyse.cjs","names":["
|
|
1
|
+
{"version":3,"file":"analyse.cjs","names":["toArray","Project","addJSDocToSourceText","analyzeImports","analyzeExports","buildImportStrings","pathToDotNotation","v","CodebaseAnalysisSchema"],"sources":["../src/analyse.ts"],"sourcesContent":["import { join, relative } from 'path';\nimport { Project } from 'ts-morph';\nimport * as v from 'valibot';\nimport { addJSDocToSourceText } from './analyse.utils';\nimport { analyzeExports } from './exports';\nimport { toArray } from './helpers';\nimport { analyzeImports, buildImportStrings } from './imports';\nimport { CodebaseAnalysisSchema } from './schemas';\nimport { pathToDotNotation } from './utils';\n\nexport type AnalyzeOptions = {\n src: string;\n excludes?: string | string[];\n};\n\n/**\n * Analyzes all TypeScript files in src/ (except src/scripts/)\n */\nexport const analyze = ({\n src,\n excludes: _excludes,\n}: AnalyzeOptions) => {\n console.log('🔍 Codebase analysis in progress...');\n const excludes = toArray(_excludes);\n\n // Initialize the ts-morph project\n const project = new Project({\n tsConfigFilePath: join(process.cwd(), 'tsconfig.json'),\n });\n\n // Add all TypeScript files from the src folder\n const sourceFiles = project.addSourceFilesAtPaths(\n [\n `${src}/**/*.ts`,\n `${src}/**/*.tsx`,\n\n // #region Exclude test files\n `!${src}/**/*.test.ts`,\n `!${src}/**/*.test.tsx`,\n `!${src}/**/*.spec.ts`,\n `!${src}/**/*.spec.tsx`,\n // #endregion\n ].concat(excludes.map(exclude => `!${exclude}`)),\n );\n\n const analysis: v.InferInput<typeof CodebaseAnalysisSchema> = {};\n let processedCount = 0;\n\n for (const sourceFile of sourceFiles) {\n const filePath = sourceFile.getFilePath();\n const relativePath = relative(src, filePath);\n\n // Generate modified text with JSDoc for exports\n\n const _text = addJSDocToSourceText(sourceFile);\n\n // #region Analyze imports and exports\n const imports = analyzeImports(sourceFile);\n const exports = analyzeExports(sourceFile);\n // #endregion\n\n // Build imports from fileAnalysis.imports\n const importsStrings = buildImportStrings(imports);\n\n // Combine imports and content\n const importsSection =\n importsStrings.length > 0 ? importsStrings.join('\\n') : '';\n\n const text =\n importsSection === ''\n ? _text\n : `${importsSection}\n\n${_text}\n `;\n\n analysis[pathToDotNotation(relativePath)] = {\n relativePath,\n imports,\n exports,\n text,\n };\n\n processedCount++;\n\n // #region Display analysis progress in increments of 50\n if (processedCount % 50 === 0) {\n console.log(\n `📊 Analyzed ${processedCount}/${sourceFiles.length} files...`,\n );\n }\n // #endregion\n }\n\n console.log(\n `✅ Analysis completed: ${processedCount} files analyzed`,\n );\n return v.parse(CodebaseAnalysisSchema, analysis);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAa,WAAW,EACtB,KACA,UAAU,gBACU;CACpB,QAAQ,IAAI,qCAAqC;CACjD,MAAM,WAAWA,gBAAAA,QAAQ,SAAS;CAQlC,MAAM,cAAc,IALAC,SAAAA,QAAQ,EAC1B,mBAAA,GAAA,KAAA,KAAA,CAAuB,QAAQ,IAAI,GAAG,eAAe,EACvD,CAG0B,CAAC,CAAC,sBAC1B;EACE,GAAG,IAAI;EACP,GAAG,IAAI;EAGP,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,IAAI;CAEV,CAAC,CAAC,OAAO,SAAS,KAAI,YAAW,IAAI,SAAS,CAAC,CACjD;CAEA,MAAM,WAAwD,CAAC;CAC/D,IAAI,iBAAiB;CAErB,KAAK,MAAM,cAAc,aAAa;EAEpC,MAAM,gBAAA,GAAA,KAAA,SAAA,CAAwB,KADb,WAAW,YACc,CAAC;EAI3C,MAAM,QAAQC,sBAAAA,qBAAqB,UAAU;EAG7C,MAAM,UAAUC,gBAAAA,eAAe,UAAU;EACzC,MAAM,UAAUC,gBAAAA,eAAe,UAAU;EAIzC,MAAM,iBAAiBC,gBAAAA,mBAAmB,OAAO;EAGjD,MAAM,iBACJ,eAAe,SAAS,IAAI,eAAe,KAAK,IAAI,IAAI;EAE1D,MAAM,OACJ,mBAAmB,KACf,QACA,GAAG,eAAe;;EAE1B,MAAM;;EAGJ,SAASC,cAAAA,kBAAkB,YAAY,KAAK;GAC1C;GACA;GACA;GACA;EACF;EAEA;EAGA,IAAI,iBAAiB,OAAO,GAC1B,QAAQ,IACN,eAAe,eAAe,GAAG,YAAY,OAAO,UACtD;CAGJ;CAEA,QAAQ,IACN,yBAAyB,eAAe,gBAC1C;CACA,OAAOC,QAAE,MAAMC,gBAAAA,wBAAwB,QAAQ;AACjD"}
|
package/lib/analyse.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export type AnalyzeOptions = {
|
|
2
|
-
src
|
|
2
|
+
src: string;
|
|
3
3
|
excludes?: string | string[];
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
6
|
* Analyzes all TypeScript files in src/ (except src/scripts/)
|
|
7
7
|
*/
|
|
8
|
-
export declare const analyze: ({ src, excludes: _excludes, }
|
|
8
|
+
export declare const analyze: ({ src, excludes: _excludes, }: AnalyzeOptions) => {
|
|
9
9
|
[x: string]: {
|
|
10
10
|
relativePath: string;
|
|
11
11
|
imports: {
|
package/lib/analyse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyse.d.ts","sourceRoot":"","sources":["../src/analyse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analyse.d.ts","sourceRoot":"","sources":["../src/analyse.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,+BAGrB,cAAc;;;;;;;;;;;;;;;;;;;;CA6EhB,CAAC"}
|
package/lib/analyse.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { pathToDotNotation } from "./utils.js";
|
|
2
|
-
import { SRC_DIR } from "./constants.js";
|
|
3
2
|
import { CodebaseAnalysisSchema } from "./schemas.js";
|
|
4
3
|
import { addJSDocToSourceText } from "./analyse.utils.js";
|
|
5
4
|
import { analyzeExports } from "./exports.js";
|
|
@@ -12,13 +11,16 @@ import { Project } from "ts-morph";
|
|
|
12
11
|
/**
|
|
13
12
|
* Analyzes all TypeScript files in src/ (except src/scripts/)
|
|
14
13
|
*/
|
|
15
|
-
const analyze = ({ src
|
|
14
|
+
const analyze = ({ src, excludes: _excludes }) => {
|
|
16
15
|
console.log("🔍 Codebase analysis in progress...");
|
|
17
16
|
const excludes = toArray(_excludes);
|
|
18
17
|
const sourceFiles = new Project({ tsConfigFilePath: join(process.cwd(), "tsconfig.json") }).addSourceFilesAtPaths([
|
|
19
18
|
`${src}/**/*.ts`,
|
|
19
|
+
`${src}/**/*.tsx`,
|
|
20
20
|
`!${src}/**/*.test.ts`,
|
|
21
|
-
`!${src}/**/*.
|
|
21
|
+
`!${src}/**/*.test.tsx`,
|
|
22
|
+
`!${src}/**/*.spec.ts`,
|
|
23
|
+
`!${src}/**/*.spec.tsx`
|
|
22
24
|
].concat(excludes.map((exclude) => `!${exclude}`)));
|
|
23
25
|
const analysis = {};
|
|
24
26
|
let processedCount = 0;
|
package/lib/analyse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyse.js","names":[],"sources":["../src/analyse.ts"],"sourcesContent":["import { join, relative } from 'path';\nimport { Project } from 'ts-morph';\nimport * as v from 'valibot';\nimport { addJSDocToSourceText } from './analyse.utils';\nimport {
|
|
1
|
+
{"version":3,"file":"analyse.js","names":[],"sources":["../src/analyse.ts"],"sourcesContent":["import { join, relative } from 'path';\nimport { Project } from 'ts-morph';\nimport * as v from 'valibot';\nimport { addJSDocToSourceText } from './analyse.utils';\nimport { analyzeExports } from './exports';\nimport { toArray } from './helpers';\nimport { analyzeImports, buildImportStrings } from './imports';\nimport { CodebaseAnalysisSchema } from './schemas';\nimport { pathToDotNotation } from './utils';\n\nexport type AnalyzeOptions = {\n src: string;\n excludes?: string | string[];\n};\n\n/**\n * Analyzes all TypeScript files in src/ (except src/scripts/)\n */\nexport const analyze = ({\n src,\n excludes: _excludes,\n}: AnalyzeOptions) => {\n console.log('🔍 Codebase analysis in progress...');\n const excludes = toArray(_excludes);\n\n // Initialize the ts-morph project\n const project = new Project({\n tsConfigFilePath: join(process.cwd(), 'tsconfig.json'),\n });\n\n // Add all TypeScript files from the src folder\n const sourceFiles = project.addSourceFilesAtPaths(\n [\n `${src}/**/*.ts`,\n `${src}/**/*.tsx`,\n\n // #region Exclude test files\n `!${src}/**/*.test.ts`,\n `!${src}/**/*.test.tsx`,\n `!${src}/**/*.spec.ts`,\n `!${src}/**/*.spec.tsx`,\n // #endregion\n ].concat(excludes.map(exclude => `!${exclude}`)),\n );\n\n const analysis: v.InferInput<typeof CodebaseAnalysisSchema> = {};\n let processedCount = 0;\n\n for (const sourceFile of sourceFiles) {\n const filePath = sourceFile.getFilePath();\n const relativePath = relative(src, filePath);\n\n // Generate modified text with JSDoc for exports\n\n const _text = addJSDocToSourceText(sourceFile);\n\n // #region Analyze imports and exports\n const imports = analyzeImports(sourceFile);\n const exports = analyzeExports(sourceFile);\n // #endregion\n\n // Build imports from fileAnalysis.imports\n const importsStrings = buildImportStrings(imports);\n\n // Combine imports and content\n const importsSection =\n importsStrings.length > 0 ? importsStrings.join('\\n') : '';\n\n const text =\n importsSection === ''\n ? _text\n : `${importsSection}\n\n${_text}\n `;\n\n analysis[pathToDotNotation(relativePath)] = {\n relativePath,\n imports,\n exports,\n text,\n };\n\n processedCount++;\n\n // #region Display analysis progress in increments of 50\n if (processedCount % 50 === 0) {\n console.log(\n `📊 Analyzed ${processedCount}/${sourceFiles.length} files...`,\n );\n }\n // #endregion\n }\n\n console.log(\n `✅ Analysis completed: ${processedCount} files analyzed`,\n );\n return v.parse(CodebaseAnalysisSchema, analysis);\n};\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAa,WAAW,EACtB,KACA,UAAU,gBACU;CACpB,QAAQ,IAAI,qCAAqC;CACjD,MAAM,WAAW,QAAQ,SAAS;CAQlC,MAAM,cAAc,IALA,QAAQ,EAC1B,kBAAkB,KAAK,QAAQ,IAAI,GAAG,eAAe,EACvD,CAG0B,CAAC,CAAC,sBAC1B;EACE,GAAG,IAAI;EACP,GAAG,IAAI;EAGP,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,IAAI;CAEV,CAAC,CAAC,OAAO,SAAS,KAAI,YAAW,IAAI,SAAS,CAAC,CACjD;CAEA,MAAM,WAAwD,CAAC;CAC/D,IAAI,iBAAiB;CAErB,KAAK,MAAM,cAAc,aAAa;EAEpC,MAAM,eAAe,SAAS,KADb,WAAW,YACc,CAAC;EAI3C,MAAM,QAAQ,qBAAqB,UAAU;EAG7C,MAAM,UAAU,eAAe,UAAU;EACzC,MAAM,UAAU,eAAe,UAAU;EAIzC,MAAM,iBAAiB,mBAAmB,OAAO;EAGjD,MAAM,iBACJ,eAAe,SAAS,IAAI,eAAe,KAAK,IAAI,IAAI;EAE1D,MAAM,OACJ,mBAAmB,KACf,QACA,GAAG,eAAe;;EAE1B,MAAM;;EAGJ,SAAS,kBAAkB,YAAY,KAAK;GAC1C;GACA;GACA;GACA;EACF;EAEA;EAGA,IAAI,iBAAiB,OAAO,GAC1B,QAAQ,IACN,eAAe,eAAe,GAAG,YAAY,OAAO,UACtD;CAGJ;CAEA,QAAQ,IACN,yBAAyB,eAAe,gBAC1C;CACA,OAAO,EAAE,MAAM,wBAAwB,QAAQ;AACjD"}
|
package/lib/cli/cli.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_constants = require("../constants.cjs");
|
|
3
3
|
const require_functions_generate = require("../functions/generate.cjs");
|
|
4
|
+
const require_cli_constants = require("./constants.cjs");
|
|
4
5
|
let cmd_ts = require("cmd-ts");
|
|
5
6
|
//#region src/cli/cli.ts
|
|
6
7
|
const cli = (0, cmd_ts.command)({
|
|
7
|
-
name: "generate",
|
|
8
8
|
args: {
|
|
9
9
|
output: (0, cmd_ts.option)({
|
|
10
10
|
long: "output",
|
|
@@ -21,6 +21,7 @@ const cli = (0, cmd_ts.command)({
|
|
|
21
21
|
defaultValue: () => []
|
|
22
22
|
})
|
|
23
23
|
},
|
|
24
|
+
name: require_cli_constants.BIN,
|
|
24
25
|
handler: require_functions_generate.generate
|
|
25
26
|
});
|
|
26
27
|
//#endregion
|
package/lib/cli/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["string","CODEBASE_FILE"],"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["string","CODEBASE_FILE","BIN"],"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\nimport { BIN } from './constants';\n\nexport const cli = command({\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n\n excludes: multioption({\n description: 'The files to exclude, globs',\n long: 'excludes',\n short: 'x',\n type: array(string),\n defaultValue: () => [],\n }),\n },\n\n name: BIN,\n handler,\n});\n"],"mappings":";;;;;;AAKA,MAAa,OAAA,GAAA,OAAA,QAAA,CAAc;CACzB,MAAM;EACJ,SAAA,GAAA,OAAA,OAAA,CAAe;GACb,MAAM;GACN,OAAO;GACP,MAAMA,OAAAA;GACN,aAAa;GACb,oBAAoBC,kBAAAA;EACtB,CAAC;EAED,WAAA,GAAA,OAAA,YAAA,CAAsB;GACpB,aAAa;GACb,MAAM;GACN,OAAO;GACP,OAAA,GAAA,OAAA,MAAA,CAAYD,OAAAA,MAAM;GAClB,oBAAoB,CAAC;EACvB,CAAC;CACH;CAEA,MAAME,sBAAAA;CACN,SAAA,2BAAA;AACF,CAAC"}
|
package/lib/cli/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG;;;;;;;;;;oJAqBd,CAAC"}
|
package/lib/cli/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CODEBASE_FILE } from "../constants.js";
|
|
2
2
|
import { generate } from "../functions/generate.js";
|
|
3
|
+
import { BIN } from "./constants.js";
|
|
3
4
|
import { array, command, multioption, option, string } from "cmd-ts";
|
|
4
5
|
//#region src/cli/cli.ts
|
|
5
6
|
const cli = command({
|
|
6
|
-
name: "generate",
|
|
7
7
|
args: {
|
|
8
8
|
output: option({
|
|
9
9
|
long: "output",
|
|
@@ -20,6 +20,7 @@ const cli = command({
|
|
|
20
20
|
defaultValue: () => []
|
|
21
21
|
})
|
|
22
22
|
},
|
|
23
|
+
name: BIN,
|
|
23
24
|
handler: generate
|
|
24
25
|
});
|
|
25
26
|
//#endregion
|
package/lib/cli/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":[],"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n
|
|
1
|
+
{"version":3,"file":"cli.js","names":[],"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\nimport { BIN } from './constants';\n\nexport const cli = command({\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n\n excludes: multioption({\n description: 'The files to exclude, globs',\n long: 'excludes',\n short: 'x',\n type: array(string),\n defaultValue: () => [],\n }),\n },\n\n name: BIN,\n handler,\n});\n"],"mappings":";;;;;AAKA,MAAa,MAAM,QAAQ;CACzB,MAAM;EACJ,QAAQ,OAAO;GACb,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;GACb,oBAAoB;EACtB,CAAC;EAED,UAAU,YAAY;GACpB,aAAa;GACb,MAAM;GACN,OAAO;GACP,MAAM,MAAM,MAAM;GAClB,oBAAoB,CAAC;EACvB,CAAC;CACH;CAEA,MAAM;CACN,SAAA;AACF,CAAC"}
|
package/lib/utils.cjs
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
5
5
|
* Ex: 'features/arrays/castings/all.ts' -> 'features.arrays.castings.all'
|
|
6
6
|
*/
|
|
7
7
|
function pathToDotNotation(filePath) {
|
|
8
|
-
return filePath.replace(/\.ts$/, "").replace(/\//g, ".");
|
|
8
|
+
return filePath.replace(/\.ts$/, "").replace(/\.tsx$/, "").replace(/\//g, ".");
|
|
9
9
|
}
|
|
10
10
|
//#endregion
|
|
11
11
|
exports.pathToDotNotation = pathToDotNotation;
|
package/lib/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["/**\n * Converts a file path to a dot notation key as in .manifest.ts\n * Ex: 'features/arrays/castings/all.ts' -> 'features.arrays.castings.all'\n */\nexport function pathToDotNotation(filePath: string): string {\n return filePath\n .replace(/\\.ts$/, '') // Remove the .ts extension\n .replace(/\\//g, '.'); // Replace / with .\n}\n"],"mappings":";;;;;;AAIA,SAAgB,kBAAkB,UAA0B;CAC1D,OAAO,SACJ,QAAQ,SAAS,EAAE,CAAC,CACpB,QAAQ,OAAO,GAAG;AACvB"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["/**\n * Converts a file path to a dot notation key as in .manifest.ts\n * Ex: 'features/arrays/castings/all.ts' -> 'features.arrays.castings.all'\n */\nexport function pathToDotNotation(filePath: string): string {\n return filePath\n .replace(/\\.ts$/, '') // Remove the .ts extension\n .replace(/\\.tsx$/, '') // Remove the .tsx extension\n .replace(/\\//g, '.'); // Replace / with .\n}\n"],"mappings":";;;;;;AAIA,SAAgB,kBAAkB,UAA0B;CAC1D,OAAO,SACJ,QAAQ,SAAS,EAAE,CAAC,CACpB,QAAQ,UAAU,EAAE,CAAC,CACrB,QAAQ,OAAO,GAAG;AACvB"}
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK1D"}
|
package/lib/utils.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Ex: 'features/arrays/castings/all.ts' -> 'features.arrays.castings.all'
|
|
5
5
|
*/
|
|
6
6
|
function pathToDotNotation(filePath) {
|
|
7
|
-
return filePath.replace(/\.ts$/, "").replace(/\//g, ".");
|
|
7
|
+
return filePath.replace(/\.ts$/, "").replace(/\.tsx$/, "").replace(/\//g, ".");
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
10
|
export { pathToDotNotation };
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["/**\n * Converts a file path to a dot notation key as in .manifest.ts\n * Ex: 'features/arrays/castings/all.ts' -> 'features.arrays.castings.all'\n */\nexport function pathToDotNotation(filePath: string): string {\n return filePath\n .replace(/\\.ts$/, '') // Remove the .ts extension\n .replace(/\\//g, '.'); // Replace / with .\n}\n"],"mappings":";;;;;AAIA,SAAgB,kBAAkB,UAA0B;CAC1D,OAAO,SACJ,QAAQ,SAAS,EAAE,CAAC,CACpB,QAAQ,OAAO,GAAG;AACvB"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["/**\n * Converts a file path to a dot notation key as in .manifest.ts\n * Ex: 'features/arrays/castings/all.ts' -> 'features.arrays.castings.all'\n */\nexport function pathToDotNotation(filePath: string): string {\n return filePath\n .replace(/\\.ts$/, '') // Remove the .ts extension\n .replace(/\\.tsx$/, '') // Remove the .tsx extension\n .replace(/\\//g, '.'); // Replace / with .\n}\n"],"mappings":";;;;;AAIA,SAAgB,kBAAkB,UAA0B;CAC1D,OAAO,SACJ,QAAQ,SAAS,EAAE,CAAC,CACpB,QAAQ,UAAU,EAAE,CAAC,CACrB,QAAQ,OAAO,GAAG;AACvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/codebase",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "The CLI for to generate codebase, and import partially a library. From @bemedev.",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "bri_lvi@icloud.com",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"valibot": "^1.4.1"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
|
-
"build": "pnpm rm:lib && pnpm run rolldown && pnpm run codegen",
|
|
90
|
+
"build": "pnpm rm:lib && pnpm run rolldown && pnpm run codegen && chmod +x lib/cli/index.js",
|
|
91
91
|
"_ci": "pnpm run config:off && pnpm run lint && pnpm run test",
|
|
92
92
|
"ci": "CI_START=$(date +%s) && pnpm run _ci && pnpm run p-q && echo \"\n✅ CI takes $(($(date +%s) - CI_START))s\n\"",
|
|
93
93
|
"ci:admin": "CI_START=$(date +%s) && pnpm run rm && pnpm run upgrade && pnpm run _ci && echo \"\n✅ CI_ADMIN takes $(($(date +%s) - CI_START))s\n\"",
|