Skip to content

Commit 94afb90

Browse files
authored
Merge pull request #170 from contentstack/development
development to staging
2 parents f3c012a + 54b025b commit 94afb90

File tree

14 files changed

+295
-195
lines changed

14 files changed

+295
-195
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/apps-cli",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "App ClI",
55
"author": "Contentstack CLI",
66
"homepage": "https://github.com/contentstack/contentstack-apps-cli",
@@ -17,8 +17,8 @@
1717
"/oclif.manifest.json"
1818
],
1919
"dependencies": {
20-
"@contentstack/cli-command": "^1.2.11",
21-
"@contentstack/cli-utilities": "^1.5.1",
20+
"@contentstack/cli-command": "^1.2.16",
21+
"@contentstack/cli-utilities": "^1.5.8",
2222
"adm-zip": "^0.5.10",
2323
"chalk": "^4.1.2",
2424
"lodash": "^4.17.21",

src/app-cli-base-coomand.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { resolve } from "path";
2+
import { existsSync, readFileSync } from "fs";
3+
4+
import config from "./config";
5+
import { AppManifest } from "./types";
6+
import { BaseCommand } from "./base-command";
7+
8+
export abstract class AppCLIBaseCommand extends BaseCommand<
9+
typeof AppCLIBaseCommand
10+
> {
11+
protected manifestPath!: string;
12+
protected manifestData!: AppManifest & Record<string, any>;
13+
14+
public async init(): Promise<void> {
15+
await super.init();
16+
this.getManifestData();
17+
}
18+
19+
getManifestData() {
20+
this.manifestPath = resolve(process.cwd(), `${config.defaultAppFileName}.json`);
21+
if (existsSync(this.manifestPath)) {
22+
try {
23+
this.manifestData = JSON.parse(
24+
readFileSync(this.manifestPath, {
25+
encoding: "utf-8",
26+
})
27+
);
28+
} catch (error) {
29+
throw error;
30+
}
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)