@krx3d/tizentubekrx 1.15.15 → 1.15.19

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.
@@ -1,15 +1,15 @@
1
- name: Build & Publish to npm (install mods deps + polyfills)
1
+ name: Build and publish on release
2
2
 
3
3
  on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
+ release:
8
+ types: [published]
7
9
 
8
10
  jobs:
9
11
  build-and-publish:
10
12
  runs-on: ubuntu-latest
11
- env:
12
- NODE_OPTIONS: --max_old_space_size=4096
13
13
 
14
14
  steps:
15
15
  - name: Checkout repository
@@ -19,178 +19,52 @@ jobs:
19
19
  uses: actions/setup-node@v4
20
20
  with:
21
21
  node-version: 20
22
- registry-url: 'https://registry.npmjs.org/'
22
+ registry-url: https://registry.npmjs.org/
23
23
 
24
- - name: Show repo top-level files for debugging
25
- run: |
26
- echo "=== root files ==="
27
- ls -la
28
-
29
- - name: Install dependencies for mods (if present)
24
+ # ----------------------------
25
+ # Build mods (userScript.js)
26
+ # ----------------------------
27
+ - name: Install mods dependencies
30
28
  run: |
31
29
  set -euo pipefail
32
- if [ -f mods/package.json ]; then
33
- echo "Installing mods deps using mods/package-lock.json (if present)..."
34
- # Prefer npm ci in mods (fast, reproducible). Falls back to npm install if no lockfile.
35
- if [ -f mods/package-lock.json ]; then
36
- npm ci --prefix mods
37
- else
38
- npm install --prefix mods
39
- fi
40
- echo "mods/node_modules installed"
41
- ls -la mods/node_modules | sed -n '1,200p' || true
42
- else
43
- echo "No mods/package.json found — skipping."
44
- fi
30
+ cd mods
31
+ npm ci
45
32
 
46
- - name: Install dependencies for service (if present)
33
+ - name: Build mods (rollup)
47
34
  run: |
48
35
  set -euo pipefail
49
- if [ -f service/package.json ]; then
50
- echo "Installing service deps using service/package-lock.json (if present)..."
51
- if [ -f service/package-lock.json ]; then
52
- npm ci --prefix service
53
- else
54
- npm install --prefix service
55
- fi
56
- echo "service/node_modules installed"
57
- ls -la service/node_modules | sed -n '1,200p' || true
58
- else
59
- echo "No service/package.json found — skipping."
60
- fi
36
+ cd mods
37
+ npx rollup -c
61
38
 
62
- - name: Install bundlers/tools (esbuild + ncc) at repo root
39
+ # ----------------------------
40
+ # Build service (service.js)
41
+ # ----------------------------
42
+ - name: Install service dependencies
63
43
  run: |
64
44
  set -euo pipefail
65
- # Install tooling locally in runner (no-save so package.json not changed)
66
- npm install --no-save esbuild @vercel/ncc
67
-
68
- - name: Dump mods/ file list and show userScript head (debug)
69
- run: |
70
- echo "=== mods/ files ==="
71
- ls -la mods || true
72
- echo "=== first lines of mods/userScript.js ==="
73
- if [ -f mods/userScript.js ]; then
74
- sed -n '1,120p' mods/userScript.js || true
75
- else
76
- echo "mods/userScript.js missing"
77
- exit 1
78
- fi
45
+ cd service
46
+ npm ci
79
47
 
80
- - name: Fetch polyfills & prepare tmp entry (strip poly imports & rewrite relative imports)
48
+ - name: Build service (rollup)
81
49
  run: |
82
50
  set -euo pipefail
83
- mkdir -p tmp dist
84
-
85
- # Fetch polyfills from unpkg (adjust pinned versions if you prefer)
86
- curl -fsSL https://unpkg.com/whatwg-fetch/dist/fetch.umd.js -o tmp/whatwg-fetch.umd.js || true
87
- curl -fsSL https://unpkg.com/core-js-bundle@3.32.2/minified.js -o tmp/core-js-bundle.min.js || true
88
-
89
- # formatjs iife bundles often are not exported via package exports; try CDN fallback
90
- curl -fsSL https://unpkg.com/@formatjs/intl-getcanonicallocales@latest/polyfill.iife.js -o tmp/intl-getcanonicallocales.polyfill.iife.js || true
91
- curl -fsSL https://unpkg.com/@formatjs/intl-locale@latest/polyfill.iife.js -o tmp/intl-locale.polyfill.iife.js || true
92
- curl -fsSL https://unpkg.com/@formatjs/intl-displaynames@latest/polyfill.iife.js -o tmp/intl-displaynames.polyfill.iife.js || true
93
- curl -fsSL https://unpkg.com/@formatjs/intl-displaynames@latest/locale-data/en.js -o tmp/intl-displaynames.locale-data.en.js || true
51
+ cd service
52
+ npx rollup -c
94
53
 
