@zambit/elevate-ts 0.1.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/CLA-CORPORATE.md +72 -0
- package/CLA-INDIVIDUAL.md +71 -0
- package/DUAL-PUBLISHING-STRATEGY.md +571 -0
- package/LICENSE +610 -0
- package/README.md +77 -0
- package/dist/cjs/Either.d.ts +67 -0
- package/dist/cjs/Either.d.ts.map +1 -0
- package/dist/cjs/Either.js +147 -0
- package/dist/cjs/Either.js.map +1 -0
- package/dist/cjs/EitherAsync.d.ts +139 -0
- package/dist/cjs/EitherAsync.d.ts.map +1 -0
- package/dist/cjs/EitherAsync.js +171 -0
- package/dist/cjs/EitherAsync.js.map +1 -0
- package/dist/cjs/Function.d.ts +153 -0
- package/dist/cjs/Function.d.ts.map +1 -0
- package/dist/cjs/Function.js +110 -0
- package/dist/cjs/Function.js.map +1 -0
- package/dist/cjs/List.d.ts +134 -0
- package/dist/cjs/List.d.ts.map +1 -0
- package/dist/cjs/List.js +243 -0
- package/dist/cjs/List.js.map +1 -0
- package/dist/cjs/Maybe.d.ts +64 -0
- package/dist/cjs/Maybe.d.ts.map +1 -0
- package/dist/cjs/Maybe.js +122 -0
- package/dist/cjs/Maybe.js.map +1 -0
- package/dist/cjs/MaybeAsync.d.ts +115 -0
- package/dist/cjs/MaybeAsync.d.ts.map +1 -0
- package/dist/cjs/MaybeAsync.js +151 -0
- package/dist/cjs/MaybeAsync.js.map +1 -0
- package/dist/cjs/NonEmptyList.d.ts +86 -0
- package/dist/cjs/NonEmptyList.d.ts.map +1 -0
- package/dist/cjs/NonEmptyList.js +128 -0
- package/dist/cjs/NonEmptyList.js.map +1 -0
- package/dist/cjs/Reader.d.ts +53 -0
- package/dist/cjs/Reader.d.ts.map +1 -0
- package/dist/cjs/Reader.js +60 -0
- package/dist/cjs/Reader.js.map +1 -0
- package/dist/cjs/State.d.ts +71 -0
- package/dist/cjs/State.d.ts.map +1 -0
- package/dist/cjs/State.js +94 -0
- package/dist/cjs/State.js.map +1 -0
- package/dist/cjs/Tuple.d.ts +69 -0
- package/dist/cjs/Tuple.d.ts.map +1 -0
- package/dist/cjs/Tuple.js +73 -0
- package/dist/cjs/Tuple.js.map +1 -0
- package/dist/cjs/Validation.d.ts +53 -0
- package/dist/cjs/Validation.d.ts.map +1 -0
- package/dist/cjs/Validation.js +77 -0
- package/dist/cjs/Validation.js.map +1 -0
- package/dist/cjs/index.d.ts +12 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/tokens/config.d.ts +43 -0
- package/dist/cjs/tokens/config.d.ts.map +1 -0
- package/dist/cjs/tokens/config.js +162 -0
- package/dist/cjs/tokens/config.js.map +1 -0
- package/dist/cjs/tokens/cssGen.d.ts +18 -0
- package/dist/cjs/tokens/cssGen.d.ts.map +1 -0
- package/dist/cjs/tokens/cssGen.js +144 -0
- package/dist/cjs/tokens/cssGen.js.map +1 -0
- package/dist/cjs/tokens/generateCSS.d.ts +18 -0
- package/dist/cjs/tokens/generateCSS.d.ts.map +1 -0
- package/dist/cjs/tokens/generateCSS.js +83 -0
- package/dist/cjs/tokens/generateCSS.js.map +1 -0
- package/dist/cjs/tokens/index.d.ts +13 -0
- package/dist/cjs/tokens/index.d.ts.map +1 -0
- package/dist/cjs/tokens/index.js +12 -0
- package/dist/cjs/tokens/index.js.map +1 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/Either.d.ts +67 -0
- package/dist/esm/Either.d.ts.map +1 -0
- package/dist/esm/Either.js +136 -0
- package/dist/esm/Either.js.map +1 -0
- package/dist/esm/EitherAsync.d.ts +139 -0
- package/dist/esm/EitherAsync.d.ts.map +1 -0
- package/dist/esm/EitherAsync.js +173 -0
- package/dist/esm/EitherAsync.js.map +1 -0
- package/dist/esm/Function.d.ts +153 -0
- package/dist/esm/Function.d.ts.map +1 -0
- package/dist/esm/Function.js +109 -0
- package/dist/esm/Function.js.map +1 -0
- package/dist/esm/List.d.ts +134 -0
- package/dist/esm/List.d.ts.map +1 -0
- package/dist/esm/List.js +243 -0
- package/dist/esm/List.js.map +1 -0
- package/dist/esm/Maybe.d.ts +64 -0
- package/dist/esm/Maybe.d.ts.map +1 -0
- package/dist/esm/Maybe.js +113 -0
- package/dist/esm/Maybe.js.map +1 -0
- package/dist/esm/MaybeAsync.d.ts +115 -0
- package/dist/esm/MaybeAsync.d.ts.map +1 -0
- package/dist/esm/MaybeAsync.js +150 -0
- package/dist/esm/MaybeAsync.js.map +1 -0
- package/dist/esm/NonEmptyList.d.ts +86 -0
- package/dist/esm/NonEmptyList.d.ts.map +1 -0
- package/dist/esm/NonEmptyList.js +128 -0
- package/dist/esm/NonEmptyList.js.map +1 -0
- package/dist/esm/Reader.d.ts +53 -0
- package/dist/esm/Reader.d.ts.map +1 -0
- package/dist/esm/Reader.js +60 -0
- package/dist/esm/Reader.js.map +1 -0
- package/dist/esm/State.d.ts +71 -0
- package/dist/esm/State.d.ts.map +1 -0
- package/dist/esm/State.js +94 -0
- package/dist/esm/State.js.map +1 -0
- package/dist/esm/Tuple.d.ts +69 -0
- package/dist/esm/Tuple.d.ts.map +1 -0
- package/dist/esm/Tuple.js +73 -0
- package/dist/esm/Tuple.js.map +1 -0
- package/dist/esm/Validation.d.ts +53 -0
- package/dist/esm/Validation.d.ts.map +1 -0
- package/dist/esm/Validation.js +79 -0
- package/dist/esm/Validation.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +22 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/src/Either.d.ts +67 -0
- package/dist/esm/src/Either.d.ts.map +1 -0
- package/dist/esm/src/Either.js +147 -0
- package/dist/esm/src/Either.js.map +1 -0
- package/dist/esm/src/EitherAsync.d.ts +139 -0
- package/dist/esm/src/EitherAsync.d.ts.map +1 -0
- package/dist/esm/src/EitherAsync.js +171 -0
- package/dist/esm/src/EitherAsync.js.map +1 -0
- package/dist/esm/src/Function.d.ts +153 -0
- package/dist/esm/src/Function.d.ts.map +1 -0
- package/dist/esm/src/Function.js +110 -0
- package/dist/esm/src/Function.js.map +1 -0
- package/dist/esm/src/List.d.ts +134 -0
- package/dist/esm/src/List.d.ts.map +1 -0
- package/dist/esm/src/List.js +243 -0
- package/dist/esm/src/List.js.map +1 -0
- package/dist/esm/src/Maybe.d.ts +64 -0
- package/dist/esm/src/Maybe.d.ts.map +1 -0
- package/dist/esm/src/Maybe.js +122 -0
- package/dist/esm/src/Maybe.js.map +1 -0
- package/dist/esm/src/MaybeAsync.d.ts +115 -0
- package/dist/esm/src/MaybeAsync.d.ts.map +1 -0
- package/dist/esm/src/MaybeAsync.js +151 -0
- package/dist/esm/src/MaybeAsync.js.map +1 -0
- package/dist/esm/src/NonEmptyList.d.ts +86 -0
- package/dist/esm/src/NonEmptyList.d.ts.map +1 -0
- package/dist/esm/src/NonEmptyList.js +128 -0
- package/dist/esm/src/NonEmptyList.js.map +1 -0
- package/dist/esm/src/Reader.d.ts +53 -0
- package/dist/esm/src/Reader.d.ts.map +1 -0
- package/dist/esm/src/Reader.js +60 -0
- package/dist/esm/src/Reader.js.map +1 -0
- package/dist/esm/src/State.d.ts +71 -0
- package/dist/esm/src/State.d.ts.map +1 -0
- package/dist/esm/src/State.js +94 -0
- package/dist/esm/src/State.js.map +1 -0
- package/dist/esm/src/Tuple.d.ts +69 -0
- package/dist/esm/src/Tuple.d.ts.map +1 -0
- package/dist/esm/src/Tuple.js +73 -0
- package/dist/esm/src/Tuple.js.map +1 -0
- package/dist/esm/src/Validation.d.ts +53 -0
- package/dist/esm/src/Validation.d.ts.map +1 -0
- package/dist/esm/src/Validation.js +77 -0
- package/dist/esm/src/Validation.js.map +1 -0
- package/dist/esm/src/index.d.ts +12 -0
- package/dist/esm/src/index.d.ts.map +1 -0
- package/dist/esm/src/index.js +25 -0
- package/dist/esm/src/index.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/elevate-ts-vs-effect-critique.md +806 -0
- package/eslint.config.js +104 -0
- package/package.json +139 -0
package/CLA-CORPORATE.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Corporate Contributor License Agreement
|
|
2
|
+
|
|
3
|
+
Version 1.0
|
|
4
|
+
|
|
5
|
+
Important: this is a practical template for project operations. It is not legal advice. Have counsel review it before using it for inbound contributions.
|
|
6
|
+
|
|
7
|
+
This Corporate Contributor License Agreement ("Agreement") is between the entity identified in a signature block or other written acceptance ("Company") and Zambit, or its successor or affiliate
|
|
8
|
+
operating the `elevate-ts` project ("Zambit").
|
|
9
|
+
|
|
10
|
+
## 1. Covered Contributions
|
|
11
|
+
|
|
12
|
+
"Contribution" means any source code, object code, patch, bug fix, configuration, test, example, documentation, design material, issue text, or other material intentionally submitted by Company or by
|
|
13
|
+
a Company employee or contractor authorized by Company to contribute to `elevate-ts`.
|
|
14
|
+
|
|
15
|
+
## 2. Authorized Contributors
|
|
16
|
+
|
|
17
|
+
Company may authorize individual employees and contractors to submit Contributions on its behalf. Company is responsible for ensuring that those individuals have authority to do so.
|
|
18
|
+
|
|
19
|
+
## 3. License Grant to Zambit
|
|
20
|
+
|
|
21
|
+
Company grants Zambit a perpetual, worldwide, non-exclusive, irrevocable, transferable, sublicensable, royalty-free license to use, copy, reproduce, modify, prepare derivative works of, publicly
|
|
22
|
+
display, publicly perform, distribute, import, make available, sublicense, and relicense each Contribution, in whole or in part, under any license terms, including open-source, source-available, and
|
|
23
|
+
proprietary or commercial license terms.
|
|
24
|
+
|
|
25
|
+
This grant includes the right for Zambit to license the Contribution as part of `elevate-ts` under the GNU Affero General Public License and under separate commercial licenses for closed-source use.
|
|
26
|
+
|
|
27
|
+
## 4. Patent Grant
|
|
28
|
+
|
|
29
|
+
Company grants Zambit and recipients of software distributed by Zambit a perpetual, worldwide, non-exclusive, irrevocable, royalty-free patent license under Company's patent claims that Company can
|
|
30
|
+
license, to make, have made, use, sell, offer for sale, import, and otherwise transfer the Contribution and derivative works based on it.
|
|
31
|
+
|
|
32
|
+
This patent grant applies only to patent claims necessarily infringed by the Contribution alone or by combination of the Contribution with the project to which it was submitted.
|
|
33
|
+
|
|
34
|
+
## 5. Company Representations
|
|
35
|
+
|
|
36
|
+
Company represents that:
|
|
37
|
+
|
|
38
|
+
- Company has the legal right to submit each Contribution and to make the grants in this Agreement;
|
|
39
|
+
- each Contribution submitted by Company personnel is either original to Company or otherwise controlled by Company sufficiently to permit the grants in this Agreement; and
|
|
40
|
+
- to the best of Company's knowledge, no Contribution knowingly includes material under terms that would prevent Zambit from using, sublicensing, or relicensing it as described in this Agreement.
|
|
41
|
+
|
|
42
|
+
## 6. No Obligation
|
|
43
|
+
|
|
44
|
+
Zambit is not required to use any Contribution, attribute it, or distribute it.
|
|
45
|
+
|
|
46
|
+
## 7. Disclaimer
|
|
47
|
+
|
|
48
|
+
Except for the express representations in this Agreement, the Contribution is provided "as is." Company makes no other warranty.
|
|
49
|
+
|
|
50
|
+
## 8. Acceptance
|
|
51
|
+
|
|
52
|
+
Company accepts this Agreement by signing it or by agreeing through a project-managed electronic acceptance flow that identifies the Company.
|
|
53
|
+
|
|
54
|
+
## 9. General
|
|
55
|
+
|
|
56
|
+
This Agreement is the entire agreement between Company and Zambit for Contributions to `elevate-ts` unless the parties sign a separate written agreement covering the same subject matter.
|
|
57
|
+
|
|
58
|
+
If any provision is unenforceable, the remaining provisions will remain in effect to the maximum extent permitted by law.
|
|
59
|
+
|
|
60
|
+
## Signature
|
|
61
|
+
|
|
62
|
+
Company legal name:
|
|
63
|
+
|
|
64
|
+
Authorized signer:
|
|
65
|
+
|
|
66
|
+
Title:
|
|
67
|
+
|
|
68
|
+
Email:
|
|
69
|
+
|
|
70
|
+
Date:
|
|
71
|
+
|
|
72
|
+
Signature:
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Individual Contributor License Agreement
|
|
2
|
+
|
|
3
|
+
Version 1.0
|
|
4
|
+
|
|
5
|
+
Important: this is a practical template for project operations. It is not legal advice. Have counsel review it before using it for inbound contributions.
|
|
6
|
+
|
|
7
|
+
This Individual Contributor License Agreement ("Agreement") is between the individual identified in a signature block, pull request confirmation, or other written acceptance ("Contributor") and
|
|
8
|
+
Zambit, or its successor or affiliate operating the `elevate-ts` project ("Zambit").
|
|
9
|
+
|
|
10
|
+
## 1. Contribution
|
|
11
|
+
|
|
12
|
+
"Contribution" means any source code, object code, patch, bug fix, configuration, test, example, documentation, design material, issue text, or other material intentionally submitted by Contributor to
|
|
13
|
+
`elevate-ts` for inclusion in, review for, or discussion about the project.
|
|
14
|
+
|
|
15
|
+
## 2. Ownership
|
|
16
|
+
|
|
17
|
+
Contributor retains ownership of Contributor's copyrights in each Contribution.
|
|
18
|
+
|
|
19
|
+
## 3. License Grant to Zambit
|
|
20
|
+
|
|
21
|
+
Contributor grants Zambit a perpetual, worldwide, non-exclusive, irrevocable, transferable, sublicensable, royalty-free license to use, copy, reproduce, modify, prepare derivative works of, publicly
|
|
22
|
+
display, publicly perform, distribute, import, make available, sublicense, and relicense each Contribution, in whole or in part, under any license terms, including open-source, source-available, and
|
|
23
|
+
proprietary or commercial license terms.
|
|
24
|
+
|
|
25
|
+
This grant includes the right for Zambit to license the Contribution as part of `elevate-ts` under the GNU Affero General Public License and under separate commercial licenses for closed-source use.
|
|
26
|
+
|
|
27
|
+
## 4. Patent Grant
|
|
28
|
+
|
|
29
|
+
Contributor grants Zambit and recipients of software distributed by Zambit a perpetual, worldwide, non-exclusive, irrevocable, royalty-free patent license under Contributor's patent claims that
|
|
30
|
+
Contributor can license, to make, have made, use, sell, offer for sale, import, and otherwise transfer the Contribution and derivative works based on it.
|
|
31
|
+
|
|
32
|
+
This patent grant applies only to patent claims necessarily infringed by the Contribution alone or by combination of the Contribution with the project to which it was submitted.
|
|
33
|
+
|
|
34
|
+
## 5. Contributor Representations
|
|
35
|
+
|
|
36
|
+
Contributor represents that:
|
|
37
|
+
|
|
38
|
+
- Contributor has the legal right to submit the Contribution and to make the grants in this Agreement;
|
|
39
|
+
- each Contribution is an original work of authorship of Contributor, or Contributor otherwise has sufficient rights to submit it under these terms;
|
|
40
|
+
- to the best of Contributor's knowledge, no Contribution knowingly includes material under terms that would prevent Zambit from using, sublicensing, or relicensing it as described in this Agreement;
|
|
41
|
+
and
|
|
42
|
+
- if the Contribution was created within the scope of Contributor's employment or other engagement, Contributor has obtained any required permission from the relevant employer or principal.
|
|
43
|
+
|
|
44
|
+
## 6. No Obligation
|
|
45
|
+
|
|
46
|
+
Zambit is not required to use any Contribution, attribute it, or distribute it.
|
|
47
|
+
|
|
48
|
+
## 7. Disclaimer
|
|
49
|
+
|
|
50
|
+
Except for the express representations in this Agreement, the Contribution is provided "as is." Contributor makes no other warranty.
|
|
51
|
+
|
|
52
|
+
## 8. Acceptance
|
|
53
|
+
|
|
54
|
+
Contributor accepts this Agreement by signing it, by agreeing through a project-managed electronic acceptance flow, or by making a contribution after being presented with this Agreement and a clear
|
|
55
|
+
statement that the Contribution is subject to it.
|
|
56
|
+
|
|
57
|
+
## 9. General
|
|
58
|
+
|
|
59
|
+
This Agreement is the entire agreement between Contributor and Zambit for Contributions to `elevate-ts` unless the parties sign a separate written agreement covering the same subject matter.
|
|
60
|
+
|
|
61
|
+
If any provision is unenforceable, the remaining provisions will remain in effect to the maximum extent permitted by law.
|
|
62
|
+
|
|
63
|
+
## Signature
|
|
64
|
+
|
|
65
|
+
Contributor name:
|
|
66
|
+
|
|
67
|
+
Email:
|
|
68
|
+
|
|
69
|
+
Date:
|
|
70
|
+
|
|
71
|
+
Signature:
|
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
# Dual Publishing Strategy
|
|
2
|
+
|
|
3
|
+
This document outlines how elevate-ts publishes to two separate registries with different licenses.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
npm org: elevate-ts (under mlhamatzbt)
|
|
9
|
+
GitHub org: zambit
|
|
10
|
+
GitHub repo: zambit/elevate-ts (public)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### AGPL Version
|
|
14
|
+
|
|
15
|
+
- Package: `elevate-ts` (unscoped, public)
|
|
16
|
+
- Registry: npmjs.org
|
|
17
|
+
- Anyone can download
|
|
18
|
+
|
|
19
|
+
### Commercial Version
|
|
20
|
+
|
|
21
|
+
- Package: `@zambit/elevate-ts-commercial` (scoped to GitHub)
|
|
22
|
+
- Registry: GitHub Packages (private)
|
|
23
|
+
- Only org members with GitHub auth can download
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Part 1: Changes on Publish Side
|
|
28
|
+
|
|
29
|
+
### A. Update `package.json`
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"name": "elevate-ts",
|
|
34
|
+
"version": "0.1.2",
|
|
35
|
+
"description": "Functional programming library for TypeScript. Available under AGPL-3.0 or Commercial License.",
|
|
36
|
+
"license": "AGPL-3.0-or-later",
|
|
37
|
+
"type": "module",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/zambit/elevate-ts.git"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/zambit/elevate-ts",
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"registry": "https://registry.npmjs.org"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"publish:agpl": "npm publish --registry https://registry.npmjs.org",
|
|
49
|
+
"publish:commercial": "tsx scripts/publish-commercial.ts",
|
|
50
|
+
"prepublishOnly": "pnpm build && pnpm test && pnpm lint:md && pnpm check:nodeps"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Key changes:
|
|
56
|
+
|
|
57
|
+
- `"name": "elevate-ts"` (unscoped, discoverable)
|
|
58
|
+
- `"registry"` explicitly set to npmjs.org
|
|
59
|
+
- `"publish:agpl"` script added
|
|
60
|
+
|
|
61
|
+
### B. Create `.npmrc` in repo root (for CI/CD)
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
# NPM public registry (for AGPL publishes)
|
|
65
|
+
registry=https://registry.npmjs.org
|
|
66
|
+
|
|
67
|
+
# GitHub Packages registry (for commercial publishes)
|
|
68
|
+
@zambit:registry=https://npm.pkg.github.com
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### C. Update `scripts/publish-commercial.ts`
|
|
72
|
+
|
|
73
|
+
This script swaps the package name and LICENSE file, then publishes to GitHub Packages.
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
#!/usr/bin/env node
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Publish commercial version to GitHub Packages.
|
|
80
|
+
*
|
|
81
|
+
* 1. Updates package.json name to @zambit/elevate-ts-commercial
|
|
82
|
+
* 2. Swaps LICENSE (AGPL → commercial)
|
|
83
|
+
* 3. Publishes to GitHub Packages registry
|
|
84
|
+
* 4. Restores everything
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
88
|
+
import { execSync } from 'child_process';
|
|
89
|
+
|
|
90
|
+
const pkgPath = 'package.json';
|
|
91
|
+
const licensePath = 'LICENSE';
|
|
92
|
+
const agplBackupPath = 'LICENSE.agpl';
|
|
93
|
+
const commercialLicensePath = 'COMMERCIAL-LICENSE.md';
|
|
94
|
+
|
|
95
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
96
|
+
const originalName = pkg.name;
|
|
97
|
+
const originalLicense = pkg.license;
|
|
98
|
+
|
|
99
|
+
console.log('Publishing commercial version to GitHub Packages...');
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
// Update package
|
|
103
|
+
pkg.name = '@zambit/elevate-ts-commercial';
|
|
104
|
+
pkg.license = 'SEE COMMERCIAL-LICENSE.md';
|
|
105
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
106
|
+
|
|
107
|
+
// Swap licenses
|
|
108
|
+
execSync(`mv ${licensePath} ${agplBackupPath}`);
|
|
109
|
+
execSync(`cp ${commercialLicensePath} ${licensePath}`);
|
|
110
|
+
|
|
111
|
+
// Publish to GitHub Packages
|
|
112
|
+
execSync('npm publish --registry https://npm.pkg.github.com', { stdio: 'inherit' });
|
|
113
|
+
console.log('Commercial version published to GitHub Packages!');
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error('Error:', error.message);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
} finally {
|
|
118
|
+
// Restore
|
|
119
|
+
pkg.name = originalName;
|
|
120
|
+
pkg.license = originalLicense;
|
|
121
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
122
|
+
|
|
123
|
+
execSync(`rm ${licensePath}`);
|
|
124
|
+
execSync(`mv ${agplBackupPath} ${licensePath}`);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### D. Update `.github/workflows/publish.yml`
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
name: Publish
|
|
132
|
+
|
|
133
|
+
on:
|
|
134
|
+
push:
|
|
135
|
+
tags:
|
|
136
|
+
- 'v*'
|
|
137
|
+
|
|
138
|
+
jobs:
|
|
139
|
+
publish:
|
|
140
|
+
runs-on: ubuntu-latest
|
|
141
|
+
steps:
|
|
142
|
+
- uses: actions/checkout@v4
|
|
143
|
+
|
|
144
|
+
- uses: actions/setup-node@v4
|
|
145
|
+
with:
|
|
146
|
+
node-version: '24'
|
|
147
|
+
|
|
148
|
+
- run: pnpm install
|
|
149
|
+
- run: pnpm build
|
|
150
|
+
- run: pnpm test
|
|
151
|
+
|
|
152
|
+
# Determine which version to publish
|
|
153
|
+
- name: Determine License
|
|
154
|
+
id: license
|
|
155
|
+
run: |
|
|
156
|
+
TAG=${{ github.ref_name }}
|
|
157
|
+
if [[ $TAG == *"-commercial" ]]; then
|
|
158
|
+
echo "type=commercial" >> $GITHUB_OUTPUT
|
|
159
|
+
else
|
|
160
|
+
echo "type=agpl" >> $GITHUB_OUTPUT
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# Publish AGPL to npmjs.org
|
|
164
|
+
- name: Publish AGPL to npm
|
|
165
|
+
if: steps.license.outputs.type == 'agpl'
|
|
166
|
+
run: npm publish --registry https://registry.npmjs.org
|
|
167
|
+
env:
|
|
168
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
169
|
+
|
|
170
|
+
# Publish Commercial to GitHub Packages
|
|
171
|
+
- name: Publish Commercial to GitHub Packages
|
|
172
|
+
if: steps.license.outputs.type == 'commercial'
|
|
173
|
+
run: pnpm publish:commercial
|
|
174
|
+
env:
|
|
175
|
+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Part 2: Changes to Documentation
|
|
181
|
+
|
|
182
|
+
### A. Update `README.md`
|
|
183
|
+
|
|
184
|
+
````markdown
|
|
185
|
+
# elevate-ts
|
|
186
|
+
|
|
187
|
+
Point-free, data-last functional programming for TypeScript.
|
|
188
|
+
|
|
189
|
+
## Installation
|
|
190
|
+
|
|
191
|
+
### AGPL-3.0 (Free, Open Source)
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm install elevate-ts
|
|
195
|
+
```
|
|
196
|
+
````
|
|
197
|
+
|
|
198
|
+
See [LICENSE](./LICENSE) for terms. You must share modifications under AGPL-3.0.
|
|
199
|
+
|
|
200
|
+
### Commercial License (Proprietary Use)
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
npm install @zambit/elevate-ts-commercial --registry=https://npm.pkg.github.com
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
See [COMMERCIAL-LICENSE.md](./COMMERCIAL-LICENSE.md) and [COMMERCIAL_ACCESS.md](./COMMERCIAL_ACCESS.md) for setup and terms.
|
|
207
|
+
|
|
208
|
+
## Quick Start
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
import { pipe } from 'elevate-ts/Function';
|
|
212
|
+
import { Just, map, chain } from 'elevate-ts/Maybe';
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### B. Create `COMMERCIAL_ACCESS.md`
|
|
216
|
+
|
|
217
|
+
````markdown
|
|
218
|
+
# Commercial Package Access
|
|
219
|
+
|
|
220
|
+
This guide explains how to install `@zambit/elevate-ts-commercial` from GitHub Packages.
|
|
221
|
+
|
|
222
|
+
## Prerequisites
|
|
223
|
+
|
|
224
|
+
- A GitHub account with access to the Zambit org
|
|
225
|
+
- An npm account (optional, but recommended)
|
|
226
|
+
|
|
227
|
+
## Step 1: Get Your Token
|
|
228
|
+
|
|
229
|
+
Ask Zambit for a GitHub personal access token. It looks like:
|
|
230
|
+
|
|
231
|
+
```text
|
|
232
|
+
ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
233
|
+
```
|
|
234
|
+
````
|
|
235
|
+
|
|
236
|
+
Or create your own:
|
|
237
|
+
|
|
238
|
+
1. GitHub.com → Settings → Developer settings → Personal access tokens
|
|
239
|
+
2. Generate new token (classic)
|
|
240
|
+
3. Scopes: `read:packages`
|
|
241
|
+
|
|
242
|
+
## Step 2: Configure npm
|
|
243
|
+
|
|
244
|
+
Add to your `~/.npmrc`:
|
|
245
|
+
|
|
246
|
+
```text
|
|
247
|
+
@zambit:registry=https://npm.pkg.github.com
|
|
248
|
+
//npm.pkg.github.com/:_authToken=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Multiple Organizations
|
|
252
|
+
|
|
253
|
+
If you use packages from multiple orgs:
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
# Zambit commercial packages
|
|
257
|
+
@zambit:registry=https://npm.pkg.github.com
|
|
258
|
+
//npm.pkg.github.com/:_authToken=ghp_zambit_xxxxx
|
|
259
|
+
|
|
260
|
+
# Other orgs
|
|
261
|
+
@acme:registry=https://npm.pkg.github.com
|
|
262
|
+
//npm.pkg.github.com/:_authToken=ghp_acme_xxxxx
|
|
263
|
+
|
|
264
|
+
# Public npm (default)
|
|
265
|
+
registry=https://registry.npmjs.org
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Step 3: Install
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
npm install @zambit/elevate-ts-commercial
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## CI/CD Setup
|
|
275
|
+
|
|
276
|
+
### GitHub Actions
|
|
277
|
+
|
|
278
|
+
```yaml
|
|
279
|
+
- name: Install dependencies
|
|
280
|
+
run: npm install
|
|
281
|
+
env:
|
|
282
|
+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Docker
|
|
286
|
+
|
|
287
|
+
```dockerfile
|
|
288
|
+
ARG GITHUB_TOKEN
|
|
289
|
+
RUN echo "@zambit:registry=https://npm.pkg.github.com" >> ~/.npmrc && \
|
|
290
|
+
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> ~/.npmrc && \
|
|
291
|
+
npm install
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Build with:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
docker build --build-arg GITHUB_TOKEN=ghp_xxx -t myapp .
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Troubleshooting
|
|
301
|
+
|
|
302
|
+
### Error: 404 Not Found
|
|
303
|
+
|
|
304
|
+
**Cause:** npm can't find the package or you don't have access.
|
|
305
|
+
|
|
306
|
+
**Fix:**
|
|
307
|
+
|
|
308
|
+
- Verify you have GitHub access to the Zambit org
|
|
309
|
+
- Confirm token is valid: `npm view @zambit/elevate-ts-commercial --registry=https://npm.pkg.github.com`
|
|
310
|
+
- Check `.npmrc` is correct: `cat ~/.npmrc`
|
|
311
|
+
|
|
312
|
+
### Error: 401 Unauthorized
|
|
313
|
+
|
|
314
|
+
**Cause:** Token expired or invalid.
|
|
315
|
+
|
|
316
|
+
**Fix:**
|
|
317
|
+
|
|
318
|
+
- Create new token at GitHub.com → Settings → Developer settings → Personal access tokens
|
|
319
|
+
- Update `~/.npmrc` with new token
|
|
320
|
+
- Run `npm cache clean --force`
|
|
321
|
+
|
|
322
|
+
### Error: ENOENT: no such file or directory
|
|
323
|
+
|
|
324
|
+
**Cause:** `.npmrc` configuration missing or incorrect.
|
|
325
|
+
|
|
326
|
+
**Fix:**
|
|
327
|
+
|
|
328
|
+
- Make sure `@zambit:registry` is set in `~/.npmrc`
|
|
329
|
+
- Run `npm cache clean --force`
|
|
330
|
+
- Try again
|
|
331
|
+
|
|
332
|
+
## Support
|
|
333
|
+
|
|
334
|
+
Contact: [support@zambit.com](mailto:support@zambit.com)
|
|
335
|
+
|
|
336
|
+
### C. Update `PUBLISH_CHECKLIST.md`
|
|
337
|
+
|
|
338
|
+
Add this section:
|
|
339
|
+
|
|
340
|
+
````markdown
|
|
341
|
+
## Publishing Flow
|
|
342
|
+
|
|
343
|
+
### AGPL Version
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
git tag v1.0.0 # Triggers publish to npmjs.org
|
|
347
|
+
git push --tags
|
|
348
|
+
```
|
|
349
|
+
````
|
|
350
|
+
|
|
351
|
+
GitHub Actions automatically:
|
|
352
|
+
|
|
353
|
+
1. Detects tag `v1.0.0` (no `-commercial` suffix)
|
|
354
|
+
2. Publishes to npmjs.org
|
|
355
|
+
3. Creates GitHub Release
|
|
356
|
+
|
|
357
|
+
Verify:
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
npm view elevate-ts
|
|
361
|
+
npm search elevate-ts
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Step 3B: Publish Commercial
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
git tag v1.0.0-commercial # Triggers publish to GitHub Packages
|
|
368
|
+
git push --tags
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
GitHub Actions automatically:
|
|
372
|
+
|
|
373
|
+
1. Detects tag with `-commercial` suffix
|
|
374
|
+
2. Publishes to GitHub Packages
|
|
375
|
+
3. Creates GitHub Release
|
|
376
|
+
|
|
377
|
+
Verify (with GitHub auth):
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
npm view @zambit/elevate-ts-commercial --registry=https://npm.pkg.github.com
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Part 3: Complete Publishing Workflow
|
|
386
|
+
|
|
387
|
+
### Step 1: Create Changeset (during development)
|
|
388
|
+
|
|
389
|
+
During development, document changes with changesets:
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
pnpm changeset
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Follow prompts:
|
|
396
|
+
|
|
397
|
+
- Select: `elevate-ts`
|
|
398
|
+
- Select: `patch` (bug fix), `minor` (feature), or `major` (breaking)
|
|
399
|
+
- Write description
|
|
400
|
+
|
|
401
|
+
This creates a file in `.changeset/` with your change details.
|
|
402
|
+
|
|
403
|
+
### Step 2: Merge to Main
|
|
404
|
+
|
|
405
|
+
When ready to release, create PR and merge `initial` → `main`:
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
git push origin initial
|
|
409
|
+
# Create PR on GitHub (initial → main)
|
|
410
|
+
# Have reviewer approve
|
|
411
|
+
# Merge
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Step 3A: Publish AGPL (Public to npmjs.org)
|
|
415
|
+
|
|
416
|
+
After merge to main, create and push git tag:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# Pull main locally
|
|
420
|
+
git checkout main
|
|
421
|
+
git pull origin main
|
|
422
|
+
|
|
423
|
+
# Check current version in package.json
|
|
424
|
+
cat package.json | grep version
|
|
425
|
+
|
|
426
|
+
# Create and push tag
|
|
427
|
+
git tag v0.1.2
|
|
428
|
+
git push origin v0.1.2
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**GitHub Actions automatically:**
|
|
432
|
+
|
|
433
|
+
1. Detects tag `v0.1.2` (no `-commercial` suffix)
|
|
434
|
+
2. Runs: `npm publish --registry https://registry.npmjs.org`
|
|
435
|
+
3. Uses `NPM_TOKEN` secret for authentication
|
|
436
|
+
4. Creates GitHub Release
|
|
437
|
+
5. Done ✅
|
|
438
|
+
|
|
439
|
+
**Verify publication:**
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
npm view elevate-ts
|
|
443
|
+
npm install elevate-ts # Test it locally
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Step 3B: Publish Commercial (Optional, to GitHub Packages)
|
|
447
|
+
|
|
448
|
+
If you want to release a commercial version alongside AGPL:
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
git tag v0.1.2-commercial
|
|
452
|
+
git push origin v0.1.2-commercial
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
**GitHub Actions automatically:**
|
|
456
|
+
|
|
457
|
+
1. Detects tag with `-commercial` suffix
|
|
458
|
+
2. Runs: `pnpm publish:commercial`
|
|
459
|
+
- Updates package name to `@zambit/elevate-ts-commercial`
|
|
460
|
+
- Swaps LICENSE files
|
|
461
|
+
- Publishes to GitHub Packages
|
|
462
|
+
3. Uses `GITHUB_TOKEN` (automatic)
|
|
463
|
+
4. Creates GitHub Release
|
|
464
|
+
5. Restores original state
|
|
465
|
+
6. Done ✅
|
|
466
|
+
|
|
467
|
+
**Verify publication (with GitHub auth):**
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
npm view @zambit/elevate-ts-commercial --registry=https://npm.pkg.github.com
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
## Part 4: Environment Setup for CI/CD
|
|
476
|
+
|
|
477
|
+
### NPM_TOKEN (for npmjs.org publishing)
|
|
478
|
+
|
|
479
|
+
1. Log into npm.com
|
|
480
|
+
2. Go to your profile → **Access Tokens**
|
|
481
|
+
3. Click **Generate new token**
|
|
482
|
+
4. Choose **Granular access token**
|
|
483
|
+
5. Permissions:
|
|
484
|
+
- `publish:packages` (required)
|
|
485
|
+
- Scoped to `elevate-ts` package
|
|
486
|
+
- Expiration: 1 year
|
|
487
|
+
6. Copy the token
|
|
488
|
+
7. In GitHub repo → Settings → **Secrets and variables** → **Actions**
|
|
489
|
+
8. Create secret: `NPM_TOKEN` = (paste token)
|
|
490
|
+
|
|
491
|
+
### GITHUB_TOKEN (automatic)
|
|
492
|
+
|
|
493
|
+
GitHub Actions provides `${{ secrets.GITHUB_TOKEN }}` automatically. No setup needed.
|
|
494
|
+
|
|
495
|
+
It has permission to publish to GitHub Packages by default.
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## Part 5: Summary
|
|
500
|
+
|
|
501
|
+
| Aspect | AGPL | Commercial |
|
|
502
|
+
| --------------- | ---------------- | ------------------------------- |
|
|
503
|
+
| Package name | `elevate-ts` | `@zambit/elevate-ts-commercial` |
|
|
504
|
+
| Registry | npmjs.org | GitHub Packages |
|
|
505
|
+
| Git tag pattern | `v1.0.0` | `v1.0.0-commercial` |
|
|
506
|
+
| Public? | Yes | No (GitHub auth required) |
|
|
507
|
+
| Discovery | Visible on npmjs | GitHub Packages only |
|
|
508
|
+
| License file | AGPL-3.0 | Commercial License |
|
|
509
|
+
| Authentication | None (public) | GitHub token |
|
|
510
|
+
| Automation | GitHub Actions | GitHub Actions |
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## Publish Troubleshooting
|
|
515
|
+
|
|
516
|
+
### Publish fails: 404 Not Found
|
|
517
|
+
|
|
518
|
+
**AGPL:**
|
|
519
|
+
|
|
520
|
+
- Check `NPM_TOKEN` is set correctly in GitHub secrets
|
|
521
|
+
- Verify you have publish rights to `elevate-ts` on npmjs
|
|
522
|
+
|
|
523
|
+
**Commercial:**
|
|
524
|
+
|
|
525
|
+
- Verify you have publish rights to `@zambit` org on GitHub Packages
|
|
526
|
+
- Check GitHub Packages is enabled in org settings
|
|
527
|
+
|
|
528
|
+
### Publish fails: "Already exists"
|
|
529
|
+
|
|
530
|
+
You can only publish each version once per registry. Solutions:
|
|
531
|
+
|
|
532
|
+
1. Bump version in `package.json`
|
|
533
|
+
2. Create new changeset: `pnpm changeset`
|
|
534
|
+
3. Merge and retag
|
|
535
|
+
|
|
536
|
+
Or, within 24 hours, unpublish and retry:
|
|
537
|
+
|
|
538
|
+
```bash
|
|
539
|
+
npm unpublish elevate-ts@0.1.2 --force
|
|
540
|
+
npm publish
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Can't install commercial version
|
|
544
|
+
|
|
545
|
+
#### Installation: 404 Not Found
|
|
546
|
+
|
|
547
|
+
- Verify GitHub token is valid
|
|
548
|
+
- Verify `@zambit:registry` is in `.npmrc`
|
|
549
|
+
|
|
550
|
+
#### Installation: 401 Unauthorized
|
|
551
|
+
|
|
552
|
+
- GitHub token expired or incorrect
|
|
553
|
+
- Create new token at GitHub.com → Settings → Developer settings
|
|
554
|
+
|
|
555
|
+
### Both AGPL and commercial published same version
|
|
556
|
+
|
|
557
|
+
This is fine. They have different package names:
|
|
558
|
+
|
|
559
|
+
- `elevate-ts` on npmjs
|
|
560
|
+
- `@zambit/elevate-ts-commercial` on GitHub Packages
|
|
561
|
+
|
|
562
|
+
Both can exist at v0.1.2 simultaneously.
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
## See Also
|
|
567
|
+
|
|
568
|
+
- [COMMERCIAL_ACCESS.md](./COMMERCIAL_ACCESS.md) — Setup instructions for clients
|
|
569
|
+
- [COMMERCIAL-LICENSE.md](./COMMERCIAL-LICENSE.md) — Commercial license terms
|
|
570
|
+
- `.github/workflows/publish.yml` — Automated publishing workflow
|
|
571
|
+
- `scripts/publish-commercial.ts` — Commercial package publishing script
|