Skip to content

Commit b44ecc9

Browse files
committed
try and rename starship context
1 parent f9fac40 commit b44ecc9

File tree

6 files changed

+58
-58
lines changed

6 files changed

+58
-58
lines changed

clients/js/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ npm install @starship-ci/client
146146
First, you need to import and initialize the `StarshipClient` with your Helm configuration:
147147

148148
```js
149-
import { StarshipClient } from '@starship-ci/client';
149+
import {StarshipClient} from '@starship-ci/client';
150150

151151
const client = new StarshipClient({
152-
helmName: 'osmojs',
153-
helmFile: 'path/to/config.yaml',
154-
helmRepo: 'starship',
155-
helmRepoUrl: 'https://cosmology-tech.github.io/starship/',
156-
helmChart: 'devnet',
157-
helmVersion: 'v0.2.3'
152+
name: 'osmojs',
153+
config: 'path/to/config.yaml',
154+
repo: 'starship',
155+
repoUrl: 'https://cosmology-tech.github.io/starship/',
156+
chart: 'devnet',
157+
version: 'v0.2.3'
158158
});
159159
```
160160

clients/js/packages/cli/src/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const loadConfig = (argv: any): Config => {
4747
let starship: StarshipConfig = {} as StarshipConfig;
4848

4949
if (argv.config) {
50-
context.helmFile = argv.config;
50+
context.config = argv.config;
5151
}
5252

5353
console.log("context", context);
@@ -61,9 +61,9 @@ export const loadConfig = (argv: any): Config => {
6161
}
6262
});
6363

