Skip to content

Commit 8c6d7b1

Browse files
committed
feat: Added homebrew, git, git-lfs, examples, aws-profile, aws-cli
1 parent dcbe194 commit 8c6d7b1

8 files changed

Lines changed: 98 additions & 22 deletions

File tree

src/resources/aws-cli/cli/aws-cli.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import fs from 'node:fs/promises';
44
import os from 'node:os';
55
import path from 'node:path';
66

7+
import { exampleAwsCliConfigs } from '../examples.js';
78
import Schema from './aws-cli-schema.json';
89

910
export interface AwsCliConfig extends StringIndexedObject {
@@ -17,6 +18,9 @@ export class AwsCliResource extends Resource<AwsCliConfig> {
1718
getSettings(): ResourceSettings<AwsCliConfig> {
1819
return {
1920
schema: Schema,
21+
exampleConfigs: {
22+
...exampleAwsCliConfigs,
23+
},
2024
operatingSystems: [OS.Darwin, OS.Linux],
2125
id: 'aws-cli',
2226
};

src/resources/aws-cli/examples.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { ExampleConfigs } from '@codifycli/plugin-core';
2+
3+
export const exampleAwsCliConfigs: ExampleConfigs = {
4+
example1: {
5+
title: 'Install AWS CLI and configure a profile',
6+
description: 'Install the AWS CLI and set up a default profile with credentials — a complete AWS setup from scratch.',
7+
configs: [
8+
{
9+
type: 'aws-cli',
10+
},
11+
{
12+
type: 'aws-profile',
13+
profile: 'default',
14+
awsAccessKeyId: '<Replace me here!>',
15+
awsSecretAccessKey: '<Replace me here!>',
16+
region: 'us-east-1',
17+
output: 'json',
18+
},
19+
]
20+
},
21+
}

src/resources/aws-cli/profile/aws-profile.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import * as fs from 'node:fs/promises';
1414
import os from 'node:os';
1515
import path from 'node:path';
1616

17+
import { exampleAwsCliConfigs } from '../examples.js';
1718
import Schema from './aws-profile-schema.json'
1819
import { CSVCredentialsTransformation } from './csv-credentials-transformation.js';
1920

@@ -47,23 +48,6 @@ const exampleProfile: ExampleConfig = {
4748
}]
4849
}
4950

50-
const exampleWithCli: ExampleConfig = {
51-
title: 'Install AWS CLI and configure a profile',
52-
description: 'Install the AWS CLI and set up a default profile with credentials — a complete AWS setup from scratch.',
53-
configs: [
54-
{
55-
type: 'aws-cli',
56-
},
57-
{
58-
type: 'aws-profile',
59-
profile: 'default',
60-
awsAccessKeyId: '<Replace me here!>',
61-
awsSecretAccessKey: '<Replace me here!>',
62-
region: 'us-east-1',
63-
output: 'json',
64-
},
65-
]
66-
}
6751

6852
export class AwsProfileResource extends Resource<AwsProfileConfig> {
6953

@@ -73,7 +57,7 @@ export class AwsProfileResource extends Resource<AwsProfileConfig> {
7357
defaultConfig,
7458
exampleConfigs: {
7559
example1: exampleProfile,
76-
example2: exampleWithCli,
60+
example2: exampleAwsCliConfigs.example1,
7761
},
7862
operatingSystems: [OS.Darwin, OS.Linux],
7963
dependencies: ['aws-cli'],

src/resources/git/git/git-resource.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Resource, ResourceSettings, SpawnStatus, Utils, getPty } from '@codifycli/plugin-core';
1+
import { ExampleConfig, Resource, ResourceSettings, SpawnStatus, Utils, getPty } from '@codifycli/plugin-core';
22
import { OS, StringIndexedObject } from '@codifycli/schemas';
33

44
import { GitEmailParameter } from './git-email-paramater.js';
@@ -11,10 +11,23 @@ export interface GitConfig extends StringIndexedObject {
1111
// TODO: Allow upgrading git to the latest version in the future. This means installing git using homebrew
1212
}
1313

14+
const exampleConfig: ExampleConfig = {
15+
title: 'Configure global git identity',
16+
description: 'Set the global git username and email used for all commits on this machine.',
17+
configs: [{
18+
type: 'git',
19+
email: 'you@example.com',
20+
username: 'Your Name',
21+
}]
22+
}
23+
1424
export class GitResource extends Resource<GitConfig> {
1525
getSettings(): ResourceSettings<GitConfig> {
1626
return {
1727
id: 'git',
28+
exampleConfigs: {
29+
example1: exampleConfig,
30+
},
1831
operatingSystems: [OS.Darwin, OS.Linux],
1932
schema: Schema,
2033
removeStatefulParametersBeforeDestroy: true,

src/resources/git/lfs/git-lfs.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getPty, Resource, ResourceSettings, SpawnStatus, Utils } from '@codifycli/plugin-core';
1+
import { ExampleConfig, getPty, Resource, ResourceSettings, SpawnStatus, Utils } from '@codifycli/plugin-core';
22
import { OS, ResourceConfig } from '@codifycli/schemas';
33
import * as os from 'node:os';
44

@@ -8,11 +8,30 @@ export interface GitLfsConfig extends ResourceConfig {
88
// TODO: Add --system option for installing.
99
}
1010

11+
const exampleWithRepo: ExampleConfig = {
12+
title: 'Install Git LFS and clone a repository',
13+
description: 'Install Git LFS and clone a repository that uses LFS for large file storage.',
14+
configs: [
15+
{
16+
type: 'git-lfs',
17+
},
18+
{
19+
type: 'git-repository',
20+
repository: 'git@github.com:org/repo-with-lfs.git',
21+
directory: '~/projects/repo-with-lfs',
22+
dependsOn: ['git-lfs'],
23+
},
24+
]
25+
}
26+
1127
export class GitLfsResource extends Resource<GitLfsConfig> {
1228
getSettings(): ResourceSettings<GitLfsConfig> {
1329
return {
1430
id: 'git-lfs',
15-
operatingSystems: [OS.Darwin],
31+
exampleConfigs: {
32+
example1: exampleWithRepo,
33+
},
34+
operatingSystems: [OS.Darwin, OS.Linux],
1635
schema: Schema,
1736
dependencies: ['homebrew'],
1837
}

src/resources/git/wait-github-ssh-key/wait-github-ssh-key.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
getPty
77
} from '@codifycli/plugin-core';
88
import { OS, ResourceConfig } from '@codifycli/schemas';
9+
import { exampleSshConfigs } from '../../ssh/examples.js';
910
import fs from 'node:fs/promises';
1011
import os from 'node:os';
1112
import path from 'node:path';
@@ -16,6 +17,9 @@ export class WaitGithubSshKey extends Resource<WaitGithubSshKeyConfig> {
1617
getSettings(): ResourceSettings<WaitGithubSshKeyConfig> {
1718
return {
1819
id: 'wait-github-ssh-key',
20+
exampleConfigs: {
21+
example1: exampleSshConfigs.example2,
22+
},
1923
operatingSystems: [OS.Darwin, OS.Linux],
2024
dependencies: [
2125
'ssh-key',

src/resources/homebrew/homebrew.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
CreatePlan,
3+
ExampleConfig,
34
FileUtils,
45
Resource,
56
ResourceSettings,
@@ -26,13 +27,43 @@ export interface HomebrewConfig extends ResourceConfig {
2627
onlyPlanUserInstalled: boolean
2728
}
2829

30+
const defaultConfig: Partial<HomebrewConfig> = {
31+
formulae: [],
32+
casks: [],
33+
}
34+
35+
const exampleFormulae: ExampleConfig = {
36+
title: 'Install common CLI tools',
37+
description: 'Install Homebrew and a set of essential command-line utilities for development.',
38+
configs: [{
39+
type: 'homebrew',
40+
formulae: ['git', 'wget', 'jq', 'ripgrep', 'tree', 'htop'],
41+
casks: [],
42+
}]
43+
}
44+
45+
const exampleWithCasks: ExampleConfig = {
46+
title: 'Install CLI tools and GUI apps',
47+
description: 'Install Homebrew with developer CLI tools and popular GUI applications via casks.',
48+
configs: [{
49+
type: 'homebrew',
50+
formulae: ['git', 'wget', 'jq', 'ripgrep'],
51+
casks: ['visual-studio-code', 'iterm2', 'google-chrome'],
52+
}]
53+
}
54+
2955
export class HomebrewResource extends Resource<HomebrewConfig> {
3056

3157
override getSettings(): ResourceSettings<HomebrewConfig> {
3258
return {
3359
schema: HomebrewSchema,
3460
operatingSystems: [OS.Darwin, OS.Linux],
3561
id: 'homebrew',
62+
defaultConfig,
63+
exampleConfigs: {
64+
example1: exampleFormulae,
65+
example2: exampleWithCasks,
66+
},
3667
parameterSettings: {
3768
taps: { type: 'stateful', definition: new TapsParameter(), order: 1 },
3869
formulae: { type: 'stateful', definition: new FormulaeParameter(), order: 2 },

src/resources/ssh/examples.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const exampleSshConfigs: ExampleConfigs = {
3636
"dependsOn": ["ssh-config"]
3737
},
3838
{
39-
"type": 'git-repository',
39+
"type": 'git-repositories',
4040
"parentDirectory": '~/projects',
4141
"repositories": ['<Replace me here!>', '<Replace me here!>']
4242
}

0 commit comments

Comments
 (0)