create-stx 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.ts +18 -9
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -236,7 +236,8 @@ export function createStore<T extends object>(
236
236
  if (stored) {
237
237
  currentValue = { ...initialValue, ...JSON.parse(stored) }
238
238
  }
239
- } catch { /* Invalid stored value */ }
239
+ }
240
+ catch { /* Invalid stored value */ }
240
241
  }
241
242
 
242
243
  const persistValue = (value: T) => {
@@ -246,14 +247,16 @@ export function createStore<T extends object>(
246
247
  if (persist.debounce) {
247
248
  if (persistTimeout) clearTimeout(persistTimeout)
248
249
  persistTimeout = setTimeout(() => storage.setItem(key, JSON.stringify(value)), persist.debounce)
249
- } else {
250
+ }
251
+ else {
250
252
  storage.setItem(key, JSON.stringify(value))
251
253
  }
252
254
  }
253
255
 
254
256
  const notify = (newValue: T, prevValue: T | undefined) => {
255
257
  for (const subscriber of subscribers) {
256
- try { subscriber(newValue, prevValue) } catch (e) { console.error('[store]', e) }
258
+ try { subscriber(newValue, prevValue) }
259
+ catch (e) { console.error('[store]', e) }
257
260
  }
258
261
  if (onChange) onChange(newValue, prevValue)
259
262
  }
@@ -322,7 +325,8 @@ export function useStorage<T>(
322
325
  try {
323
326
  const raw = storage.getItem(key)
324
327
  return raw !== null ? serializer.read(raw) : defaultValue
325
- } catch {
328
+ }
329
+ catch {
326
330
  return defaultValue
327
331
  }
328
332
  }
@@ -331,7 +335,8 @@ export function useStorage<T>(
331
335
  try {
332
336
  storage.setItem(key, serializer.write(value))
333
337
  listeners.forEach(fn => fn(value))
334
- } catch (e) {
338
+ }
339
+ catch (e) {
335
340
  console.error('[useStorage] Failed to set:', e)
336
341
  }
337
342
  }
@@ -396,7 +401,8 @@ export function useCookie<T = string>(name: string, options: CookieOptions = {})
396
401
  const serialize = (val: T): string =>
397
402
  typeof val === 'string' ? val : JSON.stringify(val)
398
403
  const deserialize = (raw: string): T => {
399
- try { return JSON.parse(raw) as T } catch { return raw as T }
404
+ try { return JSON.parse(raw) as T }
405
+ catch { return raw as T }
400
406
  }
401
407
 
402
408
  return {
@@ -634,7 +640,8 @@ async function createProject(projectName: string, targetDir: string) {
634
640
  child.on('close', (code) => {
635
641
  if (code === 0) {
636
642
  success('Installed dependencies')
637
- } else {
643
+ }
644
+ else {
638
645
  log('')
639
646
  info('Could not install STX packages from npm (not yet published)')
640
647
  info('For local development, link the packages manually:')
@@ -679,7 +686,8 @@ async function main() {
679
686
  error(`Directory "${projectName}" already exists and is not empty`)
680
687
  process.exit(1)
681
688
  }
682
- } else {
689
+ }
690
+ else {
683
691
  fs.mkdirSync(targetDir, { recursive: true })
684
692
  }
685
693
 
@@ -694,7 +702,8 @@ async function main() {
694
702
  log(` ${colors.cyan}cd ${projectName}${colors.reset}`)
695
703
  log(` ${colors.cyan}bun dev${colors.reset}`)
696
704
  log('')
697
- } catch (err) {
705
+ }
706
+ catch (err) {
698
707
  error(`Failed to create project: ${err}`)
699
708
  process.exit(1)
700
709
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-stx",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Create a new STX application",
5
5
  "type": "module",
6
6
  "bin": {