Skip to content

Commit

Permalink
refactor: resolve format issues appearing in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterBrown committed Sep 9, 2024
1 parent ed31767 commit d736b23
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 33 deletions.
31 changes: 3 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
CI: true
PNPM_CACHE_FOLDER: .pnpm-store
jobs:
lint:
format_and_lint:
runs-on: ubuntu-latest

steps:
Expand All @@ -35,33 +35,8 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Lint code
run: pnpm run lint

format:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.x.x
run_install: false

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Format code
run: pnpm run format
- name: Format and lint code
run: pnpm run format && pnpm run lint

compile:
runs-on: ubuntu-latest
Expand Down
16 changes: 12 additions & 4 deletions src/toolbox/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ export async function build({
examples !== undefined
? examples.map((example) => collectChoicesFromTree(example)).flat()
: []
if (contributed !== undefined) choices.push(...contributed.flatMap(project => collectChoicesFromTree(project)))
if (contributed !== undefined) {
choices.push(...contributed.flatMap(project => collectChoicesFromTree(project)))
}
const { example: selectedExample } = await prompt.ask([
{
type: 'autocomplete',
Expand Down Expand Up @@ -214,9 +216,15 @@ export async function build({
`-t ${DEPLOY_TARGET[deployStatus]}`,
`-o ${outputDir}`,
]
if (mode === 'development') configArgs.push('-d')
if (mode === 'production') configArgs.push('-i')
if (log) configArgs.push('-l')
if (mode === 'development') {
configArgs.push('-d')
}
if (mode === 'production') {
configArgs.push('-i')
}
if (log) {
configArgs.push('-l')
}

Object.entries(config).forEach(([element, value]) => {
configArgs.push(`${element}="${value}"`)
Expand Down
4 changes: 3 additions & 1 deletion src/toolbox/system/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export function detectPython(): string | null {

export async function getPythonVersion(): Promise<string | null> {
const python = detectPython()
if (python !== null) return (await system.run(`${python} --version`)).split(' ').pop()?.trim() ?? null
if (python !== null) {
return (await system.run(`${python} --version`)).split(' ').pop()?.trim() ?? null
}
return null
}

0 comments on commit d736b23

Please sign in to comment.