Skip to content

Commit

Permalink
feat(pico): update SDK to v2.0.0 (#181)
Browse files Browse the repository at this point in the history
* feat(pico): update SDK to v2.0.0

* fix(setup/update): use correct import path for toolbox file
  • Loading branch information
HipsterBrown authored Nov 10, 2024
1 parent 4377962 commit 5f21283
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Device } from '../types'
import setupEjectfix from '../toolbox/setup/ejectfix'
import { DEVICE_ALIAS } from '../toolbox/prompt/devices'
import { MODDABLE_REPO } from '../toolbox/setup/constants'
import type { SetupArgs, PlatformSetupArgs } from '../toolbox/setup/types'
import type { SetupArgs } from '../toolbox/setup/types'

interface SetupOptions {
device?: Device
Expand All @@ -28,7 +28,7 @@ const command = buildCommand({
targetBranch = 'latest-release',
sourceRepo = MODDABLE_REPO,
} = flags
let target: Device = device ?? currentPlatform
let target: Device = device ?? DEVICE_ALIAS[currentPlatform]

if (device === undefined && listDevices) {
const choices = [
Expand Down Expand Up @@ -72,8 +72,7 @@ const command = buildCommand({
'lin',
'linux',
]
const setup: (args: SetupArgs | PlatformSetupArgs) => Promise<void> =
await import(`../commands/setup.ts/${target}`)
const { default: setup } = await import(`../toolbox/setup/${target}`)
if (platformDevices.includes(target)) {
await setup({ targetBranch, sourceRepo })
} else {
Expand Down
7 changes: 5 additions & 2 deletions src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ const command = buildCommand({
},
async func(this: LocalContext, flags: UpdateOptions) {
const currentPlatform: Device = platformType().toLowerCase() as Device
const { device = currentPlatform, targetBranch = 'latest-release' } = flags
const update = await import(`../toolbox/update/${device}`)
const {
device = DEVICE_ALIAS[currentPlatform],
targetBranch = 'latest-release',
} = flags
const { default: update } = await import(`../toolbox/update/${device}`)
await update({ targetBranch })
},
parameters: {
Expand Down
2 changes: 1 addition & 1 deletion src/toolbox/prompt/devices.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Device } from '../../types'

export const DEVICE_ALIAS: Record<Device | 'esp8266', string> = Object.freeze({
export const DEVICE_ALIAS: Record<Device | 'esp8266', Device> = Object.freeze({
esp8266: 'esp',
darwin: 'mac',
mac: 'mac',
Expand Down
2 changes: 1 addition & 1 deletion src/toolbox/setup/pico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { sourceEnvironment } from '../system/exec'

export default async function (): Promise<void> {
const OS = platformType().toLowerCase()
const PICO_BRANCH = '1.5.0'
const PICO_BRANCH = '2.0.0'
const PICO_SDK_REPO = 'https://github.com/raspberrypi/pico-sdk'
const PICO_EXTRAS_REPO = 'https://github.com/raspberrypi/pico-extras'
const PICO_EXAMPLES_REPO = 'https://github.com/raspberrypi/pico-examples'
Expand Down
2 changes: 1 addition & 1 deletion src/toolbox/update/pico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { sourceEnvironment } from '../system/exec'

export default async function (): Promise<void> {
const OS = platformType().toLowerCase()
const PICO_BRANCH = '1.5.0'
const PICO_BRANCH = '2.0.0'
const PICO_EXTRAS_REPO = 'https://github.com/raspberrypi/pico-extras'
const PICO_ROOT =
process.env.PICO_ROOT ?? filesystem.resolve(INSTALL_DIR, 'pico')
Expand Down

0 comments on commit 5f21283

Please sign in to comment.