Skip to content

Commit f90acdb

Browse files
authored
Merge branch 'main' into cdn
2 parents 1022ec7 + ce87aa2 commit f90acdb

File tree

9 files changed

+331
-27
lines changed

9 files changed

+331
-27
lines changed

.github/actions/setup/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ runs:
2323
node-version-file: .nvmrc
2424
cache: yarn
2525
cache-dependency-path: yarn.lock
26+
registry-url: 'https://registry.npmjs.org'
2627

2728
- name: Install dependencies
2829
run: yarn install --immutable

.github/workflows/build-npm.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
id-token: write # to enable use of OIDC for npm provenance
1111
env:
1212
WORKING_DIRECTORY: ./
13-
INPUT_TOKEN: ${{ secrets.NPM_TOKEN }}
1413
concurrency:
1514
group: npm-${{ github.ref }}
1615
cancel-in-progress: true
@@ -20,6 +19,12 @@ jobs:
2019
with:
2120
submodules: recursive
2221

22+
- name: Setup Node.js with npm registry
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
registry-url: 'https://registry.npmjs.org'
27+
2328
- name: Setup
2429
uses: ./.github/actions/setup
2530
with:
@@ -34,8 +39,8 @@ jobs:
3439
yarn release
3540
env:
3641
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
YARN_NPM_AUTH_TOKEN: ''
43+
NPM_TOKEN: ''
3944
NPM_CONFIG_PROVENANCE: true
4045

