@capgo/capacitor-youtube-player 8.2.5 → 8.2.7

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 CHANGED
@@ -31,6 +31,20 @@ The most complete doc is available here: https://capgo.app/docs/plugins/youtube-
31
31
 
32
32
  ## Install
33
33
 
34
+ You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
35
+
36
+ ```bash
37
+ npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins
38
+ ```
39
+
40
+ Then use the following prompt:
41
+
42
+ ```text
43
+ Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-youtube-player` plugin in my project.
44
+ ```
45
+
46
+ If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
47
+
34
48
  ```bash
35
49
  npm install @capgo/capacitor-youtube-player
36
50
  npx cap sync
@@ -9,7 +9,7 @@ import UIKit
9
9
  */
10
10
  @objc(YoutubePlayerPlugin)
11
11
  public class YoutubePlayerPlugin: CAPPlugin, CAPBridgedPlugin {
12
- private let pluginVersion: String = "8.2.5"
12
+ private let pluginVersion: String = "8.2.7"
13
13
  public let identifier = "YoutubePlayerPlugin"
14
14
  public let jsName = "YoutubePlayer"
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-youtube-player",
3
- "version": "8.2.5",
3
+ "version": "8.2.7",
4
4
  "description": "Capacitor player to embed YouTube player controls in Capacitor apps",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -56,7 +56,10 @@
56
56
  "clean": "rimraf ./dist",
57
57
  "watch": "tsc --watch",
58
58
  "prepublishOnly": "bun run build",
59
- "check:wiring": "node scripts/check-capacitor-plugin-wiring.mjs"
59
+ "check:wiring": "node scripts/check-capacitor-plugin-wiring.mjs",
60
+ "example:install": "cd example-app && bun install --frozen-lockfile",
61
+ "example:build": "bun run build && cd example-app && bun install --frozen-lockfile && bun run build",
62
+ "example:capgo:deploy": "bun run example:build && bun scripts/deploy-example-capgo.mjs"
60
63
  },
