craft-native 0.0.37 → 0.0.49

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 (89) hide show
  1. package/dist/android/src/index.js +268 -0
  2. package/dist/android/src/index.js.map +10 -0
  3. package/dist/android/templates/AndroidManifest.xml.template +69 -0
  4. package/dist/android/templates/CraftBridge.kt.template +3748 -0
  5. package/dist/android/templates/CraftBridgeExtensions.kt.template +383 -0
  6. package/dist/android/templates/CraftWidgetProvider.kt.template +246 -0
  7. package/dist/android/templates/MainActivity.kt.template +109 -0
  8. package/dist/android/templates/build.gradle.kts.app.template +80 -0
  9. package/dist/android/templates/build.gradle.kts.project.template +5 -0
  10. package/dist/android/templates/fastlane/Appfile +25 -0
  11. package/dist/android/templates/fastlane/Fastfile +192 -0
  12. package/dist/android/templates/fastlane/Gemfile +7 -0
  13. package/dist/android/templates/github-workflow-android.yml +248 -0
  14. package/dist/android/templates/github-workflow-test.yml +329 -0
  15. package/dist/android/templates/settings.gradle.kts.template +18 -0
  16. package/dist/android/templates/test-bridges.html +1463 -0
  17. package/dist/api/window.d.ts +18 -0
  18. package/dist/api/window.d.ts.map +1 -1
  19. package/dist/assets/index.d.ts.map +1 -1
  20. package/dist/bridge/core.d.ts +2 -0
  21. package/dist/bridge/core.d.ts.map +1 -1
  22. package/dist/cli.js +4168 -0
  23. package/dist/components/sidebar.d.ts +5 -1
  24. package/dist/components/sidebar.d.ts.map +1 -1
  25. package/dist/dev/devtools.d.ts +1 -1
  26. package/dist/dev/devtools.d.ts.map +1 -1
  27. package/dist/dev/hot-reload.d.ts +12 -3
  28. package/dist/dev/hot-reload.d.ts.map +1 -1
  29. package/dist/index.cjs +573 -208
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +585 -216
  32. package/dist/index.js.map +45 -0
  33. package/dist/ios/src/index.js +186 -0
  34. package/dist/ios/src/index.js.map +10 -0
  35. package/dist/ios/templates/CraftApp.swift +4241 -0
  36. package/dist/ios/templates/CraftAppExtensions.swift +361 -0
  37. package/dist/ios/templates/CraftWidget.swift +247 -0
  38. package/dist/ios/templates/Info.plist.template +65 -0
  39. package/dist/ios/templates/fastlane/Appfile +45 -0
  40. package/dist/ios/templates/fastlane/Fastfile +189 -0
  41. package/dist/ios/templates/fastlane/Gemfile +7 -0
  42. package/dist/ios/templates/fastlane/Matchfile +58 -0
  43. package/dist/ios/templates/github-workflow-ios.yml +192 -0
  44. package/dist/ios/templates/github-workflow-release.yml +175 -0
  45. package/dist/ios/templates/github-workflow-test.yml +272 -0
  46. package/dist/ios/templates/project.yml.template +25 -0
  47. package/dist/ios/templates/test-bridges.html +1463 -0
  48. package/dist/package.d.ts +106 -2
  49. package/dist/package.d.ts.map +1 -1
  50. package/dist/package.test.d.ts +2 -0
  51. package/dist/package.test.d.ts.map +1 -0
  52. package/dist/styles/sidebar-templates.d.ts.map +1 -1
  53. package/dist/styles/sidebars.d.ts +12 -8
  54. package/dist/styles/sidebars.d.ts.map +1 -1
  55. package/dist/templates/projects/blank/craft.config.ts +19 -0
  56. package/dist/templates/projects/blank/index.html +27 -0
  57. package/dist/templates/projects/blank/package.json +19 -0
  58. package/dist/templates/projects/blank/src/main.ts +26 -0
  59. package/dist/templates/projects/dashboard/craft.config.ts +42 -0
  60. package/dist/templates/projects/dashboard/index.html +13 -0
  61. package/dist/templates/projects/dashboard/package.json +20 -0
  62. package/dist/templates/projects/dashboard/src/main.ts +163 -0
  63. package/dist/templates/projects/dashboard/src/styles.css +280 -0
  64. package/dist/templates/projects/drawer/craft.config.ts +47 -0
  65. package/dist/templates/projects/drawer/index.html +13 -0
  66. package/dist/templates/projects/drawer/package.json +21 -0
  67. package/dist/templates/projects/drawer/src/main.ts +406 -0
  68. package/dist/templates/projects/drawer/src/styles.css +468 -0
  69. package/dist/templates/projects/ecommerce/craft.config.ts +32 -0
  70. package/dist/templates/projects/ecommerce/index.html +13 -0
  71. package/dist/templates/projects/ecommerce/package.json +19 -0
  72. package/dist/templates/projects/ecommerce/src/main.ts +194 -0
  73. package/dist/templates/projects/ecommerce/src/styles.css +169 -0
  74. package/dist/templates/projects/social/craft.config.ts +32 -0
  75. package/dist/templates/projects/social/index.html +13 -0
  76. package/dist/templates/projects/social/package.json +19 -0
  77. package/dist/templates/projects/social/src/main.ts +270 -0
  78. package/dist/templates/projects/social/src/styles.css +216 -0
  79. package/dist/templates/projects/tabs/craft.config.ts +47 -0
  80. package/dist/templates/projects/tabs/index.html +13 -0
  81. package/dist/templates/projects/tabs/package.json +21 -0
  82. package/dist/templates/projects/tabs/src/main.ts +177 -0
  83. package/dist/templates/projects/tabs/src/styles.css +163 -0
  84. package/dist/types.d.ts +29 -0
  85. package/dist/types.d.ts.map +1 -1
  86. package/dist/updater/index.d.ts +1 -0
  87. package/dist/updater/index.d.ts.map +1 -1
  88. package/package.json +5 -12
  89. package/bin/cli.ts +0 -937
