codeplay-common 4.11.34 → 4.11.37
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/CHANGELOG.md +115 -115
- package/LICENSE +21 -21
- package/README.md +6 -0
- package/RELEASE_NOTES.md +110 -110
- package/files/buildCodeplay/HUAWEI-PRIVACY.md +9 -9
- package/files/buildCodeplay/add-splash-screen.js +256 -256
- package/files/buildCodeplay/apk-store-builder.js +97 -97
- package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
- package/files/buildCodeplay/fix-optimize-builld/android-r8-rules.cjs +31 -31
- package/files/buildCodeplay/fix-optimize-builld/ffmpeg-jni-rules.cjs +28 -28
- package/files/buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle +9 -9
- package/files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs +30 -30
- package/files/buildCodeplay/huawei-privacy.cjs +102 -92
- package/files/buildCodeplay/iap-alias.cjs +116 -108
- package/files/buildCodeplay/ios-emi-admob-modification.js +24 -24
- package/files/buildCodeplay/manifestModification.js +38 -38
- package/files/buildCodeplay/migrate-system-bars.cjs +122 -122
- package/files/buildCodeplay/packageidBaseModification.js +528 -528
- package/files/buildCodeplay/project-scripts.cjs +69 -69
- package/files/buildCodeplay/ruads.cjs +10 -1
- package/files/buildCodeplay/setSplashAnimation.js +228 -228
- package/files/buildCodeplay/setup-ruads.cjs +9 -2
- package/files/buildCodeplay/splash-setup.cjs +88 -88
- package/files/buildCodeplay/splashxml/codeplay_splashScreen.xml +11 -11
- package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
- package/files/buildCodeplay/tests/huawei-live-reload.test.cjs +60 -0
- package/files/buildCodeplay/tests/huawei-multiple-entries.test.cjs +80 -0
- package/files/buildCodeplay/tests/huawei-vite.test.cjs +38 -35
- package/files/buildCodeplay/versions.json +28 -28
- package/files/finalrelease +1365 -1365
- package/files/generate-ai-promo-video.js +23 -23
- package/files/ionic.config.json +6 -6
- package/files/scripts-common/run-codeplay-sync-after.js +21 -21
- package/files/scripts-common/screenshot/background-decorations.js +120 -120
- package/files/scripts-common/screenshot/frame-samples.js +117 -117
- package/files/scripts-common/setup-baseline-profile.js +291 -291
- package/files/take-screen-video.js +644 -644
- package/package.json +1 -1
- package/runtime/splash-ready.mjs +52 -52
- package/scripts/iap-alias.test.cjs +117 -78
- package/scripts/ruads-install.test.cjs +20 -3
- package/scripts/splash-setup.test.cjs +142 -142
- package/scripts/sync-files.js +119 -119
- package/scripts/system-bars-package.test.cjs +37 -37
- package/scripts/system-bars.test.cjs +93 -93
- package/scripts/uninstall.js +2 -2
- package/scripts/vite-build-settings.test.cjs +1 -0
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
const { test } = require('node:test');
|
|
2
|
-
const assert = require('node:assert/strict');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { migrateSystemBars, auditLegacyStatusBar, migrateLegacyStatusBar } = require('../files/buildCodeplay/migrate-system-bars.cjs');
|
|
6
|
-
|
|
7
|
-
function fixture() {
|
|
8
|
-
const base = path.resolve(process.env.CODEPLAY_TEST_ROOT || path.join(__dirname, '../agent-temp'));
|
|
9
|
-
fs.mkdirSync(base, { recursive: true });
|
|
10
|
-
const root = fs.mkdtempSync(path.join(base, 'system-bars-'));
|
|
11
|
-
const write = (relative, content) => {
|
|
12
|
-
const file = path.join(root, relative);
|
|
13
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
14
|
-
fs.writeFileSync(file, content);
|
|
15
|
-
};
|
|
16
|
-
write('package.json', JSON.stringify({ name: 'fixture', dependencies: { '@capacitor/status-bar': '^8.0.4' } }));
|
|
17
|
-
return { root, write };
|
|
18
|
-
}
|
|
19
|
-
const modern = 'import {SystemBars,SystemBarType} from "@capacitor/core"; SystemBars.setStyle({style:"DARK",bar:SystemBarType.StatusBar});';
|
|
20
|
-
|
|
21
|
-
test('copied helper resolves the package-owned parser in a nested npm layout', async () => {
|
|
22
|
-
const { root, write } = fixture();
|
|
23
|
-
write('src/app.js', modern + '\n/* StatusBar.hide(); */');
|
|
24
|
-
write('node_modules/codeplay-common/package.json', JSON.stringify({ name: 'codeplay-common' }));
|
|
25
|
-
const parserPath = require.resolve('terser');
|
|
26
|
-
write('node_modules/codeplay-common/node_modules/terser/index.js',
|
|
27
|
-
`module.exports = require(${JSON.stringify(parserPath)});`);
|
|
28
|
-
const copiedHelper = path.join(root, 'buildCodeplay/migrate-system-bars.cjs');
|
|
29
|
-
write('buildCodeplay/migrate-system-bars.cjs',
|
|
30
|
-
fs.readFileSync(path.join(__dirname, '../files/buildCodeplay/migrate-system-bars.cjs'), 'utf8'));
|
|
31
|
-
const { auditLegacyStatusBar: auditCopiedHelper } = require(copiedHelper);
|
|
32
|
-
assert.equal((await auditCopiedHelper(root)).status, 'unused');
|
|
33
|
-
write('src/app.js', modern + ' StatusBar.hide();');
|
|
34
|
-
assert.equal((await auditCopiedHelper(root)).status, 'retained');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('legacy dependency is removed only after confirming modern usage; native references are refreshed', async () => {
|
|
38
|
-
const { root, write } = fixture();
|
|
39
|
-
write('src/app.js', modern + '\n/* StatusBar.hide(); */');
|
|
40
|
-
assert.equal((await auditLegacyStatusBar(root)).status, 'unused');
|
|
41
|
-
write('android/capacitor.settings.gradle', "include ':capacitor-status-bar'\n");
|
|
42
|
-
write('ios/App/Podfile', "# App pods\n pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'\n pod 'CapacitorApp'\n");
|
|
43
|
-
const commands = [];
|
|
44
|
-
const result = await migrateLegacyStatusBar(root, { runNpm: command => commands.push(command) });
|
|
45
|
-
assert.equal(result.status, 'removed');
|
|
46
|
-
assert.deepEqual(commands, ['npm uninstall @capacitor/status-bar --ignore-scripts --no-audit --no-fund', 'npx --no-install cap update android']);
|
|
47
|
-
assert.equal(fs.readFileSync(path.join(root, 'ios/App/Podfile'), 'utf8'), "# App pods\n pod 'CapacitorApp'\n");
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
for (const [name, code] of [
|
|
51
|
-
['active import', modern + 'import {StatusBar} from "@capacitor/status-bar"; StatusBar.hide();'],
|
|
52
|
-
['URL followed by a legacy call', modern + 'const url="https://localhost"; StatusBar.hide();'],
|
|
53
|
-
['unparseable code', modern + 'const invalid=;'],
|
|
54
|
-
['no confirmed replacement API', 'console.log("app");']
|
|
55
|
-
]) {
|
|
56
|
-
test(`preserves dependency for ${name}`, async () => {
|
|
57
|
-
const { root, write } = fixture();
|
|
58
|
-
write('src/app.js', code);
|
|
59
|
-
const result = await migrateLegacyStatusBar(root, { runNpm: () => assert.fail('must retain the dependency') });
|
|
60
|
-
assert.equal(result.status, 'retained');
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
test('Framework7 script handling ignores old generated diagnostics and retains custom native registration', async () => {
|
|
65
|
-
const { root, write } = fixture();
|
|
66
|
-
write('src/page.f7', `<template><div></div></template><script>${modern}</script>`);
|
|
67
|
-
write('src/agent-temp/old.js', 'StatusBar.hide();');
|
|
68
|
-
assert.equal((await auditLegacyStatusBar(root)).status, 'unused');
|
|
69
|
-
write('android/app/src/main/java/App.java', 'bridge.registerPlugin(StatusBarPlugin.class);');
|
|
70
|
-
assert.equal((await auditLegacyStatusBar(root)).status, 'retained');
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test('native patch preserves surrounding code, is idempotent, and fails closed for unexpected sources', () => {
|
|
74
|
-
const { root, write } = fixture();
|
|
75
|
-
const relative = 'node_modules/capacitor-codeplay-system-bars/android/src/main/java/com/codeplay/systembars/CodeplaySystemBarsPlugin.java';
|
|
76
|
-
const original = 'controller.setAppearanceLightNavigationBars(useDarkIcons);\r\n window.setNavigationBarColor(Color.TRANSPARENT);\r\nwindow.getDecorView().post(this::updateNavigationBarProtection);\r\n';
|
|
77
|
-
write(relative, original);
|
|
78
|
-
assert.equal(migrateSystemBars(root), true);
|
|
79
|
-
const patched = fs.readFileSync(path.join(root, relative), 'utf8');
|
|
80
|
-
assert(patched.includes('Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM'));
|
|
81
|
-
assert(patched.startsWith(original.split('\r\n')[0] + '\r\n'));
|
|
82
|
-
assert(patched.endsWith(original.split('\r\n').slice(-2).join('\r\n')));
|
|
83
|
-
assert.equal(migrateSystemBars(root), false);
|
|
84
|
-
assert.equal(fs.readFileSync(path.join(root, relative), 'utf8'), patched);
|
|
85
|
-
write(relative, 'unexpected implementation');
|
|
86
|
-
assert.throws(() => migrateSystemBars(root), /structure changed/);
|
|
87
|
-
assert.equal(fs.readFileSync(path.join(root, relative), 'utf8'), 'unexpected implementation');
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test('missing navigation-bar plugin is allowed during installation', () => {
|
|
91
|
-
const { root } = fixture();
|
|
92
|
-
assert.equal(migrateSystemBars(root), false);
|
|
93
|
-
});
|
|
1
|
+
const { test } = require('node:test');
|
|
2
|
+
const assert = require('node:assert/strict');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { migrateSystemBars, auditLegacyStatusBar, migrateLegacyStatusBar } = require('../files/buildCodeplay/migrate-system-bars.cjs');
|
|
6
|
+
|
|
7
|
+
function fixture() {
|
|
8
|
+
const base = path.resolve(process.env.CODEPLAY_TEST_ROOT || path.join(__dirname, '../agent-temp'));
|
|
9
|
+
fs.mkdirSync(base, { recursive: true });
|
|
10
|
+
const root = fs.mkdtempSync(path.join(base, 'system-bars-'));
|
|
11
|
+
const write = (relative, content) => {
|
|
12
|
+
const file = path.join(root, relative);
|
|
13
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
14
|
+
fs.writeFileSync(file, content);
|
|
15
|
+
};
|
|
16
|
+
write('package.json', JSON.stringify({ name: 'fixture', dependencies: { '@capacitor/status-bar': '^8.0.4' } }));
|
|
17
|
+
return { root, write };
|
|
18
|
+
}
|
|
19
|
+
const modern = 'import {SystemBars,SystemBarType} from "@capacitor/core"; SystemBars.setStyle({style:"DARK",bar:SystemBarType.StatusBar});';
|
|
20
|
+
|
|
21
|
+
test('copied helper resolves the package-owned parser in a nested npm layout', async () => {
|
|
22
|
+
const { root, write } = fixture();
|
|
23
|
+
write('src/app.js', modern + '\n/* StatusBar.hide(); */');
|
|
24
|
+
write('node_modules/codeplay-common/package.json', JSON.stringify({ name: 'codeplay-common' }));
|
|
25
|
+
const parserPath = require.resolve('terser');
|
|
26
|
+
write('node_modules/codeplay-common/node_modules/terser/index.js',
|
|
27
|
+
`module.exports = require(${JSON.stringify(parserPath)});`);
|
|
28
|
+
const copiedHelper = path.join(root, 'buildCodeplay/migrate-system-bars.cjs');
|
|
29
|
+
write('buildCodeplay/migrate-system-bars.cjs',
|
|
30
|
+
fs.readFileSync(path.join(__dirname, '../files/buildCodeplay/migrate-system-bars.cjs'), 'utf8'));
|
|
31
|
+
const { auditLegacyStatusBar: auditCopiedHelper } = require(copiedHelper);
|
|
32
|
+
assert.equal((await auditCopiedHelper(root)).status, 'unused');
|
|
33
|
+
write('src/app.js', modern + ' StatusBar.hide();');
|
|
34
|
+
assert.equal((await auditCopiedHelper(root)).status, 'retained');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('legacy dependency is removed only after confirming modern usage; native references are refreshed', async () => {
|
|
38
|
+
const { root, write } = fixture();
|
|
39
|
+
write('src/app.js', modern + '\n/* StatusBar.hide(); */');
|
|
40
|
+
assert.equal((await auditLegacyStatusBar(root)).status, 'unused');
|
|
41
|
+
write('android/capacitor.settings.gradle', "include ':capacitor-status-bar'\n");
|
|
42
|
+
write('ios/App/Podfile', "# App pods\n pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'\n pod 'CapacitorApp'\n");
|
|
43
|
+
const commands = [];
|
|
44
|
+
const result = await migrateLegacyStatusBar(root, { runNpm: command => commands.push(command) });
|
|
45
|
+
assert.equal(result.status, 'removed');
|
|
46
|
+
assert.deepEqual(commands, ['npm uninstall @capacitor/status-bar --ignore-scripts --no-audit --no-fund', 'npx --no-install cap update android']);
|
|
47
|
+
assert.equal(fs.readFileSync(path.join(root, 'ios/App/Podfile'), 'utf8'), "# App pods\n pod 'CapacitorApp'\n");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
for (const [name, code] of [
|
|
51
|
+
['active import', modern + 'import {StatusBar} from "@capacitor/status-bar"; StatusBar.hide();'],
|
|
52
|
+
['URL followed by a legacy call', modern + 'const url="https://localhost"; StatusBar.hide();'],
|
|
53
|
+
['unparseable code', modern + 'const invalid=;'],
|
|
54
|
+
['no confirmed replacement API', 'console.log("app");']
|
|
55
|
+
]) {
|
|
56
|
+
test(`preserves dependency for ${name}`, async () => {
|
|
57
|
+
const { root, write } = fixture();
|
|
58
|
+
write('src/app.js', code);
|
|
59
|
+
const result = await migrateLegacyStatusBar(root, { runNpm: () => assert.fail('must retain the dependency') });
|
|
60
|
+
assert.equal(result.status, 'retained');
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
test('Framework7 script handling ignores old generated diagnostics and retains custom native registration', async () => {
|
|
65
|
+
const { root, write } = fixture();
|
|
66
|
+
write('src/page.f7', `<template><div></div></template><script>${modern}</script>`);
|
|
67
|
+
write('src/agent-temp/old.js', 'StatusBar.hide();');
|
|
68
|
+
assert.equal((await auditLegacyStatusBar(root)).status, 'unused');
|
|
69
|
+
write('android/app/src/main/java/App.java', 'bridge.registerPlugin(StatusBarPlugin.class);');
|
|
70
|
+
assert.equal((await auditLegacyStatusBar(root)).status, 'retained');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('native patch preserves surrounding code, is idempotent, and fails closed for unexpected sources', () => {
|
|
74
|
+
const { root, write } = fixture();
|
|
75
|
+
const relative = 'node_modules/capacitor-codeplay-system-bars/android/src/main/java/com/codeplay/systembars/CodeplaySystemBarsPlugin.java';
|
|
76
|
+
const original = 'controller.setAppearanceLightNavigationBars(useDarkIcons);\r\n window.setNavigationBarColor(Color.TRANSPARENT);\r\nwindow.getDecorView().post(this::updateNavigationBarProtection);\r\n';
|
|
77
|
+
write(relative, original);
|
|
78
|
+
assert.equal(migrateSystemBars(root), true);
|
|
79
|
+
const patched = fs.readFileSync(path.join(root, relative), 'utf8');
|
|
80
|
+
assert(patched.includes('Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM'));
|
|
81
|
+
assert(patched.startsWith(original.split('\r\n')[0] + '\r\n'));
|
|
82
|
+
assert(patched.endsWith(original.split('\r\n').slice(-2).join('\r\n')));
|
|
83
|
+
assert.equal(migrateSystemBars(root), false);
|
|
84
|
+
assert.equal(fs.readFileSync(path.join(root, relative), 'utf8'), patched);
|
|
85
|
+
write(relative, 'unexpected implementation');
|
|
86
|
+
assert.throws(() => migrateSystemBars(root), /structure changed/);
|
|
87
|
+
assert.equal(fs.readFileSync(path.join(root, relative), 'utf8'), 'unexpected implementation');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('missing navigation-bar plugin is allowed during installation', () => {
|
|
91
|
+
const { root } = fixture();
|
|
92
|
+
assert.equal(migrateSystemBars(root), false);
|
|
93
|
+
});
|
package/scripts/uninstall.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Preserve working app files during preinstall. Postinstall migrates commands
|
|
2
|
-
// first, then removes only recognized copied build scripts.
|
|
1
|
+
// Preserve working app files during preinstall. Postinstall migrates commands
|
|
2
|
+
// first, then removes only recognized copied build scripts.
|
|
3
3
|
console.log('codeplay-common: preserving app files until installation completes.');
|
|
@@ -47,6 +47,7 @@ test('installer and before-build preserve build settings for object/function/def
|
|
|
47
47
|
const resolved = await configure({ mode: 'production' });
|
|
48
48
|
assert.deepEqual(resolved.build, { ...build, rollupOptions: { ...build.rollupOptions, treeshake: true } });
|
|
49
49
|
assert.equal(resolved.define.custom, 'true');
|
|
50
|
+
assert.equal(resolved.resolve.alias['/buildCodeplay'], path.join(f.root, 'buildCodeplay'));
|
|
50
51
|
assert.equal(resolved.define['import.meta.env.VITE_STORE_ID'], JSON.stringify(store));
|
|
51
52
|
assert.equal(resolved.resolve.alias['@admob'], store === '1' ? '/original-admob.js' : path.join(f.root, 'src/js/Ads/vk-ads-1.3/vk-ads.js'));
|
|
52
53
|
}
|