61
64
  "devDependencies": {
62
65
  "@capacitor/android": "^8.0.0",
@@ -11,8 +11,8 @@
11
11
  * - CocoaPods podspec s.name matches SwiftPM Package(name: ...) and .library(name: ...)
12
12
  *
13
13
  * Usage:
14
- * node tools/check-capacitor-plugin-wiring.mjs # checks current working dir
15
- * node tools/check-capacitor-plugin-wiring.mjs --dir path # checks given plugin dir
14
+ * node scripts/check-capacitor-plugin-wiring.mjs # checks current working dir
15
+ * node scripts/check-capacitor-plugin-wiring.mjs --dir path # checks given plugin dir
16
16
  */
17
17
 
18
18
  import fs from "node:fs";
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { dirname, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { spawnSync } from 'node:child_process';
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const repoRoot = resolve(__dirname, '..');
9
+ const appDir = resolve(repoRoot, 'example-app');
10
+ const rootPackageJson = JSON.parse(readFileSync(resolve(repoRoot, 'package.json'), 'utf8'));
11
+ const examplePackageJson = JSON.parse(readFileSync(resolve(appDir, 'package.json'), 'utf8'));
12
+ const tsConfigPath = resolve(appDir, 'capacitor.config.ts');
13
+ const jsonConfigPath = resolve(appDir, 'capacitor.config.json');
14
+ const configPath = existsSync(tsConfigPath)
15
+ ? tsConfigPath
16
+ : existsSync(jsonConfigPath)
17
+ ? jsonConfigPath
18
+ : null;
19
+
20
+ if (!configPath) {
21
+ console.error('Missing Capacitor config. Expected example-app/capacitor.config.ts or example-app/capacitor.config.json.');
22
+ process.exit(1);
23
+ }
24
+
25
+ const configText = readFileSync(configPath, 'utf8');
26
+
27
+ function readConfigString(key, fallback) {
28
+ const match = configText.match(new RegExp(`['"]?${key}['"]?\\s*[:=]\\s*['"]([^'"]+)['"]`));
29
+ return match?.[1] ?? fallback;
30
+ }
31
+
32
+ function runCapgo(args, allowFailure = false) {
33
+ const token = process.env.CAPGO_TOKEN;
34
+ const fullArgs = ['@capgo/cli@8.5.3', ...args];
35
+ if (token) {
36
+ fullArgs.push('--apikey', token);
37
+ }
38
+ const result = spawnSync('bunx', fullArgs, {
39
+ cwd: appDir,
40
+ stdio: 'inherit',
41
+ env: process.env,
42
+ });
43
+ if (!allowFailure && result.status !== 0) {
44
+ process.exit(result.status ?? 1);
45
+ }
46
+ return result.status ?? 1;
47
+ }
48
+
49
+ const appId = process.env.CAPGO_APP_ID || readConfigString('appId');
50
+ const appName = process.env.CAPGO_APP_NAME || readConfigString('appName', rootPackageJson.name);
51
+ const webDir = process.env.CAPGO_WEB_DIR || readConfigString('webDir', 'dist');
52
+ const distDir = resolve(appDir, webDir);
53
+ const channel = process.env.CAPGO_CHANNEL || process.argv[2] || 'production';
54
+ function usableVersion(version) {
55
+ return version && version !== '0.0.0' ? version : undefined;
56
+ }
57
+
58
+ const bundle =
59
+ process.env.CAPGO_BUNDLE || usableVersion(examplePackageJson.version) || usableVersion(rootPackageJson.version);
60
+ const comment =
61
+ process.env.CAPGO_COMMENT ||
62
+ (process.env.GITHUB_RUN_NUMBER
63
+ ? `${appName} run ${process.env.GITHUB_RUN_NUMBER}`
64
+ : `${appName} ${bundle}`);
65
+ const iconPath = process.env.CAPGO_ICON || resolve(appDir, 'assets', 'capgo-icon.png');
66
+
67
+ if (!appId) {
68
+ console.error('Missing Capgo app id. Set CAPGO_APP_ID or example-app/capacitor.config.* appId.');
69
+ process.exit(1);
70
+ }
71
+
72
+ if (!existsSync(distDir)) {
73
+ console.error(`Missing example app bundle at ${distDir}. Run bun run example:build first.`);
74
+ process.exit(1);
75
+ }
76
+
77
+ if (!bundle) {
78
+ console.error('Missing Capgo bundle version. Set CAPGO_BUNDLE or add a version to example-app/package.json or package.json.');
79
+ process.exit(1);
80
+ }
81
+
82
+ const appArgs = [appId, '--name', appName];
83
+ if (existsSync(iconPath)) {
84
+ appArgs.push('--icon', iconPath);
85
+ }
86
+
87
+ const setStatus = runCapgo(['app', 'set', ...appArgs], true);
88
+ if (setStatus !== 0) {
89
+ runCapgo(['app', 'add', ...appArgs]);
90
+ }
91
+
92
+ console.log(`Deploying ${appId} to Capgo channel "${channel}"`);
93
+ const channelArgs = ['channel', 'add', channel, appId];
94
+ if (channel === 'production') {
95
+ channelArgs.push('--default');
96
+ }
97
+ runCapgo(channelArgs, true);
98
+
99
+
100
+ runCapgo([
101
+ 'bundle',
102
+ 'upload',
103
+ appId,
104
+ '--bundle',
105
+ bundle,
106
+ '--path',
107
+ webDir,
108
+ '--channel',
109
+ channel,
110
+ '--package-json',
111
+ 'package.json,../package.json',
112
+ '--node-modules',
113
+ 'node_modules,../node_modules',
114
+ '--delta',
115
+ '--no-key',
116
+ '--ignore-checksum-check',
117
+ '--version-exists-ok',
118
+ '--comment',
119
+ comment,
120
+ ]);