4146
- name: Deploy to GitHub Pages
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
name: Debug npm OIDC Authentication
2+
3+
on:
4+
workflow_dispatch: # Manual trigger only
5+
6+
jobs:
7+
debug-npm-auth:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
id-token: write # Required for OIDC
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js with npm registry
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
registry-url: 'https://registry.npmjs.org'
22+
23+
- name: Debug - Check environment
24+
run: |
25+
echo "=== Node and npm versions ==="
26+
node --version
27+
npm --version
28+
29+
echo ""
30+
echo "=== npm config ==="
31+
npm config list
32+
33+
echo ""
34+
echo "=== Registry configuration ==="
35+
npm config get registry
36+
37+
echo ""
38+
echo "=== .npmrc contents (redacted) ==="
39+
if [ -f ~/.npmrc ]; then
40+
# Show structure but redact actual tokens
41+
sed 's/=.*/=<REDACTED>/' ~/.npmrc
42+
else
43+
echo "No ~/.npmrc found"
44+
fi
45+
46+
if [ -f .npmrc ]; then
47+
echo ""
48+
echo "=== Project .npmrc (redacted) ==="
49+
sed 's/=.*/=<REDACTED>/' .npmrc
50+
fi
51+
52+
- name: Debug - Check OIDC token availability
53+
id: oidc-check
54+
continue-on-error: true
55+
run: |
56+
echo "=== OIDC Token Check ==="
57+
OIDC_OK=true
58+
if [ -n "$ACTIONS_ID_TOKEN_REQUEST_URL" ]; then
59+
echo "✅ OIDC token request URL is set"
60+
echo "URL prefix: ${ACTIONS_ID_TOKEN_REQUEST_URL:0:50}..."
61+
else
62+
echo "❌ OIDC token request URL is NOT set"
63+
echo "Make sure 'id-token: write' permission is configured"
64+
OIDC_OK=false
65+
fi
66+
67+
if [ -n "$ACTIONS_ID_TOKEN_REQUEST_TOKEN" ]; then
68+
echo "✅ OIDC token request token is available"
69+
else
70+
echo "❌ OIDC token request token is NOT available"
71+
OIDC_OK=false
72+
fi
73+
74+
if [ "$OIDC_OK" = "false" ]; then
75+
exit 1
76+
fi
77+
78+
- name: Debug - Test npm authentication
79+
id: npm-auth
80+
continue-on-error: true
81+
run: |
82+
echo "=== Testing npm whoami ==="
83+
if npm whoami 2>&1; then
84+
echo "✅ Successfully authenticated with npm"
85+
else
86+
echo "❌ npm whoami failed - not authenticated"
87+
exit 1
88+
fi
89+
90+
- name: Debug - Check package info
91+
run: |
92+
echo "=== Package.json info ==="
93+
if [ -f package.json ]; then
94+
echo "Package name: $(jq -r '.name' package.json)"
95+
echo "Package version: $(jq -r '.version' package.json)"
96+
echo "Repository: $(jq -r '.repository.url // .repository // "not set"' package.json)"
97+
else
98+
echo "No package.json found in root"
99+
fi
100+
101+
- name: Debug - Check access to @shopify scope
102+
run: |
103+
echo "=== Checking @shopify scope access ==="
104+
105+
echo ""
106+
echo "Packages you can access in @shopify scope:"
107+
npm access list packages @shopify 2>&1 || echo "Could not list packages (may need org membership)"
108+
109+
echo ""
110+
echo "=== Checking specific package access ==="
111+
npm access list collaborators @shopify/react-native-skia 2>&1 || echo "Could not list collaborators"
112+
113+
- name: Debug - Check npm org membership
114+
run: |
115+
echo "=== Organization membership check ==="
116+
npm org ls shopify 2>&1 || echo "Could not list org members (may not have permission)"
117+
118+
- name: Setup
119+
uses: ./.github/actions/setup
120+
with:
121+
github_token: ${{ secrets.GITHUB_TOKEN }}
122+
123+
- name: Debug - Dry run publish test
124+
id: dry-run
125+
continue-on-error: true
126+
run: |
127+
echo "=== Attempting dry-run publish ==="
128+
echo "This will NOT actually publish, just test if it would work"
129+
130+
# Build the project using yarn (this is a yarn monorepo)
131+
echo "Running build first..."
132+
if ! yarn build; then
133+
echo "❌ Build step failed"
134+
exit 1
135+
fi
136+
137+
# Try dry-run publish from the skia package
138+
cd packages/skia
139+
if ! npm publish --dry-run --provenance --access public 2>&1; then
140+
echo "❌ Dry-run publish failed"
141+
exit 1
142+
fi
143+
echo "✅ Dry-run publish succeeded"
144+
145+
- name: Debug - Check provenance requirements
146+
run: |
147+
echo "=== Provenance publishing requirements ==="
148+
echo ""
149+
echo "For provenance publishing to work, you need:"
150+
echo "1. ✅ id-token: write permission (set in this workflow)"
151+
echo "2. Package must be linked to this GitHub repo on npmjs.com"
152+
echo "3. Publishing from a GitHub Actions workflow"
153+
echo ""
154+
echo "Current repository: $GITHUB_REPOSITORY"
155+
echo "Current ref: $GITHUB_REF"
156+
echo "Current SHA: $GITHUB_SHA"
157+
echo ""
158+
echo "Check https://www.npmjs.com/package/@shopify/react-native-skia/access"
159+
echo "to verify this repo is configured for publishing"
160+
161+
- name: Summary
162+
run: |
163+
echo ""
164+
echo "========================================"
165+
echo " DEBUG SUMMARY"
166+
echo "========================================"
167+
echo ""
168+
echo "If you see authentication failures above, check:"
169+
echo ""
170+
echo "1. Is this repo configured in npm package settings?"
171+
echo " → Go to npmjs.com → @shopify/react-native-skia → Settings → Publishing access"
172+
echo " → Verify '$GITHUB_REPOSITORY' is listed"
173+
echo ""
174+
echo "2. Do you have the right npm org permissions?"
175+
echo " → You need publish access to the @shopify scope"
176+
echo ""
177+
echo "3. Is the workflow running from the right branch/context?"
178+
echo " → Some orgs restrict publishing to specific branches"
179+
echo ""
180+
echo "4. Check npm's provenance documentation:"
181+
echo " → https://docs.npmjs.com/generating-provenance-statements"
182+
echo ""
183+
184+
- name: Final validation
185+
run: |
186+
echo ""
187+
echo "========================================"
188+
echo " VALIDATION RESULTS"
189+
echo "========================================"
190+
echo ""
191+
FAILED=false
192+
193+
if [ "${{ steps.oidc-check.outcome }}" = "failure" ]; then
194+
echo "❌ OIDC token check: FAILED"
195+
FAILED=true
196+
else
197+
echo "✅ OIDC token check: PASSED"
198+
fi
199+
200+
if [ "${{ steps.npm-auth.outcome }}" = "failure" ]; then
201+
echo "❌ npm authentication: FAILED"
202+
FAILED=true
203+
else
204+
echo "✅ npm authentication: PASSED"
205+
fi
206+
207+
if [ "${{ steps.dry-run.outcome }}" = "failure" ]; then
208+
echo "❌ Dry-run publish: FAILED"
209+
FAILED=true
210+
else
211+
echo "✅ Dry-run publish: PASSED"
212+
fi
213+
214+
echo ""
215+
if [ "$FAILED" = "true" ]; then
216+
echo "========================================"
217+
echo " ❌ OVERALL: SOME CHECKS FAILED"
218+
echo "========================================"
219+
exit 1
220+
else
221+
echo "========================================"
222+
echo " ✅ OVERALL: ALL CHECKS PASSED"
223+
echo "========================================"
224+
fi

