Skip to content

Commit 66b6674

Browse files
committed
feat(tsgen): migrate contentstack-cli-tsgen into cli-plugins monorepo
1 parent 8aae1ca commit 66b6674

38 files changed

Lines changed: 1670 additions & 28 deletions

File tree

.github/config/release.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"seed": false,
1111
"bootstrap": false,
1212
"branches": false,
13-
"apps-cli": false
13+
"apps-cli": false,
14+
"tsgen": false
1415
}
1516
}

.github/workflows/release-v2-beta-plugins.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,11 @@ jobs:
150150
token: ${{ secrets.NPM_TOKEN }}
151151
package: ./packages/contentstack-apps-cli/package.json
152152
tag: beta
153+
154+
# Tsgen
155+
- name: Publishing tsgen (Beta)
156+
uses: JS-DevTools/npm-publish@v3
157+
with:
158+
token: ${{ secrets.NPM_TOKEN }}
159+
package: ./packages/contentstack-cli-tsgen/package.json
160+
tag: beta
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Tsgen Integration Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
tsgen-integration:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup pnpm
15+
uses: pnpm/action-setup@v4
16+
with:
17+
version: 10.28.0
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '22.x'
23+
cache: 'pnpm'
24+
25+
- name: Install dependencies
26+
run: pnpm install --frozen-lockfile
27+
28+
- name: Build tsgen plugin
29+
run: pnpm --filter contentstack-cli-tsgen run build
30+
31+
- name: Install Contentstack CLI (v2 beta)
32+
run: npm i -g @contentstack/cli@beta
33+
34+
- name: Configure CLI region
35+
run: csdx config:set:region ${{ secrets.REGION }}
36+
37+
- name: Add delivery token
38+
run: csdx auth:tokens:add -a ${{ secrets.TOKEN_ALIAS }} --delivery -k ${{ secrets.APIKEY }} --token ${{ secrets.DELIVERYKEY }} -e ${{ secrets.ENVIRONMENT }}
39+
40+
- name: Link tsgen plugin
41+
working-directory: ./packages/contentstack-cli-tsgen
42+
run: csdx plugins:link
43+
44+
- name: Run integration tests
45+
run: pnpm --filter contentstack-cli-tsgen run test:integration
46+
env:
47+
TOKEN_ALIAS: ${{ secrets.TOKEN_ALIAS }}
48+
49+
- name: Unlink tsgen plugin
50+
working-directory: ./packages/contentstack-cli-tsgen
51+
run: csdx plugins:unlink
52+
if: always()

.github/workflows/unit-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,7 @@ jobs:
7070
- name: Run tests for Contentstack Apps CLI
7171
working-directory: ./packages/contentstack-apps-cli
7272
run: npm run test:unit:report:json
73+
74+
- name: Lint Contentstack Tsgen plugin
75+
working-directory: ./packages/contentstack-cli-tsgen
76+
run: pnpm run lint

.talismanrc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
fileignoreconfig:
22
- filename: pnpm-lock.yaml
3-
checksum: e5b5f8ab64f4f27a1483e426cc01d7388482263e1d6fe3baf1caafcf2878ebb2
4-
- filename: skills/framework/SKILL.md
5-
checksum: c5746de64b1e7d1df051c4337de5eb32de6a4c85c7297aa408838d304bb2d771
3+
checksum: 4372202dbc918ff057d77df14383465c11b0b211afb408e74e33d6f036e928b3
4+
- filename: packages/contentstack-cli-tsgen/AGENTS.md
5+
checksum: 7291676dc95b70ba0c4f0ead220b88355534682d4392aecd75609f1740df4be1
6+
- filename: packages/contentstack-cli-tsgen/src/lib/helper.ts
7+
checksum: a7ead0030ead9d15b6b6e9623f61e7def77b00325e3988f0e3d73a145180dedc
8+
- filename: packages/contentstack-cli-tsgen/skills/typescript-cli-tsgen/SKILL.md
9+
checksum: 0434741d74f66edab28fbea1520a6a5d4d42e292cc014d3f9c804aa10809334b
10+
- filename: packages/contentstack-cli-tsgen/src/commands/tsgen.ts
11+
checksum: 054ea78f765edca62c785714cf8962df4fb91529c0851439d1ed61e963467408
612
version: '1.0'

AGENTS.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
| Field | Detail |
88
| --- | --- |
99
| **Name:** | Contentstack CLI plugins (pnpm monorepo; root package name `csdx`) |
10-
| **Purpose:** | OCLIF plugins that extend the Contentstack CLI (import/export, clone, migration, seed, audit, variants, Developer Hub apps, etc.). |
10+
| **Purpose:** | OCLIF plugins that extend the Contentstack CLI (import/export, clone, migration, seed, audit, variants, Developer Hub apps, TypeScript codegen, etc.). |
1111
| **Out of scope (if any):** | The **core** CLI aggregation lives in the separate `cli` monorepo; this repo ships plugin packages only. |
1212