64-
if (context.helmFile) {
65-
context.helmFile = resolvePath(context.helmFile);
66-
starship = loadYaml(context.helmFile) as StarshipConfig
64+
if (context.config) {
65+
context.config = resolvePath(context.config);
66+
starship = loadYaml(context.config) as StarshipConfig
6767
}
6868

6969
console.log("starship: ", starship);
@@ -91,9 +91,9 @@ Configuration File:
9191
Command-line options will override settings from this file if both are provided.
9292
9393
Command-line Options:
94-
--helmName <name> Specify the Helm release name, default: starship.
94+
--name <name> Specify the Helm release name, default: starship.
9595
Will overide config file settings for name.
96-
--helmVersion <ver> Specify the version of the Helm chart, default: v0.2.3.
96+
--version <ver> Specify the version of the Helm chart, default: v0.2.6.
9797
Will overide config file settings for version.
9898
9999
Examples:

clients/js/packages/client/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ The `StarshipClient` simplifies managing Kubernetes resources, specifically tail
120120
First, you need to import and initialize the `StarshipClient` with your Helm configuration:
121121

122122
```js
123-
import { StarshipClient } from '@starship-ci/client';
123+
import {StarshipClient} from '@starship-ci/client';
124124

125125
const client = new StarshipClient({
126-
helmName: 'osmojs',
127-
helmFile: 'path/to/config.yaml',
128-
helmRepo: 'starship',
129-
helmRepoUrl: 'https://cosmology-tech.github.io/starship/',
130-
helmChart: 'devnet',
131-
helmVersion: 'v0.2.3'
126+
name: 'osmojs',
127+
config: 'path/to/config.yaml',
128+
repo: 'starship',
129+
repoUrl: 'https://cosmology-tech.github.io/starship/',
130+
chart: 'devnet',
131+
version: 'v0.2.3'
132132
});
133133
```
134134

clients/js/packages/client/__tests__/client.config.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ describe('StarshipClient', () => {
1010
client.dependencies.forEach(dep => dep.installed = true);
1111

1212
client.setConfig(config.config);
13-
const helmFile = client.ctx.helmFile;
14-
client.ctx.helmFile = join(outputDir, 'my-config.yaml');
15-
client.ctx.helmFile = relative(process.cwd(), client.ctx.helmChart)
13+
const helmFile = client.ctx.config;
14+
client.ctx.config = join(outputDir, 'my-config.yaml');
15+
client.ctx.config = relative(process.cwd(), client.ctx.chart)
1616
// @ts-ignore
1717
client.saveYaml = () => {};
1818
client.saveConfig();
19-
client.ctx.helmFile = helmFile;
19+
client.ctx.config = helmFile;
2020

2121
const portYaml = join(outputDir, 'default-pod-ports.yaml');
2222
const relativePortYaml = relative(process.cwd(), portYaml);

clients/js/packages/client/src/client.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ import { dependencies as defaultDependencies, Dependency } from "./deps";
1313
import { readAndParsePackageJson } from './package';
1414

1515
export interface StarshipContext {
16-
helmName?: string;
17-
helmFile?: string;
18-
helmRepo?: string;
19-
helmRepoUrl?: string;
20-
helmChart?: string;
21-
helmVersion?: string;
22-
helmNamespace?: string;
16+
name?: string;
17+
config?: string;
18+
repo?: string;
19+
repoUrl?: string;
20+
chart?: string;
21+
version?: string;
22+
namespace?: string;
2323
verbose?: boolean;
2424
curdir?: string;
2525
};
2626

2727
export const defaultStarshipContext: Partial<StarshipContext> = {
28-
helmName: '',
29-
helmRepo: 'starship',
30-
helmRepoUrl: 'https://cosmology-tech.github.io/starship/',
31-
helmChart: 'starship/devnet',
32-
helmNamespace: '',
33-
helmVersion: '',
28+
name: '',
29+
repo: 'starship',
30+
repoUrl: 'https://cosmology-tech.github.io/starship/',
31+
chart: 'starship/devnet',
32+
namespace: '',
33+
version: '',
3434
};
3535

3636
export interface PodPorts {
@@ -206,13 +206,13 @@ export class StarshipClient implements StarshipClientI {
206206
}
207207

208208
public loadConfig(): void {
209-
this.ensureFileExists(this.ctx.helmFile);
210-
this.config = this.loadYaml(this.ctx.helmFile) as StarshipConfig;
209+
this.ensureFileExists(this.ctx.config);
210+
this.config = this.loadYaml(this.ctx.config) as StarshipConfig;
211211
this.overrideNameAndVersion();
212212
}
213213

214214
public saveConfig(): void {
215-
this.saveYaml(this.ctx.helmFile, this.config);
215+
this.saveYaml(this.ctx.config, this.config);
216216
}
217217

218218
public savePodPorts(filename: string): void {
@@ -243,11 +243,11 @@ export class StarshipClient implements StarshipClientI {
243243
}
244244

245245
// Override config name and version if provided in context
246-
if (this.ctx.helmName) {
247-
this.config.name = this.ctx.helmName;
246+
if (this.ctx.name) {
247+
this.config.name = this.ctx.name;
248248
}
249-
if (this.ctx.helmVersion) {
250-
this.config.version = this.ctx.helmVersion;
249+
if (this.ctx.version) {
250+
this.config.version = this.ctx.version;
251251
}
252252

253253
// Use default name and version if not provided
@@ -265,15 +265,15 @@ export class StarshipClient implements StarshipClientI {
265265

266266
public getArgs(): string[] {
267267
const args = [];
268-
if (this.ctx.helmNamespace) {
269-
args.push('--namespace', this.ctx.helmNamespace);
268+
if (this.ctx.namespace) {
269+
args.push('--namespace', this.ctx.namespace);
270270
}
271271
return args;
272272
}
273273

274274
public getDeployArgs(): string[] {
275275
const args = this.getArgs();
276-
if (this.ctx.helmNamespace) {
276+
if (this.ctx.namespace) {
277277
args.push('--create-namespace');
278278
}
279279
return args;
@@ -285,7 +285,7 @@ export class StarshipClient implements StarshipClientI {
285285
'yarn',
286286
'run',
287287
'jest',
288-
`--testPathPattern=../${this.ctx.helmRepo}`,
288+
`--testPathPattern=../${this.ctx.repo}`,
289289
'--verbose',
290290
'--bail'
291291
]);
@@ -308,15 +308,15 @@ export class StarshipClient implements StarshipClientI {
308308
'helm',
309309
'repo',
310310
'add',
311-
this.ctx.helmRepo,
312-
this.ctx.helmRepoUrl
311+
this.ctx.repo,
312+
this.ctx.repoUrl
313313
]);
314314
this.exec(['helm', 'repo', 'update']);
315315
this.exec([
316316
'helm',
317317
'search',
318318
'repo',
319-
this.ctx.helmChart,
319+
this.ctx.chart,
320320
'--version',
321321
this.config.version
322322
]);
@@ -330,24 +330,24 @@ export class StarshipClient implements StarshipClientI {
330330
}
331331

332332
public deploy(options: string[] = []): void {
333-
this.ensureFileExists(this.ctx.helmFile);
333+
this.ensureFileExists(this.ctx.config);
334334
this.log("Installing the helm chart. This is going to take a while.....");
335335

336336
const cmd: string[] = [
337337
'helm',
338338
'install',
339339
'-f',
340-
this.ctx.helmFile,
340+
this.ctx.config,
341341
this.config.name,
342-
this.ctx.helmChart,
342+
this.ctx.chart,
343343
'--version',
344344
this.config.version,
345345
...this.getDeployArgs(),
346346
...options,
347347
];
348348

349349
// Determine the data directory of the config file
350-
const datadir = resolve(dirname(this.ctx.helmFile!));
350+
const datadir = resolve(dirname(this.ctx.config!));
351351

352352
// Iterate through each chain to add script arguments
353353
this.config.chains.forEach((chain, chainIndex) => {
@@ -367,7 +367,7 @@ export class StarshipClient implements StarshipClientI {
367367
}
368368

369369
public debug(): void {
370-
this.ensureFileExists(this.ctx.helmFile);
370+
this.ensureFileExists(this.ctx.config);
371371
this.deploy(['--dry-run', '--debug']);
372372
}
373373

clients/js/packages/client/test-utils/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export const createClient = () => {
1818
};
1919

2020
const client = new StarshipClient({
21-
helmName: 'osmojs',
22-
helmFile: relative(process.cwd(), config.configPath),
21+
name: 'osmojs',
22+
config: relative(process.cwd(), config.configPath),
2323
});
2424

2525
const handler = {

0 commit comments

Comments
 (0)