@snap/valdi 1.0.7 → 1.0.8

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 (160) hide show
  1. package/README.md +12 -3
  2. package/bundled-skills/CONTRIBUTING_SKILLS.md +74 -0
  3. package/bundled-skills/registry.json +20 -0
  4. package/bundled-skills/skills/valdi-android/skill.md +89 -0
  5. package/bundled-skills/skills/valdi-async/skill.md +246 -0
  6. package/bundled-skills/skills/valdi-async/tests/BUILD.bazel +19 -0
  7. package/bundled-skills/skills/valdi-async/tests/README.md +25 -0
  8. package/bundled-skills/skills/valdi-async/tests/src/reference.tsx +210 -0
  9. package/bundled-skills/skills/valdi-async/tests/tsconfig.json +1 -0
  10. package/bundled-skills/skills/valdi-bazel/skill.md +122 -0
  11. package/bundled-skills/skills/valdi-compiler/skill.md +108 -0
  12. package/bundled-skills/skills/valdi-component-tests/skill.md +430 -0
  13. package/bundled-skills/skills/valdi-component-tests/tests/BUILD.bazel +24 -0
  14. package/bundled-skills/skills/valdi-component-tests/tests/README.md +35 -0
  15. package/bundled-skills/skills/valdi-component-tests/tests/src/ProfileCard.tsx +38 -0
  16. package/bundled-skills/skills/valdi-component-tests/tests/test/ProfileCardTest.spec.tsx +107 -0
  17. package/bundled-skills/skills/valdi-component-tests/tests/tsconfig.json +1 -0
  18. package/bundled-skills/skills/valdi-cpp-runtime/skill.md +103 -0
  19. package/bundled-skills/skills/valdi-custom-view/skill.md +62 -0
  20. package/bundled-skills/skills/valdi-ios/skill.md +93 -0
  21. package/bundled-skills/skills/valdi-migrate/skill.md +175 -0
  22. package/bundled-skills/skills/valdi-migrate/tests/BUILD.bazel +23 -0
  23. package/bundled-skills/skills/valdi-migrate/tests/README.md +70 -0
  24. package/bundled-skills/skills/valdi-migrate/tests/check_antipatterns.py +89 -0
  25. package/bundled-skills/skills/valdi-migrate/tests/compose_example.kt +94 -0
  26. package/bundled-skills/skills/valdi-migrate/tests/flutter_example.dart +129 -0
  27. package/bundled-skills/skills/valdi-migrate/tests/react_example.tsx +98 -0
  28. package/bundled-skills/skills/valdi-migrate/tests/src/expected_valdi.tsx +267 -0
  29. package/bundled-skills/skills/valdi-migrate/tests/tsconfig.json +3 -0
  30. package/bundled-skills/skills/valdi-overview/skill.md +63 -0
  31. package/bundled-skills/skills/valdi-perf/skill.md +197 -0
  32. package/bundled-skills/skills/valdi-perf/tests/BUILD.bazel +19 -0
  33. package/bundled-skills/skills/valdi-perf/tests/README.md +26 -0
  34. package/bundled-skills/skills/valdi-perf/tests/src/reference.tsx +202 -0
  35. package/bundled-skills/skills/valdi-perf/tests/tsconfig.json +1 -0
  36. package/bundled-skills/skills/valdi-polyglot-module/skill.md +85 -0
  37. package/bundled-skills/skills/valdi-setup/skill.md +129 -0
  38. package/bundled-skills/skills/valdi-testing/skill.md +65 -0
  39. package/bundled-skills/skills/valdi-tsx/skill.md +385 -0
  40. package/bundled-skills/skills/valdi-tsx/tests/BUILD.bazel +19 -0
  41. package/bundled-skills/skills/valdi-tsx/tests/README.md +29 -0
  42. package/bundled-skills/skills/valdi-tsx/tests/src/reference.tsx +173 -0
  43. package/bundled-skills/skills/valdi-tsx/tests/tsconfig.json +1 -0
  44. package/dist/commands/bootstrap.js +0 -7
  45. package/dist/commands/newModule.js +10 -14
  46. package/dist/commands/skills.js +16 -0
  47. package/dist/commands/skills_commands/create.js +125 -0
  48. package/dist/commands/skills_commands/install.js +96 -0
  49. package/dist/commands/skills_commands/list.js +83 -0
  50. package/dist/commands/skills_commands/remove.js +41 -0
  51. package/dist/commands/skills_commands/update.js +59 -0
  52. package/dist/core/constants.js +0 -1
  53. package/dist/setup/versions.js +1 -1
  54. package/dist/utils/skillsAdapters.js +140 -0
  55. package/dist/utils/skillsRegistry.js +40 -0
  56. package/package.json +6 -1
  57. package/.bazelignore +0 -2
  58. package/.bootstrap/apps/cli_application/BUILD.bazel.template +0 -7
  59. package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +0 -11
  60. package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/src/index.ts +0 -1
  61. package/.bootstrap/apps/ui_application/.eslint.rc +0 -27
  62. package/.bootstrap/apps/ui_application/BUILD.bazel.template +0 -19
  63. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +0 -21
  64. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/res/valdi@3x.png +0 -0
  65. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/src/App.tsx +0 -133
  66. package/.bootstrap/apps/ui_application/package.json +0 -24
  67. package/.bootstrap/modules/cpp_bridge_module/BUILD.bazel.template +0 -21
  68. package/.bootstrap/modules/cpp_bridge_module/cpp/CalculatorModuleFactory.cpp.template +0 -28
  69. package/.bootstrap/modules/cpp_bridge_module/src/Calculator.d.ts +0 -4
  70. package/.bootstrap/modules/ios_android_bridge_module/BUILD.bazel.template +0 -39
  71. package/.bootstrap/modules/ios_android_bridge_module/android/CalculatorModuleFactory.kt.template +0 -18
  72. package/.bootstrap/modules/ios_android_bridge_module/ios/SCCCalculatorModuleFactory.m.template +0 -31
  73. package/.bootstrap/modules/ios_android_bridge_module/src/Calculator.d.ts +0 -4
  74. package/.bootstrap/modules/ios_android_view_module/BUILD.bazel.template +0 -41
  75. package/.bootstrap/modules/ios_android_view_module/android/CircleView.kt.template +0 -42
  76. package/.bootstrap/modules/ios_android_view_module/android/CircleViewAttributesBinder.kt.template +0 -60
  77. package/.bootstrap/modules/ios_android_view_module/ios/SCCCircleView.h +0 -6
  78. package/.bootstrap/modules/ios_android_view_module/ios/SCCCircleView.m +0 -82
  79. package/.bootstrap/modules/ios_android_view_module/src/Circle.tsx.template +0 -15
  80. package/.bootstrap/modules/ui_component/BUILD.bazel.template +0 -34
  81. package/.bootstrap/modules/ui_component/src/NewModuleComponent.tsx +0 -45
  82. package/.config/copyconfig.json +0 -10
  83. package/.editorconfig +0 -21
  84. package/.eslintignore +0 -1
  85. package/.eslintrc.js +0 -72
  86. package/.github/README.md +0 -164
  87. package/.metadata/.bazelrc.template +0 -91
  88. package/.metadata/.bazelversion.template +0 -1
  89. package/.metadata/.cursorrules.template +0 -60
  90. package/.metadata/.editorconfig.template +0 -37
  91. package/.metadata/.eslintrc.js.template +0 -27
  92. package/.metadata/.gitignore.template +0 -4
  93. package/.metadata/.prettierrc.json.template +0 -7
  94. package/.metadata/.watchmanconfig.template +0 -8
  95. package/.metadata/AGENTS.md.template +0 -282
  96. package/.metadata/README.md.template +0 -31
  97. package/.metadata/WORKSPACE.template +0 -57
  98. package/.metadata/config.yaml.template +0 -1
  99. package/.metadata/package.json.template +0 -23
  100. package/.prettierignore +0 -2
  101. package/.prettierrc.json +0 -7
  102. package/LINUX_COMPATIBILITY.md +0 -248
  103. package/prettier.config.js +0 -4
  104. package/scripts/sync-agents-md.sh +0 -44
  105. package/scripts/update-agents-templates.ts +0 -170
  106. package/spec/support/jasmine.json +0 -6
  107. package/src/commands/bootstrap.ts +0 -410
  108. package/src/commands/build.ts +0 -89
  109. package/src/commands/devSetup.ts +0 -17
  110. package/src/commands/doctor.ts +0 -1832
  111. package/src/commands/export.ts +0 -131
  112. package/src/commands/hotreload.ts +0 -108
  113. package/src/commands/install.ts +0 -93
  114. package/src/commands/lint.ts +0 -15
  115. package/src/commands/lint_commands/lintCheck.ts +0 -53
  116. package/src/commands/lint_commands/lintFormat.ts +0 -49
  117. package/src/commands/log.ts +0 -108
  118. package/src/commands/newModule.ts +0 -286
  119. package/src/commands/package.ts +0 -102
  120. package/src/commands/projectsync.ts +0 -488
  121. package/src/commands/test.ts +0 -68
  122. package/src/core/constants.ts +0 -98
  123. package/src/core/errors.ts +0 -10
  124. package/src/index.ts +0 -27
  125. package/src/setup/DevSetupHelper.ts +0 -290
  126. package/src/setup/linuxSetup.ts +0 -261
  127. package/src/setup/macOSSetup.ts +0 -156
  128. package/src/setup/setupEntryPoint.ts +0 -64
  129. package/src/setup/versions.ts +0 -8
  130. package/src/utils/ArgumentsResolver.ts +0 -23
  131. package/src/utils/BazelClient.ts +0 -285
  132. package/src/utils/Digraph.ts +0 -81
  133. package/src/utils/LoadingIndicator.ts +0 -43
  134. package/src/utils/applicationUtils.ts +0 -276
  135. package/src/utils/buildInfo.ts +0 -99
  136. package/src/utils/byString.ts +0 -3
  137. package/src/utils/cliUtils.ts +0 -112
  138. package/src/utils/copyBootstrapFiles.ts +0 -30
  139. package/src/utils/deviceUtils.ts +0 -76
  140. package/src/utils/errorUtils.ts +0 -63
  141. package/src/utils/fileUtils.ts +0 -257
  142. package/src/utils/githubUtils.ts +0 -102
  143. package/src/utils/jsonUtils.ts +0 -30
  144. package/src/utils/lintUtils.ts +0 -190
  145. package/src/utils/linuxDistro.spec.ts +0 -219
  146. package/src/utils/linuxDistro.ts +0 -326
  147. package/src/utils/logUtils.ts +0 -9
  148. package/src/utils/pathUtils.ts +0 -12
  149. package/src/utils/stringUtils.spec.ts +0 -95
  150. package/src/utils/stringUtils.ts +0 -103
  151. package/src/utils/tempDir.ts +0 -24
  152. package/src/utils/zipUtils.ts +0 -14
  153. package/test/ValdiSmokeTest.ts +0 -279
  154. package/test/helpers/AsyncHelpers.ts +0 -113
  155. package/test/helpers/CommandHelpers.ts +0 -37
  156. package/test/helpers/ProjectHelpers.ts +0 -153
  157. package/test/helpers/StreamHelpers.ts +0 -37
  158. package/test/helpers/TypeScriptClient.ts +0 -217
  159. package/tsconfig.dist.json +0 -8
  160. package/tsconfig.json +0 -42