1313
## Tech stack (at a glance)
@@ -48,6 +48,14 @@ CI: [.github/workflows/unit-test.yml](.github/workflows/unit-test.yml) and other
4848
- **v1 / v2:** Maintain on `v1-dev` (1.x CLI deps) and `v2-dev` / `v2-beta` (2.x beta deps) branches; align `@contentstack/cli-command` and `@contentstack/cli-utilities` versions with the target CLI line.
4949
- **Docs:** OCLIF / `app:*` commands → [contentstack-cli](skills/contentstack-cli/SKILL.md#apps-cli-commands-app); SDK, manifests, GraphQL, HTTP → [framework](skills/framework/SKILL.md#apps-cli-plugin-contentstackapps-cli)
5050

51+
## Tsgen plugin (`contentstack-cli-tsgen`)
52+
53+
- **Package path:** [packages/contentstack-cli-tsgen](packages/contentstack-cli-tsgen)
54+
- **npm name:** `contentstack-cli-tsgen` (unchanged for consumers)
55+
- **Migrated from:** standalone `contentstack-cli-tsgen` repos — see [TSGEN-MIGRATION.md](TSGEN-MIGRATION.md)
56+
- **v2 beta only:** `5.0.0-beta.0`+ on `feat/migrate-external-cli-plugins-v2` / `v2-beta`; requires CLI 2.x beta.
57+
- **Docs:** `csdx tsgen`[typescript-cli-tsgen](packages/contentstack-cli-tsgen/skills/typescript-cli-tsgen/SKILL.md); tests → [package testing skill](packages/contentstack-cli-tsgen/skills/testing/SKILL.md)
58+
5159
## Using Cursor (optional)
5260

5361
If you use **Cursor**, [.cursor/rules/README.md](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ To get a more detailed documentation for every command, visit the [CLI section](
6767

6868
## Useful Plugins
6969

70-
- [Generate TypeScript typings from a Stack](https://github.com/Contentstack-Solutions/contentstack-cli-tsgen)
70+
- [Generate TypeScript typings from a Stack](https://github.com/contentstack/cli-plugins/tree/v2-beta/packages/contentstack-cli-tsgen) (`contentstack-cli-tsgen`)

TSGEN-MIGRATION.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Tsgen CLI migration: standalone repo → cli-plugins monorepo
2+
3+
## Summary
4+
5+
The **contentstack-cli-tsgen** plugin has moved from the standalone repositories [Contentstack-Solutions/contentstack-cli-tsgen](https://github.com/Contentstack-Solutions/contentstack-cli-tsgen) and [contentstack/contentstack-cli-tsgen](https://github.com/contentstack/contentstack-cli-tsgen) into the [contentstack/cli-plugins](https://github.com/contentstack/cli-plugins) monorepo at **`packages/contentstack-cli-tsgen`**.
6+
7+
The **npm package name is unchanged**: `contentstack-cli-tsgen`. Install and command usage stay the same (`csdx tsgen`).
8+
9+
## Repository and issue tracking
10+
11+
| Before | After |
12+
| --- | --- |
13+
| Source: standalone `contentstack-cli-tsgen` repos | Source: `github.com/contentstack/cli-plugins``packages/contentstack-cli-tsgen` |
14+
| Issues: standalone repo | Issues: [cli-plugins issues](https://github.com/contentstack/cli-plugins/issues) (label or mention `tsgen` / `contentstack-cli-tsgen`) |
15+
16+
The standalone **contentstack-cli-tsgen** repository should be **archived** after the first release from cli-plugins. Open PRs and bugs should be recreated or linked in cli-plugins.
17+
18+
## Version line (2.x beta only)
19+
20+
| CLI line | cli-plugins branch | Tsgen plugin notes |
21+
| --- | --- | --- |
22+
| **2.x beta** | `feat/migrate-external-cli-plugins-v2``v2-beta` | `@contentstack/cli-command` and `@contentstack/cli-utilities` on `~2.0.0-beta.*`; first monorepo release **`5.0.0-beta.0`** |
23+
24+
This migration does not maintain a `v1-dev` line for tsgen.
25+
26+
## Install (unchanged)
27+
28+
```bash
29+
csdx plugins:install contentstack-cli-tsgen@beta
30+
# or
31+
npm install -g contentstack-cli-tsgen
32+
```
33+
34+
Requires **Contentstack CLI 2.x beta** and a **delivery token** alias for `csdx tsgen`.
35+
36+
## Local development
37+
38+
Clone [cli-dev-workspace](https://github.com/contentstack/cli-dev-workspace) (or cli-plugins only), then:
39+
40+
```bash
41+
cd cli-plugins
42+
pnpm install
43+
pnpm --filter contentstack-cli-tsgen run build
44+
cd packages/contentstack-cli-tsgen && csdx plugins:link
45+
csdx tsgen --help
46+
```
47+
48+
See [AGENTS.md](./AGENTS.md), package [AGENTS.md](./packages/contentstack-cli-tsgen/AGENTS.md), and [skills/typescript-cli-tsgen](./packages/contentstack-cli-tsgen/skills/typescript-cli-tsgen/SKILL.md) for contributor docs.
49+
50+
## Related migrations
51+
52+
- Core CLI: [cli](https://github.com/contentstack/cli) monorepo
53+
- Apps CLI: [APPS-CLI-MIGRATION.md](./APPS-CLI-MIGRATION.md)
54+
- Other external plugins: same cli-plugins consolidation effort
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
parser: "@typescript-eslint/parser",
3+
parserOptions: {
4+
ecmaVersion: 2020,
5+
sourceType: "module",
6+
},
7+
plugins: ["@typescript-eslint"],
8+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
9+
rules: {
10+
"unicorn/prefer-module": "off",
11+
"unicorn/no-abusive-eslint-disable": "off",
12+
"@typescript-eslint/no-use-before-define": "off",
13+
"node/no-missing-import": "off",
14+
"@typescript-eslint/no-explicit-any": "off",
15+
"@typescript-eslint/no-require-imports": "off",
16+
"no-useless-escape": "off",
17+
},
18+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*-debug.log
2+
*-error.log
3+
/.nyc_output
4+
/dist
5+
/lib
6+
/tmp
7+
node_modules
8+
.DS_Store
9+
coverage
10+
.env
11+
oclif.manifest.json
12+
talisman_output.log
13+
snyk_output.log
14+
tsconfig.tsbuildinfo
15+
tests/integration/generated.d.ts

0 commit comments

Comments
 (0)