@@ -0,0 +1,272 @@
1
+ # iOS Test Workflow
2
+ # Runs unit and UI tests on iOS simulators
3
+ # Supports multiple iOS versions and device types
4
+
5
+ name: iOS Tests
6
+
7
+ on:
8
+ push:
9
+ branches: [main, develop]
10
+ paths:
11
+ - 'ios/**'
12
+ - '.github/workflows/ios-test.yml'
13
+ pull_request:
14
+ branches: [main, develop]
15
+ paths:
16
+ - 'ios/**'
17
+ workflow_dispatch:
18
+ inputs:
19
+ ios_version:
20
+ description: 'iOS version to test'
21
+ required: false
22
+ default: '17.2'
23
+ device:
24
+ description: 'Simulator device'
25
+ required: false
26
+ default: 'iPhone 15'
27
+
28
+ env:
29
+ DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
30
+ # Update these for your project
31
+ SCHEME: CraftApp
32
+ PROJECT_PATH: ios/CraftApp.xcodeproj
33
+ # Or use workspace:
34
+ # WORKSPACE_PATH: ios/CraftApp.xcworkspace
35
+
36
+ jobs:
37
+ unit-tests:
38
+ name: Unit Tests
39
+ runs-on: macos-14
40
+ timeout-minutes: 30
41
+
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ include:
46
+ - ios: '17.2'
47
+ device: 'iPhone 15'
48
+ - ios: '16.4'
49
+ device: 'iPhone 14'
50
+ # Add more combinations as needed
51
+
52
+ steps:
53
+ - name: Checkout
54
+ uses: actions/checkout@v4
55
+
56
+ - name: Select Xcode
57
+ run: sudo xcode-select -s /Applications/Xcode_15.2.app
58
+
59
+ - name: Show Xcode version
60
+ run: xcodebuild -version
61
+
62
+ - name: List available simulators
63
+ run: xcrun simctl list devices available
64
+
65
+ - name: Cache CocoaPods
66
+ uses: actions/cache@v4
67
+ with:
68
+ path: ios/Pods
69
+ key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
70
+ restore-keys: |
71
+ ${{ runner.os }}-pods-
72
+
73
+ - name: Install CocoaPods
74
+ if: hashFiles('ios/Podfile') != ''
75
+ run: |
76
+ cd ios
77
+ pod install --repo-update
78
+
79
+ - name: Cache Swift Package Manager
80
+ uses: actions/cache@v4
81
+ with:
82
+ path: |
83
+ ~/Library/Caches/org.swift.swiftpm
84
+ ~/Library/Developer/Xcode/DerivedData/**/SourcePackages
85
+ key: ${{ runner.os }}-spm-${{ hashFiles('ios/**/Package.resolved') }}
86
+ restore-keys: |
87
+ ${{ runner.os }}-spm-
88
+
89
+ - name: Run Unit Tests
90
+ run: |
91
+ set -o pipefail
92
+ xcodebuild test \
93
+ -project "$PROJECT_PATH" \
94
+ -scheme "$SCHEME" \
95
+ -destination "platform=iOS Simulator,OS=${{ matrix.ios }},name=${{ matrix.device }}" \
96
+ -resultBundlePath TestResults-${{ matrix.ios }}.xcresult \
97
+ -enableCodeCoverage YES \
98
+ CODE_SIGNING_ALLOWED=NO \
99
+ | xcpretty --color --report junit --output TestResults-${{ matrix.ios }}.xml
100
+
101
+ - name: Upload Test Results
102
+ uses: actions/upload-artifact@v4
103
+ if: always()
104
+ with:
105
+ name: test-results-ios-${{ matrix.ios }}
106
+ path: |
107
+ TestResults-${{ matrix.ios }}.xcresult
108
+ TestResults-${{ matrix.ios }}.xml
109
+ retention-days: 14
110
+
111
+ - name: Generate Coverage Report
112
+ if: success()
113
+ run: |
114
+ xcrun xccov view --report --json TestResults-${{ matrix.ios }}.xcresult > coverage-${{ matrix.ios }}.json
115
+ echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
116
+ cat coverage-${{ matrix.ios }}.json | jq -r '.targets[] | "- \(.name): \(.lineCoverage * 100 | floor)%"' >> $GITHUB_STEP_SUMMARY
117
+
118
+ - name: Upload Coverage
119
+ uses: actions/upload-artifact@v4
120
+ if: success()
121
+ with:
122
+ name: coverage-ios-${{ matrix.ios }}
123
+ path: coverage-${{ matrix.ios }}.json
124
+ retention-days: 14
125
+
126
+ ui-tests:
127
+ name: UI Tests
128
+ runs-on: macos-14
129
+ timeout-minutes: 45
130
+ needs: unit-tests
131
+
132
+ steps:
133
+ - name: Checkout
134
+ uses: actions/checkout@v4
135
+
136
+ - name: Select Xcode
137
+ run: sudo xcode-select -s /Applications/Xcode_15.2.app
138
+
139
+ - name: Cache CocoaPods
140
+ uses: actions/cache@v4
141
+ with:
142
+ path: ios/Pods
143
+ key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
144
+ restore-keys: |
145
+ ${{ runner.os }}-pods-
146
+
147
+ - name: Install CocoaPods
148
+ if: hashFiles('ios/Podfile') != ''
149
+ run: |
150
+ cd ios
151
+ pod install --repo-update
152
+
153
+ - name: Boot Simulator
154
+ run: |
155
+ DEVICE_ID=$(xcrun simctl list devices available --json | jq -r '.devices["com.apple.CoreSimulator.SimRuntime.iOS-17-2"][] | select(.name == "iPhone 15") | .udid' | head -1)
156
+ xcrun simctl boot "$DEVICE_ID" || true
157
+ # Wait for simulator to be ready
158
+ sleep 10
159
+
160
+ - name: Run UI Tests
161
+ run: |
162
+ set -o pipefail
163
+ xcodebuild test \
164
+ -project "$PROJECT_PATH" \
165
+ -scheme "${SCHEME}UITests" \
166
+ -destination "platform=iOS Simulator,OS=17.2,name=iPhone 15" \
167
+ -resultBundlePath UITestResults.xcresult \
168
+ CODE_SIGNING_ALLOWED=NO \
169
+ | xcpretty --color --report junit --output UITestResults.xml
170
+
171
+ - name: Upload UI Test Results
172
+ uses: actions/upload-artifact@v4
173
+ if: always()
174
+ with:
175
+ name: ui-test-results
176
+ path: |
177
+ UITestResults.xcresult
178
+ UITestResults.xml
179
+ retention-days: 14
180
+
181
+ - name: Capture Screenshots on Failure
182
+ if: failure()
183
+ run: |
184
+ mkdir -p screenshots
185
+ xcrun simctl io booted screenshot screenshots/failure-$(date +%s).png
186
+
187
+ - name: Upload Failure Screenshots
188
+ uses: actions/upload-artifact@v4
189
+ if: failure()
190
+ with:
191
+ name: failure-screenshots
192
+ path: screenshots/
193
+ retention-days: 7
194
+
195
+ snapshot-tests:
196
+ name: Snapshot Tests
197
+ runs-on: macos-14
198
+ timeout-minutes: 30
199
+ if: github.event_name == 'pull_request'
200
+
201
+ steps:
202
+ - name: Checkout
203
+ uses: actions/checkout@v4
204
+ with:
205
+ fetch-depth: 0
206
+
207
+ - name: Select Xcode
208
+ run: sudo xcode-select -s /Applications/Xcode_15.2.app
209
+
210
+ - name: Cache CocoaPods
211
+ uses: actions/cache@v4
212
+ with:
213
+ path: ios/Pods
214
+ key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
215
+ restore-keys: |
216
+ ${{ runner.os }}-pods-
217
+
218
+ - name: Install CocoaPods
219
+ if: hashFiles('ios/Podfile') != ''
220
+ run: |
221
+ cd ios
222
+ pod install --repo-update
223
+
224
+ - name: Run Snapshot Tests
225
+ run: |
226
+ set -o pipefail
227
+ xcodebuild test \
228
+ -project "$PROJECT_PATH" \
229
+ -scheme "${SCHEME}SnapshotTests" \
230
+ -destination "platform=iOS Simulator,OS=17.2,name=iPhone 15" \
231
+ -resultBundlePath SnapshotTestResults.xcresult \
232
+ CODE_SIGNING_ALLOWED=NO \
233
+ | xcpretty --color
234
+
235
+ - name: Upload Snapshot Differences
236
+ uses: actions/upload-artifact@v4
237
+ if: failure()
238
+ with:
239
+ name: snapshot-differences
240
+ path: |
241
+ ios/**/FailureDiffs/
242
+ SnapshotTestResults.xcresult
243
+ retention-days: 14
244
+
245
+ test-summary:
246
+ name: Test Summary
247
+ runs-on: ubuntu-latest
248
+ needs: [unit-tests, ui-tests]
249
+ if: always()
250
+
251
+ steps:
252
+ - name: Download all artifacts
253
+ uses: actions/download-artifact@v4
254
+ with:
255
+ path: artifacts
256
+
257
+ - name: Generate Summary
258
+ run: |
259
+ echo "## iOS Test Results" >> $GITHUB_STEP_SUMMARY
260
+ echo "" >> $GITHUB_STEP_SUMMARY
261
+
262
+ if [ -d "artifacts" ]; then
263
+ echo "### Test Artifacts" >> $GITHUB_STEP_SUMMARY
264
+ find artifacts -name "*.xml" -exec echo "- {}" \; >> $GITHUB_STEP_SUMMARY
265
+ fi
266
+
267
+ echo "" >> $GITHUB_STEP_SUMMARY
268
+ echo "### Jobs Status" >> $GITHUB_STEP_SUMMARY
269
+ echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
270
+ echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
271
+ echo "| Unit Tests | ${{ needs.unit-tests.result }} |" >> $GITHUB_STEP_SUMMARY
272
+ echo "| UI Tests | ${{ needs.ui-tests.result }} |" >> $GITHUB_STEP_SUMMARY
@@ -0,0 +1,25 @@
1
+ name: {{APP_NAME}}
2
+ options:
3
+ bundleIdPrefix: {{BUNDLE_ID_PREFIX}}
4
+ deploymentTarget:
5
+ iOS: "{{IOS_VERSION}}"
6
+ settings:
7
+ MARKETING_VERSION: "{{VERSION}}"
8
+ CURRENT_PROJECT_VERSION: "{{BUILD_NUMBER}}"
9
+ CODE_SIGN_STYLE: Automatic
10
+ DEVELOPMENT_TEAM: "{{TEAM_ID}}"
11
+ targets:
12
+ {{APP_NAME}}:
13
+ type: application
14
+ platform: iOS
15
+ sources:
16
+ - Sources
17
+ resources:
18
+ - path: dist
19
+ type: folder
20
+ - path: craft.config.json
21
+ optional: true
22
+ settings:
23
+ INFOPLIST_FILE: Info.plist
24
+ PRODUCT_BUNDLE_IDENTIFIER: {{BUNDLE_ID}}
25
+ SWIFT_VERSION: "5.0"