nwui-cli 0.4.1 → 0.4.2
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.
- package/.turbo/turbo-build.log +2 -1
- package/build/index.js +33 -17
- package/build/install-component.js +105 -48
- package/build/login.js +14 -11
- package/build/utils/env.js +1 -1
- package/package.json +2 -1
- package/build/cli/src/index.js +0 -41
- package/build/cli/src/install-component.js +0 -42
- package/build/cli/src/login.js +0 -77
- package/build/cli/src/net.js +0 -12
- package/build/cli/src/project-setup.js +0 -1
- package/build/cli/src/prompts.js +0 -119
- package/build/cli/src/utils/local-storage.js +0 -19
- package/build/docs/app/data.js +0 -1380
- package/build/log/index.js +0 -81
- package/build/prompts.js +0 -119
- package/my-expo-app-2/app/+html.tsx +0 -46
- package/my-expo-app-2/app/+not-found.tsx +0 -33
- package/my-expo-app-2/app/_layout.tsx +0 -22
- package/my-expo-app-2/app/details.tsx +0 -17
- package/my-expo-app-2/app/index.tsx +0 -23
- package/my-expo-app-2/app-env.d.ts +0 -2
- package/my-expo-app-2/app.json +0 -48
- package/my-expo-app-2/assets/adaptive-icon.png +0 -0
- package/my-expo-app-2/assets/favicon.png +0 -0
- package/my-expo-app-2/assets/icon.png +0 -0
- package/my-expo-app-2/assets/splash.png +0 -0
- package/my-expo-app-2/babel.config.js +0 -18
- package/my-expo-app-2/cesconfig.json +0 -35
- package/my-expo-app-2/components/Button.tsx +0 -19
- package/my-expo-app-2/components/Container.tsx +0 -9
- package/my-expo-app-2/components/EditScreenInfo.tsx +0 -34
- package/my-expo-app-2/components/ScreenContent.tsx +0 -25
- package/my-expo-app-2/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/my-expo-app-2/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.ios.tsx +0 -97
- package/my-expo-app-2/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.tsx +0 -264
- package/my-expo-app-2/components/nativewindui/AdaptiveSearchHeader/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/AdaptiveSearchHeader/types.ts +0 -95
- package/my-expo-app-2/components/nativewindui/Alert/Alert.ios.tsx +0 -65
- package/my-expo-app-2/components/nativewindui/Alert/Alert.tsx +0 -291
- package/my-expo-app-2/components/nativewindui/Alert/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/Alert/types.ts +0 -27
- package/my-expo-app-2/components/nativewindui/Badge.tsx +0 -84
- package/my-expo-app-2/components/nativewindui/Button.tsx +0 -156
- package/my-expo-app-2/components/nativewindui/Checkbox.tsx +0 -61
- package/my-expo-app-2/components/nativewindui/ContextMenu/ContextMenu.ios.tsx +0 -221
- package/my-expo-app-2/components/nativewindui/ContextMenu/ContextMenu.tsx +0 -420
- package/my-expo-app-2/components/nativewindui/ContextMenu/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/ContextMenu/types.ts +0 -91
- package/my-expo-app-2/components/nativewindui/ContextMenu/utils.ts +0 -14
- package/my-expo-app-2/components/nativewindui/DrawerContent.tsx +0 -145
- package/my-expo-app-2/components/nativewindui/DropdownMenu/DropdownMenu.ios.tsx +0 -168
- package/my-expo-app-2/components/nativewindui/DropdownMenu/DropdownMenu.tsx +0 -330
- package/my-expo-app-2/components/nativewindui/DropdownMenu/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/DropdownMenu/types.ts +0 -93
- package/my-expo-app-2/components/nativewindui/DropdownMenu/utils.ts +0 -14
- package/my-expo-app-2/components/nativewindui/Form.tsx +0 -125
- package/my-expo-app-2/components/nativewindui/LargeTitleHeader/LargeTitleHeader.ios.tsx +0 -99
- package/my-expo-app-2/components/nativewindui/LargeTitleHeader/LargeTitleHeader.tsx +0 -288
- package/my-expo-app-2/components/nativewindui/LargeTitleHeader/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/LargeTitleHeader/types.ts +0 -89
- package/my-expo-app-2/components/nativewindui/List.tsx +0 -433
- package/my-expo-app-2/components/nativewindui/SearchInput/SearchInput.ios.tsx +0 -177
- package/my-expo-app-2/components/nativewindui/SearchInput/SearchInput.tsx +0 -86
- package/my-expo-app-2/components/nativewindui/SearchInput/index.tsx +0 -1
- package/my-expo-app-2/components/nativewindui/SearchInput/types.ts +0 -12
- package/my-expo-app-2/components/nativewindui/SegmentedControl/SegmentedControl.ios.tsx +0 -31
- package/my-expo-app-2/components/nativewindui/SegmentedControl/SegmentedControl.tsx +0 -55
- package/my-expo-app-2/components/nativewindui/SegmentedControl/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/SegmentedControl/types.ts +0 -15
- package/my-expo-app-2/components/nativewindui/Stepper.tsx +0 -62
- package/my-expo-app-2/components/nativewindui/Text.tsx +0 -55
- package/my-expo-app-2/components/nativewindui/TextField/TextField.ios.tsx +0 -85
- package/my-expo-app-2/components/nativewindui/TextField/TextField.tsx +0 -326
- package/my-expo-app-2/components/nativewindui/TextField/index.tsx +0 -1
- package/my-expo-app-2/components/nativewindui/TextField/types.ts +0 -26
- package/my-expo-app-2/components/nativewindui/Toolbar.tsx +0 -116
- package/my-expo-app-2/global.css +0 -3
- package/my-expo-app-2/metro.config.js +0 -12
- package/my-expo-app-2/package-lock.json +0 -19162
- package/my-expo-app-2/package.json +0 -74
- package/my-expo-app-2/prettier.config.js +0 -11
- package/my-expo-app-2/tailwind.config.js +0 -11
- package/my-expo-app-3/app/+html.tsx +0 -46
- package/my-expo-app-3/app/+not-found.tsx +0 -33
- package/my-expo-app-3/app/_layout.tsx +0 -22
- package/my-expo-app-3/app/details.tsx +0 -17
- package/my-expo-app-3/app/index.tsx +0 -23
- package/my-expo-app-3/app-env.d.ts +0 -2
- package/my-expo-app-3/app.json +0 -48
- package/my-expo-app-3/assets/adaptive-icon.png +0 -0
- package/my-expo-app-3/assets/favicon.png +0 -0
- package/my-expo-app-3/assets/icon.png +0 -0
- package/my-expo-app-3/assets/splash.png +0 -0
- package/my-expo-app-3/babel.config.js +0 -18
- package/my-expo-app-3/cesconfig.json +0 -35
- package/my-expo-app-3/components/Button.tsx +0 -19
- package/my-expo-app-3/components/Container.tsx +0 -9
- package/my-expo-app-3/components/EditScreenInfo.tsx +0 -34
- package/my-expo-app-3/components/ScreenContent.tsx +0 -25
- package/my-expo-app-3/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/my-expo-app-3/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.ios.tsx +0 -97
- package/my-expo-app-3/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.tsx +0 -264
- package/my-expo-app-3/components/nativewindui/AdaptiveSearchHeader/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/AdaptiveSearchHeader/types.ts +0 -95
- package/my-expo-app-3/components/nativewindui/Alert/Alert.ios.tsx +0 -65
- package/my-expo-app-3/components/nativewindui/Alert/Alert.tsx +0 -291
- package/my-expo-app-3/components/nativewindui/Alert/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/Alert/types.ts +0 -27
- package/my-expo-app-3/components/nativewindui/Badge.tsx +0 -84
- package/my-expo-app-3/components/nativewindui/Button.tsx +0 -156
- package/my-expo-app-3/components/nativewindui/Checkbox.tsx +0 -61
- package/my-expo-app-3/components/nativewindui/ContextMenu/ContextMenu.ios.tsx +0 -221
- package/my-expo-app-3/components/nativewindui/ContextMenu/ContextMenu.tsx +0 -420
- package/my-expo-app-3/components/nativewindui/ContextMenu/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/ContextMenu/types.ts +0 -91
- package/my-expo-app-3/components/nativewindui/ContextMenu/utils.ts +0 -14
- package/my-expo-app-3/components/nativewindui/DrawerContent.tsx +0 -145
- package/my-expo-app-3/components/nativewindui/DropdownMenu/DropdownMenu.ios.tsx +0 -168
- package/my-expo-app-3/components/nativewindui/DropdownMenu/DropdownMenu.tsx +0 -330
- package/my-expo-app-3/components/nativewindui/DropdownMenu/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/DropdownMenu/types.ts +0 -93
- package/my-expo-app-3/components/nativewindui/DropdownMenu/utils.ts +0 -14
- package/my-expo-app-3/components/nativewindui/Form.tsx +0 -125
- package/my-expo-app-3/components/nativewindui/LargeTitleHeader/LargeTitleHeader.ios.tsx +0 -99
- package/my-expo-app-3/components/nativewindui/LargeTitleHeader/LargeTitleHeader.tsx +0 -288
- package/my-expo-app-3/components/nativewindui/LargeTitleHeader/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/LargeTitleHeader/types.ts +0 -89
- package/my-expo-app-3/components/nativewindui/List.tsx +0 -433
- package/my-expo-app-3/components/nativewindui/SearchInput/SearchInput.ios.tsx +0 -177
- package/my-expo-app-3/components/nativewindui/SearchInput/SearchInput.tsx +0 -86
- package/my-expo-app-3/components/nativewindui/SearchInput/index.tsx +0 -1
- package/my-expo-app-3/components/nativewindui/SearchInput/types.ts +0 -12
- package/my-expo-app-3/components/nativewindui/SegmentedControl/SegmentedControl.ios.tsx +0 -31
- package/my-expo-app-3/components/nativewindui/SegmentedControl/SegmentedControl.tsx +0 -55
- package/my-expo-app-3/components/nativewindui/SegmentedControl/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/SegmentedControl/types.ts +0 -15
- package/my-expo-app-3/components/nativewindui/Stepper.tsx +0 -62
- package/my-expo-app-3/components/nativewindui/Text.tsx +0 -55
- package/my-expo-app-3/components/nativewindui/TextField/TextField.ios.tsx +0 -85
- package/my-expo-app-3/components/nativewindui/TextField/TextField.tsx +0 -326
- package/my-expo-app-3/components/nativewindui/TextField/index.tsx +0 -1
- package/my-expo-app-3/components/nativewindui/TextField/types.ts +0 -26
- package/my-expo-app-3/components/nativewindui/Toolbar.tsx +0 -116
- package/my-expo-app-3/components/nativewindui/examples/selectable-text.tsx +0 -43
- package/my-expo-app-3/components/nativewindui/examples/text.tsx +0 -43
- package/my-expo-app-3/global.css +0 -3
- package/my-expo-app-3/metro.config.js +0 -12
- package/my-expo-app-3/package-lock.json +0 -19141
- package/my-expo-app-3/package.json +0 -73
- package/my-expo-app-3/prettier.config.js +0 -11
- package/my-expo-app-3/tailwind.config.js +0 -11
- package/my-expo-app-test-case/app/+html.tsx +0 -46
- package/my-expo-app-test-case/app/+not-found.tsx +0 -33
- package/my-expo-app-test-case/app/_layout.tsx +0 -22
- package/my-expo-app-test-case/app/details.tsx +0 -17
- package/my-expo-app-test-case/app/index.tsx +0 -23
- package/my-expo-app-test-case/app-env.d.ts +0 -2
- package/my-expo-app-test-case/app.json +0 -48
- package/my-expo-app-test-case/assets/adaptive-icon.png +0 -0
- package/my-expo-app-test-case/assets/favicon.png +0 -0
- package/my-expo-app-test-case/assets/icon.png +0 -0
- package/my-expo-app-test-case/assets/splash.png +0 -0
- package/my-expo-app-test-case/babel.config.js +0 -18
- package/my-expo-app-test-case/cesconfig.json +0 -35
- package/my-expo-app-test-case/components/Button.tsx +0 -19
- package/my-expo-app-test-case/components/Container.tsx +0 -9
- package/my-expo-app-test-case/components/EditScreenInfo.tsx +0 -34
- package/my-expo-app-test-case/components/ScreenContent.tsx +0 -25
- package/my-expo-app-test-case/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/my-expo-app-test-case/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.ios.tsx +0 -97
- package/my-expo-app-test-case/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.tsx +0 -264
- package/my-expo-app-test-case/components/nativewindui/AdaptiveSearchHeader/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/AdaptiveSearchHeader/types.ts +0 -95
- package/my-expo-app-test-case/components/nativewindui/Alert/Alert.ios.tsx +0 -65
- package/my-expo-app-test-case/components/nativewindui/Alert/Alert.tsx +0 -291
- package/my-expo-app-test-case/components/nativewindui/Alert/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/Alert/types.ts +0 -27
- package/my-expo-app-test-case/components/nativewindui/Badge.tsx +0 -84
- package/my-expo-app-test-case/components/nativewindui/Button.tsx +0 -156
- package/my-expo-app-test-case/components/nativewindui/Checkbox.tsx +0 -61
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/ContextMenu.ios.tsx +0 -221
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/ContextMenu.tsx +0 -420
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/types.ts +0 -91
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/utils.ts +0 -14
- package/my-expo-app-test-case/components/nativewindui/DrawerContent.tsx +0 -145
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/DropdownMenu.ios.tsx +0 -168
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/DropdownMenu.tsx +0 -330
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/types.ts +0 -93
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/utils.ts +0 -14
- package/my-expo-app-test-case/components/nativewindui/Form.tsx +0 -125
- package/my-expo-app-test-case/components/nativewindui/LargeTitleHeader/LargeTitleHeader.ios.tsx +0 -99
- package/my-expo-app-test-case/components/nativewindui/LargeTitleHeader/LargeTitleHeader.tsx +0 -288
- package/my-expo-app-test-case/components/nativewindui/LargeTitleHeader/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/LargeTitleHeader/types.ts +0 -89
- package/my-expo-app-test-case/components/nativewindui/List.tsx +0 -433
- package/my-expo-app-test-case/components/nativewindui/SearchInput/SearchInput.ios.tsx +0 -177
- package/my-expo-app-test-case/components/nativewindui/SearchInput/SearchInput.tsx +0 -86
- package/my-expo-app-test-case/components/nativewindui/SearchInput/index.tsx +0 -1
- package/my-expo-app-test-case/components/nativewindui/SearchInput/types.ts +0 -12
- package/my-expo-app-test-case/components/nativewindui/SegmentedControl/SegmentedControl.ios.tsx +0 -31
- package/my-expo-app-test-case/components/nativewindui/SegmentedControl/SegmentedControl.tsx +0 -55
- package/my-expo-app-test-case/components/nativewindui/SegmentedControl/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/SegmentedControl/types.ts +0 -15
- package/my-expo-app-test-case/components/nativewindui/Stepper.tsx +0 -62
- package/my-expo-app-test-case/components/nativewindui/Text.tsx +0 -55
- package/my-expo-app-test-case/components/nativewindui/TextField/TextField.ios.tsx +0 -85
- package/my-expo-app-test-case/components/nativewindui/TextField/TextField.tsx +0 -326
- package/my-expo-app-test-case/components/nativewindui/TextField/index.tsx +0 -1
- package/my-expo-app-test-case/components/nativewindui/TextField/types.ts +0 -26
- package/my-expo-app-test-case/components/nativewindui/Toolbar.tsx +0 -116
- package/my-expo-app-test-case/components/nativewindui/examples/a-user-created-file.tsx +0 -0
- package/my-expo-app-test-case/components/nativewindui/examples/selectable-text.tsx +0 -43
- package/my-expo-app-test-case/components/nativewindui/examples/text.tsx +0 -43
- package/my-expo-app-test-case/global.css +0 -3
- package/my-expo-app-test-case/metro.config.js +0 -12
- package/my-expo-app-test-case/package-lock.json +0 -19141
- package/my-expo-app-test-case/package.json +0 -73
- package/my-expo-app-test-case/prettier.config.js +0 -11
- package/my-expo-app-test-case/tailwind.config.js +0 -11
- package/no-install/app/+html.tsx +0 -46
- package/no-install/app/+not-found.tsx +0 -25
- package/no-install/app/_layout.tsx +0 -7
- package/no-install/app/details.tsx +0 -20
- package/no-install/app/index.tsx +0 -19
- package/no-install/app-env.d.ts +0 -2
- package/no-install/app.json +0 -41
- package/no-install/assets/adaptive-icon.png +0 -0
- package/no-install/assets/favicon.png +0 -0
- package/no-install/assets/icon.png +0 -0
- package/no-install/assets/splash.png +0 -0
- package/no-install/babel.config.js +0 -13
- package/no-install/cesconfig.json +0 -35
- package/no-install/components/Button.tsx +0 -25
- package/no-install/components/Container.tsx +0 -9
- package/no-install/components/EditScreenInfo.tsx +0 -31
- package/no-install/components/ScreenContent.tsx +0 -29
- package/no-install/components/nativewindui/Slider.tsx +0 -26
- package/no-install/global.css +0 -3
- package/no-install/metro.config.js +0 -10
- package/no-install/package-lock.json +0 -17505
- package/no-install/package.json +0 -59
- package/no-install/prettier.config.js +0 -10
- package/no-install/tailwind.config.js +0 -14
- package/test-app/app/+html.tsx +0 -46
- package/test-app/app/+not-found.tsx +0 -25
- package/test-app/app/_layout.tsx +0 -7
- package/test-app/app/details.tsx +0 -20
- package/test-app/app/index.tsx +0 -19
- package/test-app/app-env.d.ts +0 -2
- package/test-app/app.json +0 -41
- package/test-app/assets/adaptive-icon.png +0 -0
- package/test-app/assets/favicon.png +0 -0
- package/test-app/assets/icon.png +0 -0
- package/test-app/assets/splash.png +0 -0
- package/test-app/babel.config.js +0 -13
- package/test-app/cesconfig.json +0 -35
- package/test-app/components/Button.tsx +0 -25
- package/test-app/components/Container.tsx +0 -9
- package/test-app/components/EditScreenInfo.tsx +0 -31
- package/test-app/components/ScreenContent.tsx +0 -29
- package/test-app/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/test-app/components/nativewindui/Avatar.tsx +0 -133
- package/test-app/components/nativewindui/DatePicker/DatePicker.android.tsx +0 -72
- package/test-app/components/nativewindui/DatePicker/DatePicker.tsx +0 -23
- package/test-app/components/nativewindui/DatePicker/index.ts +0 -1
- package/test-app/components/nativewindui/Picker.tsx +0 -42
- package/test-app/components/nativewindui/ProgressIndicator.tsx +0 -78
- package/test-app/components/nativewindui/Sheet.tsx +0 -52
- package/test-app/components/nativewindui/Slider.tsx +0 -26
- package/test-app/components/nativewindui/Text.tsx +0 -55
- package/test-app/components/nativewindui/Toggle.tsx +0 -20
- package/test-app/global.css +0 -3
- package/test-app/metro.config.js +0 -10
- package/test-app/package.json +0 -64
- package/test-app/prettier.config.js +0 -10
- package/test-app/tailwind.config.js +0 -14
- package/test-no-install/app/+html.tsx +0 -46
- package/test-no-install/app/+not-found.tsx +0 -25
- package/test-no-install/app/_layout.tsx +0 -7
- package/test-no-install/app/details.tsx +0 -20
- package/test-no-install/app/index.tsx +0 -19
- package/test-no-install/app-env.d.ts +0 -2
- package/test-no-install/app.json +0 -41
- package/test-no-install/assets/adaptive-icon.png +0 -0
- package/test-no-install/assets/favicon.png +0 -0
- package/test-no-install/assets/icon.png +0 -0
- package/test-no-install/assets/splash.png +0 -0
- package/test-no-install/babel.config.js +0 -13
- package/test-no-install/cesconfig.json +0 -35
- package/test-no-install/components/Button.tsx +0 -25
- package/test-no-install/components/Container.tsx +0 -9
- package/test-no-install/components/EditScreenInfo.tsx +0 -31
- package/test-no-install/components/ScreenContent.tsx +0 -29
- package/test-no-install/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/test-no-install/components/nativewindui/Avatar.tsx +0 -133
- package/test-no-install/components/nativewindui/DatePicker/DatePicker.android.tsx +0 -72
- package/test-no-install/components/nativewindui/DatePicker/DatePicker.tsx +0 -23
- package/test-no-install/components/nativewindui/DatePicker/index.ts +0 -1
- package/test-no-install/components/nativewindui/Picker.tsx +0 -42
- package/test-no-install/components/nativewindui/ProgressIndicator.tsx +0 -78
- package/test-no-install/components/nativewindui/Sheet.tsx +0 -52
- package/test-no-install/components/nativewindui/Slider.tsx +0 -26
- package/test-no-install/components/nativewindui/Text.tsx +0 -55
- package/test-no-install/components/nativewindui/Toggle.tsx +0 -20
- package/test-no-install/global.css +0 -3
- package/test-no-install/metro.config.js +0 -10
- package/test-no-install/package.json +0 -64
- package/test-no-install/prettier.config.js +0 -10
- package/test-no-install/tailwind.config.js +0 -14
package/build/cli/src/login.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import open from 'open';
|
|
2
|
-
import ora from 'ora';
|
|
3
|
-
import { API_BASE_URL, supabase } from './net.js';
|
|
4
|
-
/**
|
|
5
|
-
* Checks if this device has a session, i.e. for an anonymous Supabase user, and refreshes tokens to ensure the (anonymous) account still exists.
|
|
6
|
-
*/
|
|
7
|
-
export const checkAndRefreshSession = async () => {
|
|
8
|
-
const { data: { user }, error: getUserError } = await supabase.auth.getUser();
|
|
9
|
-
if (getUserError || !user) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
const { data: { session }, error: getSessionError } = await supabase.auth.getSession();
|
|
13
|
-
if (getSessionError || !session) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return { user, session };
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Whether this device has an anonymous Supabase user that's also linked to a real Supabase user.
|
|
20
|
-
* Also has the side-effect of refreshing the access token via checkAndRefreshSession.
|
|
21
|
-
*
|
|
22
|
-
* TODO: should this ensure the user_id is valid?
|
|
23
|
-
* although RLS ensures this at creation, it doesn't prevent deleted REAL user accounts (a small edge-case).
|
|
24
|
-
*/
|
|
25
|
-
export const isLoggedIn = async () => {
|
|
26
|
-
const { user } = (await checkAndRefreshSession()) || {};
|
|
27
|
-
if (!user) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
const { data, error } = await supabase.from('session')
|
|
31
|
-
.select('*')
|
|
32
|
-
.eq('anon_id', user.id)
|
|
33
|
-
.limit(1)
|
|
34
|
-
.maybeSingle();
|
|
35
|
-
if (!error && data && data.user_id && data.user_id.length > 0) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Creates a new anonymous user and opens the web browser for the user to link their real account.
|
|
41
|
-
*/
|
|
42
|
-
export const login = async () => {
|
|
43
|
-
const { data: { user, session }, error } = await supabase.auth.signInAnonymously();
|
|
44
|
-
if (error || user === null || session === null)
|
|
45
|
-
throw error;
|
|
46
|
-
const { access_token, refresh_token } = session;
|
|
47
|
-
const url = `${API_BASE_URL}/cli?access_token=${access_token}&refresh_token=${refresh_token}`;
|
|
48
|
-
if (process.env.NODE_ENV === 'development') {
|
|
49
|
-
console.log('url:', url);
|
|
50
|
-
console.log('access_token:', access_token);
|
|
51
|
-
console.log('refresh_token:', refresh_token);
|
|
52
|
-
}
|
|
53
|
-
open(url);
|
|
54
|
-
const spinner = ora({ text: "Waiting for you to authenticate in the browser..." });
|
|
55
|
-
spinner.start();
|
|
56
|
-
const failed = !(await new Promise((resolve, reject) => {
|
|
57
|
-
const subscription = supabase.channel(user.id)
|
|
58
|
-
.on('broadcast', { event: 'session-created' }, (_payload) => {
|
|
59
|
-
subscription.unsubscribe();
|
|
60
|
-
resolve(true);
|
|
61
|
-
})
|
|
62
|
-
.subscribe((_status, err) => {
|
|
63
|
-
if (err) {
|
|
64
|
-
try {
|
|
65
|
-
subscription.unsubscribe();
|
|
66
|
-
}
|
|
67
|
-
catch (_err) { }
|
|
68
|
-
reject(err);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}));
|
|
72
|
-
spinner.stopAndPersist({ text: "Done" });
|
|
73
|
-
if (failed) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
77
|
-
};
|
package/build/cli/src/net.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createClient } from '@supabase/supabase-js';
|
|
2
|
-
import { localStorage } from './utils/local-storage.js';
|
|
3
|
-
export const API_BASE_URL = process.env.NODE_ENV === 'development'
|
|
4
|
-
? 'http://localhost:3000'
|
|
5
|
-
: 'https://nativewindui.com';
|
|
6
|
-
export const supabase = createClient('https://nqtyhmiojvtleupkdelg.supabase.co', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xdHlobWlvanZ0bGV1cGtkZWxnIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTU5MDc2MDIsImV4cCI6MjAzMTQ4MzYwMn0.7tRFhmjngUKXQxiNKPPWfsjWrUB515PHtQzBSM-vN88', {
|
|
7
|
-
'auth': {
|
|
8
|
-
'autoRefreshToken': true,
|
|
9
|
-
'persistSession': true,
|
|
10
|
-
'storage': localStorage('anon-user'),
|
|
11
|
-
},
|
|
12
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/cli/src/prompts.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { ConfirmPrompt, isCancel, SelectPrompt, TextPrompt } from "@clack/core";
|
|
2
|
-
import isUnicodeSupported from "is-unicode-supported";
|
|
3
|
-
import color from "picocolors";
|
|
4
|
-
export { isCancel } from "@clack/core";
|
|
5
|
-
const unicode = isUnicodeSupported();
|
|
6
|
-
const s = (c, fallback) => (unicode ? c : fallback);
|
|
7
|
-
const S_RADIO_ACTIVE = s("●", ">");
|
|
8
|
-
const S_RADIO_INACTIVE = s("○", " ");
|
|
9
|
-
export const text = (opts) => {
|
|
10
|
-
return new TextPrompt({
|
|
11
|
-
validate: opts.validate,
|
|
12
|
-
placeholder: opts.placeholder,
|
|
13
|
-
defaultValue: opts.defaultValue,
|
|
14
|
-
initialValue: opts.initialValue,
|
|
15
|
-
render() {
|
|
16
|
-
const title = `${opts.message} \n ${"\u279C"}`;
|
|
17
|
-
const placeholder = opts.placeholder
|
|
18
|
-
? color.inverse(opts.placeholder[0]) +
|
|
19
|
-
color.dim(opts.placeholder.slice(1))
|
|
20
|
-
: color.inverse(color.hidden("_"));
|
|
21
|
-
const value = !this.value ? placeholder : this.valueWithCursor;
|
|
22
|
-
switch (this.state) {
|
|
23
|
-
case "error":
|
|
24
|
-
return `${title.trim()} ${value}\n ${color.yellow(this.error)}\n`;
|
|
25
|
-
case "submit":
|
|
26
|
-
return `${title} ${color.dim(value || opts.placeholder)}`;
|
|
27
|
-
case "cancel":
|
|
28
|
-
return `${title} ${color.strikethrough(color.dim(value ?? ""))}${value?.trim() ? "\n" : ""}`;
|
|
29
|
-
default:
|
|
30
|
-
return `${title} ${value}`;
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
}).prompt();
|
|
34
|
-
};
|
|
35
|
-
export const confirm = (opts) => {
|
|
36
|
-
const active = opts.active ?? "Yes";
|
|
37
|
-
const inactive = opts.inactive ?? "No";
|
|
38
|
-
return new ConfirmPrompt({
|
|
39
|
-
active,
|
|
40
|
-
inactive,
|
|
41
|
-
initialValue: opts.initialValue ?? true,
|
|
42
|
-
render() {
|
|
43
|
-
const title = `${opts.message}\n`;
|
|
44
|
-
const value = this.value ? active : inactive;
|
|
45
|
-
switch (this.state) {
|
|
46
|
-
case "submit":
|
|
47
|
-
return `${title} ${color.dim(value)}\n`;
|
|
48
|
-
case "cancel":
|
|
49
|
-
return `${title} ${color.strikethrough(color.dim(value))}\n`;
|
|
50
|
-
default: {
|
|
51
|
-
return `${title} ${this.value ? `${active}` : `${color.dim(active)}`} ${color.dim("/")} ${!this.value ? `${inactive}` : `${color.dim(inactive)}`}\n`;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
}).prompt();
|
|
56
|
-
};
|
|
57
|
-
export const select = (opts) => {
|
|
58
|
-
const opt = (option, state) => {
|
|
59
|
-
const label = option.label ?? String(option.value);
|
|
60
|
-
if (state === "active") {
|
|
61
|
-
return `${color.green(S_RADIO_ACTIVE)} ${label} ${option.hint ? color.dim(`(${option.hint})`) : ""}`;
|
|
62
|
-
}
|
|
63
|
-
else if (state === "selected") {
|
|
64
|
-
return `${color.dim(label)}`;
|
|
65
|
-
}
|
|
66
|
-
else if (state === "cancelled") {
|
|
67
|
-
return `${color.strikethrough(color.dim(label))}`;
|
|
68
|
-
}
|
|
69
|
-
return `${color.dim(S_RADIO_INACTIVE)} ${color.dim(label)}`;
|
|
70
|
-
};
|
|
71
|
-
return new SelectPrompt({
|
|
72
|
-
options: opts.options,
|
|
73
|
-
initialValue: opts.initialValue,
|
|
74
|
-
render() {
|
|
75
|
-
const title = `\n${opts.message}\n`;
|
|
76
|
-
switch (this.state) {
|
|
77
|
-
case "submit":
|
|
78
|
-
return `${title} ${opt(this.options[this.cursor], "selected")}`;
|
|
79
|
-
case "cancel":
|
|
80
|
-
return `${title} ${opt(this.options[this.cursor], "cancelled")}`;
|
|
81
|
-
default: {
|
|
82
|
-
return `${title} ${this.options
|
|
83
|
-
.map((option, i) => opt(option, i === this.cursor ? "active" : "inactive"))
|
|
84
|
-
.join(`\n`)}\n \n`;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
}).prompt();
|
|
89
|
-
};
|
|
90
|
-
export const cancel = (message = "") => {
|
|
91
|
-
process.stdout.write(`${color.bold(`${color.red(message)}`)}\n\n`);
|
|
92
|
-
};
|
|
93
|
-
export const intro = (title = "") => {
|
|
94
|
-
process.stdout.write(`${title}\n`);
|
|
95
|
-
};
|
|
96
|
-
export const outro = (message = "") => {
|
|
97
|
-
process.stdout.write(`${message}\n\n`);
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Define a group of prompts to be displayed and return a results of objects within the group
|
|
101
|
-
*/
|
|
102
|
-
export const group = async (prompts, opts) => {
|
|
103
|
-
const results = {}; //eslint-disable-line
|
|
104
|
-
const promptNames = Object.keys(prompts);
|
|
105
|
-
for (const name of promptNames) {
|
|
106
|
-
const prompt = prompts[name];
|
|
107
|
-
//eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
108
|
-
const result = await prompt({ results })?.catch((e) => {
|
|
109
|
-
throw e;
|
|
110
|
-
});
|
|
111
|
-
if (typeof opts?.onCancel === "function" && isCancel(result)) {
|
|
112
|
-
results[name] = "canceled"; //eslint-disable-line
|
|
113
|
-
opts.onCancel({ results }); //eslint-disable-line
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
results[name] = result; //eslint-disable-line
|
|
117
|
-
}
|
|
118
|
-
return results; //eslint-disable-line
|
|
119
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { LocalStorage } from 'node-localstorage';
|
|
5
|
-
const STORAGE_DIR = path.join(os.homedir(), '.nwui/');
|
|
6
|
-
try {
|
|
7
|
-
fs.readdirSync(STORAGE_DIR);
|
|
8
|
-
}
|
|
9
|
-
catch (err) {
|
|
10
|
-
if (typeof err == 'object' && err && 'code' in err && err.code === 'ENOENT') {
|
|
11
|
-
fs.mkdirSync(STORAGE_DIR);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
throw err;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export const localStorage = (storageName) => {
|
|
18
|
-
return new LocalStorage(path.join(STORAGE_DIR, storageName));
|
|
19
|
-
};
|