@signageos/cli 2.3.1 → 2.4.0
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 +54 -19
- package/dist/Applet/Build/appletBuildCommand.js +28 -72
- package/dist/Applet/Generate/Templates/CHANGELOG.md.template +7 -0
- package/dist/Applet/Generate/Templates/README.md.template +3 -0
- package/dist/Applet/Generate/Templates/rspack.config.mjs.template +12 -12
- package/dist/Applet/Generate/appletGenerateCommand.d.ts +23 -62
- package/dist/Applet/Generate/appletGenerateCommand.js +432 -365
- package/dist/Applet/Start/appletStartCommand.js +70 -132
- package/dist/Applet/Test/Upload/appletTestRunCommand.js +90 -178
- package/dist/Applet/Test/Upload/appletTestRunFacade.js +5 -29
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js +99 -224
- package/dist/Applet/Test/Upload/appletTestUploadFacade.js +51 -105
- package/dist/Applet/Test/appletTestCommand.js +6 -36
- package/dist/Applet/Upload/appletUploadCommand.js +199 -305
- package/dist/Applet/Upload/appletUploadCommandHelper.js +129 -144
- package/dist/Applet/Upload/appletUploadFacade.d.ts +2 -2
- package/dist/Applet/Upload/appletUploadFacade.js +184 -265
- package/dist/Applet/Upload/appletUploadFacadeHelper.js +51 -55
- package/dist/Applet/appletCommand.d.ts +25 -157
- package/dist/Applet/appletCommand.js +9 -39
- package/dist/Applet/appletErrors.js +5 -24
- package/dist/Applet/appletFacade.js +122 -147
- package/dist/Applet/appletServerHelper.js +18 -55
- package/dist/Auth/loginCommand.d.ts +2 -2
- package/dist/Auth/loginCommand.js +105 -136
- package/dist/Cache/tmpCache.js +47 -16
- package/dist/Cli/helper.js +3 -5
- package/dist/Cli/packageVersion.js +99 -131
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.d.ts +10 -0
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.js +39 -0
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.ts +30 -0
- package/dist/Command/Autocomplete/Install/sos-completion.sh +63 -0
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.d.ts +8 -0
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.js +120 -0
- package/dist/Command/Autocomplete/autocompleteCommand.d.ts +22 -0
- package/dist/Command/Autocomplete/autocompleteCommand.js +32 -0
- package/dist/Command/autoComplete.d.ts +4 -0
- package/dist/Command/autoComplete.js +184 -0
- package/dist/Command/commandDefinition.d.ts +9 -9
- package/dist/Command/commandDefinition.js +1 -3
- package/dist/Command/commandProcessor.js +41 -131
- package/dist/Command/globalArgs.js +9 -8
- package/dist/CommandLine/IProgressBar.js +0 -1
- package/dist/CommandLine/progressBarFactory.d.ts +1 -1
- package/dist/CommandLine/progressBarFactory.js +42 -13
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js +17 -56
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js +94 -109
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +44 -120
- package/dist/CustomScript/customScriptCommand.d.ts +1 -9
- package/dist/CustomScript/customScriptCommand.js +6 -36
- package/dist/CustomScript/customScriptFacade.d.ts +2 -2
- package/dist/CustomScript/customScriptFacade.js +187 -297
- package/dist/Device/Connect/connectCommand.js +73 -137
- package/dist/Device/Content/setContentCommand.js +33 -78
- package/dist/Device/PowerAction/powerActionCommand.js +22 -65
- package/dist/Device/deviceCommand.js +7 -37
- package/dist/Device/deviceFacade.js +71 -127
- package/dist/Emulator/IEmulator.js +0 -1
- package/dist/Emulator/createDomain.d.ts +0 -1
- package/dist/Emulator/createDomain.js +44 -14
- package/dist/Emulator/emulatorFacade.js +75 -133
- package/dist/Emulator/emulatorFactory.js +123 -126
- package/dist/Firmware/Upload/firmwareUploadCommand.js +133 -221
- package/dist/Firmware/Upload/firmwareUploadFacade.js +75 -112
- package/dist/Firmware/Upload/firmwareUploadHelper.js +38 -6
- package/dist/Firmware/firmwareCommand.js +5 -35
- package/dist/Lib/archive.js +56 -62
- package/dist/Lib/childProcess.js +37 -5
- package/dist/Lib/fileSystem.js +76 -87
- package/dist/Lib/git.d.ts +1 -1
- package/dist/Lib/git.js +58 -87
- package/dist/Organization/Get/organizationGetCommand.js +14 -50
- package/dist/Organization/List/organizationListCommand.js +12 -46
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +18 -56
- package/dist/Organization/organizationCommand.js +7 -37
- package/dist/Organization/organizationFacade.js +102 -177
- package/dist/RunControl/runControlHelper.js +14 -64
- package/dist/Timer/wait.js +2 -3
- package/dist/Timing/List/timingListCommand.js +20 -62
- package/dist/Timing/timingCommand.js +5 -35
- package/dist/generalCommand.js +1 -2
- package/dist/helper.d.ts +4 -4
- package/dist/helper.js +61 -122
- package/dist/index.js +19 -46
- package/dist/parameters.js +17 -40
- package/package.json +52 -57
- package/dist/Applet/Build/appletBuildCommand.js.map +0 -1
- package/dist/Applet/Generate/appletGenerateCommand.js.map +0 -1
- package/dist/Applet/Start/appletStartCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestRunCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestRunFacade.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestUploadFacade.js.map +0 -1
- package/dist/Applet/Test/appletTestCommand.js.map +0 -1
- package/dist/Applet/Upload/appletUploadCommand.js.map +0 -1
- package/dist/Applet/Upload/appletUploadCommandHelper.js.map +0 -1
- package/dist/Applet/Upload/appletUploadFacade.js.map +0 -1
- package/dist/Applet/Upload/appletUploadFacadeHelper.js.map +0 -1
- package/dist/Applet/appletCommand.js.map +0 -1
- package/dist/Applet/appletErrors.js.map +0 -1
- package/dist/Applet/appletFacade.js.map +0 -1
- package/dist/Applet/appletServerHelper.js.map +0 -1
- package/dist/Auth/loginCommand.js.map +0 -1
- package/dist/Cache/tmpCache.js.map +0 -1
- package/dist/Cli/helper.js.map +0 -1
- package/dist/Cli/packageVersion.js.map +0 -1
- package/dist/Command/commandDefinition.js.map +0 -1
- package/dist/Command/commandProcessor.js.map +0 -1
- package/dist/Command/globalArgs.js.map +0 -1
- package/dist/CommandLine/IProgressBar.js.map +0 -1
- package/dist/CommandLine/progressBarFactory.js.map +0 -1
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js.map +0 -1
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js.map +0 -1
- package/dist/CustomScript/Upload/customScriptUploadCommand.js.map +0 -1
- package/dist/CustomScript/customScriptCommand.js.map +0 -1
- package/dist/CustomScript/customScriptFacade.js.map +0 -1
- package/dist/Device/Connect/connectCommand.js.map +0 -1
- package/dist/Device/Content/setContentCommand.js.map +0 -1
- package/dist/Device/PowerAction/powerActionCommand.js.map +0 -1
- package/dist/Device/deviceCommand.js.map +0 -1
- package/dist/Device/deviceFacade.js.map +0 -1
- package/dist/Emulator/IEmulator.js.map +0 -1
- package/dist/Emulator/createDomain.js.map +0 -1
- package/dist/Emulator/emulatorFacade.js.map +0 -1
- package/dist/Emulator/emulatorFactory.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadCommand.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadFacade.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadHelper.js.map +0 -1
- package/dist/Firmware/firmwareCommand.js.map +0 -1
- package/dist/Lib/archive.js.map +0 -1
- package/dist/Lib/childProcess.js.map +0 -1
- package/dist/Lib/fileSystem.js.map +0 -1
- package/dist/Lib/git.js.map +0 -1
- package/dist/Organization/Get/organizationGetCommand.js.map +0 -1
- package/dist/Organization/List/organizationListCommand.js.map +0 -1
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js.map +0 -1
- package/dist/Organization/organizationCommand.js.map +0 -1
- package/dist/Organization/organizationFacade.js.map +0 -1
- package/dist/RunControl/runControlHelper.js.map +0 -1
- package/dist/Timer/wait.js.map +0 -1
- package/dist/Timing/List/timingListCommand.js.map +0 -1
- package/dist/Timing/timingCommand.js.map +0 -1
- package/dist/generalCommand.js.map +0 -1
- package/dist/helper.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/parameters.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# CLI
|
|
1
|
+
# signageOS CLI
|
|
2
2
|
|
|
3
3
|
signageOS command-line interface which helps you develop your applets locally and manage devices from terminal.
|
|
4
4
|
|
|
@@ -12,6 +12,39 @@ sos --help
|
|
|
12
12
|
cli tool allows you to run commands interactively for best user experience, please use standard bash terminal on *nix systems
|
|
13
13
|
and [gitbash](https://gitforwindows.org/), run it in [windows terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab).
|
|
14
14
|
|
|
15
|
+
### Autocomplete
|
|
16
|
+
signageOS CLI offers tab completion for commands and options, which enhances the user experience by making it easier to discover and use available commands.
|
|
17
|
+
|
|
18
|
+
#### Installation
|
|
19
|
+
To enable autocomplete in your shell, use the following command:
|
|
20
|
+
```sh
|
|
21
|
+
sos autocomplete install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This will install a completion script in your home directory and add a source line to your shell configuration file (`.zshrc`, `.bashrc`, or `.bash_profile`, depending on your shell).
|
|
25
|
+
|
|
26
|
+
To start using autocomplete immediately without restarting your terminal, run:
|
|
27
|
+
```sh
|
|
28
|
+
source ~/.sos-completion.sh
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### Usage
|
|
32
|
+
Once autocomplete is installed, you can use the TAB key to discover and complete commands:
|
|
33
|
+
```sh
|
|
34
|
+
sos [TAB] # Show all top-level commands
|
|
35
|
+
sos applet [TAB] # Show all applet subcommands
|
|
36
|
+
sos applet up[TAB] # Autocomplete to "sos applet upload"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Uninstallation
|
|
40
|
+
If you want to disable autocomplete, use:
|
|
41
|
+
```sh
|
|
42
|
+
sos autocomplete uninstall
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This will remove the completion script and the source line from your shell configuration file.
|
|
46
|
+
|
|
47
|
+
|
|
15
48
|
## Test
|
|
16
49
|
```bash
|
|
17
50
|
cp .env.amy .env
|
|
@@ -22,7 +55,7 @@ npm test
|
|
|
22
55
|
### General
|
|
23
56
|
| Argument | Description | Default value |
|
|
24
57
|
|----------------------------|---------------------------------|---------------------------------------------------|
|
|
25
|
-
| --api-url *(optional)* | URL address to use for REST API | ${SOS_API_URL
|
|
58
|
+
| --api-url *(optional)* | URL address to use for REST API | ${SOS_API_URL='https://api.signageos.io'} |
|
|
26
59
|
| --profile *(optional)* | Profile used for separation of credentials and other configurations set in the `~/.sosrc` file | ${SOS_PROFILE} |
|
|
27
60
|
|
|
28
61
|
### Login
|
|
@@ -32,21 +65,21 @@ npm test
|
|
|
32
65
|
```bash
|
|
33
66
|
sos login
|
|
34
67
|
```
|
|
35
|
-
- Login account to allow use REST API commands
|
|
68
|
+
- Login account to allow you to use REST API commands
|
|
36
69
|
- Logged account credentials are stored in `~/.sosrc` file.
|
|
37
|
-
- You override login credentials using environment variables `SOS_API_IDENTIFICATION` & `SOS_API_SECURITY_TOKEN`. Go to https://box.signageos.io/settings to generate the token.
|
|
70
|
+
- You can override login credentials using environment variables `SOS_API_IDENTIFICATION` & `SOS_API_SECURITY_TOKEN`. Go to https://box.signageos.io/settings to generate the token.
|
|
38
71
|
|
|
39
72
|
| Argument | Description | Default value |
|
|
40
73
|
|----------------------------|---------------------------------|----------------|
|
|
41
74
|
| --username *(required)* | Username or e-mail user for box | STDIN |
|
|
42
75
|
|
|
43
76
|
#### Run control file
|
|
44
|
-
There
|
|
77
|
+
There is a file created when running command `sos login` in the path `~/.sosrc`. This file contains by default only the following values (as default profile is used).
|
|
45
78
|
```ini
|
|
46
79
|
identification=xxxxxxxxxxxxxxxxxxxx
|
|
47
80
|
apiSecurityToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
48
81
|
```
|
|
49
|
-
If you'd like to manage more accounts/configurations on one machine, you can use environment variable `SOS_PROFILE` or argument `--profile`. The configuration file will
|
|
82
|
+
If you'd like to manage more accounts/configurations on one machine, you can use environment variable `SOS_PROFILE` or argument `--profile`. The configuration file will use an INI section `profile xxxx` for the profile named `xxxx`. You can use as many profiles as you want.
|
|
50
83
|
```ini
|
|
51
84
|
[profile xxxx]
|
|
52
85
|
identification=xxxxxxxxxxxxxxxxxxxx
|
|
@@ -76,11 +109,12 @@ npm run build
|
|
|
76
109
|
| --language *(optional)* | Generate applet with "typescript" or "javascript" source code | STDIN |
|
|
77
110
|
| --bundler *(optional)* | Generate applet with "webpack" or "rspack" | webpack |
|
|
78
111
|
| --git *(optional)* | Initialize applet as git repository "yes" or "no" | no |
|
|
112
|
+
| --packager *(optional)* | Use preferred package manager "npm", "pnpm", "bun", "yarn" | npm |
|
|
79
113
|
|
|
80
114
|
> ! Windows users note:
|
|
81
|
-
> There
|
|
115
|
+
> There is an unresolved issue with NPX tool on Windows clients when your username contains spaces (e.g.: `John Doe`).
|
|
82
116
|
> https://stackoverflow.com/a/58354623/4609457
|
|
83
|
-
> To prevent this issue there is simple hotfix. Run following command in your Command Line (replace `John` with your real first name):
|
|
117
|
+
> To prevent this issue there is a simple hotfix. Run following command in your Command Line (replace `John` with your real first name):
|
|
84
118
|
> Sometimes the Administrator privileges are required (Run as Administrator)
|
|
85
119
|
```cmd
|
|
86
120
|
npm config set cache "C:\Users\John~1\AppData\Roaming\npm-cache" --global
|
|
@@ -95,7 +129,7 @@ npm run upload
|
|
|
95
129
|
#Deprecated
|
|
96
130
|
sos applet upload --applet-path=dist/index.html
|
|
97
131
|
# This will upload only the one specified file
|
|
98
|
-
#
|
|
132
|
+
# The rest of the files will be removed from our servers
|
|
99
133
|
```
|
|
100
134
|
- If applet is not created yet, it will create it
|
|
101
135
|
- The applet version is used from `package.json`
|
|
@@ -103,7 +137,7 @@ sos applet upload --applet-path=dist/index.html
|
|
|
103
137
|
- You can use SOS_APPLET_UID as environment variable to specify appletUid to upload to (sos.appletUid of package.json will be overlooked).
|
|
104
138
|
- You can use SOS_APPLET_VERSION as environment variable to specify applet version to upload to (version of package.json will be overlooked).
|
|
105
139
|
- Ignore files priority (from top to bottom) `.sosignore` > `.npmignore` > `.gitignore`
|
|
106
|
-
- Only one ignore file is used or
|
|
140
|
+
- Only one ignore file is used or none
|
|
107
141
|
|
|
108
142
|
| Argument | Description | Default value |
|
|
109
143
|
|--------------------------------|-------------------------------|------------------------|
|
|
@@ -138,7 +172,7 @@ sos applet start
|
|
|
138
172
|
| --server-port *(optional)* | The custom server port for local machine server. | {RANDOM_PORT} |
|
|
139
173
|
| --hot-reload *(optional)* | Enable hot reload and build of applet | false |
|
|
140
174
|
| --force *(optional)* | Force start applet server of hot reload even if it is already running on a different port. Kill the running server first. | false |
|
|
141
|
-
| --detach *(optional)* | Run the applet HTTP server in the background (detached
|
|
175
|
+
| --detach *(optional)* | Run the applet HTTP server in the background (detached process) | false |
|
|
142
176
|
| --forward-server-url *(optional)* | Custom forward server URL for `sos device connect` command. | https://forward.signageos.io |
|
|
143
177
|
|
|
144
178
|
#### Applet Tests Upload
|
|
@@ -187,12 +221,12 @@ sos organization get
|
|
|
187
221
|
| --organization-uid *(required)* | Organization UID | STDIN |
|
|
188
222
|
|
|
189
223
|
#### Organization Set Default
|
|
190
|
-
- Sets default organization for current logged in account. This organization will be used for example in webpack plugin of applet to register emulator
|
|
191
|
-
- If you not set default organization, by default will be used the organization you will be asked to select from list where you have access to.
|
|
224
|
+
- Sets default organization for current logged in account. This organization will be used for example in the webpack plugin of applet to register emulator
|
|
225
|
+
- If you do not set default organization, by default will be used the organization you will be asked to select from list where you have access to.
|
|
192
226
|
```bash
|
|
193
227
|
sos organization set-default
|
|
194
228
|
```
|
|
195
|
-
- You override default organization using environment variable `SOS_ORGANIZATION_UID`. Go to https://box.signageos.io/organizations to
|
|
229
|
+
- You can override default organization using environment variable `SOS_ORGANIZATION_UID`. Go to https://box.signageos.io/organizations to get the organizationUid.
|
|
196
230
|
|
|
197
231
|
| Argument | Description | Default value |
|
|
198
232
|
|---------------------------------|------------------------------|----------------|
|
|
@@ -234,7 +268,7 @@ sos device power-action
|
|
|
234
268
|
|---------------------------------|------------------------------|
|
|
235
269
|
| reload | Applet Reload |
|
|
236
270
|
| displayOn | Display power On |
|
|
237
|
-
| displayOff | Display power
|
|
271
|
+
| displayOff | Display power Off |
|
|
238
272
|
| restart | Application restart |
|
|
239
273
|
| disable | Applet disable |
|
|
240
274
|
| enable | Applet enable |
|
|
@@ -260,19 +294,20 @@ sos device connect
|
|
|
260
294
|
```
|
|
261
295
|
| Argument | Description | Default value |
|
|
262
296
|
|--------------------------------|---------------------------------------|------------------------|
|
|
263
|
-
| --device-uid *(required)* | Uid of device from box
|
|
297
|
+
| --device-uid *(required)* | Uid of device from box | STDIN |
|
|
264
298
|
| --applet-uid *(required)* | Applet UID | STDIN |
|
|
265
299
|
| --organization-uid *(required)* | Organization UID | STDIN |
|
|
266
|
-
| --update-package-config *(optional)* | Update package.json value `sos.appletUid` config when applet doesn't
|
|
300
|
+
| --update-package-config *(optional)* | Update package.json value `sos.appletUid` config when applet doesn't exist and is created | false |
|
|
267
301
|
| --server-public-url *(optional)* | Public url of local machine server. Is useful when the local machine is behind a reverse proxy. | http://{CURRENT_REMOTE_ADDR}:{RANDOM_PORT} or https://forward.signageos.io/{random-hash} |
|
|
268
302
|
| --use-forward-server *(optional)* | Use forward server to connect to the device instead of the local network (LAN) (https://forward.signageos.io/{random-hash}). It's useful when the device is not in the same network as the local machine. | false |
|
|
269
303
|
| --server-port *(optional)* | The custom server port for local machine server. | {RANDOM_PORT} |
|
|
270
304
|
| --force *(optional)* | Force start applet server even if it is already running on a different port. Kill the running server first. | false |
|
|
271
305
|
| --applet-path *(optional)* | Root path of applet project | ${PWD}/dist |
|
|
272
|
-
| --detach *(optional)* | Run the applet HTTP server in the background (detached
|
|
306
|
+
| --detach *(optional)* | Run the applet HTTP server in the background (detached process) | false |
|
|
273
307
|
| --forward-server-url *(optional)* | Custom forward server URL. | https://forward.signageos.io |
|
|
274
308
|
| --hot-reload *(optional)* | Enable hot reload and build of applet | false |
|
|
275
309
|
|
|
310
|
+
|
|
276
311
|
## Debugging
|
|
277
312
|
|
|
278
313
|
To enable debugging for the `@signageos/cli:Applet:Upload:appletUploadFacade` module, use:
|
|
@@ -287,7 +322,7 @@ If you want to enable debugging for all modules under `@signageos`, use the aste
|
|
|
287
322
|
DEBUG=@signageos/* sos applet upload
|
|
288
323
|
```
|
|
289
324
|
|
|
290
|
-
You can use `export DEBUG=@signageos
|
|
325
|
+
You can use `export DEBUG=@signageos/*` as well.
|
|
291
326
|
|
|
292
327
|
## Contribution
|
|
293
328
|
Clone the repository and install dev dependencies
|
|
@@ -8,88 +8,44 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
13
|
};
|
|
38
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
15
|
exports.appletBuild = exports.OPTION_LIST = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
18
|
+
const organizationFacade_1 = require("../../Organization/organizationFacade");
|
|
19
|
+
const helper_1 = require("../../helper");
|
|
20
|
+
const dist_1 = require("@signageos/sdk/dist");
|
|
21
|
+
const appletFacade_1 = require("../appletFacade");
|
|
22
|
+
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
23
|
+
const debug_1 = __importDefault(require("debug"));
|
|
24
|
+
const Debug = (0, debug_1.default)('@signageos/cli:Applet:Build:appletBuildCommand');
|
|
49
25
|
exports.OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION, appletFacade_1.APPLET_UID_OPTION];
|
|
50
26
|
exports.appletBuild = (0, commandDefinition_1.createCommandDefinition)({
|
|
51
27
|
name: 'build',
|
|
52
28
|
description: 'Build applet locally. The result is a zip file in the /tmp/signageos directory.',
|
|
53
29
|
optionList: exports.OPTION_LIST,
|
|
54
30
|
commands: [],
|
|
55
|
-
run
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
case 1:
|
|
64
|
-
organizationUid = _a.sent();
|
|
65
|
-
return [4 /*yield*/, (0, organizationFacade_1.getOrganization)(organizationUid)];
|
|
66
|
-
case 2:
|
|
67
|
-
organization = _a.sent();
|
|
68
|
-
return [4 /*yield*/, (0, helper_1.createOrganizationRestApi)(organization)];
|
|
69
|
-
case 3:
|
|
70
|
-
restApi = _a.sent();
|
|
71
|
-
dev = (0, dist_1.createDevelopment)({
|
|
72
|
-
organizationUid: organization.uid,
|
|
73
|
-
});
|
|
74
|
-
return [4 /*yield*/, (0, appletFacade_1.getAppletUid)(restApi, options)];
|
|
75
|
-
case 4:
|
|
76
|
-
appletUid = _a.sent();
|
|
77
|
-
return [4 /*yield*/, (0, appletFacade_1.getAppletVersion)(currentDirectory)];
|
|
78
|
-
case 5:
|
|
79
|
-
appletVersion = _a.sent();
|
|
80
|
-
return [4 /*yield*/, dev.applet.build.build({
|
|
81
|
-
appletUid: appletUid,
|
|
82
|
-
appletVersion: appletVersion,
|
|
83
|
-
appletPath: currentDirectory,
|
|
84
|
-
})];
|
|
85
|
-
case 6:
|
|
86
|
-
build = _a.sent();
|
|
87
|
-
(0, log_1.log)('info', "Applet ".concat(chalk_1.default.green(appletUid), "@").concat(chalk_1.default.green(appletVersion), " was built successfully into \"").concat(chalk_1.default.green(build.packageArchivePath), "\"."));
|
|
88
|
-
debug('Applet build result:', build);
|
|
89
|
-
return [2 /*return*/];
|
|
90
|
-
}
|
|
31
|
+
run(options) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const currentDirectory = process.cwd();
|
|
34
|
+
const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options);
|
|
35
|
+
const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
|
|
36
|
+
const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
|
|
37
|
+
const dev = (0, dist_1.createDevelopment)({
|
|
38
|
+
organizationUid: organization.uid,
|
|
91
39
|
});
|
|
40
|
+
const appletUid = yield (0, appletFacade_1.getAppletUid)(restApi, options);
|
|
41
|
+
const appletVersion = yield (0, appletFacade_1.getAppletVersion)(currentDirectory);
|
|
42
|
+
const build = yield dev.applet.build.build({
|
|
43
|
+
appletUid,
|
|
44
|
+
appletVersion,
|
|
45
|
+
appletPath: currentDirectory,
|
|
46
|
+
});
|
|
47
|
+
(0, log_1.log)('info', `Applet ${chalk_1.default.green(appletUid)}@${chalk_1.default.green(appletVersion)} was built successfully into "${chalk_1.default.green(build.packageArchivePath)}".`);
|
|
48
|
+
Debug('Applet build result:', build);
|
|
92
49
|
});
|
|
93
50
|
},
|
|
94
51
|
});
|
|
95
|
-
//# sourceMappingURL=appletBuildCommand.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
@@ -18,22 +18,22 @@ export default defineConfig({
|
|
|
18
18
|
},
|
|
19
19
|
module: {
|
|
20
20
|
rules: [
|
|
21
|
-
{
|
|
22
|
-
test: /\.js$/,
|
|
23
|
-
exclude: /node_modules/,
|
|
24
|
-
use: {
|
|
25
|
-
loader: 'babel-loader',
|
|
26
|
-
options: {
|
|
27
|
-
presets: ['@babel/preset-env'], // Ensure ES5 transpilation
|
|
28
|
-
cacheDirectory: true, // Speed up subsequent builds
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
21
|
{
|
|
33
22
|
test: /^(.(?!.module.css))*.css$/,
|
|
34
23
|
use: ['style-loader', 'css-loader'],
|
|
35
24
|
},
|
|
36
|
-
{
|
|
25
|
+
{
|
|
26
|
+
test: /\.(tsx?|js)$/,
|
|
27
|
+
loader: 'builtin:swc-loader',
|
|
28
|
+
options: {
|
|
29
|
+
jsc: {
|
|
30
|
+
parser: {
|
|
31
|
+
syntax: 'typescript',
|
|
32
|
+
},
|
|
33
|
+
target: 'es5',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
37
|
],
|
|
38
38
|
},
|
|
39
39
|
plugins: [
|
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
import { CommandLineOptions } from '../../Command/commandDefinition';
|
|
2
|
-
declare const OPTION_LIST:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly type: StringConstructor;
|
|
14
|
-
readonly description: "Directory where will be the applet generated to";
|
|
15
|
-
}, {
|
|
16
|
-
readonly name: "npm-registry";
|
|
17
|
-
readonly type: StringConstructor;
|
|
18
|
-
readonly description: "NPM registry URL. If you have your private npm registry";
|
|
19
|
-
}, {
|
|
20
|
-
readonly name: "language";
|
|
21
|
-
readonly type: StringConstructor;
|
|
22
|
-
readonly description: "Generate applet with \"typescript\" or \"javascript\" source code";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "bundler";
|
|
25
|
-
readonly type: StringConstructor;
|
|
26
|
-
readonly description: "Generate applet with \"webpack\" (default) or \"rspack\"";
|
|
27
|
-
}, {
|
|
28
|
-
readonly name: "git";
|
|
29
|
-
readonly type: StringConstructor;
|
|
30
|
-
readonly description: "Init applet as git repository \"no\" (default) or \"yes\"";
|
|
31
|
-
readonly defaultValue: "no";
|
|
32
|
-
}];
|
|
2
|
+
declare const OPTION_LIST: ({
|
|
3
|
+
name: string;
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
description: string;
|
|
6
|
+
defaultValue?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
name: string;
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
description: string;
|
|
11
|
+
defaultValue: string;
|
|
12
|
+
})[];
|
|
33
13
|
/**
|
|
34
14
|
* Command definition for generating a new applet.
|
|
35
15
|
* This command facilitates the creation of a basic applet sample with configurable options such as
|
|
@@ -43,6 +23,7 @@ declare const OPTION_LIST: readonly [{
|
|
|
43
23
|
* @param {string} options.language - The language of the applet (typescript or javascript)
|
|
44
24
|
* @param {string} options.bundler - The bundler to use (webpack or rspack)
|
|
45
25
|
* @param {string} options.git - Whether to initialize a git repository (yes or no)
|
|
26
|
+
* @param {string} options.packager - Whether to manage packages with npm, pnpm, bun or yarn
|
|
46
27
|
* @returns {Promise<void>} - A promise that resolves when the applet is generated
|
|
47
28
|
* @example
|
|
48
29
|
* appletGenerate.run({
|
|
@@ -58,37 +39,17 @@ declare const OPTION_LIST: readonly [{
|
|
|
58
39
|
export declare const appletGenerate: {
|
|
59
40
|
name: "generate";
|
|
60
41
|
description: string;
|
|
61
|
-
optionList:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
readonly type: StringConstructor;
|
|
73
|
-
readonly description: "Directory where will be the applet generated to";
|
|
74
|
-
}, {
|
|
75
|
-
readonly name: "npm-registry";
|
|
76
|
-
readonly type: StringConstructor;
|
|
77
|
-
readonly description: "NPM registry URL. If you have your private npm registry";
|
|
78
|
-
}, {
|
|
79
|
-
readonly name: "language";
|
|
80
|
-
readonly type: StringConstructor;
|
|
81
|
-
readonly description: "Generate applet with \"typescript\" or \"javascript\" source code";
|
|
82
|
-
}, {
|
|
83
|
-
readonly name: "bundler";
|
|
84
|
-
readonly type: StringConstructor;
|
|
85
|
-
readonly description: "Generate applet with \"webpack\" (default) or \"rspack\"";
|
|
86
|
-
}, {
|
|
87
|
-
readonly name: "git";
|
|
88
|
-
readonly type: StringConstructor;
|
|
89
|
-
readonly description: "Init applet as git repository \"no\" (default) or \"yes\"";
|
|
90
|
-
readonly defaultValue: "no";
|
|
91
|
-
}];
|
|
42
|
+
optionList: ({
|
|
43
|
+
name: string;
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
description: string;
|
|
46
|
+
defaultValue?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
name: string;
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
description: string;
|
|
51
|
+
defaultValue: string;
|
|
52
|
+
})[];
|
|
92
53
|
commands: never[];
|
|
93
54
|
run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
|
|
94
55
|
};
|