Skip to content

Commit ce563a8

Browse files
committed
run format
1 parent cf2d871 commit ce563a8

File tree

2 files changed

+39
-24
lines changed

2 files changed

+39
-24
lines changed

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/installer/stages/pioarduino-core.js

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ export default class pioarduinoCoreStage extends BaseStage {
4444
// First check if we have local installation without network calls
4545
if (await this.checkLocalPioInstallation()) {
4646
console.info('Found existing pioarduino installation locally');
47-
47+
4848
// Even with local installation, we need to load core state
4949
try {
5050
await this.loadCoreState();
5151
} catch (err) {
5252
console.warn('Failed to load core state for local installation:', err.message);
5353
// Continue anyway - local installation exists
5454
}
55-
55+
5656
// Setup `platformio` CLI globally for a Node.JS process
5757
if (this.params.useBuiltinPIOCore) {
5858
proc.extendOSEnvironPath('PLATFORMIO_PATH', [
@@ -94,16 +94,21 @@ export default class pioarduinoCoreStage extends BaseStage {
9494
} catch (err) {
9595
// If network operations fail, check if we have local installation anyway
9696
if (await this.checkLocalPioInstallation()) {
97-
console.info('Network failed, but found existing pioarduino installation locally');
98-
97+
console.info(
98+
'Network failed, but found existing pioarduino installation locally',
99+
);
100+
99101
// Try to load core state for local installation (may fail, but continue)
100102
try {
101103
await this.loadCoreState();
102104
} catch (coreStateErr) {
103-
console.warn('Failed to load core state in fallback mode:', coreStateErr.message);
105+
console.warn(
106+
'Failed to load core state in fallback mode:',
107+
coreStateErr.message,
108+
);
104109
// Continue anyway - local installation exists
105110
}
106-
111+
107112
// Setup `platformio` CLI globally for a Node.JS process
108113
if (this.params.useBuiltinPIOCore) {
109114
proc.extendOSEnvironPath('PLATFORMIO_PATH', [
@@ -129,29 +134,32 @@ export default class pioarduinoCoreStage extends BaseStage {
129134
'/opt/platformio',
130135
// Windows program files
131136
path.join(process.env.PROGRAMFILES || 'C:\\Program Files', 'PlatformIO'),
132-
path.join(process.env.PROGRAMFILES_X86 || 'C:\\Program Files (x86)', 'PlatformIO'),
137+
path.join(
138+
process.env.PROGRAMFILES_X86 || 'C:\\Program Files (x86)',
139+
'PlatformIO',
140+
),
133141
// macOS Applications
134142
'/Applications/PlatformIO.app/Contents/Resources',
135143
].filter(Boolean); // Remove undefined values
136-
144+
137145
let foundExecutable = false;
138146
let foundPlatformIODir = null;
139-
147+
140148
for (const pioarduinoDir of possiblePlatformIODirs) {
141149
try {
142150
const penvDir = path.join(pioarduinoDir, 'penv');
143-
151+
144152
// Check if .platformio/penv directory exists
145153
await fs.access(penvDir);
146-
154+
147155
// Try to find pio executable in different locations
148156
const pioExecutablePaths = [
149-
path.join(penvDir, 'bin', 'pio'), // Unix/macOS
150-
path.join(penvDir, 'Scripts', 'pio.exe'), // Windows
151-
path.join(penvDir, 'bin', 'platformio'), // Alternative Unix name
157+
path.join(penvDir, 'bin', 'pio'), // Unix/macOS
158+
path.join(penvDir, 'Scripts', 'pio.exe'), // Windows
159+
path.join(penvDir, 'bin', 'platformio'), // Alternative Unix name
152160
path.join(penvDir, 'Scripts', 'platformio.exe'), // Alternative Windows name
153161
];
154-
162+
155163
let executableFound = false;
156164
for (const execPath of pioExecutablePaths) {
157165
try {
@@ -163,7 +171,7 @@ export default class pioarduinoCoreStage extends BaseStage {
163171
// Continue checking other paths
164172
}
165173
}
166-
174+
167175
if (executableFound) {
168176
foundExecutable = true;
169177
foundPlatformIODir = pioarduinoDir;
@@ -174,12 +182,14 @@ export default class pioarduinoCoreStage extends BaseStage {
174182
continue;
175183
}
176184
}
177-
185+
178186
if (!foundExecutable) {
179-
console.warn('No PlatformIO installation found in any of the checked locations');
187+
console.warn(
188+
'No PlatformIO installation found in any of the checked locations',
189+
);
180190
return false;
181191
}
182-
192+
183193
// For builtin core, also check core directory (but don't fail if missing)
184194
if (this.params.useBuiltinPIOCore) {
185195
try {
@@ -189,13 +199,13 @@ export default class pioarduinoCoreStage extends BaseStage {
189199
console.info('Builtin core not found, but global installation is sufficient');
190200
}
191201
}
192-
202+
193203
console.info('Local pioarduino installation found:', {
194204
pioarduinoDir: foundPlatformIODir,
195205
hasExecutable: foundExecutable,
196-
useBuiltinCore: this.params.useBuiltinPIOCore
206+
useBuiltinCore: this.params.useBuiltinPIOCore,
197207
});
198-
208+
199209
return true;
200210
} catch (err) {
201211
// console.debug('Local pioarduino check failed:', err.message);
@@ -253,7 +263,12 @@ export default class pioarduinoCoreStage extends BaseStage {
253263
const coreState = core.getCoreState();
254264
try {
255265
await fs.access(builtInPythonDir);
256-
if (!coreState.python_version.startsWith('3.10.') && !coreState.python_version.startsWith('3.11.') && !coreState.python_version.startsWith('3.12.') && !coreState.python_version.startsWith('3.13.')) {
266+
if (
267+
!coreState.python_version.startsWith('3.10.') &&
268+
!coreState.python_version.startsWith('3.11.') &&
269+
!coreState.python_version.startsWith('3.12.') &&
270+
!coreState.python_version.startsWith('3.13.')
271+
) {
257272
throw new Error('Not Python 3.10+ in penv');
258273
}
259274
const pkgVersion = (

0 commit comments

Comments
 (0)