Skip to content

Commit 399b84f

Browse files
Merge pull request #25 from Contentstack-Solutions/Feat/CS-35664
Oclif core v2 migration changes
2 parents a2d4432 + 610cc3d commit 399b84f

8 files changed

Lines changed: 7789 additions & 15042 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [10.x, 12.x, 14.x]
19+
node-version: [16.x]
2020

2121
steps:
2222
- uses: actions/checkout@v2

.talismanrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
fileignoreconfig:
22
- filename: lib/commands/tsgen.js
33
checksum: 02bab20fef5508565dbf38b5c12192c48ec27249b89d48c70303abaae17984ce
4+
- filename: package-lock.json
5+
checksum: f69fb633369ac69c08b707b17c96fffb89198944fae8d6f6bcf590bda960f26a
46
version: "1.0"

bin/run

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env node
22

3-
require('@oclif/command').run()
4-
.catch(require('@oclif/errors/handle'))
3+
(async () => {
4+
const oclif = require('@contentstack/cli-utilities/node_modules/@oclif/core')
5+
await oclif.execute({ type: 'cjs', dir: __dirname })
6+
})()

package-lock.json

Lines changed: 7767 additions & 14995 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
{
22
"name": "contentstack-cli-tsgen",
33
"description": "Generate TypeScript typings from a Stack.",
4-
"version": "2.0.0",
4+
"version": "2.1.0",
55
"author": "Michael Davis",
66
"bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues",
77
"dependencies": {
8-
"@contentstack/cli-command": "^1.0.3",
9-
"@oclif/command": "^1.8.0",
10-
"@oclif/config": "^1.17.0",
8+
"@contentstack/cli-command": "^1.2.0",
9+
"@contentstack/cli-utilities": "^1.2.0",
1110
"lodash": "^4.17.20",
1211
"prettier": "^2.0.5",
1312
"tslib": "^1.13.0"
1413
},
1514
"devDependencies": {
16-
"@oclif/dev-cli": "^1.22.2",
1715
"@oclif/plugin-help": "^3.2.0",
1816
"@types/jest": "^26.0.14",
1917
"@types/lodash": "^4.14.162",
@@ -23,9 +21,10 @@
2321
"eslint-config-oclif-typescript": "^0.1.0",
2422
"globby": "^10.0.2",
2523
"jest": "^26.5.3",
24+
"oclif": "^3.7.0",
2625
"ts-jest": "^26.4.1",
27-
"ts-node": "^8.10.2",
28-
"typescript": "^3.9.7"
26+
"ts-node": "^10.9.1",
27+
"typescript": "^4.8.4"
2928
},
3029
"engines": {
3130
"node": ">=8.0.0"
@@ -54,8 +53,8 @@
5453
"scripts": {
5554
"postpack": "rm -f oclif.manifest.json",
5655
"posttest": "eslint . --ext .ts --config .eslintrc",
57-
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
56+
"prepack": "rm -rf lib && tsc -b && oclif manifest && oclif readme",
5857
"test": "jest",
59-
"version": "oclif-dev readme && git add README.md"
58+
"version": "oclif readme && git add README.md"
6059
}
61-
}
60+
}

src/commands/tsgen.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {Command, flags} from '@contentstack/cli-command'
1+
import {Command} from '@contentstack/cli-command'
2+
import {flags} from '@contentstack/cli-utilities'
23
import {getGlobalFields, stackConnect, StackConnectionConfig} from '../lib/stack/client'
34
import {ContentType} from '../lib/stack/schema'
45
import tsgenRunner from '../lib/tsgen/runner'
@@ -12,7 +13,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
1213
'$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts" --no-doc',
1314
];
1415

15-
static flags = {
16+
static flags: any = {
1617
'token-alias': flags.string({
1718
char: 'a',
1819
description: 'delivery token alias',
@@ -88,7 +89,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
8889
this.log('No Content Types exist in the Stack.')
8990
}
9091
} catch (error) {
91-
this.error(error, {exit: 1})
92+
this.error(error as any, {exit: 1})
9293
}
9394
}
9495
}

src/typings/@contentstack/cli-command.d.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"rootDir": "src",
88
"strict": true,
99
"target": "es2017",
10-
"allowJs": true
10+
"skipLibCheck": true
1111
},
1212
"include": [
13-
"src/**/*", "src/typings/@contentstack/cli-command.ts"
13+
"src/**/*"
1414
]
1515
}

0 commit comments

Comments
 (0)