codeplay-common 4.8.1 → 4.8.3
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/README.md +15 -0
- package/files/take-screen-image.js +50 -13
- package/package.json +1 -1
- package/scripts/sync-files.js +2 -0
- package/scripts/uninstall.js +15 -1
- package/files/scripts-screenshot/screenshot/screenshot-copy.json +0 -3
- package/files/scripts-screenshot/screenshot/screenshot-info.json +0 -1737
- /package/files/{scripts-screenshot → scripts}/screenshot/background-decorations.js +0 -0
- /package/files/{scripts-screenshot → scripts}/screenshot/frame-samples.js +0 -0
package/README.md
CHANGED
|
@@ -33,6 +33,21 @@ If `onesignal-cordova-plugin` is declared or installed, the pre-build script war
|
|
|
33
33
|
runs `npm uninstall onesignal-cordova-plugin`. It stops if removal fails or active
|
|
34
34
|
package imports remain. Legacy OneSignal patching and helper downloads are disabled.
|
|
35
35
|
|
|
36
|
+
## Screenshot data
|
|
37
|
+
|
|
38
|
+
Shared screenshot helpers are installed into `scripts/screenshot/` and updated with
|
|
39
|
+
the package. App-specific data is not bundled with the package.
|
|
40
|
+
During an upgrade, cleanup removes only the two legacy helpers `frame-samples.js`
|
|
41
|
+
and `background-decorations.js` from `scripts-screenshot/screenshot/`, preserving
|
|
42
|
+
the folder, JSON data, and other app files.
|
|
43
|
+
|
|
44
|
+
`take-screen-image.js` creates `scripts-screenshot/screenshot/` and empty
|
|
45
|
+
`screenshot-copy.json` and `screenshot-info.json` files when needed. Existing files
|
|
46
|
+
are preserved during initialization, package installation, and cleanup. Capture
|
|
47
|
+
updates screenshot information; the AI text-generation workflow fills screenshot
|
|
48
|
+
copy. `--delete` removes matching records, and screenshot runs reconcile records
|
|
49
|
+
against the captured images (except dry runs and `--refresh-info`).
|
|
50
|
+
|
|
36
51
|
## Agent instructions
|
|
37
52
|
|
|
38
53
|
Agent instructions are updated during `npm run build`, not during npm installation.
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
//node take-screen-image.js --profiles vivo-store //only taking screenshot for vivo-store - Not only vivo, we can do this to all of our store images.
|
|
4
4
|
//node take-screen-image.js --vivo-existing //Used if we already took the screenshot and those vivo screenshots are not there then execute this to resize the screenshot for vivo store.
|
|
5
5
|
//node take-screen-image.js --oppo-existing //Used if we already took the screenshot and those oppo screenshots are not there then execute this to resize the screenshot for Oppo store.
|
|
6
|
+
//node take-screen-image.js --profiles iphone,iphone-duo,ipad //Capture current App Store sizes; iPhone-Duo uses the 2007x2853 inner display.
|
|
7
|
+
//Apple also accepts 1398x2034 for the Duo outer display. This profile captures the inner display only.
|
|
8
|
+
//New captures create iPhone-Duo folders automatically. Reframing existing files does not recapture responsive UI at the new viewport sizes.
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
/*
|
|
@@ -23,12 +26,12 @@ const path = require('node:path');
|
|
|
23
26
|
const readline = require('node:readline/promises');
|
|
24
27
|
const { spawn, spawnSync } = require('node:child_process');
|
|
25
28
|
const sharp = require('sharp');
|
|
26
|
-
const { frameStyles, createFrameSamples } = require('./scripts
|
|
29
|
+
const { frameStyles, createFrameSamples } = require('./scripts/screenshot/frame-samples.js');
|
|
27
30
|
const {
|
|
28
31
|
getDecorationSeed,
|
|
29
32
|
createPromotionalDecorations,
|
|
30
33
|
getPromotionalDecorationStyles,
|
|
31
|
-
} = require('./scripts
|
|
34
|
+
} = require('./scripts/screenshot/background-decorations.js');
|
|
32
35
|
|
|
33
36
|
const screenshotDirectory = path.join(__dirname, 'Auto-Screenshot', 'Store-image-Screenshot');
|
|
34
37
|
const inFrameDirectory = path.join(__dirname, 'Auto-Screenshot', 'Store-image-Frame');
|
|
@@ -158,14 +161,28 @@ const deviceProfiles = [
|
|
|
158
161
|
},
|
|
159
162
|
{
|
|
160
163
|
name: 'iphone',
|
|
161
|
-
label: 'iPhone
|
|
164
|
+
label: 'iPhone Dynamic Island medium-display App Store viewport',
|
|
162
165
|
outputDirectory: 'iPhone',
|
|
163
166
|
frameType: 'iphone',
|
|
164
|
-
width:
|
|
165
|
-
height:
|
|
167
|
+
width: 402,
|
|
168
|
+
height: 874,
|
|
166
169
|
deviceScaleFactor: 3,
|
|
167
|
-
framedWidth:
|
|
168
|
-
framedHeight:
|
|
170
|
+
framedWidth: 1206,
|
|
171
|
+
framedHeight: 2622,
|
|
172
|
+
orientationSensitive: true,
|
|
173
|
+
mobile: true,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'iphone-duo',
|
|
177
|
+
label: 'iPhone Duo inner-display App Store viewport (generic frame)',
|
|
178
|
+
outputDirectory: 'iPhone-Duo',
|
|
179
|
+
frameType: 'iphone',
|
|
180
|
+
showDynamicIsland: false,
|
|
181
|
+
width: 669,
|
|
182
|
+
height: 951,
|
|
183
|
+
deviceScaleFactor: 3,
|
|
184
|
+
framedWidth: 2007,
|
|
185
|
+
framedHeight: 2853,
|
|
169
186
|
orientationSensitive: true,
|
|
170
187
|
mobile: true,
|
|
171
188
|
},
|
|
@@ -195,12 +212,13 @@ const deviceProfiles = [
|
|
|
195
212
|
},
|
|
196
213
|
{
|
|
197
214
|
name: 'iphone-store',
|
|
198
|
-
label: 'iPhone App Store screenshot set',
|
|
215
|
+
label: 'iPhone Dynamic Island medium-display App Store screenshot set',
|
|
199
216
|
outputDirectory: 'iPhone-Store',
|
|
200
217
|
frameType: 'iphone',
|
|
201
|
-
width:
|
|
202
|
-
height:
|
|
218
|
+
width: 402,
|
|
219
|
+
height: 874,
|
|
203
220
|
deviceScaleFactor: 3,
|
|
221
|
+
orientationSensitive: true,
|
|
204
222
|
mobile: true,
|
|
205
223
|
screenshotOnly: true,
|
|
206
224
|
},
|
|
@@ -586,6 +604,7 @@ function printHelp() {
|
|
|
586
604
|
console.log('Usage:');
|
|
587
605
|
console.log(' node take-screen-image.js');
|
|
588
606
|
console.log(' node take-screen-image.js --profiles iphone,ipad');
|
|
607
|
+
console.log(' node take-screen-image.js --profiles iphone,iphone-duo,ipad');
|
|
589
608
|
console.log(' node take-screen-image.js --android-frame graphite --ios-frame titanium');
|
|
590
609
|
console.log(' node take-screen-image.js --prefix home --profiles android-phone,ipad');
|
|
591
610
|
console.log(' node take-screen-image.js --frame-existing');
|
|
@@ -708,6 +727,20 @@ function deleteMatchingImages(input) {
|
|
|
708
727
|
for (const filePath of deletedFiles) console.log(`Deleted: ${filePath}`);
|
|
709
728
|
}
|
|
710
729
|
|
|
730
|
+
function initializeScreenshotData() {
|
|
731
|
+
for (const [filePath, version] of [
|
|
732
|
+
[screenshotCopyPath, 1],
|
|
733
|
+
[screenshotInfoPath, 2],
|
|
734
|
+
]) {
|
|
735
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
736
|
+
try {
|
|
737
|
+
fs.writeFileSync(filePath, `${JSON.stringify({ version, screenshots: {} }, null, 2)}\n`, { flag: 'wx' });
|
|
738
|
+
} catch (error) {
|
|
739
|
+
if (error.code !== 'EEXIST') throw error;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
711
744
|
function readScreenshotRecordSource(filePath) {
|
|
712
745
|
if (!fs.existsSync(filePath)) return { screenshots: {} };
|
|
713
746
|
|
|
@@ -2004,13 +2037,13 @@ function createStoreDeviceFrameHtml(
|
|
|
2004
2037
|
</html>`;
|
|
2005
2038
|
}
|
|
2006
2039
|
|
|
2007
|
-
function getPhoneStatusBar(platform, time, batteryPercentage = null) {
|
|
2040
|
+
function getPhoneStatusBar(platform, time, batteryPercentage = null, showDynamicIsland = true) {
|
|
2008
2041
|
const batteryLevel = Number.isInteger(batteryPercentage) ? batteryPercentage : 75;
|
|
2009
2042
|
|
|
2010
2043
|
if (platform === 'ios') {
|
|
2011
2044
|
return `<div class="phone-statusbar ios-statusbar">
|
|
2012
2045
|
<span class="status-time">${time}</span>
|
|
2013
|
-
<div class="dynamic-island"></div>
|
|
2046
|
+
${showDynamicIsland ? '<div class="dynamic-island"></div>' : ''}
|
|
2014
2047
|
<svg viewBox="0 0 90 28" aria-hidden="true">
|
|
2015
2048
|
<circle cx="5" cy="14" r="2" fill="currentColor" opacity="0.35"></circle><circle cx="13" cy="14" r="2" fill="currentColor" opacity="0.35"></circle>
|
|
2016
2049
|
<circle cx="21" cy="14" r="2" fill="currentColor" opacity="0.35"></circle><circle cx="29" cy="14" r="2" fill="currentColor" opacity="0.35"></circle>
|
|
@@ -2091,7 +2124,7 @@ function createDeviceFrameHtml(
|
|
|
2091
2124
|
const statusBarPlatform = profile.frameType === 'ipad' ? 'ipad' : phonePlatform;
|
|
2092
2125
|
const phoneStyle = phonePlatform && frameStyles[phonePlatform][selectedFrameStyles[phonePlatform]];
|
|
2093
2126
|
const phoneStatusBar = statusBarPlatform
|
|
2094
|
-
? getPhoneStatusBar(statusBarPlatform, displayTime, batteryPercentage)
|
|
2127
|
+
? getPhoneStatusBar(statusBarPlatform, displayTime, batteryPercentage, profile.showDynamicIsland !== false)
|
|
2095
2128
|
: '';
|
|
2096
2129
|
const phoneNavigation = phonePlatform === 'android'
|
|
2097
2130
|
? '<div class="android-navigation"><div class="gesture-pill"></div></div>'
|
|
@@ -3774,6 +3807,10 @@ async function main() {
|
|
|
3774
3807
|
|
|
3775
3808
|
options = await getInteractiveOptions(options);
|
|
3776
3809
|
|
|
3810
|
+
if (!options.dryRun) {
|
|
3811
|
+
initializeScreenshotData();
|
|
3812
|
+
}
|
|
3813
|
+
|
|
3777
3814
|
if (!options.dryRun && !options.refreshInfo) {
|
|
3778
3815
|
reconcileScreenshotRecords();
|
|
3779
3816
|
}
|
package/package.json
CHANGED
package/scripts/sync-files.js
CHANGED
|
@@ -25,6 +25,8 @@ function copyFolderSync(source, destination) {
|
|
|
25
25
|
|
|
26
26
|
// Copy all files from `common-build-files/files/` to the project root
|
|
27
27
|
fs.readdirSync(commonBuildPath).forEach(file => {
|
|
28
|
+
// Never distribute or overwrite app-owned screenshot data.
|
|
29
|
+
if (file === "scripts-screenshot") return;
|
|
28
30
|
const sourcePath = path.join(commonBuildPath, file);
|
|
29
31
|
const destPath = path.join(projectRoot, file);
|
|
30
32
|
|
package/scripts/uninstall.js
CHANGED
|
@@ -70,7 +70,8 @@ filesInProject.forEach(file => {
|
|
|
70
70
|
if (fs.existsSync(commonBuildPath)) {
|
|
71
71
|
fs.readdirSync(commonBuildPath).forEach(file => {
|
|
72
72
|
const destPath = path.join(projectRoot, file);
|
|
73
|
-
|
|
73
|
+
// Screenshot data belongs to the app, including folders from older releases.
|
|
74
|
+
if (file === "scripts" || file === "scripts-screenshot" || isAgentInstructionAsset(file)) {
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
if (fs.existsSync(destPath)) {
|
|
@@ -88,6 +89,19 @@ if (fs.existsSync(commonBuildPath)) {
|
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
for (const helperDirectory of [
|
|
93
|
+
path.join(projectRoot, "scripts", "screenshot"),
|
|
94
|
+
path.join(projectRoot, "scripts-screenshot", "screenshot")
|
|
95
|
+
]) {
|
|
96
|
+
for (const helperName of ["frame-samples.js", "background-decorations.js"]) {
|
|
97
|
+
const helperPath = path.join(helperDirectory, helperName);
|
|
98
|
+
if (fs.existsSync(helperPath)) {
|
|
99
|
+
fs.unlinkSync(helperPath);
|
|
100
|
+
process.stdout.write(`🗑️ Removed file: ${helperPath}\n`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
91
105
|
if (fs.existsSync(baselineProfileSetupScript)) {
|
|
92
106
|
try {
|
|
93
107
|
fs.unlinkSync(baselineProfileSetupScript);
|