-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
3,277 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
watch_file "./nix/env.nix" "./nix/fmt.nix" "./nix/packages.nix" "./nix/shells.nix" "./nix/pre-commit.nix" "./flake.nix" "./parse.nix" | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name: CI-CD | |
on: | ||
push: | ||
branches: | ||
- "main" | ||
- 'main' | ||
|
||
env: | ||
# Docker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Cyan, CyanGlob, GlobType, IDeterminism, IInquirer } from '@atomicloud/cyan-sdk'; | ||
|
||
function SimpleCopy(vars: Record<string, string | boolean>, ...files: CyanGlob[]): Cyan { | ||
return { | ||
plugins: [], | ||
processors: [ | ||
{ | ||
name: 'cyan/default', | ||
files, | ||
config: { | ||
vars, | ||
parser: { | ||
varSyntax: [ | ||
['var__', '__'], | ||
['<%', '%>'], | ||
], | ||
}, | ||
}, | ||
}, | ||
], | ||
} as Cyan; | ||
} | ||
|
||
export async function atomiPrompt(i: IInquirer, d: IDeterminism): Promise<Cyan> { | ||
const runtime = await i.select('Runtime', ['Go', '.NET', 'Bun'], 'Runtime to setup with Nix'); | ||
|
||
const platform = await i.text('Platform', 'LPSM Service Tree Platform'); | ||
const service = await i.text('Service', 'LPSM Service Tree Service'); | ||
|
||
const infra = await i.confirm('Infrastructure', 'Include infrastructure binaries like helm, k3d, kubectl and docker'); | ||
const vars: Record<string, string | boolean> = { platform, service, infra }; | ||
|
||
if (runtime == 'Go') { | ||
return SimpleCopy(vars, { | ||
root: 'templates/go', | ||
exclude: [], | ||
glob: '**/*', | ||
type: GlobType.Template, | ||
}); | ||
} else if (runtime == '.NET') { | ||
return SimpleCopy(vars, { | ||
root: 'templates/dotnet', | ||
exclude: [], | ||
glob: '**/*', | ||
type: GlobType.Template, | ||
}); | ||
} else { | ||
return SimpleCopy(vars, { | ||
root: 'templates/bun', | ||
exclude: [], | ||
glob: '**/*', | ||
type: GlobType.Template, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Cyan, GlobType, IDeterminism, IInquirer } from '@atomicloud/cyan-sdk'; | ||
|
||
export async function normalPrompt(i: IInquirer, d: IDeterminism): Promise<Cyan> { | ||
const vars: Record<string, string> = { description: '' }; | ||
|
||
vars.description = await i.text('Description', 'Description of this Project'); | ||
|
||
const standard = await i.confirm('Include default binaries'); | ||
const pc = await i.confirm('Include Pre-Commit Hooks'); | ||
|
||
const folder = standard ? 'templates/normal/standard' : 'templates/normal/empty'; | ||
const folderExclude = pc ? [] : ['pre-commit.nix', 'fmt.nix']; | ||
const precommit = pc ? 'templates/normal/with-pc' : 'templates/normal/without-pc'; | ||
|
||
return { | ||
processors: [ | ||
{ | ||
name: 'cyan/default', | ||
files: [ | ||
{ | ||
glob: '**/*', | ||
type: GlobType.Template, | ||
root: 'templates/normal/common', | ||
exclude: [], | ||
}, | ||
{ | ||
glob: '**/*', | ||
type: GlobType.Template, | ||
root: folder, | ||
exclude: folderExclude, | ||
}, | ||
{ | ||
glob: '**/*', | ||
type: GlobType.Template, | ||
root: precommit, | ||
exclude: [], | ||
}, | ||
], | ||
config: { | ||
vars, | ||
parser: { | ||
varSyntax: [['var__', '__']], | ||
}, | ||
}, | ||
}, | ||
], | ||
plugins: [], | ||
} as Cyan; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,41 @@ | ||
import {StartTemplateWithLambda} from "@atomicloud/cyan-sdk"; | ||
import { Cyan, GlobType, StartTemplateWithLambda } from '@atomicloud/cyan-sdk'; | ||
import { Glob } from 'bun'; | ||
import { normalPrompt } from './functions/normal'; | ||
import { atomiPrompt } from './functions/atomi'; | ||
|
||
StartTemplateWithLambda(async (i, d) => { | ||
return { | ||
processors: [ | ||
{ | ||
name: "cyan/default", | ||
files: [], | ||
config: {}, | ||
}, | ||
], | ||
plugins: [ | ||
|
||
], | ||
StartTemplateWithLambda(async (i, d): Promise<Cyan> => { | ||
const type = await i.select( | ||
'Which type of Nix do you want to initialize?', | ||
['Standard', 'CyanPrint Bun', 'AtomiCloud Suite'], | ||
'For default configuration, please choose standard.', | ||
); | ||
|
||
if (type == 'Standard') { | ||
return await normalPrompt(i, d); | ||
} else if (type == 'CyanPrint Bun') { | ||
return { | ||
plugins: [], | ||
processors: [ | ||
{ | ||
name: 'cyan/default', | ||
files: [ | ||
{ | ||
root: 'templates/cyanprint-bun', | ||
glob: '**/*', | ||
exclude: [], | ||
type: GlobType.Template, | ||
}, | ||
], | ||
config: { | ||
vars: {}, | ||
parser: { | ||
varSyntax: [['var__', '__']], | ||
}, | ||
}, | ||
}, | ||
], | ||
} as Cyan; | ||
} else { | ||
return await atomiPrompt(i, d); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.