@cobol-ts/codegen 0.0.0-stage → 0.0.2

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 CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ # @cobol-ts/codegen
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Orchestrates COBOL copybook source generation. The library reads the catalogue
4
+ and generation policy, resolves the artefact manifest, builds a default
5
+ projection in memory and produces TypeScript source files with the three pure
6
+ printers. Generated TypeScript is **not executed or imported** by codegen.
7
+
8
+ ```typescript
9
+ import {generateCode} from '@cobol-ts/codegen'
10
+ import {nodeTextFiles} from '@cobol-ts/files'
11
+ import {valueOrThrow} from '@cobol-ts/errors'
12
+
13
+ const result = valueOrThrow(await generateCode({
14
+ files: nodeTextFiles,
15
+ catalogue: '/project/definitions/.cobolts/files.yaml',
16
+ policy: '/project/definitions/.cobolts/generation.yaml',
17
+ configDirectory: '/project/definitions/.cobolts',
18
+ names: {
19
+ customers: {
20
+ source: 'CustomerRecordCB',
21
+ projection: 'Customer',
22
+ variable: 'customerProjection'
23
+ }
24
+ }
25
+ }))
26
+ ```
27
+
28
+ For each COBOL source, `createDefaultProjection` supplies the *same* in-memory
29
+ projection to the definition and projected-type printers. The source-side
30
+ copybook type is printed independently from the AST. The resulting
31
+ `defineProjection<Customer>(...)` pairs are checked by the consumer's TypeScript
32
+ compiler, not by the generator.
33
+
34
+ Manual projection definitions must have manual companion projection types; they
35
+ are maintained together and never overwritten. Generated copybook types remain
36
+ independently configurable.
37
+
38
+ The library uses `TextFiles` for I/O and returns `ErrorsOr<GenerationResult>`.
39
+ Individual files are written as they are produced, not as an atomic transaction.
40
+ The definitions package tests generation and resulting files; the application
41
+ package directly imports and tests the generated code.
42
+
43
+ Relative YAML roots are resolved from the `.cobolts` directory passed as `configDirectory`.
@@ -0,0 +1 @@
1
+ export * from './src/codegen';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/codegen"), exports);
18
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,67 @@
1
1
  {
2
2
  "name": "@cobol-ts/codegen",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Orchestrates source generation from COBOL copybooks through a shared in-memory default projection",
4
+ "version": "0.0.2",
5
+ "main": "dist/index",
6
+ "types": "dist/index",
7
+ "browserslist": {
8
+ "development": [
9
+ "last 1 chrome version",
10
+ "last 1 firefox version",
11
+ "last 1 safari version"
12
+ ],
13
+ "production": [
14
+ ">0.2%",
15
+ "not dead",
16
+ "not op_mini all"
17
+ ]
18
+ },
19
+ "dependencies": {
20
+ "@cobol-ts/file-catalogue": "0.0.2",
21
+ "@cobol-ts/files": "0.0.2",
22
+ "@cobol-ts/copybook": "0.0.2",
23
+ "@cobol-ts/copybook-typescript": "0.0.2",
24
+ "@cobol-ts/default-projection-typescript": "0.0.2",
25
+ "@cobol-ts/projection-typescript": "0.0.2",
26
+ "@cobol-ts/errors": "0.0.2"
27
+ },
28
+ "devDependencies": {
29
+ "typescript": "^5.2.2",
30
+ "@testing-library/jest-dom": "^6.1.4",
31
+ "@types/jest": "^29.0.0",
32
+ "@types/node": "^14.0.0",
33
+ "jest": "^29.0.0",
34
+ "ts-jest": "^29.0.0"
35
+ },
36
+ "eslintConfig": {
37
+ "extends": [
38
+ "react-app",
39
+ "react-app/jest"
40
+ ],
41
+ "overrides": [
42
+ {
43
+ "files": [
44
+ "**/*.stories.*"
45
+ ],
46
+ "rules": {
47
+ "import/no-anonymous-default-export": "off"
48
+ }
49
+ }
50
+ ]
51
+ },
52
+ "files": [
53
+ "dist/index.js",
54
+ "dist/index.d.ts",
55
+ "dist/src/",
56
+ "build/"
57
+ ],
58
+ "keywords": [
59
+ "indexing"
60
+ ],
61
+ "license": "MIT",
62
+ "repository": "git@github.com:intellimaintain/intellimaintain.git",
63
+ "scripts": {
64
+ "test": "jest --config jest.config.json --env node",
65
+ "test:watch": "npm run test -- --watch"
66
+ }
6
67
  }