codeplay-common 4.11.32 → 4.11.35
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 +6 -0
- package/files/buildCodeplay/codeplayBeforeBuild.js +30 -6
- package/files/buildCodeplay/disabled-ads.mjs +8 -0
- package/files/buildCodeplay/iap-alias.cjs +10 -2
- package/package.json +29 -29
- package/scripts/iap-alias.test.cjs +39 -0
- package/scripts/squeezeback-config.test.cjs +78 -0
- package/scripts/system-bars-package.test.cjs +1 -1
package/README.md
CHANGED
|
@@ -366,3 +366,9 @@ Version : 4.0.0 (Previous version 3.2.19)
|
|
|
366
366
|
3)
|
|
367
367
|
|
|
368
368
|
The fix preserves the metadata behind the release permission-check failure verified in testing. It does not guarantee every native dialog or plugin: required manifest declarations, Android permission policy, device settings and plugin-specific keep rules still apply.
|
|
369
|
+
|
|
370
|
+
## AdMob config 1.9 (4.11.33)
|
|
371
|
+
|
|
372
|
+
Before-build adds `android.squeezebackid`, `ios.squeezebackid`, `testid.squeezebackid` and the config options `squeezebackEnabled`, `squeezebackRetryIntervalMs`, `squeezebackFallbackBackgroundColor`, `squeezebackPages` and `setCoarseLocationCollectionEnabled`. Squeezeback defaults to disabled, no automatic pages, a 5000ms retry interval and blank live IDs. The Google Squeezeback test ID is supplied automatically. Existing app settings, including false and empty IDs, take priority over downloaded templates.
|
|
373
|
+
|
|
374
|
+
Coarse-location collection defaults to true at the user's request; this setting does not add or request Android location permission. Apps with existing legitimate location access must review their disclosures and consent. Squeezeback controller support requires admob-nextgen-5.0. Only apps that explicitly enable squeezebackEnabled require native capacitor-admob-nextgen >= 1.6.1-beta; other apps retain their installed native plugin. Native plugin changes require a later native sync and rebuild. Shared builds do not distribute publisher IDs or choose placements for apps.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Version 8.5: require the Squeezeback native plugin only for explicitly enabled apps.
|
|
2
|
+
// Version 8.4: migrate Squeezeback and coarse-location configuration defaults.
|
|
1
3
|
// Version 8.3: update the system-bars package to the latest npm release before migration.
|
|
2
4
|
// Version 8.2: declare the installed SAF plugin's DocumentFile dependency before native sync.
|
|
3
5
|
// Version 8.1: prevent native app startup from requesting ATT before regional consent.
|
|
@@ -3257,7 +3259,7 @@ const syncCodeplaySystemBarsPackage = () => {
|
|
|
3257
3259
|
};
|
|
3258
3260
|
|
|
3259
3261
|
const ADMOB_NEXTGEN_DEFAULTS = {
|
|
3260
|
-
VERSION: "1.
|
|
3262
|
+
VERSION: "1.9",
|
|
3261
3263
|
IAP: {
|
|
3262
3264
|
configuration: {
|
|
3263
3265
|
adFreeEntitlement: "",
|
|
@@ -3266,9 +3268,14 @@ const ADMOB_NEXTGEN_DEFAULTS = {
|
|
|
3266
3268
|
samsungPaywallProductIds: ""
|
|
3267
3269
|
}
|
|
3268
3270
|
},
|
|
3269
|
-
ios: { nativeid: "" },
|
|
3270
|
-
android: { nativeid: "" },
|
|
3271
|
+
ios: { nativeid: "", squeezebackid: "" },
|
|
3272
|
+
android: { nativeid: "", squeezebackid: "" },
|
|
3271
3273
|
config: {
|
|
3274
|
+
setCoarseLocationCollectionEnabled: true,
|
|
3275
|
+
squeezebackEnabled: false,
|
|
3276
|
+
squeezebackRetryIntervalMs: 5000,
|
|
3277
|
+
squeezebackFallbackBackgroundColor: "",
|
|
3278
|
+
squeezebackPages: [],
|
|
3272
3279
|
bannerStartupDelayMs: "",
|
|
3273
3280
|
interstitialStartupDelayMs: "",
|
|
3274
3281
|
appOpenLoadOnColdStart: "",
|
|
@@ -3311,6 +3318,7 @@ const ADMOB_NEXTGEN_DEFAULTS = {
|
|
|
3311
3318
|
appOpenFirstTimeOut: ""
|
|
3312
3319
|
},
|
|
3313
3320
|
testid: {
|
|
3321
|
+
squeezebackid: "ca-app-pub-3940256099942544/9983381271",
|
|
3314
3322
|
nativeid: "",
|
|
3315
3323
|
nativeid_android: "ca-app-pub-3940256099942544/2247696110",
|
|
3316
3324
|
nativeid_ios: "ca-app-pub-3940256099942544/3986624511"
|
|
@@ -3401,6 +3409,9 @@ const ensureAdmobNextgenConfigDefaults = (config) => {
|
|
|
3401
3409
|
const normalizedConfig = { ...config };
|
|
3402
3410
|
const runtimeConfig = hasObjectKeys(config?.config) ? config.config : {};
|
|
3403
3411
|
|
|
3412
|
+
for (const platform of ["android", "ios", "testid"]) {
|
|
3413
|
+
normalizedConfig[platform] = mergeObjects(ADMOB_NEXTGEN_DEFAULTS[platform], config?.[platform]);
|
|
3414
|
+
}
|
|
3404
3415
|
normalizedConfig.config = mergeObjects(ADMOB_NEXTGEN_DEFAULTS.config, runtimeConfig);
|
|
3405
3416
|
normalizedConfig.IAP = mergeObjects(ADMOB_NEXTGEN_DEFAULTS.IAP, config?.IAP);
|
|
3406
3417
|
|
|
@@ -3421,6 +3432,15 @@ const buildNextgenAdmobConfigFromOldConfig = (templateConfig, existingNextgenCon
|
|
|
3421
3432
|
mergedConfig.IAP.configuration[key] = mergeObjects(defaultValue, appIapConfig[key]);
|
|
3422
3433
|
}
|
|
3423
3434
|
|
|
3435
|
+
const appAdConfig = mergeObjects(oldConfig?.config || {}, existingNextgenConfig?.config);
|
|
3436
|
+
for (const key of ["setCoarseLocationCollectionEnabled", "squeezebackEnabled", "squeezebackRetryIntervalMs", "squeezebackFallbackBackgroundColor", "squeezebackPages"]) {
|
|
3437
|
+
mergedConfig.config[key] = appAdConfig[key] ?? ADMOB_NEXTGEN_DEFAULTS.config[key];
|
|
3438
|
+
}
|
|
3439
|
+
for (const platform of ["android", "ios", "testid"]) {
|
|
3440
|
+
mergedConfig[platform].squeezebackid = existingNextgenConfig?.[platform]?.squeezebackid
|
|
3441
|
+
?? oldConfig?.[platform]?.squeezebackid ?? ADMOB_NEXTGEN_DEFAULTS[platform].squeezebackid;
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3424
3444
|
const templateVersion = compareVersionStrings(templateConfig.VERSION || '0', ADMOB_NEXTGEN_DEFAULTS.VERSION) > 0
|
|
3425
3445
|
? templateConfig.VERSION : ADMOB_NEXTGEN_DEFAULTS.VERSION;
|
|
3426
3446
|
mergedConfig.VERSION = compareVersionStrings(existingNextgenConfig?.VERSION || '0', templateVersion) > 0
|
|
@@ -3441,10 +3461,14 @@ const syncAdmobNextgenPackage = () => {
|
|
|
3441
3461
|
console.log("ℹ️ emi-indo-cordova-plugin-admob is not installed.");
|
|
3442
3462
|
}
|
|
3443
3463
|
|
|
3444
|
-
|
|
3445
|
-
|
|
3464
|
+
const installedAdmob = getInstalledVersion("capacitor-admob-nextgen");
|
|
3465
|
+
const squeezebackEnabled = readJsonSafe(getAdmobJsonPath())?.config?.squeezebackEnabled;
|
|
3466
|
+
const needsSqueezeback = [true, 1, "true", "1"].includes(squeezebackEnabled);
|
|
3467
|
+
if (!installedAdmob || (needsSqueezeback && compareVersionStrings(installedAdmob.split("-")[0], "1.6.1") < 0)) {
|
|
3468
|
+
const version = needsSqueezeback ? "@^1.6.1-beta" : "";
|
|
3469
|
+
runNpmCommand(`npm install capacitor-admob-nextgen${version}`);
|
|
3446
3470
|
} else {
|
|
3447
|
-
console.log("ℹ️ capacitor-admob-nextgen
|
|
3471
|
+
console.log("ℹ️ Keeping the installed capacitor-admob-nextgen version.");
|
|
3448
3472
|
}
|
|
3449
3473
|
};
|
|
3450
3474
|
|
|
@@ -43,3 +43,11 @@ export const destroyPictureInPictureAd = hidePictureInPictureAd;
|
|
|
43
43
|
export const removePictureInPictureAd = destroyPictureInPictureAd;
|
|
44
44
|
export const getPictureInPictureAdState = () => ({ loading: false, loaded: false, showing: false, fullscreen: false, adUnitId: '', error: null });
|
|
45
45
|
export const addPictureInPictureAdListener = () => ({ remove: ignore });
|
|
46
|
+
|
|
47
|
+
export const loadSqueezebackAd = async () => false;
|
|
48
|
+
export const showSqueezebackAd = async () => false;
|
|
49
|
+
export const hideSqueezebackAd = async () => true;
|
|
50
|
+
export const destroySqueezebackAd = async () => true;
|
|
51
|
+
export const getSqueezebackAdState = () => ({
|
|
52
|
+
loading: false, loaded: false, showing: false, fullscreen: false, adUnitId: '', error: null
|
|
53
|
+
});
|
|
@@ -78,13 +78,21 @@ function syncIapAliases(projectRoot = process.cwd(), files = []) {
|
|
|
78
78
|
(match, quote) => quote ? match : match.replace(/[^\r\n]/g, ' '));
|
|
79
79
|
const header = /\balias\s*:\s*([\[{])/.exec(code);
|
|
80
80
|
if (!header) throw new Error('Cannot configure @iap: Vite needs a resolve.alias object or array.');
|
|
81
|
-
|
|
81
|
+
// Migrate only the standard versioned app directory; never evaluate config code.
|
|
82
|
+
const existing = /['"]@iap['"]\s*[:,]/.test(code);
|
|
83
|
+
const standard = /(['"]@iap['"]\s*:\s*|\bfind\s*:\s*['"]@iap['"]\s*,\s*replacement\s*:\s*)((?:path\.)?resolve\s*\(\s*__dirname\s*,\s*(['"])(?:\.\/)?src\/js\/Ads\/IAP-\d+(?:\.\d+)*\/?\3\s*\))(?=\s*[,}])/g;
|
|
84
|
+
const matches = [...code.matchAll(standard)];
|
|
85
|
+
if (existing && matches.length !== 1) throw new Error('Cannot replace a custom @iap alias automatically; use codeplayIapAliases.findLatestIapDirectory().');
|
|
82
86
|
const entry = header[1] === '{'
|
|
83
87
|
? "'@iap': codeplayIapAliases.findLatestIapDirectory(),"
|
|
84
88
|
: "{ find: '@iap', replacement: codeplayIapAliases.findLatestIapDirectory() },";
|
|
85
89
|
const offset = header.index + header[0].length;
|
|
86
90
|
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
87
|
-
const
|
|
91
|
+
const match = matches[0];
|
|
92
|
+
const start = match && match.index + match[1].length;
|
|
93
|
+
const updated = existing
|
|
94
|
+
? original.slice(0, start) + 'codeplayIapAliases.findLatestIapDirectory()' + original.slice(start + match[2].length)
|
|
95
|
+
: original.slice(0, offset) + newline + ' ' + entry + original.slice(offset);
|
|
88
96
|
original = `import codeplayIapAliases from './buildCodeplay/iap-alias.cjs';${newline}${updated}`;
|
|
89
97
|
}
|
|
90
98
|
if (!original.includes('codeplayIapAliases.legacyIapPlugin(')) {
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "codeplay-common",
|
|
3
|
-
"version": "4.11.
|
|
4
|
-
"description": "Common build scripts and files",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"postinstall": "node scripts/sync-files.js",
|
|
7
|
-
"preinstall": "node scripts/uninstall.js"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"adm-zip": "^0.6.1",
|
|
11
|
-
"plist": "^3.1.0",
|
|
12
|
-
"terser": "^5.51.4"
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://github.com/merbin2012/codeplay-common.git"
|
|
17
|
-
},
|
|
18
|
-
"author": "Codeplay Technologies",
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"files": [
|
|
21
|
-
"files/",
|
|
22
|
-
"scripts/",
|
|
23
|
-
"README.md",
|
|
24
|
-
"CHANGELOG.md",
|
|
25
|
-
"RELEASE_NOTES.md",
|
|
26
|
-
"LICENSE",
|
|
27
|
-
"runtime/"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "codeplay-common",
|
|
3
|
+
"version": "4.11.35",
|
|
4
|
+
"description": "Common build scripts and files",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"postinstall": "node scripts/sync-files.js",
|
|
7
|
+
"preinstall": "node scripts/uninstall.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"adm-zip": "^0.6.1",
|
|
11
|
+
"plist": "^3.1.0",
|
|
12
|
+
"terser": "^5.51.4"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/merbin2012/codeplay-common.git"
|
|
17
|
+
},
|
|
18
|
+
"author": "Codeplay Technologies",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"files": [
|
|
21
|
+
"files/",
|
|
22
|
+
"scripts/",
|
|
23
|
+
"README.md",
|
|
24
|
+
"CHANGELOG.md",
|
|
25
|
+
"RELEASE_NOTES.md",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"runtime/"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -58,6 +58,45 @@ test('missing IAP modules fail before any source or Vite changes', () => {
|
|
|
58
58
|
assert.equal(fs.readFileSync(path.join(f.root, 'vite.config.mjs'), 'utf8'), vite);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
+
test('existing standard versioned aliases migrate for object and array configurations', async () => {
|
|
62
|
+
const previous = process.cwd();
|
|
63
|
+
try {
|
|
64
|
+
for (const aliases of [
|
|
65
|
+
"{'@iap': path.resolve(__dirname, './src/js/Ads/IAP-5.2'), '@existing': '/unchanged'}",
|
|
66
|
+
"[{ find: '@iap', replacement: path.resolve(__dirname, './src/js/Ads/IAP-5.2') }, { find: '@existing', replacement: '/unchanged' }]",
|
|
67
|
+
]) {
|
|
68
|
+
const f = fixture(aliases);
|
|
69
|
+
const vite = path.join(f.root, 'vite.config.mjs');
|
|
70
|
+
fs.writeFileSync(vite, "import path from 'node:path';\nconst __dirname = '/old';\n" + fs.readFileSync(vite, 'utf8'));
|
|
71
|
+
assert.deepEqual(syncIapAliases(f.root), ['vite.config.mjs']);
|
|
72
|
+
process.chdir(f.root);
|
|
73
|
+
const { default: configure } = await import(pathToFileURL(vite).href);
|
|
74
|
+
const config = await configure();
|
|
75
|
+
const entries = Array.isArray(config.resolve.alias) ? Object.fromEntries(config.resolve.alias.map(a => [a.find, a.replacement])) : config.resolve.alias;
|
|
76
|
+
assert.equal(entries['@iap'], path.join(f.root, 'src/js/Ads/IAP-4.8'));
|
|
77
|
+
assert.equal(entries['@existing'], '/unchanged');
|
|
78
|
+
assert.ok(config.plugins.some(plugin => plugin.name === 'codeplay-legacy-iap-imports'));
|
|
79
|
+
assert.deepEqual(syncIapAliases(f.root), []);
|
|
80
|
+
}
|
|
81
|
+
} finally { process.chdir(previous); }
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('custom IAP aliases fail without changing source or Vite configuration', () => {
|
|
85
|
+
for (const aliases of [
|
|
86
|
+
"{'@iap': path.resolve(__dirname, './custom/IAP-5.2')}",
|
|
87
|
+
"[{ find: '@iap', replacement: customIapDirectory() }]",
|
|
88
|
+
]) {
|
|
89
|
+
const f = fixture(aliases);
|
|
90
|
+
const source = "import { x } from '../IAP-4.9/IAP-state.js';";
|
|
91
|
+
const file = f.write('src/caller.js', source);
|
|
92
|
+
const vite = path.join(f.root, 'vite.config.mjs');
|
|
93
|
+
const original = fs.readFileSync(vite, 'utf8');
|
|
94
|
+
assert.throws(() => syncIapAliases(f.root, [file]), /Cannot replace a custom @iap alias/);
|
|
95
|
+
assert.equal(fs.readFileSync(vite, 'utf8'), original);
|
|
96
|
+
assert.equal(fs.readFileSync(file, 'utf8'), source);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
61
100
|
test('apps without IAP are left unchanged', () => {
|
|
62
101
|
const f = fixture(); fs.unlinkSync(path.join(f.root, 'src/js/Ads/IAP-4.8/IAP-state.js'));
|
|
63
102
|
assert.equal(findLatestIapDirectory(f.root), null);
|
|
@@ -0,0 +1,78 @@
|
|
|
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 vm = require('vm');
|
|
6
|
+
const script = fs.readFileSync(path.join(__dirname, '../files/buildCodeplay/codeplayBeforeBuild.js'), 'utf8');
|
|
7
|
+
const defaults = script.slice(script.indexOf('const ADMOB_NEXTGEN_DEFAULTS ='), script.indexOf('function getAdmobJsonPath()'));
|
|
8
|
+
const merge = script.slice(script.indexOf('const mergeObjects ='), script.indexOf('const syncAdmobNextgenPackage ='));
|
|
9
|
+
const context = vm.createContext({ compareVersionStrings: (a, b) => a.localeCompare(b, undefined, { numeric: true }) });
|
|
10
|
+
vm.runInContext(defaults + merge, context);
|
|
11
|
+
const migrate = (template = {}, app = {}, old = {}) => JSON.parse(JSON.stringify(vm.runInContext(
|
|
12
|
+
`buildNextgenAdmobConfigFromOldConfig(${JSON.stringify(template)},${JSON.stringify(app)},${JSON.stringify(old)})`, context)));
|
|
13
|
+
|
|
14
|
+
test('old app configs acquire the new properties and a dedicated test unit', () => {
|
|
15
|
+
const result = migrate({}, { VERSION: '1.8', android: { bannerid: 'app-banner' } });
|
|
16
|
+
assert.equal(result.VERSION, '1.9');
|
|
17
|
+
assert.equal(result.config.setCoarseLocationCollectionEnabled, true);
|
|
18
|
+
assert.equal(result.config.squeezebackEnabled, false);
|
|
19
|
+
assert.equal(result.config.squeezebackRetryIntervalMs, 5000);
|
|
20
|
+
assert.deepEqual(result.config.squeezebackPages, []);
|
|
21
|
+
assert.equal(result.android.squeezebackid, '');
|
|
22
|
+
assert.equal(result.ios.squeezebackid, '');
|
|
23
|
+
assert.equal(result.testid.squeezebackid, 'ca-app-pub-3940256099942544/9983381271');
|
|
24
|
+
assert.equal(result.android.bannerid, 'app-banner');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('migration preserves explicit false, placement lists, custom IDs and newer schemas', () => {
|
|
28
|
+
const app = { VERSION: '2.0', config: { setCoarseLocationCollectionEnabled: false,
|
|
29
|
+
squeezebackEnabled: true, squeezebackPages: ['quizresult'], squeezebackRetryIntervalMs: 9000 },
|
|
30
|
+
android: { squeezebackid: 'app-live' }, testid: { squeezebackid: 'app-test' } };
|
|
31
|
+
const result = migrate({}, app);
|
|
32
|
+
assert.equal(result.VERSION, '2.0');
|
|
33
|
+
for (const [key, value] of Object.entries(app.config)) assert.deepEqual(result.config[key], value);
|
|
34
|
+
assert.equal(result.android.squeezebackid, 'app-live');
|
|
35
|
+
assert.equal(result.testid.squeezebackid, 'app-test');
|
|
36
|
+
assert.deepEqual(migrate({}, result), result);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('downloaded templates cannot opt apps into squeezeback or import publisher IDs', () => {
|
|
40
|
+
const template = { config: { squeezebackEnabled: true, squeezebackPages: ['home'],
|
|
41
|
+
setCoarseLocationCollectionEnabled: false }, android: { squeezebackid: 'foreign-live' },
|
|
42
|
+
testid: { squeezebackid: 'foreign-test' } };
|
|
43
|
+
const result = migrate(template);
|
|
44
|
+
assert.equal(result.config.squeezebackEnabled, false);
|
|
45
|
+
assert.deepEqual(result.config.squeezebackPages, []);
|
|
46
|
+
assert.equal(result.config.setCoarseLocationCollectionEnabled, true);
|
|
47
|
+
assert.equal(result.android.squeezebackid, '');
|
|
48
|
+
assert.equal(result.testid.squeezebackid, 'ca-app-pub-3940256099942544/9983381271');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('legacy app settings are retained with current app settings taking priority', () => {
|
|
52
|
+
const result = migrate({}, { android: { squeezebackid: '' } }, {
|
|
53
|
+
android: { squeezebackid: 'old-live' }, config: { squeezebackEnabled: true, setCoarseLocationCollectionEnabled: false }
|
|
54
|
+
});
|
|
55
|
+
assert.equal(result.android.squeezebackid, '');
|
|
56
|
+
assert.equal(result.config.squeezebackEnabled, true);
|
|
57
|
+
assert.equal(result.config.setCoarseLocationCollectionEnabled, false);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
for (const enabled of [undefined, false, true]) {
|
|
61
|
+
for (const installed of [null, '1.6.0', '1.6.1-beta', '1.7.0']) {
|
|
62
|
+
test(`native plugin: installed=${installed}, squeezebackEnabled=${enabled}`, () => {
|
|
63
|
+
const commands = [];
|
|
64
|
+
const start = script.indexOf('const syncAdmobNextgenPackage =');
|
|
65
|
+
const code = script.slice(start, script.indexOf('const downloadOptionalCodeplayFile', start));
|
|
66
|
+
vm.runInNewContext(code + '\nsyncAdmobNextgenPackage();', {
|
|
67
|
+
fs: { existsSync: () => true }, packageJsonPath: 'package.json',
|
|
68
|
+
isPackageAvailable: () => false, getInstalledVersion: () => installed,
|
|
69
|
+
getAdmobJsonPath: () => 'config.json', readJsonSafe: () => ({ config: { squeezebackEnabled: enabled } }),
|
|
70
|
+
compareVersionStrings: (a, b) => a.localeCompare(b, undefined, { numeric: true }),
|
|
71
|
+
runNpmCommand: command => commands.push(command), console: { log() {}, warn() {} }
|
|
72
|
+
});
|
|
73
|
+
const update = !installed || (enabled === true && installed === '1.6.0');
|
|
74
|
+
assert.deepEqual(commands, update
|
|
75
|
+
? [`npm install capacitor-admob-nextgen${enabled === true ? '@^1.6.1-beta' : ''}`] : []);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -35,4 +35,4 @@ test('installs a missing package', () => assert.equal(run({ installed: null }).c
|
|
|
35
35
|
test('replaces a local plugin reference', () => assert.equal(run({ declared: 'file:../plugin' }).commands.length, 1));
|
|
36
36
|
test('offline builds skip the registry check', () => assert.deepEqual(run({ offline: true }), { commands: [], queries: 0 }));
|
|
37
37
|
test('registry failure preserves the installed package', () => assert.deepEqual(run({ latest: null }).commands, []));
|
|
38
|
-
test('installation failure stops the build', () => assert.throws(() => run({ fail: true }), /install failed/));
|
|
38
|
+
test('installation failure stops the build', () => assert.throws(() => run({ fail: true }), /install failed/));
|