@teardown/cli 1.2.38 → 2.0.41
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/bin/teardown.js +11 -1
- package/package.json +77 -57
- package/src/cli/commands/init.ts +254 -0
- package/src/cli/commands/plugins.ts +93 -0
- package/src/cli/commands/prebuild.ts +168 -0
- package/src/cli/commands/run.ts +727 -0
- package/src/cli/commands/start.ts +87 -0
- package/src/cli/commands/validate.ts +62 -0
- package/src/cli/index.ts +59 -0
- package/src/config/index.ts +45 -0
- package/src/config/loader.ts +366 -0
- package/src/config/schema.ts +235 -0
- package/src/config/types.ts +322 -0
- package/src/index.ts +177 -0
- package/src/pipeline/cache.ts +179 -0
- package/src/pipeline/index.ts +10 -0
- package/src/pipeline/stages.ts +692 -0
- package/src/plugins/base.ts +370 -0
- package/src/plugins/capabilities/biometrics.ts +64 -0
- package/src/plugins/capabilities/bluetooth.ts +86 -0
- package/src/plugins/capabilities/calendar.ts +57 -0
- package/src/plugins/capabilities/camera.ts +77 -0
- package/src/plugins/capabilities/contacts.ts +57 -0
- package/src/plugins/capabilities/deep-linking.ts +124 -0
- package/src/plugins/capabilities/firebase.ts +138 -0
- package/src/plugins/capabilities/index.ts +96 -0
- package/src/plugins/capabilities/location.ts +87 -0
- package/src/plugins/capabilities/photo-library.ts +80 -0
- package/src/plugins/capabilities/push-notifications.ts +98 -0
- package/src/plugins/capabilities/sign-in-with-apple.ts +53 -0
- package/src/plugins/context.ts +220 -0
- package/src/plugins/index.ts +26 -0
- package/src/plugins/resolver.ts +321 -0
- package/src/templates/generator.ts +507 -0
- package/src/templates/index.ts +9 -0
- package/src/templates/paths.ts +25 -0
- package/src/transformers/android/gradle.ts +400 -0
- package/src/transformers/android/index.ts +19 -0
- package/src/transformers/android/manifest.ts +506 -0
- package/src/transformers/index.ts +39 -0
- package/src/transformers/ios/entitlements.ts +283 -0
- package/src/transformers/ios/index.ts +10 -0
- package/src/transformers/ios/pbxproj.ts +267 -0
- package/src/transformers/ios/plist.ts +198 -0
- package/src/utils/fs.ts +429 -0
- package/src/utils/index.ts +21 -0
- package/src/utils/logger.ts +203 -0
- package/templates/.gitignore +63 -0
- package/templates/Gemfile +3 -0
- package/templates/android/app/build.gradle.kts +97 -0
- package/templates/android/app/proguard-rules.pro +10 -0
- package/templates/android/app/src/main/AndroidManifest.xml +26 -0
- package/templates/android/app/src/main/java/com/appname/MainActivity.kt +22 -0
- package/templates/android/app/src/main/java/com/appname/MainApplication.kt +44 -0
- package/templates/android/app/src/main/res/values/strings.xml +3 -0
- package/templates/android/app/src/main/res/values/styles.xml +7 -0
- package/templates/android/build.gradle.kts +44 -0
- package/templates/android/gradle.properties +39 -0
- package/templates/android/settings.gradle.kts +12 -0
- package/templates/babel.config.js +15 -0
- package/templates/index.js +7 -0
- package/templates/ios/.xcode.env +11 -0
- package/templates/ios/AppName/AppDelegate.swift +25 -0
- package/templates/ios/AppName/AppName-Bridging-Header.h +4 -0
- package/templates/ios/AppName/AppName.entitlements +6 -0
- package/templates/ios/AppName/Images.xcassets/AppIcon.appiconset/Contents.json +35 -0
- package/templates/ios/AppName/Images.xcassets/Contents.json +6 -0
- package/templates/ios/AppName/Info.plist +49 -0
- package/templates/ios/AppName/LaunchScreen.storyboard +38 -0
- package/templates/ios/AppName.xcodeproj/project.pbxproj +402 -0
- package/templates/ios/AppName.xcodeproj/xcshareddata/xcschemes/AppName.xcscheme +78 -0
- package/templates/ios/Podfile +35 -0
- package/templates/metro.config.js +41 -0
- package/templates/package.json +57 -0
- package/templates/react-native.config.js +8 -0
- package/templates/src/app/index.tsx +34 -0
- package/templates/src/assets/fonts/.gitkeep +1 -0
- package/templates/src/assets/images/.gitkeep +1 -0
- package/templates/src/components/ui/accordion.tsx +114 -0
- package/templates/src/components/ui/avatar.tsx +75 -0
- package/templates/src/components/ui/button.tsx +93 -0
- package/templates/src/components/ui/card.tsx +120 -0
- package/templates/src/components/ui/checkbox.tsx +133 -0
- package/templates/src/components/ui/chip.tsx +95 -0
- package/templates/src/components/ui/dialog.tsx +134 -0
- package/templates/src/components/ui/divider.tsx +67 -0
- package/templates/src/components/ui/error-view.tsx +82 -0
- package/templates/src/components/ui/form-field.tsx +101 -0
- package/templates/src/components/ui/index.ts +100 -0
- package/templates/src/components/ui/popover.tsx +92 -0
- package/templates/src/components/ui/pressable-feedback.tsx +88 -0
- package/templates/src/components/ui/radio-group.tsx +153 -0
- package/templates/src/components/ui/scroll-shadow.tsx +108 -0
- package/templates/src/components/ui/select.tsx +165 -0
- package/templates/src/components/ui/skeleton-group.tsx +97 -0
- package/templates/src/components/ui/skeleton.tsx +87 -0
- package/templates/src/components/ui/spinner.tsx +87 -0
- package/templates/src/components/ui/surface.tsx +95 -0
- package/templates/src/components/ui/switch.tsx +124 -0
- package/templates/src/components/ui/tabs.tsx +154 -0
- package/templates/src/components/ui/text-field.tsx +106 -0
- package/templates/src/components/ui/toast.tsx +129 -0
- package/templates/src/contexts/.gitkeep +2 -0
- package/templates/src/core/clients/api/api.client.ts +113 -0
- package/templates/src/core/clients/api/index.ts +1 -0
- package/templates/src/core/clients/storage/index.ts +1 -0
- package/templates/src/core/clients/storage/storage.client.ts +121 -0
- package/templates/src/core/constants/index.ts +19 -0
- package/templates/src/core/core.ts +40 -0
- package/templates/src/core/index.ts +10 -0
- package/templates/src/global.css +87 -0
- package/templates/src/hooks/index.ts +6 -0
- package/templates/src/hooks/use-debounce.ts +23 -0
- package/templates/src/hooks/use-mounted.ts +21 -0
- package/templates/src/index.ts +28 -0
- package/templates/src/lib/index.ts +5 -0
- package/templates/src/lib/utils.ts +115 -0
- package/templates/src/modules/.gitkeep +6 -0
- package/templates/src/navigation/index.ts +8 -0
- package/templates/src/navigation/navigation-provider.tsx +36 -0
- package/templates/src/navigation/router.tsx +137 -0
- package/templates/src/providers/app.provider.tsx +29 -0
- package/templates/src/providers/index.ts +5 -0
- package/templates/src/routes/(tabs)/_layout.tsx +42 -0
- package/templates/src/routes/(tabs)/explore.tsx +161 -0
- package/templates/src/routes/(tabs)/home.tsx +138 -0
- package/templates/src/routes/(tabs)/profile.tsx +151 -0
- package/templates/src/routes/_layout.tsx +18 -0
- package/templates/src/routes/settings.tsx +194 -0
- package/templates/src/screens/auth/index.ts +6 -0
- package/templates/src/screens/auth/login.tsx +165 -0
- package/templates/src/screens/auth/register.tsx +203 -0
- package/templates/src/screens/home.tsx +204 -0
- package/templates/src/screens/index.ts +17 -0
- package/templates/src/screens/profile.tsx +210 -0
- package/templates/src/screens/settings.tsx +216 -0
- package/templates/src/screens/welcome.tsx +101 -0
- package/templates/src/styles/index.ts +103 -0
- package/templates/src/types/common.ts +71 -0
- package/templates/src/types/index.ts +5 -0
- package/templates/tsconfig.json +14 -0
- package/README.md +0 -15
- package/assets/favicon.ico +0 -0
- package/dist/commands/dev/dev.js +0 -55
- package/dist/commands/init/init-teardown.js +0 -26
- package/dist/index.js +0 -20
- package/dist/modules/dev/dev-menu/keyboard-handler.js +0 -138
- package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.js +0 -105
- package/dist/modules/dev/dev-server/cdp/cdp.adapter.js +0 -12
- package/dist/modules/dev/dev-server/cdp/index.js +0 -18
- package/dist/modules/dev/dev-server/cdp/types.js +0 -2
- package/dist/modules/dev/dev-server/dev-server-checker.js +0 -72
- package/dist/modules/dev/dev-server/dev-server.js +0 -269
- package/dist/modules/dev/dev-server/inspector/device.event-reporter.js +0 -165
- package/dist/modules/dev/dev-server/inspector/device.js +0 -577
- package/dist/modules/dev/dev-server/inspector/inspector.js +0 -204
- package/dist/modules/dev/dev-server/inspector/types.js +0 -2
- package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.js +0 -61
- package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.js +0 -64
- package/dist/modules/dev/dev-server/plugins/devtools.plugin.js +0 -50
- package/dist/modules/dev/dev-server/plugins/favicon.plugin.js +0 -19
- package/dist/modules/dev/dev-server/plugins/multipart.plugin.js +0 -62
- package/dist/modules/dev/dev-server/plugins/systrace.plugin.js +0 -28
- package/dist/modules/dev/dev-server/plugins/types.js +0 -2
- package/dist/modules/dev/dev-server/plugins/wss/index.js +0 -19
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.js +0 -66
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.js +0 -128
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.js +0 -75
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.js +0 -198
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.js +0 -120
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.js +0 -357
- package/dist/modules/dev/dev-server/plugins/wss/types.js +0 -2
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.js +0 -57
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.js +0 -26
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.js +0 -46
- package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.js +0 -55
- package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.js +0 -36
- package/dist/modules/dev/dev-server/sybmolicate/types.js +0 -2
- package/dist/modules/dev/terminal/base.terminal.reporter.js +0 -78
- package/dist/modules/dev/terminal/terminal.reporter.js +0 -76
- package/dist/modules/dev/types.js +0 -2
- package/dist/modules/dev/utils/log.js +0 -73
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Welcome Screen
|
|
3
|
+
*
|
|
4
|
+
* The landing/onboarding screen for the app.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { View, ScrollView, Image } from "react-native";
|
|
9
|
+
import { Text, Button, Card, CardContent } from "@/components/ui";
|
|
10
|
+
|
|
11
|
+
interface WelcomeScreenProps {
|
|
12
|
+
onGetStarted?: () => void;
|
|
13
|
+
onSignIn?: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function WelcomeScreen({ onGetStarted, onSignIn }: WelcomeScreenProps): React.JSX.Element {
|
|
17
|
+
return (
|
|
18
|
+
<ScrollView className="flex-1 bg-background" contentContainerClassName="flex-grow">
|
|
19
|
+
<View className="flex-1 px-6 py-12">
|
|
20
|
+
{/* Hero Section */}
|
|
21
|
+
<View className="flex-1 items-center justify-center gap-8">
|
|
22
|
+
{/* Logo/Icon Placeholder */}
|
|
23
|
+
<View className="h-24 w-24 items-center justify-center rounded-3xl bg-primary">
|
|
24
|
+
<Text className="text-4xl font-bold text-primary-foreground">T</Text>
|
|
25
|
+
</View>
|
|
26
|
+
|
|
27
|
+
{/* Welcome Text */}
|
|
28
|
+
<View className="items-center gap-4">
|
|
29
|
+
<Text variant="h1" className="text-center">
|
|
30
|
+
Welcome to <%= appName %>
|
|
31
|
+
</Text>
|
|
32
|
+
<Text variant="lead" className="text-center">
|
|
33
|
+
Build beautiful React Native apps with the power of Tailwind CSS
|
|
34
|
+
</Text>
|
|
35
|
+
</View>
|
|
36
|
+
|
|
37
|
+
{/* Feature Cards */}
|
|
38
|
+
<View className="w-full gap-4 mt-8">
|
|
39
|
+
<FeatureCard
|
|
40
|
+
icon="lightning"
|
|
41
|
+
title="Fast Development"
|
|
42
|
+
description="Build UIs rapidly with utility-first CSS classes"
|
|
43
|
+
/>
|
|
44
|
+
<FeatureCard
|
|
45
|
+
icon="palette"
|
|
46
|
+
title="Beautiful Design"
|
|
47
|
+
description="Pre-built components following modern design principles"
|
|
48
|
+
/>
|
|
49
|
+
<FeatureCard
|
|
50
|
+
icon="code"
|
|
51
|
+
title="Type-Safe"
|
|
52
|
+
description="Full TypeScript support for better DX"
|
|
53
|
+
/>
|
|
54
|
+
</View>
|
|
55
|
+
</View>
|
|
56
|
+
|
|
57
|
+
{/* Action Buttons */}
|
|
58
|
+
<View className="gap-4 mt-12">
|
|
59
|
+
<Button size="lg" fullWidth onPress={onGetStarted}>
|
|
60
|
+
Get Started
|
|
61
|
+
</Button>
|
|
62
|
+
<Button variant="outline" size="lg" fullWidth onPress={onSignIn}>
|
|
63
|
+
I already have an account
|
|
64
|
+
</Button>
|
|
65
|
+
</View>
|
|
66
|
+
</View>
|
|
67
|
+
</ScrollView>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface FeatureCardProps {
|
|
72
|
+
icon: "lightning" | "palette" | "code";
|
|
73
|
+
title: string;
|
|
74
|
+
description: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function FeatureCard({ icon, title, description }: FeatureCardProps): React.JSX.Element {
|
|
78
|
+
const iconMap = {
|
|
79
|
+
lightning: "bolt.fill",
|
|
80
|
+
palette: "paintpalette.fill",
|
|
81
|
+
code: "chevron.left.forwardslash.chevron.right",
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Card>
|
|
86
|
+
<CardContent className="flex-row items-center gap-4 py-4">
|
|
87
|
+
<View className="h-12 w-12 items-center justify-center rounded-xl bg-primary/10">
|
|
88
|
+
<Text className="text-2xl text-primary">
|
|
89
|
+
{icon === "lightning" ? "⚡" : icon === "palette" ? "🎨" : "⌨️"}
|
|
90
|
+
</Text>
|
|
91
|
+
</View>
|
|
92
|
+
<View className="flex-1">
|
|
93
|
+
<Text variant="large">{title}</Text>
|
|
94
|
+
<Text variant="muted">{description}</Text>
|
|
95
|
+
</View>
|
|
96
|
+
</CardContent>
|
|
97
|
+
</Card>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default WelcomeScreen;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global Style Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared style constants and utilities.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const colors = {
|
|
8
|
+
// Primary
|
|
9
|
+
primary: "#007AFF",
|
|
10
|
+
primaryDark: "#0056B3",
|
|
11
|
+
primaryLight: "#4DA3FF",
|
|
12
|
+
|
|
13
|
+
// Neutral
|
|
14
|
+
white: "#FFFFFF",
|
|
15
|
+
black: "#000000",
|
|
16
|
+
gray50: "#FAFAFA",
|
|
17
|
+
gray100: "#F5F5F5",
|
|
18
|
+
gray200: "#EEEEEE",
|
|
19
|
+
gray300: "#E0E0E0",
|
|
20
|
+
gray400: "#BDBDBD",
|
|
21
|
+
gray500: "#9E9E9E",
|
|
22
|
+
gray600: "#757575",
|
|
23
|
+
gray700: "#616161",
|
|
24
|
+
gray800: "#424242",
|
|
25
|
+
gray900: "#212121",
|
|
26
|
+
|
|
27
|
+
// Semantic
|
|
28
|
+
success: "#34C759",
|
|
29
|
+
warning: "#FF9500",
|
|
30
|
+
error: "#FF3B30",
|
|
31
|
+
info: "#5856D6",
|
|
32
|
+
|
|
33
|
+
// Background
|
|
34
|
+
background: "#FFFFFF",
|
|
35
|
+
backgroundSecondary: "#F2F2F7",
|
|
36
|
+
|
|
37
|
+
// Text
|
|
38
|
+
text: "#1A1A1A",
|
|
39
|
+
textSecondary: "#666666",
|
|
40
|
+
textTertiary: "#999999",
|
|
41
|
+
|
|
42
|
+
// Border
|
|
43
|
+
border: "#E5E5EA",
|
|
44
|
+
borderDark: "#C7C7CC",
|
|
45
|
+
} as const;
|
|
46
|
+
|
|
47
|
+
export const spacing = {
|
|
48
|
+
xs: 4,
|
|
49
|
+
sm: 8,
|
|
50
|
+
md: 16,
|
|
51
|
+
lg: 24,
|
|
52
|
+
xl: 32,
|
|
53
|
+
xxl: 48,
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
export const borderRadius = {
|
|
57
|
+
sm: 4,
|
|
58
|
+
md: 8,
|
|
59
|
+
lg: 12,
|
|
60
|
+
xl: 16,
|
|
61
|
+
full: 9999,
|
|
62
|
+
} as const;
|
|
63
|
+
|
|
64
|
+
export const fontSize = {
|
|
65
|
+
xs: 12,
|
|
66
|
+
sm: 14,
|
|
67
|
+
md: 16,
|
|
68
|
+
lg: 18,
|
|
69
|
+
xl: 20,
|
|
70
|
+
xxl: 24,
|
|
71
|
+
xxxl: 32,
|
|
72
|
+
} as const;
|
|
73
|
+
|
|
74
|
+
export const fontWeight = {
|
|
75
|
+
normal: "400" as const,
|
|
76
|
+
medium: "500" as const,
|
|
77
|
+
semibold: "600" as const,
|
|
78
|
+
bold: "700" as const,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const shadow = {
|
|
82
|
+
sm: {
|
|
83
|
+
shadowColor: "#000",
|
|
84
|
+
shadowOffset: { width: 0, height: 1 },
|
|
85
|
+
shadowOpacity: 0.05,
|
|
86
|
+
shadowRadius: 2,
|
|
87
|
+
elevation: 1,
|
|
88
|
+
},
|
|
89
|
+
md: {
|
|
90
|
+
shadowColor: "#000",
|
|
91
|
+
shadowOffset: { width: 0, height: 2 },
|
|
92
|
+
shadowOpacity: 0.1,
|
|
93
|
+
shadowRadius: 4,
|
|
94
|
+
elevation: 3,
|
|
95
|
+
},
|
|
96
|
+
lg: {
|
|
97
|
+
shadowColor: "#000",
|
|
98
|
+
shadowOffset: { width: 0, height: 4 },
|
|
99
|
+
shadowOpacity: 0.15,
|
|
100
|
+
shadowRadius: 8,
|
|
101
|
+
elevation: 5,
|
|
102
|
+
},
|
|
103
|
+
} as const;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common Types
|
|
3
|
+
*
|
|
4
|
+
* Shared utility types used across the application.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* API Response wrapper type
|
|
9
|
+
*/
|
|
10
|
+
export type ApiResponse<T> =
|
|
11
|
+
| { success: true; data: T; status: number }
|
|
12
|
+
| { success: false; error: string; status: number };
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Request configuration
|
|
16
|
+
*/
|
|
17
|
+
export interface RequestConfig {
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Pagination parameters
|
|
24
|
+
*/
|
|
25
|
+
export interface PaginationParams {
|
|
26
|
+
page: number;
|
|
27
|
+
limit: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Paginated response
|
|
32
|
+
*/
|
|
33
|
+
export interface PaginatedResponse<T> {
|
|
34
|
+
items: T[];
|
|
35
|
+
total: number;
|
|
36
|
+
page: number;
|
|
37
|
+
limit: number;
|
|
38
|
+
hasMore: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Loading state
|
|
43
|
+
*/
|
|
44
|
+
export type LoadingState = "idle" | "loading" | "success" | "error";
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Make all properties optional recursively
|
|
48
|
+
*/
|
|
49
|
+
export type DeepPartial<T> = {
|
|
50
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Extract the resolved type from a Promise
|
|
55
|
+
*/
|
|
56
|
+
export type Awaited<T> = T extends Promise<infer U> ? U : T;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Make specific keys required
|
|
60
|
+
*/
|
|
61
|
+
export type RequireKeys<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Nullable type helper
|
|
65
|
+
*/
|
|
66
|
+
export type Nullable<T> = T | null;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Maybe type helper (nullable and undefined)
|
|
70
|
+
*/
|
|
71
|
+
export type Maybe<T> = T | null | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@react-native/typescript-config/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"strict": true,
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@/*": ["./src/*"],
|
|
8
|
+
"@teardown/navigation": ["./node_modules/@teardown/navigation/src/index.ts"],
|
|
9
|
+
"@teardown/navigation/*": ["./node_modules/@teardown/navigation/src/*/index.ts"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*", ".teardown/**/*"],
|
|
13
|
+
"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
|
|
14
|
+
}
|
package/README.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# @teardown/cli
|
|
2
|
-
|
|
3
|
-
To install dependencies:
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
bun install
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
To run:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
bun run index.ts
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
This project was created using `bun init` in bun v1.1.18. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
package/assets/favicon.ico
DELETED
|
Binary file
|
package/dist/commands/dev/dev.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DevServerCommand = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const commander_1 = require("commander");
|
|
9
|
-
const dev_server_1 = require("../../modules/dev/dev-server/dev-server");
|
|
10
|
-
class DevServerCommand {
|
|
11
|
-
createCommand() {
|
|
12
|
-
const command = new commander_1.Command("dev")
|
|
13
|
-
.description("Start the development server")
|
|
14
|
-
.option("-p, --port <number>", "Port to start the server on", "8081")
|
|
15
|
-
.option("-h, --host <string>", "Host to listen on", "127.0.0.1")
|
|
16
|
-
.option("--project-root <path>", "Path to project root", process.cwd())
|
|
17
|
-
.option("--watch-folders <list>", "Specify additional folders to watch", (val) => val.split(",").map((folder) => node_path_1.default.resolve(folder)))
|
|
18
|
-
.option("--asset-plugins <list>", "Specify additional asset plugins", (val) => val.split(","))
|
|
19
|
-
.option("--source-exts <list>", "Specify additional source extensions", (val) => val.split(","))
|
|
20
|
-
.option("--max-workers <number>", "Maximum number of workers for transformation", (val) => Number(val))
|
|
21
|
-
.option("--transformer <string>", "Specify a custom transformer")
|
|
22
|
-
.option("--entry-file <path>", "Path to entry file", "index.js")
|
|
23
|
-
.option("--reset-cache", "Reset the metro cache", false)
|
|
24
|
-
.option("--https", "Enable HTTPS connections")
|
|
25
|
-
.option("--key <path>", "Path to SSL key")
|
|
26
|
-
.option("--cert <path>", "Path to SSL certificate")
|
|
27
|
-
.option("--config <path>", "Path to config file", (val) => node_path_1.default.resolve(val))
|
|
28
|
-
.option("--no-interactive", "Disable interactive mode");
|
|
29
|
-
command.action(this.action);
|
|
30
|
-
return command;
|
|
31
|
-
}
|
|
32
|
-
async action(options) {
|
|
33
|
-
try {
|
|
34
|
-
const server = new dev_server_1.DevServer({
|
|
35
|
-
projectRoot: options.projectRoot,
|
|
36
|
-
host: options.host,
|
|
37
|
-
port: options.port,
|
|
38
|
-
logRequests: true,
|
|
39
|
-
https: options.https
|
|
40
|
-
? {
|
|
41
|
-
key: options.key ?? "",
|
|
42
|
-
cert: options.cert ?? "",
|
|
43
|
-
}
|
|
44
|
-
: undefined,
|
|
45
|
-
});
|
|
46
|
-
await server.initialize();
|
|
47
|
-
await server.start();
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
console.error("Failed to start development server:", error);
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.DevServerCommand = DevServerCommand;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InitTeardown = void 0;
|
|
4
|
-
const bun_1 = require("bun");
|
|
5
|
-
class InitTeardown {
|
|
6
|
-
options;
|
|
7
|
-
constructor(options) {
|
|
8
|
-
this.options = options;
|
|
9
|
-
}
|
|
10
|
-
async init() {
|
|
11
|
-
console.log("Initializing Teardown...");
|
|
12
|
-
const projectLocation = await this.getProjectLocation();
|
|
13
|
-
console.log(projectLocation);
|
|
14
|
-
}
|
|
15
|
-
async getProjectLocation() {
|
|
16
|
-
try {
|
|
17
|
-
const projectLocation = await (0, bun_1.$) `pwd`;
|
|
18
|
-
return projectLocation.text().trim();
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
console.error("Error getting project location:", error);
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.InitTeardown = InitTeardown;
|
package/dist/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const commander_1 = require("commander");
|
|
4
|
-
const dev_1 = require("./commands/dev/dev");
|
|
5
|
-
const program = new commander_1.Command();
|
|
6
|
-
program
|
|
7
|
-
.name("Teardown CLI")
|
|
8
|
-
.description("CLI to use the Teardown")
|
|
9
|
-
.version("0.0.1");
|
|
10
|
-
// program
|
|
11
|
-
// .command("init")
|
|
12
|
-
// .description("Initialize Teardown in the current project")
|
|
13
|
-
// .action(async () => {
|
|
14
|
-
// const project = await import("./commands/init/init-teardown");
|
|
15
|
-
// await new project.InitTeardown({
|
|
16
|
-
// projectName: "example ",
|
|
17
|
-
// }).init();
|
|
18
|
-
// });
|
|
19
|
-
program.addCommand(new dev_1.DevServerCommand().createCommand());
|
|
20
|
-
program.parse();
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.KeyboardHandlerManager = void 0;
|
|
7
|
-
const node_readline_1 = __importDefault(require("node:readline"));
|
|
8
|
-
const node_tty_1 = require("node:tty");
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const open_debugger_keyboard_handler_1 = __importDefault(require("./open-debugger-keyboard-handler"));
|
|
12
|
-
class KeyboardHandlerManager {
|
|
13
|
-
devServer;
|
|
14
|
-
static CTRL_C = "\u0003";
|
|
15
|
-
static CTRL_D = "\u0004";
|
|
16
|
-
static RELOAD_TIMEOUT = 500;
|
|
17
|
-
openDebuggerKeyboardHandler;
|
|
18
|
-
previousCallTimestamp = 0;
|
|
19
|
-
constructor(devServer) {
|
|
20
|
-
this.devServer = devServer;
|
|
21
|
-
this.openDebuggerKeyboardHandler = new open_debugger_keyboard_handler_1.default({
|
|
22
|
-
reporter: this.devServer.terminalReporter,
|
|
23
|
-
devServerUrl: this.devServer.getDevServerUrl(),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async initialize() {
|
|
27
|
-
if (!this.isTTYSupported()) {
|
|
28
|
-
this.devServer.terminalReporter.update({
|
|
29
|
-
type: "client_log",
|
|
30
|
-
level: "info",
|
|
31
|
-
data: ["Interactive mode is not supported in this environment"],
|
|
32
|
-
});
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
this.setupKeyboardHandlers();
|
|
36
|
-
this.printAvailableCommands();
|
|
37
|
-
}
|
|
38
|
-
isTTYSupported() {
|
|
39
|
-
return process.stdin.isTTY === true;
|
|
40
|
-
}
|
|
41
|
-
setupKeyboardHandlers() {
|
|
42
|
-
node_readline_1.default.emitKeypressEvents(process.stdin);
|
|
43
|
-
this.setRawMode(true);
|
|
44
|
-
process.stdin.on("keypress", (str, key) => {
|
|
45
|
-
this.handleKeyPress(key);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
handleKeyPress(key) {
|
|
49
|
-
if (this.openDebuggerKeyboardHandler.maybeHandleTargetSelection(key.name)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
switch (key.sequence) {
|
|
53
|
-
case "r":
|
|
54
|
-
this.handleReload();
|
|
55
|
-
break;
|
|
56
|
-
case "d":
|
|
57
|
-
this.handleDevMenu();
|
|
58
|
-
break;
|
|
59
|
-
case "j":
|
|
60
|
-
void this.handleOpenDebugger();
|
|
61
|
-
break;
|
|
62
|
-
case KeyboardHandlerManager.CTRL_C:
|
|
63
|
-
case KeyboardHandlerManager.CTRL_D:
|
|
64
|
-
this.handleExit();
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
handleReload() {
|
|
69
|
-
const currentCallTimestamp = new Date().getTime();
|
|
70
|
-
if (currentCallTimestamp - this.previousCallTimestamp >
|
|
71
|
-
KeyboardHandlerManager.RELOAD_TIMEOUT) {
|
|
72
|
-
this.previousCallTimestamp = currentCallTimestamp;
|
|
73
|
-
this.devServer.terminalReporter.update({
|
|
74
|
-
type: "client_log",
|
|
75
|
-
level: "info",
|
|
76
|
-
data: ["Reloading connected app(s)..."],
|
|
77
|
-
});
|
|
78
|
-
this.devServer.messageServer.broadcast("reload");
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
handleDevMenu() {
|
|
82
|
-
this.devServer.terminalReporter.update({
|
|
83
|
-
type: "client_log",
|
|
84
|
-
level: "info",
|
|
85
|
-
data: ["Opening Dev Menu..."],
|
|
86
|
-
});
|
|
87
|
-
this.devServer.messageServer.broadcast("devMenu");
|
|
88
|
-
}
|
|
89
|
-
async handleOpenDebugger() {
|
|
90
|
-
await this.openDebuggerKeyboardHandler.handleOpenDebugger();
|
|
91
|
-
}
|
|
92
|
-
handleExit() {
|
|
93
|
-
this.openDebuggerKeyboardHandler.dismiss();
|
|
94
|
-
this.devServer.terminalReporter.update({
|
|
95
|
-
type: "client_log",
|
|
96
|
-
level: "info",
|
|
97
|
-
data: ["Stopping server"],
|
|
98
|
-
});
|
|
99
|
-
this.setRawMode(false);
|
|
100
|
-
process.stdin.pause();
|
|
101
|
-
process.emit("SIGINT");
|
|
102
|
-
process.exit();
|
|
103
|
-
}
|
|
104
|
-
isRawModeSupported() {
|
|
105
|
-
return process.stdin instanceof node_tty_1.ReadStream;
|
|
106
|
-
}
|
|
107
|
-
setRawMode(enable) {
|
|
108
|
-
if (!this.isRawModeSupported()) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
process.stdin.setRawMode(enable);
|
|
112
|
-
}
|
|
113
|
-
printAvailableCommands() {
|
|
114
|
-
if (!this.isRawModeSupported()) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this.devServer.terminalReporter.update({
|
|
118
|
-
type: "client_log",
|
|
119
|
-
level: "info",
|
|
120
|
-
data: [
|
|
121
|
-
"Key commands available:",
|
|
122
|
-
"\n",
|
|
123
|
-
"\n",
|
|
124
|
-
`${chalk_1.default.bold.inverse(" r ")} - reload app(s)`,
|
|
125
|
-
"\n",
|
|
126
|
-
`${chalk_1.default.bold.inverse(" d ")} - open Dev Menu`,
|
|
127
|
-
// "\n",
|
|
128
|
-
// `${chalk.bold.inverse(" j ")} - open DevTools`,
|
|
129
|
-
],
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.KeyboardHandlerManager = KeyboardHandlerManager;
|
|
134
|
-
const invariant = (condition, message) => {
|
|
135
|
-
if (!condition) {
|
|
136
|
-
throw new Error(message);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const open_1 = __importDefault(require("open"));
|
|
9
|
-
class OpenDebuggerKeyboardHandler {
|
|
10
|
-
reporter;
|
|
11
|
-
devServerUrl;
|
|
12
|
-
isTargetSelectionActive = false;
|
|
13
|
-
targets = [];
|
|
14
|
-
constructor(config) {
|
|
15
|
-
this.reporter = config.reporter;
|
|
16
|
-
this.devServerUrl = config.devServerUrl;
|
|
17
|
-
}
|
|
18
|
-
async handleOpenDebugger() {
|
|
19
|
-
try {
|
|
20
|
-
const response = await fetch(`${this.devServerUrl}/json`);
|
|
21
|
-
const pages = await response.json();
|
|
22
|
-
this.targets = pages.map((page) => ({
|
|
23
|
-
name: page.title,
|
|
24
|
-
url: page.devtoolsFrontendUrl,
|
|
25
|
-
}));
|
|
26
|
-
if (this.targets.length === 0) {
|
|
27
|
-
this.reporter.update({
|
|
28
|
-
type: "client_log",
|
|
29
|
-
level: "info",
|
|
30
|
-
data: ["No available debugging targets"],
|
|
31
|
-
});
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (this.targets.length === 1) {
|
|
35
|
-
await this.openTarget(this.targets[0]);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
this.showTargetSelection();
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
this.reporter.update({
|
|
42
|
-
type: "client_log",
|
|
43
|
-
level: "warn",
|
|
44
|
-
data: [
|
|
45
|
-
`Failed to open debugger: ${error instanceof Error ? error.message : String(error)}`,
|
|
46
|
-
],
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
maybeHandleTargetSelection(key) {
|
|
51
|
-
if (!this.isTargetSelectionActive) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
const targetIndex = Number.parseInt(key, 10) - 1;
|
|
55
|
-
if (targetIndex >= 0 && targetIndex < this.targets.length) {
|
|
56
|
-
void this.openTarget(this.targets[targetIndex]);
|
|
57
|
-
this.dismiss();
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
if (key === "escape") {
|
|
61
|
-
this.dismiss();
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
dismiss() {
|
|
67
|
-
this.isTargetSelectionActive = false;
|
|
68
|
-
this.targets = [];
|
|
69
|
-
}
|
|
70
|
-
async openTarget(target) {
|
|
71
|
-
try {
|
|
72
|
-
console.log("openTarget", target.url);
|
|
73
|
-
await (0, open_1.default)(target.url);
|
|
74
|
-
this.reporter.update({
|
|
75
|
-
type: "client_log",
|
|
76
|
-
level: "info",
|
|
77
|
-
data: [`Opening debugger for: ${target.name}`],
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
this.reporter.update({
|
|
82
|
-
type: "client_log",
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
level: "error",
|
|
85
|
-
data: [
|
|
86
|
-
`Failed to open debugger: ${error instanceof Error ? error.message : String(error)}`,
|
|
87
|
-
],
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
showTargetSelection() {
|
|
92
|
-
this.isTargetSelectionActive = true;
|
|
93
|
-
const targetList = this.targets
|
|
94
|
-
.map((target, i) => ` ${chalk_1.default.bold.inverse(` ${i + 1} `)} ${target.name}`)
|
|
95
|
-
.join("\n");
|
|
96
|
-
this.reporter.update({
|
|
97
|
-
type: "client_log",
|
|
98
|
-
level: "info",
|
|
99
|
-
data: [
|
|
100
|
-
`Select a target to debug:\n${targetList}\n\n ${chalk_1.default.bold.inverse(" ESC ")} to cancel\n`,
|
|
101
|
-
],
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.default = OpenDebuggerKeyboardHandler;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CDPAdapter = void 0;
|
|
4
|
-
// import type { DevServer } from "devtools-protocol";
|
|
5
|
-
class CDPAdapter {
|
|
6
|
-
instance;
|
|
7
|
-
constructor(instance) {
|
|
8
|
-
this.instance = instance;
|
|
9
|
-
}
|
|
10
|
-
enable() { }
|
|
11
|
-
}
|
|
12
|
-
exports.CDPAdapter = CDPAdapter;
|