@capgo/capacitor-pretty-toast 8.1.5 → 8.1.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { existsSync, readFileSync
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
4
|
import { dirname, resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
|
|
@@ -8,63 +8,33 @@ const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
|
8
8
|
const repoRoot = resolve(scriptDir, '..');
|
|
9
9
|
const appDir = resolve(repoRoot, 'example-app');
|
|
10
10
|
const distDir = resolve(appDir, 'dist');
|
|
11
|
-
const packageJsonPath = resolve(
|
|
12
|
-
const capacitorConfigPath = resolve(appDir, 'capacitor.config.json');
|
|
11
|
+
const packageJsonPath = resolve(appDir, 'package.json');
|
|
13
12
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
14
|
-
const capacitorConfig = JSON.parse(readFileSync(capacitorConfigPath, 'utf8'));
|
|
15
|
-
const packageVersion = packageJson.version;
|
|
16
13
|
|
|
17
|
-
const appId = process.env.CAPGO_APP_ID
|
|
14
|
+
const appId = process.env.CAPGO_APP_ID;
|
|
18
15
|
const channel = process.env.CAPGO_CHANNEL || process.argv[2] || 'production';
|
|
19
|
-
const bundle = packageVersion;
|
|
20
16
|
const comment =
|
|
21
17
|
process.env.CAPGO_COMMENT ||
|
|
22
18
|
(process.env.GITHUB_RUN_NUMBER
|
|
23
|
-
? `Pretty Toast example
|
|
24
|
-
: `Pretty Toast example ${
|
|
25
|
-
|
|
26
|
-
if (!packageVersion) {
|
|
27
|
-
console.error('Missing package.json version.');
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
capacitorConfig.plugins ??= {};
|
|
32
|
-
capacitorConfig.plugins.CapacitorUpdater ??= {};
|
|
33
|
-
capacitorConfig.plugins.CapacitorUpdater.version = packageVersion;
|
|
34
|
-
writeFileSync(capacitorConfigPath, `${JSON.stringify(capacitorConfig, null, 2)}\n`);
|
|
35
|
-
|
|
36
|
-
const configVersion = capacitorConfig.plugins.CapacitorUpdater.version;
|
|
37
|
-
|
|
38
|
-
if (configVersion !== packageVersion) {
|
|
39
|
-
console.error(
|
|
40
|
-
`CapacitorUpdater.version (${configVersion ?? 'missing'}) must match package.json version (${packageVersion}).`,
|
|
41
|
-
);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
19
|
+
? `Pretty Toast example run ${process.env.GITHUB_RUN_NUMBER}`
|
|
20
|
+
: `Pretty Toast example ${packageJson.version}`);
|
|
44
21
|
|
|
45
22
|
if (!existsSync(distDir)) {
|
|
46
23
|
console.error('Missing example-app/dist. Run bun run --cwd example-app build first.');
|
|
47
24
|
process.exit(1);
|
|
48
25
|
}
|
|
49
26
|
|
|
50
|
-
if (!process.env.CAPGO_TOKEN) {
|
|
51
|
-
console.error('Missing CAPGO_TOKEN.');
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
27
|
const args = [
|
|
56
|
-
'@capgo/cli@
|
|
28
|
+
'@capgo/cli@latest',
|
|
57
29
|
'bundle',
|
|
58
30
|
'upload',
|
|
59
|
-
appId,
|
|
31
|
+
...(appId ? [appId] : []),
|
|
60
32
|
'--path',
|
|
61
33
|
'dist',
|
|
62
34
|
'--channel',
|
|
63
35
|
channel,
|
|
64
|
-
'--bundle',
|
|
65
|
-
bundle,
|
|
66
36
|
'--package-json',
|
|
67
|
-
'
|
|
37
|
+
'package.json,../package.json',
|
|
68
38
|
'--node-modules',
|
|
69
39
|
'../node_modules,node_modules',
|
|
70
40
|
'--delta',
|
|
@@ -75,7 +45,7 @@ const args = [
|
|
|
75
45
|
comment,
|
|
76
46
|
];
|
|
77
47
|
|
|
78
|
-
console.log(`Deploying ${appId}
|
|
48
|
+
console.log(`Deploying ${appId ?? 'Pretty Toast example'} to Capgo channel "${channel}"`);
|
|
79
49
|
|
|
80
50
|
const result = spawnSync('bunx', args, {
|
|
81
51
|
cwd: appDir,
|