codeplay-common 4.8.2 → 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 +20 -2
- 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.
|
|
@@ -26,12 +26,12 @@ const path = require('node:path');
|
|
|
26
26
|
const readline = require('node:readline/promises');
|
|
27
27
|
const { spawn, spawnSync } = require('node:child_process');
|
|
28
28
|
const sharp = require('sharp');
|
|
29
|
-
const { frameStyles, createFrameSamples } = require('./scripts
|
|
29
|
+
const { frameStyles, createFrameSamples } = require('./scripts/screenshot/frame-samples.js');
|
|
30
30
|
const {
|
|
31
31
|
getDecorationSeed,
|
|
32
32
|
createPromotionalDecorations,
|
|
33
33
|
getPromotionalDecorationStyles,
|
|
34
|
-
} = require('./scripts
|
|
34
|
+
} = require('./scripts/screenshot/background-decorations.js');
|
|
35
35
|
|
|
36
36
|
const screenshotDirectory = path.join(__dirname, 'Auto-Screenshot', 'Store-image-Screenshot');
|
|
37
37
|
const inFrameDirectory = path.join(__dirname, 'Auto-Screenshot', 'Store-image-Frame');
|
|
@@ -727,6 +727,20 @@ function deleteMatchingImages(input) {
|
|
|
727
727
|
for (const filePath of deletedFiles) console.log(`Deleted: ${filePath}`);
|
|
728
728
|
}
|
|
729
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
|
+
|
|
730
744
|
function readScreenshotRecordSource(filePath) {
|
|
731
745
|
if (!fs.existsSync(filePath)) return { screenshots: {} };
|
|
732
746
|
|
|
@@ -3793,6 +3807,10 @@ async function main() {
|
|
|
3793
3807
|
|
|
3794
3808
|
options = await getInteractiveOptions(options);
|
|
3795
3809
|
|
|
3810
|
+
if (!options.dryRun) {
|
|
3811
|
+
initializeScreenshotData();
|
|
3812
|
+
}
|
|
3813
|
+
|
|
3796
3814
|
if (!options.dryRun && !options.refreshInfo) {
|
|
3797
3815
|
reconcileScreenshotRecords();
|
|
3798
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);
|