@@ -1,282 +0,0 @@
1
- # AGENTS.md - Guide for AI Coding Assistants
2
-
3
- This document provides context and guidelines for AI coding assistants working on this Valdi application.
4
-
5
- ## Overview
6
-
7
- This is a Valdi application that runs natively on iOS, Android, and macOS. Valdi is a cross-platform UI framework that compiles declarative TypeScript components to native views - no web views, no JavaScript bridges.
8
-
9
-
10
- ## 🚨 CRITICAL: Valdi is NOT React!
11
-
12
- **AI assistants often suggest React patterns that DON'T EXIST in Valdi.** This is because TSX/JSX syntax looks like React, but Valdi compiles to native code.
13
-
14
- ### ❌ FORBIDDEN Patterns (Don't exist in Valdi)
15
-
16
- ```typescript
17
- // ❌ WRONG - React hooks don't exist
18
- const [count, setCount] = useState(0);
19
- useEffect(() => { ... }, []);
20
-
21
- // ❌ WRONG - Functional components don't exist
22
- const MyComponent = () => <view />;
23
-
24
- // ❌ WRONG - Common AI mistakes
25
- this.markNeedsRender(); // Doesn't exist!
26
- this.props.title; // Should be: this.viewModel.title
27
- onMount() { } // Should be: onCreate()
28
- onUpdate() { } // Should be: onViewModelUpdate()
29
- onUnmount() { } // Should be: onDestroy()
30
- this.context.get(Service); // Wrong pattern, use withProviders()
31
- ```
32
-
33
- ### ✅ CORRECT Valdi Patterns
34
-
35
- ```typescript
36
- // ✅ Stateful component with state
37
- import { StatefulComponent } from 'valdi_core/src/Component';
38
-
39
- class MyComponent extends StatefulComponent<ViewModel, State> {
40
- state = { count: 0 };
41
-
42
- // Lifecycle methods
43
- onCreate() { } // Component created
44
- onViewModelUpdate(prev: ViewModel) { } // Props changed
45
- onDestroy() { } // Before removal
46
-
47
- // State updates
48
- handleClick() {
49
- this.setState({ count: this.state.count + 1 }); // Auto re-renders
50
- }
51
-
52
- // Render (returns void, JSX is statement)
53
- onRender() {
54
- <button
55
- title={`Count: ${this.state.count}`}
56
- onPress={this.handleClick}
57
- />;
58
- }
59
- }
60
-
61
- // ✅ Stateless component (props only)
62
- import { Component } from 'valdi_core/src/Component';
63
-
64
- class SimpleComponent extends Component<ViewModel> {
65
- onRender() {
66
- <label value={this.viewModel.title} />; // viewModel, not props!
67
- }
68
- }
69
- ```
70
-
71
- ### Key Differences from React
72
-
73
- | Concept | React | Valdi |
74
- |---------|-------|-------|
75
- | **Components** | Functions or classes | Classes only (Component or StatefulComponent) |
76
- | **State** | `useState` hook | `state = { }` + `setState()` |
77
- | **Props** | `this.props` | `this.viewModel` |
78
- | **Lifecycle** | `useEffect` | `onCreate`, `onViewModelUpdate`, `onDestroy` |
79
- | **Re-render** | `setCount(...)` | `this.setState(...)` |
80
- | **Return** | `return <view />` | `<view />;` (statement, returns void) |
81
-
82
- For complete framework documentation, see: https://github.com/Snapchat/Valdi
83
-
84
-
85
- ## Project Structure
86
-
87
- - **`modules/`** - Your application modules
88
- - Each module contains TypeScript/TSX source files
89
- - `BUILD.bazel` files define how modules are built
90
- - `src/` contains your component and business logic code
91
- - **`WORKSPACE`** - Bazel workspace configuration
92
- - **`config.yaml`** - Valdi project configuration
93
- - **`.bazelrc`** - Bazel build settings
94
-
95
- ## Key Technologies
96
-
97
- - **Valdi** - Cross-platform UI framework that compiles to native code
98
- - **TypeScript/TSX** - React-like syntax for declarative UI (but compiles to native, not React)
99
- - **Bazel** - Build system (note: `bzl` is an alias for `bazel`)
100
- - **Flexbox** - Layout system with automatic RTL support
101
-
102
- ## Development Workflow
103
-
104
- ### Initial Setup
105
-
106
- ```bash
107
- # Install Valdi CLI (if not already installed)
108
- cd path/to/valdi/npm_modules/cli
109
- npm run cli:install
110
-
111
- # Setup development environment
112
- valdi dev_setup
113
-
114
- # Sync project (run after changing dependencies or config)
115
- valdi projectsync
116
- ```
117
-
118
- ### Building and Running
119
-
120
- ```bash
121
- # Install and run on iOS
122
- valdi install ios
123
-
124
- # Install and run on Android
125
- valdi install android
126
-
127
- # Install and run on macOS
128
- valdi install macos
129
-
130
- # Start hot reload (for instant updates while developing)
131
- valdi hotreload
132
- ```
133
-
134
- ### Common Commands
135
-
136
- ```bash
137
- # Sync project configuration and generate IDE files
138
- valdi projectsync
139
-
140
- # Build specific targets with Bazel
141
- bazel build //modules/{{MODULE_NAME}}:{{MODULE_NAME}}
142
-
143
- # Run tests
144
- bazel test //modules/{{MODULE_NAME}}:tests
145
- ```
146
-
147
- ### Exporting and host apps (AAR / xcframework)
148
-
149
- - **Android host:** Use `com.snap.modules.<module_name>.<RootComponent>` for the generated view class (e.g. `com.snap.modules.{{MODULE_NAME}}.App`), not `com.snap.valdi.modules`. `System.loadLibrary(...)` = exact `valdi_exported_library()` target name. See `android_app/README.md`.
150
- - **iOS host:** Root view class = **`<module_name><RootComponentName>`** (Valdi module name from `valdi_module()`, snake_case, e.g. `{{MODULE_NAME}}App`), not `ios_bundle_name`. Export with `--library {{MODULE_NAME}}_export_ios`. Embed the xcframework into the app's **Frameworks** folder (Build Phases → Embed Frameworks → destination **Frameworks**; `dstSubfolderSpec = 10`), not PlugIns, or the app crashes at launch with "Library not loaded: @rpath/...framework/...".
151
-
152
- ## Valdi Component Basics
153
-
154
- Components use a class-based pattern with lifecycle methods:
155
-
156
- ```typescript
157
- import { Component } from 'valdi_core/src/Component';
158
-
159
- class MyComponent extends Component {
160
- // Required: Render the component's UI
161
- onRender() {
162
- <view backgroundColor="#FFFC00" padding={30}>
163
- <label value="Hello World" color="black" />
164
- </view>;
165
- }
166
-
167
- // Optional lifecycle methods:
168
- // onCreate() - Called when component is first created
169
- // onDestroy() - Called before component is removed
170
- // onViewModelUpdate(previousViewModel) - Called when viewModel updates
171
- }
172
- ```
173
-
174
- ### Key Concepts
175
-
176
- - **TSX/JSX Syntax** - Similar to React but compiles to native views
177
- - **State Management** - Use component properties and setState
178
- - **Flexbox Layout** - Use flexbox properties for layout
179
- - **Event Handlers** - Handle user interactions with callbacks
180
- - **Provider Pattern** - Dependency injection for passing services down the component tree
181
-
182
- ## Common Patterns
183
-
184
- ### Styling Components
185
-
186
- ```typescript
187
- <view
188
- backgroundColor="#FFFFFF"
189
- padding={20}
190
- flexDirection="column"
191
- alignItems="center"
192
- >
193
- <label value="Styled text" fontSize={16} color="#000000" />
194
- </view>
195
- ```
196
-
197
- ### Handling Events
198
-
199
- ```typescript
200
- class MyButton extends Component {
201
- private handlePress() {
202
- console.log('Button pressed!');
203
- }
204
-
205
- onRender() {
206
- <view onPress={() => this.handlePress()}>
207
- <label value="Click Me" />
208
- </view>;
209
- }
210
- }
211
- ```
212
-
213
- ### Using Providers
214
-
215
- ```typescript
216
- import { Provider } from 'valdi_core/src/Provider';
217
-
218
- class App extends Component {
219
- onRender() {
220
- const myService = new MyService();
221
-
222
- <Provider value={myService}>
223
- <MyChildComponent />
224
- </Provider>;
225
- }
226
- }
227
- ```
228
-
229
- ## Available Standard Library Modules
230
-
231
- - `valdi_core` - Core component and runtime APIs
232
- - `valdi_http` - Promise-based HTTP client for network requests
233
- - `valdi_navigation` - Navigation utilities
234
- - `valdi_rxjs` - RxJS integration for reactive programming
235
- - `persistence` - Key-value storage with encryption and TTL support
236
- - `foundation`, `coreutils` - Common utilities (arrays, Base64, LRU cache, UUID, etc.)
237
- - `worker` - Worker service support for background JavaScript execution
238
-
239
- ## Debugging
240
-
241
- - **VSCode Integration** - Set breakpoints and debug TypeScript code
242
- - **Hermes Debugger** - Use Chrome DevTools for JavaScript debugging
243
- - **Hot Reload** - See changes instantly without rebuilding
244
- - **Native Debugging** - Use Xcode or Android Studio for platform-specific issues
245
-
246
- See Valdi documentation at `/docs/docs/workflow-hermes-debugger.md` for detailed debugging instructions.
247
-
248
- ## Common Pitfalls
249
-
250
- 1. **Always run `valdi projectsync`** after changing dependencies or config files
251
- 2. **Use hot reload during development** - Much faster than rebuilding
252
- 3. **Flexbox layout** - Valdi uses flexbox, not native iOS/Android layout
253
- 4. **Component state** - Remember to call `setState()` to trigger re-renders
254
- 5. **Build cache** - If builds seem stuck, try `bazel clean`
255
-
256
- ## Important Files
257
-
258
- - **`config.yaml`** - Project configuration (dependencies, settings)
259
- - **`WORKSPACE`** - Bazel workspace and external dependencies
260
- - **`BUILD.bazel`** - Build rules for each module
261
- - **`.bazelrc`** - Bazel build flags and configuration
262
-
263
- ## Getting Help
264
-
265
- - **Documentation** - Valdi docs in the framework repository at `/docs/`
266
- - **Discord** - Join the [Valdi Discord community](https://discord.gg/uJyNEeYX2U)
267
- - **Examples** - Check `/apps/` directory in Valdi repository for examples
268
- - **API Reference** - See `/docs/api/` for comprehensive API documentation
269
- - **Codelabs** - Step-by-step tutorials at `/docs/codelabs/`
270
-
271
- ## Key Points for AI Assistants
272
-
273
- 1. **This is a Valdi application** - Not React, React Native, or web-based
274
- 2. **TSX compiles to native** - No JavaScript runtime on device, components are compiled
275
- 3. **Use `valdi` CLI commands** - Primary tool for building and running
276
- 4. **Hot reload is fast** - Encourage using it for rapid iteration
277
- 5. **Bazel is the build system** - Direct bazel commands available but CLI preferred
278
- 6. **Cross-platform by default** - Code runs on iOS, Android, and macOS
279
-
280
- ---
281
-
282
- *This document is intended for AI coding assistants to quickly understand this Valdi application. For comprehensive Valdi framework documentation, refer to the main Valdi repository at https://github.com/Snapchat/Valdi*
@@ -1,31 +0,0 @@
1
- # valdi_demo
2
- Demo of a hello world app using Valdi open source
3
-
4
- ## Usage
5
-
6
- All commands requires `valdi` to be available on PATH.
7
-
8
- Get auto completion in VSCode
9
- ```sh
10
- valdi projectsync
11
- ```
12
-
13
- Build and install iOS:
14
- ```sh
15
- valdi install ios
16
- ```
17
-
18
- Build and install Android:
19
- ```sh
20
- valdi install android
21
- ```
22
-
23
- Build and install MacOS:
24
- ```sh
25
- valdi install macos
26
- ```
27
-
28
- Start hot reloader:
29
- ```sh
30
- valdi hotreload
31
- ```
@@ -1,57 +0,0 @@
1
- workspace(name = "{{WORKSPACE_NAME}}")
2
-
3
- load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
4
- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5
-
6
- {{VALDI_IMPORT}}
7
-
8
- {{VALDI_WIDGETS_IMPORT}}
9
-
10
- load("@valdi//bzl:workspace_prepare.bzl", "valdi_prepare_workspace")
11
-
12
- valdi_prepare_workspace()
13
-
14
- load("@valdi//bzl:workspace_preinit.bzl", "valdi_preinitialize_workspace")
15
-
16
- valdi_preinitialize_workspace()
17
-
18
- load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains", "register_yq_toolchains")
19
-
20
- register_yq_toolchains()
21
-
22
- # Required bazel-lib dependencies
23
-
24
- aspect_bazel_lib_dependencies()
25
-
26
- # Required rules_shell dependencies
27
- load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
28
-
29
- rules_shell_dependencies()
30
-
31
- rules_shell_toolchains()
32
-
33
- # Register bazel-lib toolchains
34
-
35
- aspect_bazel_lib_register_toolchains()
36
-
37
- # Create the host platform repository transitively required by bazel-lib
38
-
39
- load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
40
- load("@platforms//host:extension.bzl", "host_platform_repo")
41
-
42
- maybe(
43
- host_platform_repo,
44
- name = "host_platform",
45
- )
46
-
47
- load("@valdi//bzl:workspace_init.bzl", "valdi_initialize_workspace")
48
-
49
- valdi_initialize_workspace()
50
-
51
- load("@valdi_npm//:repositories.bzl", "npm_repositories")
52
-
53
- npm_repositories()
54
-
55
- load("@valdi//bzl:workspace_postinit.bzl", "valdi_post_initialize_workspace")
56
-
57
- valdi_post_initialize_workspace()
@@ -1 +0,0 @@
1
- logs_output_dir: ~/.valdi/logs
@@ -1,23 +0,0 @@
1
- {
2
- "name": "hello_world",
3
- "version": "1.0.0",
4
- "description": "Valdi Helloworld app",
5
- "license": "ISC",
6
- "devDependencies": {
7
- "@snap/eslint-plugin-valdi": "1.0.2",
8
- "@types/eslint": "^9.6.1",
9
- "@types/jasmine": "^5.1.7",
10
- "@typescript-eslint/eslint-plugin": "^6.21.0",
11
- "@typescript-eslint/parser": "^6.21.0",
12
- "@typescript-eslint/utils": "^6.21.0",
13
- "eslint": "^8.27.0",
14
- "eslint-config-prettier": "^8.5.0",
15
- "eslint-plugin-import": "^2.26.0",
16
- "eslint-plugin-prettier": "^4.2.1",
17
- "eslint-plugin-rxjs": "^5.0.2",
18
- "eslint-plugin-unused-imports": "^3.2.0",
19
- "jasmine": "^5.6.0",
20
- "ts-node": "^10.9.2",
21
- "typescript": "5.3.3"
22
- }
23
- }
package/.prettierignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- .vscode
package/.prettierrc.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "singleQuote": true,
4
- "trailingComma": "all",
5
- "arrowParens": "avoid",
6
- "tabWidth": 2
7
- }
@@ -1,248 +0,0 @@
1
- # Linux Distribution Compatibility
2
-
3
- This document describes how the Valdi CLI handles different Linux distributions.
4
-
5
- ## Overview
6
-
7
- The Valdi CLI (`valdi doctor` and `valdi dev_setup` commands) now supports multiple Linux distributions beyond just Debian/Ubuntu. The CLI automatically detects your distribution and uses the appropriate package manager and package names.
8
-
9
- ## Supported Distributions
10
-
11
- ### Tier 1 Support (Fully Tested)
12
- - **Debian-based**: Debian, Ubuntu, Linux Mint, Pop!_OS, etc.
13
- - Package manager: `apt`
14
- - Tested on: Ubuntu 22.04, Debian 12
15
-
16
- ### Tier 2 Support (Community Tested)
17
- - **Red Hat-based**: Fedora, RHEL, CentOS, Rocky Linux, AlmaLinux
18
- - Package manager: `dnf` or `yum`
19
- - Notes: Some packages (like watchman) may require EPEL repository
20
-
21
- - **Arch-based**: Arch Linux, Manjaro, EndeavourOS
22
- - Package manager: `pacman`
23
- - Notes: Some packages may be in AUR
24
-
25
- - **SUSE-based**: openSUSE, SLES
26
- - Package manager: `zypper`
27
-
28
- ## How Distribution Detection Works
29
-
30
- The CLI detects your distribution using the following methods (in order):
31
-
32
- 1. **`/etc/os-release`**: Reads the standard Linux distribution information file
33
- - Uses `ID` and `ID_LIKE` fields to determine distribution family
34
- - Extracts distribution name and version
35
-
36
- 2. **Package Manager Detection**: Falls back to detecting available package managers
37
- - Checks for `apt-get`, `dnf`, `yum`, `pacman`, or `zypper`
38
-
39
- 3. **Unknown Distributions**: If detection fails, provides manual installation instructions
40
-
41
- ## Package Mappings
42
-
43
- Different distributions use different package names for the same software. The CLI includes mappings for common dependencies:
44
-
45
- | Dependency | Debian/Ubuntu | Red Hat/Fedora | Arch Linux | openSUSE |
46
- |------------|---------------|----------------|------------|----------|
47
- | Java 17 JDK | `openjdk-17-jdk` | `java-17-openjdk-devel` | `jdk17-openjdk` | `java-17-openjdk-devel` |
48
- | Android Debug Bridge | `adb` | `android-tools` | `android-tools` | `android-tools` |
49
- | Fontconfig Dev | `libfontconfig1-dev` | `fontconfig-devel` | `fontconfig` | `fontconfig-devel` |
50
- | Zlib Dev | `zlib1g-dev` | `zlib-devel` | `zlib` | `zlib-devel` |
51
- | Git LFS | `git-lfs` | `git-lfs` | `git-lfs` | `git-lfs` |
52
- | Watchman | `watchman` | `watchman` | `watchman` | `watchman` |
53
-
54
- ## Commands
55
-
56
- ### `valdi dev_setup`
57
-
58
- The `dev_setup` command automatically installs required dependencies for your distribution:
59
-
60
- ```bash
61
- valdi dev_setup
62
- ```
63
-
64
- **What it does:**
65
- 1. Detects your Linux distribution
66
- 2. Installs the following dependencies:
67
- - Node.js/npm (if not installed)
68
- - Java 17 JDK
69
- - Git LFS
70
- - Watchman (for hot reload)
71
- - Android Debug Bridge (adb)
72
- - Development libraries (fontconfig, zlib)
73
- - Additional distribution-specific packages
74
- 3. Downloads and installs Bazelisk
75
- 4. Sets up Android SDK with command-line tools
76
- 5. Configures environment variables in your shell RC file
77
-
78
- **Distribution-specific behavior:**
79
-
80
- - **Debian/Ubuntu**:
81
- - Sets up packagecloud repository for git-lfs
82
- - Installs `libtinfo5` for Android command-line tools compatibility
83
-
84
- - **Red Hat/Fedora**:
85
- - Sets up packagecloud RPM repository for git-lfs
86
- - Installs `ncurses-compat-libs` for Android tools
87
- - Shows warning if EPEL repository is needed for watchman
88
-
89
- - **Arch Linux**:
90
- - Uses standard repositories (most packages available)
91
- - May require AUR helper for some packages
92
-
93
- - **openSUSE**:
94
- - Uses zypper to install packages
95
-
96
- ### `valdi doctor`
97
-
98
- The `doctor` command checks your development environment and provides distribution-specific fix commands:
99
-
100
- ```bash
101
- valdi doctor
102
- ```
103
-
104
- **Features:**
105
- - Detects your distribution automatically
106
- - Provides correct package manager commands for your distribution
107
- - Shows distribution-specific warnings (e.g., EPEL repository for RHEL)
108
- - Validates all required tools are installed
109
-
110
- **Example output on Fedora:**
111
-
112
- ```
113
- Running Valdi environment diagnostics...
114
- Detected distribution: Fedora Linux (dnf)
115
-
116
- ✓ Node.js installation
117
- ✗ Java installation
118
- • Java not found in PATH
119
- Fix: sudo dnf install java-17-openjdk-devel
120
- ```
121
-
122
- ## Troubleshooting
123
-
124
- ### Watchman on Red Hat/Fedora
125
-
126
- Watchman may not be available in the default repositories. Enable EPEL:
127
-
128
- ```bash
129
- # Fedora
130
- sudo dnf install epel-release
131
-
132
- # RHEL/CentOS
133
- sudo yum install epel-release
134
- ```
135
-
136
- Then install watchman:
137
-
138
- ```bash
139
- sudo dnf install watchman
140
- # or
141
- sudo yum install watchman
142
- ```
143
-
144
- ### Packages in AUR (Arch Linux)
145
-
146
- Some packages may only be available in the AUR. Use an AUR helper like `yay` or `paru`:
147
-
148
- ```bash
149
- yay -S watchman
150
- ```
151
-
152
- ### Unknown Distribution
153
-
154
- If your distribution is not automatically detected, you'll see:
155
-
156
- ```
157
- Unable to detect Linux distribution.
158
- Please manually install the following dependencies and re-run this command:
159
- - git
160
- - git-lfs
161
- - npm (Node.js)
162
- - openjdk-17-jdk (or equivalent Java 17 JDK)
163
- - watchman
164
- - adb (Android Debug Bridge)
165
- - fontconfig development libraries
166
- - zlib development libraries
167
- ```
168
-
169
- Consult your distribution's package manager documentation for the correct package names.
170
-
171
- ### Distribution Detection Issues
172
-
173
- If distribution detection fails or provides incorrect results:
174
-
175
- 1. Check that `/etc/os-release` exists and is readable:
176
- ```bash
177
- cat /etc/os-release
178
- ```
179
-
180
- 2. Verify your package manager is in PATH:
181
- ```bash
182
- which apt-get # or dnf, yum, pacman, zypper
183
- ```
184
-
185
- 3. Report the issue with your distribution details:
186
- - Distribution name and version
187
- - Output of `cat /etc/os-release`
188
- - Available package manager
189
-
190
- ## Contributing
191
-
192
- To add support for a new distribution:
193
-
194
- 1. Add package mappings in `src/utils/linuxDistro.ts`:
195
- ```typescript
196
- // In getCommonPackageMappings()
197
- 'your-package': {
198
- debian: 'debian-package-name',
199
- redhat: 'redhat-package-name',
200
- arch: 'arch-package-name',
201
- suse: 'suse-package-name',
202
- fallback: 'generic-package-name',
203
- }
204
- ```
205
-
206
- 2. Add distribution detection logic in `detectLinuxDistro()` if needed
207
-
208
- 3. Test on the target distribution:
209
- ```bash
210
- valdi dev_setup
211
- valdi doctor
212
- ```
213
-
214
- 4. Update this documentation with your findings
215
-
216
- ## Technical Details
217
-
218
- ### Files Modified
219
- - `src/utils/linuxDistro.ts` - Distribution detection and package mapping utilities
220
- - `src/setup/linuxSetup.ts` - Linux-specific dev_setup implementation
221
- - `src/commands/doctor.ts` - Environment diagnostics with distribution-aware fix commands
222
-
223
- ### Distribution Detection API
224
-
225
- ```typescript
226
- import { detectLinuxDistro, buildInstallCommand, getPackageName } from './utils/linuxDistro';
227
-
228
- // Detect distribution
229
- const distro = detectLinuxDistro();
230
- console.log(distro.name); // e.g., "Ubuntu"
231
- console.log(distro.type); // e.g., LinuxDistroType.DEBIAN
232
- console.log(distro.packageManager.name); // e.g., "apt"
233
-
234
- // Build install command
235
- const cmd = buildInstallCommand(['git', 'npm', 'watchman'], distro);
236
- console.log(cmd); // e.g., "sudo apt-get install git npm watchman"
237
-
238
- // Get package name for current distribution
239
- const packageMappings = getCommonPackageMappings();
240
- const javaPackage = getPackageName(packageMappings['openjdk-17'], distro);
241
- console.log(javaPackage); // e.g., "openjdk-17-jdk" on Ubuntu
242
- ```
243
-
244
- ## See Also
245
-
246
- - [Valdi Installation Guide](https://github.com/Snapchat/Valdi/blob/main/docs/INSTALL.md)
247
- - [Development Setup Guide](https://github.com/Snapchat/Valdi/blob/main/docs/DEV_SETUP.md)
248
- - [Contributing Guidelines](https://github.com/Snapchat/Valdi/blob/main/CONTRIBUTING.md)
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- trailingComma: 'all',
3
- arrowParens: 'avoid',
4
- };