diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a722404..a4fa748 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,11 +39,8 @@ jobs: run: python conformance/run.py typescript: - name: TypeScript runtime + name: TypeScript packages runs-on: ubuntu-latest - defaults: - run: - working-directory: packages/codeupipe-ts steps: - uses: actions/checkout@v5 - uses: actions/setup-python@v6 @@ -54,73 +51,20 @@ jobs: node-version: "24" - name: Install run: npm ci - - name: Type check - run: npm run typecheck - - name: Tests - run: npm test - name: Build run: npm run build - - name: Example - run: node examples/pricing/main.ts - - name: Conformance - working-directory: . - run: python conformance/run.py typescript:run - - typescript-lint: - name: TypeScript linter - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-node@v5 - with: - node-version: "24" - - name: Install the core package - working-directory: packages/codeupipe-ts - run: npm ci - - name: Install - working-directory: packages/codeupipe-lint-ts - run: npm ci - name: Type check - working-directory: packages/codeupipe-lint-ts run: npm run typecheck - name: Tests - working-directory: packages/codeupipe-lint-ts run: npm test - - name: Build - working-directory: packages/codeupipe-lint-ts - run: npm run build + - name: Example + run: node packages/codeupipe-ts/examples/pricing/main.ts - name: The linter on the TypeScript code of this repository - working-directory: packages/codeupipe-lint-ts - run: npm run lint - - typescript-compile: - name: TypeScript compiler - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-python@v6 - with: - python-version: "3.12" - - uses: actions/setup-node@v5 - with: - node-version: "24" - - name: Install the core package - working-directory: packages/codeupipe-ts - run: npm ci - - name: Install - working-directory: packages/codeupipe-compile-ts - run: npm ci - - name: Type check - working-directory: packages/codeupipe-compile-ts - run: npm run typecheck - - name: Tests - working-directory: packages/codeupipe-compile-ts - run: npm test - - name: Build - working-directory: packages/codeupipe-compile-ts - run: npm run build + run: npm run lint -w codeupipe-lint - name: Conformance - run: python conformance/run.py typescript:static + run: python conformance/run.py typescript:run typescript:static + - name: The packages as npm makes them + run: npm pack --workspaces --dry-run export: name: Export against dynamic run diff --git a/.gitignore b/.gitignore index f839347..9fe902d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ packages/*/build/ conformance/results/ .venv-*/ scorecard/results/ +node_modules/ diff --git a/README.md b/README.md index a3952c5..146e1fb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # codeupipe codeupipe is a library for writing a program as a pipeline of small steps. -It is for Python. A TypeScript runtime is in this repository and is not on -npm yet. +It is for Python and for TypeScript. There are eight primitives. Each one does one thing. @@ -81,8 +80,11 @@ These changes are not compatible with 1.0.0. - **`codeupipe.lower` is now `codeupipe.compile`.** The command is `python -m codeupipe.compile`. -The TypeScript packages are new. They are version `1.0.0-beta.1` and are not on -npm. +The TypeScript packages are new. They are version `0.1.0`. A version below +1.0 is not stable yet, and a new version can change in a way that is not +compatible. They are not on npm yet: +[packages/codeupipe-ts/README.md](packages/codeupipe-ts/README.md) says how to +install them from this repository. ## Example @@ -203,7 +205,9 @@ An editable install needs pip 21.3 or later. | `scorecard/` | The comparison of the compiled code with the dynamic run on random pipelines | | `docs/` | Reference for the compiler and the config file | -The root `pyproject.toml` is not a package. It holds the test settings. +The root `pyproject.toml` is not a package. It holds the test settings. The +root `package.json` is not a package: it makes the three TypeScript packages +one npm workspace. ## Other languages diff --git a/conformance/run.py b/conformance/run.py index 59da284..0cb333a 100644 --- a/conformance/run.py +++ b/conformance/run.py @@ -74,10 +74,11 @@ def _node_runs_typescript(): "typescript:static": _typescript("static"), } -# The static target runs the compile package, which must be installed, and -# that package uses the built core package. +# The static target runs the compile package. Its dependencies must be +# installed (npm ci at the repository root), and it uses the built core +# package. _TYPESCRIPT_NEEDS = { - "typescript:static": [REPO / "packages/codeupipe-compile-ts/node_modules", + "typescript:static": [REPO / "node_modules/typescript", REPO / "packages/codeupipe-ts/dist/index.js"], } diff --git a/packages/codeupipe-ts/package-lock.json b/package-lock.json similarity index 91% rename from packages/codeupipe-ts/package-lock.json rename to package-lock.json index d3fc45f..727adf1 100644 --- a/packages/codeupipe-ts/package-lock.json +++ b/package-lock.json @@ -1,21 +1,15 @@ { - "name": "codeupipe", - "version": "1.0.0-beta.1", + "name": "codeupipe-repository", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "codeupipe", - "version": "1.0.0-beta.1", - "license": "Apache-2.0", - "devDependencies": { - "@types/node": "^24.0.0", - "esbuild": "^0.28.2", - "typescript": "^5.9.0" - }, - "engines": { - "node": ">=22.18" - } + "name": "codeupipe-repository", + "workspaces": [ + "packages/codeupipe-ts", + "packages/codeupipe-lint-ts", + "packages/codeupipe-compile-ts" + ] }, "node_modules/@esbuild/aix-ppc64": { "version": "0.28.2", @@ -469,6 +463,18 @@ "undici-types": ">=7.24.0 <7.24.7" } }, + "node_modules/codeupipe": { + "resolved": "packages/codeupipe-ts", + "link": true + }, + "node_modules/codeupipe-compile": { + "resolved": "packages/codeupipe-compile-ts", + "link": true + }, + "node_modules/codeupipe-lint": { + "resolved": "packages/codeupipe-lint-ts", + "link": true + }, "node_modules/esbuild": { "version": "0.28.2", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", @@ -515,7 +521,6 @@ "version": "5.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -531,6 +536,52 @@ "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", "dev": true, "license": "MIT" + }, + "packages/codeupipe-compile-ts": { + "name": "codeupipe-compile", + "version": "0.1.0", + "license": "Apache-2.0", + "dependencies": { + "codeupipe": "0.1.0", + "typescript": "^5.9.0" + }, + "bin": { + "codeupipe-compile": "dist/cli.js" + }, + "devDependencies": { + "@types/node": "^24.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "packages/codeupipe-lint-ts": { + "name": "codeupipe-lint", + "version": "0.1.0", + "license": "Apache-2.0", + "dependencies": { + "codeupipe": "0.1.0", + "typescript": "^5.9.0" + }, + "bin": { + "codeupipe-lint": "dist/cli.js" + }, + "devDependencies": { + "@types/node": "^24.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "packages/codeupipe-ts": { + "name": "codeupipe", + "version": "0.1.0", + "license": "Apache-2.0", + "devDependencies": { + "@types/node": "^24.0.0", + "esbuild": "^0.28.2", + "typescript": "^5.9.0" + } } } } diff --git a/package.json b/package.json new file mode 100644 index 0000000..a9ebf4f --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "codeupipe-repository", + "private": true, + "description": "The npm workspace of the TypeScript packages. It is not a package.", + "workspaces": [ + "packages/codeupipe-ts", + "packages/codeupipe-lint-ts", + "packages/codeupipe-compile-ts" + ], + "scripts": { + "build": "npm run build --workspaces", + "test": "npm test --workspaces", + "typecheck": "npm run typecheck --workspaces" + } +} diff --git a/packages/codeupipe-compile-ts/README.md b/packages/codeupipe-compile-ts/README.md index 2357435..ed4c08b 100644 --- a/packages/codeupipe-compile-ts/README.md +++ b/packages/codeupipe-compile-ts/README.md @@ -1,7 +1,7 @@ # codeupipe-compile for TypeScript Writes a codeupipe pipeline as one plain TypeScript module with no import -of codeupipe. It reads the source and does not run it. It is a beta, version `1.0.0-beta.1`, and it is not on npm yet. +of codeupipe. It reads the source and does not run it. **The rule: code that compiles gives the same output as the pipeline. A pipeline for which the compiler cannot keep that rule is refused, with the @@ -13,8 +13,11 @@ The compiler is a codeupipe pipeline: `codeupipe` and on the `typescript` package, which it uses to read and write code. +It is not on npm yet: the [README of the core package](../codeupipe-ts/README.md) +says how to install it from this repository. + ```bash -codeupipe-compile src/pricing-pipeline.ts:PricingPipeline --out build/pricing.ts +npx codeupipe-compile src/pricing-pipeline.ts:PricingPipeline --out build/pricing.ts ``` Exit code: **0** the module is written, **1** the pipeline is refused (the @@ -107,8 +110,10 @@ compiler has neither. ## Development +The three TypeScript packages are one npm workspace. Run `npm ci` once, at +the root of the repository. Then, in this directory: + ```bash -npm install # links ../codeupipe-ts and installs the TypeScript compiler npm test # builds the core package first, then runs the tests npm run typecheck # also checks the conformance runner npm run build # JavaScript and type files in dist/ diff --git a/packages/codeupipe-compile-ts/package-lock.json b/packages/codeupipe-compile-ts/package-lock.json deleted file mode 100644 index fbf2527..0000000 --- a/packages/codeupipe-compile-ts/package-lock.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "codeupipe-compile", - "version": "1.0.0-beta.1", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "codeupipe-compile", - "version": "1.0.0-beta.1", - "license": "Apache-2.0", - "dependencies": { - "codeupipe": "file:../codeupipe-ts", - "typescript": "^5.9.0" - }, - "bin": { - "codeupipe-compile": "dist/cli.js" - }, - "devDependencies": { - "@types/node": "^24.0.0" - }, - "engines": { - "node": ">=22.18" - } - }, - "../codeupipe-ts": { - "name": "codeupipe", - "version": "1.0.0-beta.1", - "license": "Apache-2.0", - "devDependencies": { - "@types/node": "^24.0.0", - "esbuild": "^0.28.2", - "typescript": "^5.9.0" - }, - "engines": { - "node": ">=22.18" - } - }, - "node_modules/@types/node": { - "version": "24.19.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz", - "integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": ">=7.24.0 <7.24.7" - } - }, - "node_modules/codeupipe": { - "resolved": "../codeupipe-ts", - "link": true - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", - "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", - "dev": true, - "license": "MIT" - } - } -} diff --git a/packages/codeupipe-compile-ts/package.json b/packages/codeupipe-compile-ts/package.json index cfee3fc..53810e8 100644 --- a/packages/codeupipe-compile-ts/package.json +++ b/packages/codeupipe-compile-ts/package.json @@ -1,6 +1,6 @@ { "name": "codeupipe-compile", - "version": "1.0.0-beta.1", + "version": "0.1.0", "private": true, "description": "Writes a codeupipe pipeline as plain TypeScript with no import of codeupipe.", "license": "Apache-2.0", @@ -15,9 +15,17 @@ "bin": { "codeupipe-compile": "./dist/cli.js" }, - "files": ["dist", "LICENSE", "NOTICE", "README.md"], + "files": [ + "dist", + "LICENSE", + "NOTICE", + "README.md" + ], + "publishConfig": { + "access": "public" + }, "engines": { - "node": ">=22.18" + "node": ">=20" }, "scripts": { "core": "npm --prefix ../codeupipe-ts run build", @@ -26,13 +34,20 @@ "pretypecheck": "npm run core", "typecheck": "tsc --noEmit", "prebuild": "npm run core", - "build": "tsc -p tsconfig.build.json" + "build": "tsc -p tsconfig.build.json", + "prepack": "npm run build" }, "dependencies": { - "codeupipe": "file:../codeupipe-ts", + "codeupipe": "0.1.0", "typescript": "^5.9.0" }, "devDependencies": { "@types/node": "^24.0.0" - } + }, + "keywords": [ + "pipeline", + "filter", + "payload", + "composition" + ] } diff --git a/packages/codeupipe-lint-ts/README.md b/packages/codeupipe-lint-ts/README.md index 5f4668b..4573218 100644 --- a/packages/codeupipe-lint-ts/README.md +++ b/packages/codeupipe-lint-ts/README.md @@ -1,18 +1,23 @@ # codeupipe-lint for TypeScript A linter for TypeScript code that uses codeupipe. It reads the source and -does not run it. It is a beta, version `1.0.0-beta.1`, and it is not on npm yet. +does not run it. The linter is a codeupipe pipeline: [src/lint-pipeline.ts](src/lint-pipeline.ts). It depends on `codeupipe` and on the `typescript` package, which it uses to parse the files. +The version is below 1.0: the package is not stable yet, and a new version +can change in a way that is not compatible. It is not on npm yet: the +[README of the core package](../codeupipe-ts/README.md) says how to install it +from this repository. + ```bash -codeupipe-lint src # files or directories -codeupipe-lint --exclude '*/generated/*' src -codeupipe-lint --disable CUP-I005 src -codeupipe-lint --rules # list the rule ids -codeupipe-lint # paths come from cup.config.json +npx codeupipe-lint src # files or directories +npx codeupipe-lint --exclude '*/generated/*' src +npx codeupipe-lint --disable CUP-I005 src +npx codeupipe-lint --rules # list the rule ids +npx codeupipe-lint # paths come from cup.config.json ``` Each finding is one line, and the message names the fix: @@ -95,8 +100,10 @@ The file is used only when no paths are given on the command line. A key in ## Development +The three TypeScript packages are one npm workspace. Run `npm ci` once, at +the root of the repository. Then, in this directory: + ```bash -npm install # links ../codeupipe-ts and installs the TypeScript compiler npm test # builds the core package first, then runs the tests npm run typecheck npm run build # JavaScript and type files in dist/ diff --git a/packages/codeupipe-lint-ts/package-lock.json b/packages/codeupipe-lint-ts/package-lock.json deleted file mode 100644 index c00e595..0000000 --- a/packages/codeupipe-lint-ts/package-lock.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "codeupipe-lint", - "version": "1.0.0-beta.1", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "codeupipe-lint", - "version": "1.0.0-beta.1", - "license": "Apache-2.0", - "dependencies": { - "codeupipe": "file:../codeupipe-ts", - "typescript": "^5.9.0" - }, - "bin": { - "codeupipe-lint": "dist/cli.js" - }, - "devDependencies": { - "@types/node": "^24.0.0" - }, - "engines": { - "node": ">=22.18" - } - }, - "../codeupipe-ts": { - "name": "codeupipe", - "version": "1.0.0-beta.1", - "license": "Apache-2.0", - "devDependencies": { - "@types/node": "^24.0.0", - "esbuild": "^0.28.2", - "typescript": "^5.9.0" - }, - "engines": { - "node": ">=22.18" - } - }, - "node_modules/@types/node": { - "version": "24.19.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz", - "integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": ">=7.24.0 <7.24.7" - } - }, - "node_modules/codeupipe": { - "resolved": "../codeupipe-ts", - "link": true - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", - "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", - "dev": true, - "license": "MIT" - } - } -} diff --git a/packages/codeupipe-lint-ts/package.json b/packages/codeupipe-lint-ts/package.json index 6d5f607..eeb7cee 100644 --- a/packages/codeupipe-lint-ts/package.json +++ b/packages/codeupipe-lint-ts/package.json @@ -1,6 +1,6 @@ { "name": "codeupipe-lint", - "version": "1.0.0-beta.1", + "version": "0.1.0", "private": true, "description": "A linter for TypeScript code that uses codeupipe.", "license": "Apache-2.0", @@ -15,9 +15,17 @@ "bin": { "codeupipe-lint": "./dist/cli.js" }, - "files": ["dist", "LICENSE", "NOTICE", "README.md"], + "files": [ + "dist", + "LICENSE", + "NOTICE", + "README.md" + ], + "publishConfig": { + "access": "public" + }, "engines": { - "node": ">=22.18" + "node": ">=20" }, "scripts": { "core": "npm --prefix ../codeupipe-ts run build", @@ -27,13 +35,20 @@ "typecheck": "tsc --noEmit", "prebuild": "npm run core", "build": "tsc -p tsconfig.build.json", - "lint": "node src/cli.ts src ../codeupipe-ts/src ../codeupipe-ts/examples ../codeupipe-compile-ts/src ../../conformance/runners/typescript" + "lint": "node src/cli.ts src ../codeupipe-ts/src ../codeupipe-ts/examples ../codeupipe-compile-ts/src ../../conformance/runners/typescript", + "prepack": "npm run build" }, "dependencies": { - "codeupipe": "file:../codeupipe-ts", + "codeupipe": "0.1.0", "typescript": "^5.9.0" }, "devDependencies": { "@types/node": "^24.0.0" - } + }, + "keywords": [ + "pipeline", + "filter", + "payload", + "composition" + ] } diff --git a/packages/codeupipe-ts/README.md b/packages/codeupipe-ts/README.md index 813425e..90ade7a 100644 --- a/packages/codeupipe-ts/README.md +++ b/packages/codeupipe-ts/README.md @@ -4,10 +4,31 @@ codeupipe is a library for writing a program as a pipeline of small steps. This is the TypeScript runtime. It has no dependencies. The built JavaScript runs in a browser and in Node. -It is a beta, version `1.0.0-beta.1`, and it is not on npm yet. It implements the same contract as the Python +It implements the same contract as the Python package, and the same 27 conformance cases judge it: [conformance/API.md](../../conformance/API.md). +The version is below 1.0: the package is not stable yet, and a new version +can change in a way that is not compatible. + +The packages are not on npm yet. Make them from this repository, and +install the files that `npm pack` writes: + +```bash +git clone https://github.com/orchestrate-solutions/codeupipe +cd codeupipe && npm ci +npm pack --workspaces --pack-destination /tmp/codeupipe +``` + +```bash +# in your project +npm install /tmp/codeupipe/codeupipe-0.1.0.tgz +npm install --save-dev /tmp/codeupipe/codeupipe-lint-0.1.0.tgz /tmp/codeupipe/codeupipe-compile-0.1.0.tgz +``` + +Install the three files in one project together: the two tools need +`codeupipe` 0.1.0, and npm takes it from the file that you install. + ## The eight primitives | Primitive | What it does | Who writes it | @@ -92,8 +113,7 @@ result.toDict(); // { price: 90, qty: 12, bulk: true } ``` -In this repository the example imports from `../../src/index.ts`, because -the package is not installed. +In this repository the example imports from `../../src/index.ts`. ## Names @@ -143,8 +163,10 @@ that keeps names, and the labels change only in the second. Node 22.18 or later runs the `.ts` files as they are. +The three TypeScript packages are one npm workspace. Run `npm ci` once, at +the root of the repository. Then, in this directory: + ```bash -npm install # the TypeScript compiler, the Node types and esbuild, for development only npm test # the tests npm run typecheck # the type check of the source, tests and example npm run build # JavaScript and type files in dist/ diff --git a/packages/codeupipe-ts/package.json b/packages/codeupipe-ts/package.json index 102dfe4..eed8fbf 100644 --- a/packages/codeupipe-ts/package.json +++ b/packages/codeupipe-ts/package.json @@ -1,6 +1,6 @@ { "name": "codeupipe", - "version": "1.0.0-beta.1", + "version": "0.1.0", "private": true, "description": "A TypeScript library for writing a program as a pipeline of small steps.", "license": "Apache-2.0", @@ -24,18 +24,25 @@ "NOTICE", "README.md" ], - "sideEffects": false, - "engines": { - "node": ">=22.18" + "publishConfig": { + "access": "public" }, + "sideEffects": false, "scripts": { "test": "node --test \"tests/*.test.ts\"", "typecheck": "tsc --noEmit", - "build": "tsc -p tsconfig.build.json" + "build": "tsc -p tsconfig.build.json", + "prepack": "npm run build" }, "devDependencies": { "@types/node": "^24.0.0", "esbuild": "^0.28.2", "typescript": "^5.9.0" - } + }, + "keywords": [ + "pipeline", + "filter", + "payload", + "composition" + ] }