95
- # Concatenate what we downloaded (safe even if parts are missing)
96
- cat tmp/whatwg-fetch.umd.js tmp/core-js-bundle.min.js tmp/intl-getcanonicallocales.polyfill.iife.js tmp/intl-locale.polyfill.iife.js tmp/intl-displaynames.polyfill.iife.js tmp/intl-displaynames.locale-data.en.js > tmp/polyfills.js || true
97
- echo "Polyfills length bytes:"
98
- wc -c tmp/polyfills.js || true
99
-
100
- # Create temporary entry:
101
- # 1) remove imports that reference the polyfills we fetched above (case-insensitive)
102
- # 2) rewrite relative imports "./..." to "../mods/..." so esbuild resolves modules from mods/
103
- sed -E '/import .*whatwg-fetch|import .*core-js|import .*@formatjs\/intl-getcanonicallocales|import .*@formatjs\/intl-locale|import .*@formatjs\/intl-displaynames|@formatjs\/intl-displaynames\/locale-data/Id' mods/userScript.js > tmp/userScript.entry.step1.js
104
-
105
- # Convert import "./path/..." to import "../mods/path/..." to keep original import graph but resolvable from tmp/
106
- sed -E "s|import[[:space:]]+\"\\./([^\"]+)\"|import \"../mods/\\1\"|g; s|import[[:space:]]+'\\./([^']+)'|import '../mods/\\1'|g" tmp/userScript.entry.step1.js > tmp/userScript.entry.js
107
-
108
- echo "tmp/userScript.entry.js head:"
109
- sed -n '1,120p' tmp/userScript.entry.js || true
110
-
111
- - name: Bundle userScript (esbuild) and produce dist/userScript.js
54
+ # ----------------------------
55
+ # Verify output
56
+ # ----------------------------
57
+ - name: Verify dist output
112
58
  run: |
113
59
  set -euo pipefail
114
- mkdir -p tmp dist
115
- # bundle using esbuild
116
- npx esbuild tmp/userScript.entry.js \
117
- --bundle \
118
- --platform=browser \
119
- --format=iife \
120
- --minify \
121
- --outfile=tmp/bundle.userScript.js \
122
- --banner:js="(function(){if(window.__TIZENTUBE_INJECT_LOADED)return;window.__TIZENTUBE_INJECT_LOADED=true;" \
123
- --footer:js="})();"
124
-
125
- # prepend polyfills if present
126
- if [ -s tmp/polyfills.js ]; then
127
- cat tmp/polyfills.js tmp/bundle.userScript.js > dist/userScript.js
128
- else
129
- cp tmp/bundle.userScript.js dist/userScript.js
130
- fi
131
-
132
- echo "Built dist/userScript.js (size):"
133
- ls -lh dist/userScript.js || true
134
- head -n 8 dist/userScript.js || true
135
-
136
- - name: Auto-detect service entry and bundle with ncc
137
- id: detect_service
138
- run: |
139
- set -euo pipefail
140
- # Find a service entry candidate
141
- ENTRY=""
142
- if [ -d service ]; then
143
- for cand in index.js main.js service.js app.js server.js start.js; do
144
- if [ -f "service/$cand" ]; then
145
- ENTRY="service/$cand"
146
- break
147
- fi
148
- done
149
- if [ -z "$ENTRY" ]; then
150
- # fallback: first .js file found in service/
151
- ENTRY=$(find service -maxdepth 1 -type f -name '*.js' | head -n1 || true)
152
- fi
153
- fi
154
- if [ -z "$ENTRY" ]; then
155
- echo "No service entry detected; skipping service bundle"
156
- echo "::set-output name=service_entry::"
157
- exit 0
158
- fi
159
- echo "Detected service entry: $ENTRY"
160
- echo "::set-output name=service_entry::$ENTRY"
161
-
162
- - name: Bundle service if detected
163
- run: |
164
- set -euo pipefail
165
- SERVICE_ENTRY="${{ steps.detect_service.outputs.service_entry }}"
166
- if [ -z "$SERVICE_ENTRY" ]; then
167
- echo "No service entry - skipping bundle"
168
- exit 0
169
- fi
170
- echo "Bundling service from $SERVICE_ENTRY"
171
- npx @vercel/ncc build "$SERVICE_ENTRY" -o dist_tmp
172
- mv dist_tmp/index.js dist/service.js
173
- rm -rf dist_tmp
174
- echo "Built dist/service.js (size):"
175
- ls -lh dist/service.js || true
176
- head -n 8 dist/service.js || true
177
-
178
- - name: Verify dist outputs
179
- run: |
180
- set -euo pipefail
181
- if [ ! -f dist/userScript.js ]; then echo "dist/userScript.js missing" >&2; exit 1; fi
182
- # service may be optional for some forks; only fail if service/package.json existed
183
- if [ -f service/package.json ] && [ ! -f dist/service.js ]; then
184
- echo "dist/service.js missing although service/package.json present" >&2
185
- exit 1
186
- fi
187
- echo "✅ dist ready"
188
-
189
- - name: Show dist contents
190
- run: ls -la dist || true
191
-
192
- - name: Publish to npm
193
- if: github.ref == 'refs/heads/main'
194
- run: npm publish --access public
60
+ ls -lh dist
61
+ test -f dist/userScript.js
62
+ test -f dist/service.js
63
+
64
+ # ----------------------------
65
+ # Publish to npm
66
+ # ----------------------------
67
+ - name: Publish package
68
+ run: npm publish
195
69
  env:
196
70
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}