@reveldigital/gadgetizer 1.0.2 → 1.0.4
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/LICENSE +6 -0
- package/assets/gadget.yaml +54 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/package.json +8 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Copyright 2025 Revel Digital Worldwide Operations
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
|
+
|
|
5
|
+
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
6
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
title: My Gadget
|
|
2
|
+
title_url: https://mysupporturl.org
|
|
3
|
+
description: Describe the purpose of your gadget here
|
|
4
|
+
author: My Organization
|
|
5
|
+
background: transparent
|
|
6
|
+
|
|
7
|
+
requirements:
|
|
8
|
+
- reveldigital
|
|
9
|
+
- offline
|
|
10
|
+
- webfont
|
|
11
|
+
|
|
12
|
+
locales:
|
|
13
|
+
- messages: https://reveldigital.github.io/reveldigital-gadgets/ALL_ALL.xml
|
|
14
|
+
|
|
15
|
+
- lang: ru
|
|
16
|
+
messages: https://reveldigital.github.io/reveldigital-gadgets/ALL_ALL.xml
|
|
17
|
+
|
|
18
|
+
prefs:
|
|
19
|
+
- name: myStringPref
|
|
20
|
+
display_name: Sample string preference
|
|
21
|
+
datatype: string
|
|
22
|
+
default_value: test string
|
|
23
|
+
required: true
|
|
24
|
+
|
|
25
|
+
- name: myBoolPref
|
|
26
|
+
display_name: Sample boolean preference
|
|
27
|
+
datatype: bool
|
|
28
|
+
default_value: true
|
|
29
|
+
required: true
|
|
30
|
+
depends:
|
|
31
|
+
- name: myEnumPref
|
|
32
|
+
any_of:
|
|
33
|
+
- values:
|
|
34
|
+
- fast
|
|
35
|
+
|
|
36
|
+
- name: myStylePref
|
|
37
|
+
display_name: Sample style preference
|
|
38
|
+
datatype: style
|
|
39
|
+
default_value: font-family:Verdana;color:rgb(255, 255, 255);font-size:18px;
|
|
40
|
+
required: true
|
|
41
|
+
|
|
42
|
+
- name: myEnumPref
|
|
43
|
+
display_name: Sample enum preference
|
|
44
|
+
datatype: enum
|
|
45
|
+
default_value: fast
|
|
46
|
+
required: true
|
|
47
|
+
multiple: false
|
|
48
|
+
options:
|
|
49
|
+
- value: fastest
|
|
50
|
+
display_value: Fastest
|
|
51
|
+
- value: fast
|
|
52
|
+
display_value: Fast
|
|
53
|
+
- value: medium
|
|
54
|
+
display_value: Medium
|
package/dist/cli.js
CHANGED
|
@@ -44,7 +44,7 @@ Options:
|
|
|
44
44
|
Description:
|
|
45
45
|
Integrates the Revel Digital SDK into your project and generates gadget XML.
|
|
46
46
|
Supports React, Vue, Angular, and vanilla JavaScript projects.
|
|
47
|
-
`)),process.exit(0)),oU&&(o3({projectPath:process.cwd(),__dirname:oj}),process.exit(0));let oz=await e8({message:"Select your project framework:",options:[{value:"react",label:"React"},{value:"vue",label:"Vue"},{value:"angular",label:"Angular"},{value:"js",label:"Vanilla JavaScript"}]}),oV="";switch(oz){case"react":oV=n.existsSync(o.join(oG,"src","App.js"))?o.join("src","App.js"):"";break;case"vue":oV=n.existsSync(o.join(oG,"src","App.vue"))?o.join("src","App.vue"):"";break;case"angular":oV=n.existsSync(o.join(oG,"src","main.ts"))?o.join("src","main.ts"):"";break;case"js":oV=n.existsSync(o.join(oG,"src","main.js"))?o.join("src","main.js"):""}oV||e5(X(ea).yellow(`\u{26A0}\u{FE0F} Could not automatically detect the main entry file for ${oz}. Please manually instrument your app with the Revel Digital SDK.`));let oH=o.join(oG,"package.json");if(n.existsSync(oH)||(e5(X(ea).red("❌ No package.json found in this directory. Please run this tool from your project root.")),process.exit(1)),"angular"===oz){e5(X(ea).cyan("\uD83D\uDCE6 Installing @reveldigital/player-client and running ng add schematic..."));try{r("npm install @reveldigital/player-client@latest",{stdio:"inherit"}),r("ng add @reveldigital/player-client@latest",{stdio:"inherit"}),e5(X(ea).green("✅ Angular project successfully instrumented with Revel Digital Player Client.")),process.exit(0)}catch(e){e5(X(ea).red("❌ Error instrumenting Angular project. Please check your Angular CLI and npm setup.")),process.exit(1)}}let oW=o.join(oj,"assets","gadget.yaml"),o$=o.join(oG,"gadget.yaml");if(n.existsSync(o$))e5(X(ea).yellow("⚠️ gadget.yaml already exists in project root. Skipping copy."));else try{n.copyFileSync(oW,o$),e5(X(ea).green("\uD83D\uDCC4 gadget.yaml copied to project root."))}catch(e){e5(X(ea).red("❌ Failed to copy gadget.yaml to project root. Please copy it manually."))}let oY="";try{oY=await new Promise((e,t)=>{((...e)=>ee("h0Fpa").then(({default:t})=>t(...e)))(oH).then(r=>{try{let t=r.split("/"),n=`https://${t[3]}.github.io/${t[4].split(".")[0]}/`;e(n)}catch(e){t(e)}}).catch(t)}),e5(X(ea).cyan(`\u{1F30E} Configuring gadget deployment URL based on Git: ${oY}`))}catch(e){oY="",e5(X(ea).yellow(`\u{26A0}\u{FE0F} Warning: Could not get deployment URL automatically.`))}let oX=await e3({message:"Enter the deployment URL:",initialValue:oY}),oJ=await e8({message:"Select Revel Digital SDK version to install:",options:[{value:"latest",label:"Latest"},{value:"custom",label:"Custom version"}]}),oK="";"custom"===oJ&&(oK=await e3({message:"Enter the custom SDK version:"}));let oQ=JSON.parse(n.readFileSync(oH,"utf8"));if(await (e=>{let t=e.active??"Yes",r=e.inactive??"No";return new eR({active:t,inactive:r,initialValue:e.initialValue??!0,render(){let n=`${X(ea).gray(eQ)}
|
|
47
|
+
`)),process.exit(0)),console.log("dir:"+oj),oU&&(o3({projectPath:process.cwd(),__dirname:oj}),process.exit(0));let oz=await e8({message:"Select your project framework:",options:[{value:"react",label:"React"},{value:"vue",label:"Vue"},{value:"angular",label:"Angular"},{value:"js",label:"Vanilla JavaScript"}]}),oV="";switch(oz){case"react":oV=n.existsSync(o.join(oG,"src","App.js"))?o.join("src","App.js"):"";break;case"vue":oV=n.existsSync(o.join(oG,"src","App.vue"))?o.join("src","App.vue"):"";break;case"angular":oV=n.existsSync(o.join(oG,"src","main.ts"))?o.join("src","main.ts"):"";break;case"js":oV=n.existsSync(o.join(oG,"src","main.js"))?o.join("src","main.js"):""}oV||e5(X(ea).yellow(`\u{26A0}\u{FE0F} Could not automatically detect the main entry file for ${oz}. Please manually instrument your app with the Revel Digital SDK.`));let oH=o.join(oG,"package.json");if(n.existsSync(oH)||(e5(X(ea).red("❌ No package.json found in this directory. Please run this tool from your project root.")),process.exit(1)),"angular"===oz){e5(X(ea).cyan("\uD83D\uDCE6 Installing @reveldigital/player-client and running ng add schematic..."));try{r("npm install @reveldigital/player-client@latest",{stdio:"inherit"}),r("ng add @reveldigital/player-client@latest",{stdio:"inherit"}),e5(X(ea).green("✅ Angular project successfully instrumented with Revel Digital Player Client.")),process.exit(0)}catch(e){e5(X(ea).red("❌ Error instrumenting Angular project. Please check your Angular CLI and npm setup.")),process.exit(1)}}let oW=o.join(oj,"assets","gadget.yaml"),o$=o.join(oG,"gadget.yaml");if(n.existsSync(o$))e5(X(ea).yellow("⚠️ gadget.yaml already exists in project root. Skipping copy."));else try{n.copyFileSync(oW,o$),e5(X(ea).green("\uD83D\uDCC4 gadget.yaml copied to project root."))}catch(e){e5(X(ea).red("❌ Failed to copy gadget.yaml to project root. Please copy it manually."))}let oY="";try{oY=await new Promise((e,t)=>{((...e)=>ee("h0Fpa").then(({default:t})=>t(...e)))(oH).then(r=>{try{let t=r.split("/"),n=`https://${t[3]}.github.io/${t[4].split(".")[0]}/`;e(n)}catch(e){t(e)}}).catch(t)}),e5(X(ea).cyan(`\u{1F30E} Configuring gadget deployment URL based on Git: ${oY}`))}catch(e){oY="",e5(X(ea).yellow(`\u{26A0}\u{FE0F} Warning: Could not get deployment URL automatically.`))}let oX=await e3({message:"Enter the deployment URL:",initialValue:oY}),oJ=await e8({message:"Select Revel Digital SDK version to install:",options:[{value:"latest",label:"Latest"},{value:"custom",label:"Custom version"}]}),oK="";"custom"===oJ&&(oK=await e3({message:"Enter the custom SDK version:"}));let oQ=JSON.parse(n.readFileSync(oH,"utf8"));if(await (e=>{let t=e.active??"Yes",r=e.inactive??"No";return new eR({active:t,inactive:r,initialValue:e.initialValue??!0,render(){let n=`${X(ea).gray(eQ)}
|
|
48
48
|
${e2(this.state)} ${e.message}
|
|
49
49
|
`,o=this.value?t:r;switch(this.state){case"submit":return`${n}${X(ea).gray(eQ)} ${X(ea).dim(o)}`;case"cancel":return`${n}${X(ea).gray(eQ)} ${X(ea).strikethrough(X(ea).dim(o))}
|
|
50
50
|
${X(ea).gray(eQ)}`;default:return`${n}${X(ea).cyan(eQ)} ${this.value?`${X(ea).green(e0)} ${t}`:`${X(ea).dim(e1)} ${X(ea).dim(t)}`} ${X(ea).dim("/")} ${this.value?`${X(ea).dim(e1)} ${X(ea).dim(r)}`:`${X(ea).green(e0)} ${r}`}
|