apps/example/src/Examples/API/Snapshot.tsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
useWindowDimensions,
99
ScrollView,
1010
} from "react-native";
11+
import Svg, { Circle, Rect } from "react-native-svg";
1112
import type { SkImage } from "@shopify/react-native-skia";
1213
import {
1314
Canvas,
@@ -54,7 +55,7 @@ export const Snapshot = () => {
5455

5556
return (
5657
<View style={{ flex: 1 }}>
57-
<View ref={viewRef} style={styles.view}>
58+
<View ref={viewRef} style={styles.view} collapsable={false}>
5859
<Component />
5960
</View>
6061
<Button title="Take snapshot" onPress={takeSnapshot} />
@@ -114,23 +115,11 @@ const Component = () => {
114115
</View>
115116
<Text>Hello World!</Text>
116117
<View style={{ flexDirection: "row" }}>
117-
<View
118-
style={{
119-
width: 80,
120-
height: 80,
121-
backgroundColor: "blue",
122-
opacity: 0.5,
123-
}}
124-
>
125-
<View
126-
style={{
127-
width: 40,
128-
height: 40,
129-
backgroundColor: "green",
130-
opacity: 0.5,
131-
}}
132-
/>
133-
</View>
118+
<Svg width={80} height={80} viewBox="0 0 80 80">
119+
<Rect x={0} y={0} width={80} height={80} fill="blue" opacity={0.5} />
120+
<Circle cx={40} cy={40} r={25} fill="green" opacity={0.7} />
121+
<Rect x={30} y={30} width={20} height={20} fill="red" opacity={0.5} />
122+
</Svg>
134123
<View
135124
style={{
136125
width: 40,

packages/skia/.releaserc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
[
2020
"@semantic-release/exec",
2121
{
22-
"publishCmd": "mkdir -p /tmp/npm-publish && cp dist/*.tgz /tmp/npm-publish/ && cd /tmp/npm-publish && npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN && npm publish *.tgz --provenance --access public --tag ${nextRelease.channel || 'latest'}"
22+
"publishCmd": "mkdir -p /tmp/npm-publish && cp dist/*.tgz /tmp/npm-publish/ && cd /tmp/npm-publish && npm publish *.tgz --provenance --access public --tag ${nextRelease.channel || 'latest'}"
2323
}
2424
],
2525
[

packages/skia/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ private static Paint createPaint() {
6767
return paint;
6868
}
6969

70+
private static boolean isSvgView(View view) {
71+
try {
72+
String className = view.getClass().getName();
73+
return className != null && className.startsWith("com.horcrux.svg");
74+
} catch (Throwable t) {
75+
Log.e("ViewScreenshotService", "Error checking if view is SVG", t);
76+
return false;
77+
}
78+
}
79+
7080
private static void renderViewToCanvas(Canvas canvas, View view, Paint paint, float parentOpacity) {
7181
float combinedOpacity = parentOpacity * view.getAlpha();
7282
canvas.save();
@@ -83,7 +93,7 @@ private static void renderViewToCanvas(Canvas canvas, View view, Paint paint, fl
8393
canvas.clipRect(clipLeft, clipTop, clipRight, clipBottom);
8494
}
8595

86-
if (view instanceof ViewGroup) {
96+
if (view instanceof ViewGroup && !isSvgView(view)) {
8797
ViewGroup group = (ViewGroup) view;
8898
drawBackgroundIfPresent(canvas, view, combinedOpacity);
8999
drawChildren(canvas, group, paint, combinedOpacity);

packages/skia/cpp/api/JsiSkImageFilterFactory.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,11 @@ class JsiSkImageFilterFactory : public JsiSkHostObject {
245245
JSI_HOST_FUNCTION(MakeRuntimeShader) {
246246
auto rtb = JsiSkRuntimeShaderBuilder::fromValue(runtime, arguments[0]);
247247

248-
const char *childName = "";
248+
std::string childNameStr = "";
249+
const char *childName = childNameStr.c_str();
249250
if (hasOptionalArgument(arguments, count, 1)) {
250-
childName = arguments[1].asString(runtime).utf8(runtime).c_str();
251+
childNameStr = arguments[1].asString(runtime).utf8(runtime);
252+
childName = childNameStr.c_str();
251253
}
252254

253255
sk_sp<SkImageFilter> input = nullptr;

packages/skia/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"android-arm64-v8a": "6be2711ca4c31523d381420e98cabfe7e7939e246975c7b427968d5dd3b62be9",
2727
"android-x86": "888934ddc34f431c7fac5628f633dc11a4e84d68c41adb33307ae7586cc7b0b5",
2828
"android-x86_64": "2180a5be52d51bbf1dabaf95051ed0ce422b047157bcda6e486657c2c7b87ceb",
29-
"apple-xcframeworks": "cb50d9c85c9f02389ecc433912145e4a7ce2277bfe26a69dd7f7a9db74c9e276"
29+
"apple-xcframeworks": "6c9e4c565977acaf9d4f4b113050cfe8f9804602fd3cd4ec982c605fa7b040e6"
3030
}
3131
},
3232
"description": "High-performance React Native Graphics using Skia",

0 commit comments

Comments
 (0)