@wiztivi/dana-cli 0.0.6 → 0.0.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/dana_completion.sh
CHANGED
|
@@ -11,13 +11,13 @@ dana_commands=(
|
|
|
11
11
|
'add-scrollView'
|
|
12
12
|
'add-screen'
|
|
13
13
|
'auth'
|
|
14
|
+
'create-app'
|
|
14
15
|
)
|
|
15
16
|
|
|
16
17
|
# Shared subcommand declarations
|
|
17
18
|
login_sub="login"
|
|
18
19
|
logout_sub="logout"
|
|
19
20
|
status_sub="status"
|
|
20
|
-
|
|
21
21
|
# Shared option declarations
|
|
22
22
|
direction_opts="-d --direction"
|
|
23
23
|
navigation_opts="-n --navigation"
|
|
@@ -26,12 +26,13 @@ margin_opts="-m --itemMargin"
|
|
|
26
26
|
custom_opts="-cm --custom"
|
|
27
27
|
item_view_opts="-i --itemView"
|
|
28
28
|
org_opts="-o --org"
|
|
29
|
+
device_opts="-d --device"
|
|
30
|
+
tutorial_opts="-t, --tutorial"
|
|
29
31
|
|
|
30
32
|
# Shared option values
|
|
31
33
|
direction_values="h v"
|
|
32
34
|
navigation_values="fixed lmr lr paginated"
|
|
33
35
|
org_values="preprod"
|
|
34
|
-
|
|
35
36
|
# Detect shell and load appropriate completion
|
|
36
37
|
if [ -n "$BASH_VERSION" ]; then
|
|
37
38
|
# Bash completion
|
|
@@ -40,7 +41,6 @@ if [ -n "$BASH_VERSION" ]; then
|
|
|
40
41
|
local cur prev opts
|
|
41
42
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
42
43
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
43
|
-
|
|
44
44
|
# Complete option values
|
|
45
45
|
case "$prev" in
|
|
46
46
|
-d|--direction)
|
|
@@ -56,13 +56,11 @@ if [ -n "$BASH_VERSION" ]; then
|
|
|
56
56
|
return 0
|
|
57
57
|
;;
|
|
58
58
|
esac
|
|
59
|
-
|
|
60
59
|
# If we're completing the first argument (command)
|
|
61
60
|
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
62
61
|
COMPREPLY=($(compgen -W "${dana_commands[*]}" -- "$cur"))
|
|
63
62
|
return 0
|
|
64
63
|
fi
|
|
65
|
-
|
|
66
64
|
# If we're completing options for specific commands
|
|
67
65
|
local cmd="${COMP_WORDS[1]}"
|
|
68
66
|
case "$cmd" in
|
|
@@ -86,14 +84,16 @@ if [ -n "$BASH_VERSION" ]; then
|
|
|
86
84
|
fi
|
|
87
85
|
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
88
86
|
;;
|
|
87
|
+
create-app)
|
|
88
|
+
opts="$device_opts $tutorial_opts"
|
|
89
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
90
|
+
;;
|
|
89
91
|
*)
|
|
90
92
|
COMPREPLY=()
|
|
91
93
|
;;
|
|
92
94
|
esac
|
|
93
95
|
}
|
|
94
|
-
|
|
95
96
|
complete -F _dana dana
|
|
96
|
-
|
|
97
97
|
elif [ -n "$ZSH_VERSION" ]; then
|
|
98
98
|
# Zsh completion
|
|
99
99
|
_dana() {
|
|
@@ -104,7 +104,6 @@ elif [ -n "$ZSH_VERSION" ]; then
|
|
|
104
104
|
compadd -a commands
|
|
105
105
|
return
|
|
106
106
|
fi
|
|
107
|
-
|
|
108
107
|
# Complete option values
|
|
109
108
|
local prev=${words[CURRENT-1]}
|
|
110
109
|
case "$prev" in
|
|
@@ -125,7 +124,6 @@ elif [ -n "$ZSH_VERSION" ]; then
|
|
|
125
124
|
return
|
|
126
125
|
;;
|
|
127
126
|
esac
|
|
128
|
-
|
|
129
127
|
# Complete options for commands
|
|
130
128
|
local cmd=${words[2]}
|
|
131
129
|
case "$cmd" in
|
|
@@ -145,6 +143,8 @@ elif [ -n "$ZSH_VERSION" ]; then
|
|
|
145
143
|
compadd -- ${=org_opts}
|
|
146
144
|
fi
|
|
147
145
|
;;
|
|
146
|
+
create-app)
|
|
147
|
+
compadd -- ${device_opts} $={tutorial_opts}
|
|
148
148
|
esac
|
|
149
149
|
}
|
|
150
150
|
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Dana-cli
|
|
4
|
+
|
|
5
|
+
Dana is a JavaScript framework built for TV apps.
|
|
6
|
+
It aims at enabling the creation of natively performant TV applications on all currently available TV platforms.
|
|
7
|
+
Code once, deploy across all major platforms (Samsung Tizen, LG WebOS, Android TV, AppleTV, Xbox...) using a single codebase.
|
|
8
|
+
|
|
9
|
+
This cli is a companion tool made to help you boostrap an application with Dana.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
To be able to use the dana-cli, you will need:
|
|
14
|
+
|
|
15
|
+
- Node > 20,
|
|
16
|
+
- an account on [Dana Cloud Service](https://app.public.dana-framework.com/)
|
|
17
|
+
|
|
18
|
+
## Getting started
|
|
19
|
+
|
|
20
|
+
First you'll need to use your account to authenticate to Dana Cloud Service platform:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx @wiztivi/dana-cli auth login
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This should open a browser and ask for your account credentials.
|
|
27
|
+
|
|
28
|
+
Then you can create a simple template of your application by running the following command:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx @wiztivi/dana-cli create-app <project-name>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Use the CLI to:
|
|
37
|
+
|
|
38
|
+
- create a new app project
|
|
39
|
+
- add device(s) easily to deploy your project on more platforms: `npx @wiztivi/dana-cli add-device`,
|
|
40
|
+
- add built-in components to your project: eg `npx @wiztivi/dana-cli add-menu`
|
|
41
|
+
|
|
42
|
+
To get all available options and more information:`npx @wiztivi/dana-cli help`
|
|
43
|
+
|
|
44
|
+
## Screenshots
|
|
45
|
+
|
|
46
|
+

|
|
@@ -24,6 +24,7 @@ import translation from "../../common/translation/translation.js";
|
|
|
24
24
|
import { CredentialsHelper } from "../authentication/helper/CredentialsHelper.js";
|
|
25
25
|
const addDevice = async () => {
|
|
26
26
|
prompts.intro(`Add device(s) to ${path.basename(process.cwd())} !`);
|
|
27
|
+
const spinner = prompts.spinner();
|
|
27
28
|
const data = {};
|
|
28
29
|
try {
|
|
29
30
|
data.directory = "./";
|
|
@@ -49,6 +50,7 @@ const addDevice = async () => {
|
|
|
49
50
|
process.exit(DEVICE_ERROR);
|
|
50
51
|
}
|
|
51
52
|
try {
|
|
53
|
+
spinner.start(translation["task.installation.start"]);
|
|
52
54
|
await CreateAppHelper.installation([
|
|
53
55
|
{
|
|
54
56
|
title: "Update package.json",
|
|
@@ -74,14 +76,15 @@ const addDevice = async () => {
|
|
|
74
76
|
title: "Execute devices config",
|
|
75
77
|
task: async () => UpdateFileHelper.setDevicesConfig(data),
|
|
76
78
|
},
|
|
77
|
-
]);
|
|
79
|
+
], spinner);
|
|
78
80
|
}
|
|
79
81
|
catch (e) {
|
|
80
|
-
|
|
82
|
+
spinner.stop();
|
|
81
83
|
const message = e instanceof Error ? e.message : e;
|
|
82
84
|
prompts.outro(colors.red(`${translation["error.common.start.message"]} ${message}`));
|
|
83
85
|
process.exit(DEVICE_ERROR);
|
|
84
86
|
}
|
|
87
|
+
spinner.stop(translation["task.installation.end"]);
|
|
85
88
|
prompts.outro("Everything is ready ! Don't forget to commit your change.");
|
|
86
89
|
return;
|
|
87
90
|
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Config } from "../types/helperTypes.js";
|
|
2
|
+
interface TemplateFile {
|
|
3
|
+
fromPath: string;
|
|
4
|
+
config: Record<string, string>;
|
|
5
|
+
toPath: string;
|
|
6
|
+
}
|
|
2
7
|
declare class UpdateFileHelper {
|
|
3
8
|
/**
|
|
4
9
|
* Update app.Config files with mandatory Data
|
|
@@ -36,5 +41,6 @@ declare class UpdateFileHelper {
|
|
|
36
41
|
directory: string;
|
|
37
42
|
name: string;
|
|
38
43
|
}) => Promise<string>;
|
|
44
|
+
static readonly getConfigFileOutput: (directory: string) => TemplateFile[];
|
|
39
45
|
}
|
|
40
46
|
export default UpdateFileHelper;
|
|
@@ -104,13 +104,9 @@ class UpdateFileHelper {
|
|
|
104
104
|
config: { appName },
|
|
105
105
|
toPath: path.join(directory, "tests", "unit", "app", `${appName}AppRoutes.js`),
|
|
106
106
|
},
|
|
107
|
-
{
|
|
108
|
-
fromPath: path.join(directory, "gitignoreTemplate.hbs"),
|
|
109
|
-
config: {},
|
|
110
|
-
toPath: path.join(directory, `.gitignore`),
|
|
111
|
-
},
|
|
112
107
|
];
|
|
113
|
-
|
|
108
|
+
const finalListToUpdate = filesToUpdate.concat(UpdateFileHelper.getConfigFileOutput(directory));
|
|
109
|
+
for (const file of finalListToUpdate) {
|
|
114
110
|
const updatedContent = templateGenerator(file.fromPath, file.config);
|
|
115
111
|
fs.writeFileSync(file.toPath, updatedContent);
|
|
116
112
|
fs.unlink(file.fromPath, (err) => {
|
|
@@ -120,5 +116,17 @@ class UpdateFileHelper {
|
|
|
120
116
|
}
|
|
121
117
|
return Promise.resolve("Files templated");
|
|
122
118
|
};
|
|
119
|
+
static getConfigFileOutput = function (directory) {
|
|
120
|
+
const configFiles = ["gitignoreTemplate.hbs", "editorConfigTemplate.hbs", "eslintrc.jsonTemplate.hbs"];
|
|
121
|
+
const filesToUpdate = [];
|
|
122
|
+
for (const configFile of configFiles) {
|
|
123
|
+
filesToUpdate.push({
|
|
124
|
+
fromPath: path.join(directory, configFile),
|
|
125
|
+
config: {},
|
|
126
|
+
toPath: path.join(directory, `.${configFile.replace("Template.hbs", "")}`),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return filesToUpdate;
|
|
130
|
+
};
|
|
123
131
|
}
|
|
124
132
|
export default UpdateFileHelper;
|
package/dist/dana_completion.sh
CHANGED
|
@@ -11,13 +11,13 @@ dana_commands=(
|
|
|
11
11
|
'add-scrollView'
|
|
12
12
|
'add-screen'
|
|
13
13
|
'auth'
|
|
14
|
+
'create-app'
|
|
14
15
|
)
|
|
15
16
|
|
|
16
17
|
# Shared subcommand declarations
|
|
17
18
|
login_sub="login"
|
|
18
19
|
logout_sub="logout"
|
|
19
20
|
status_sub="status"
|
|
20
|
-
|
|
21
21
|
# Shared option declarations
|
|
22
22
|
direction_opts="-d --direction"
|
|
23
23
|
navigation_opts="-n --navigation"
|
|
@@ -26,12 +26,13 @@ margin_opts="-m --itemMargin"
|
|
|
26
26
|
custom_opts="-cm --custom"
|
|
27
27
|
item_view_opts="-i --itemView"
|
|
28
28
|
org_opts="-o --org"
|
|
29
|
+
device_opts="-d --device"
|
|
30
|
+
tutorial_opts="-t, --tutorial"
|
|
29
31
|
|
|
30
32
|
# Shared option values
|
|
31
33
|
direction_values="h v"
|
|
32
34
|
navigation_values="fixed lmr lr paginated"
|
|
33
35
|
org_values="preprod"
|
|
34
|
-
|
|
35
36
|
# Detect shell and load appropriate completion
|
|
36
37
|
if [ -n "$BASH_VERSION" ]; then
|
|
37
38
|
# Bash completion
|
|
@@ -40,7 +41,6 @@ if [ -n "$BASH_VERSION" ]; then
|
|
|
40
41
|
local cur prev opts
|
|
41
42
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
42
43
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
43
|
-
|
|
44
44
|
# Complete option values
|
|
45
45
|
case "$prev" in
|
|
46
46
|
-d|--direction)
|
|
@@ -56,13 +56,11 @@ if [ -n "$BASH_VERSION" ]; then
|
|
|
56
56
|
return 0
|
|
57
57
|
;;
|
|
58
58
|
esac
|
|
59
|
-
|
|
60
59
|
# If we're completing the first argument (command)
|
|
61
60
|
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
62
61
|
COMPREPLY=($(compgen -W "${dana_commands[*]}" -- "$cur"))
|
|
63
62
|
return 0
|
|
64
63
|
fi
|
|
65
|
-
|
|
66
64
|
# If we're completing options for specific commands
|
|
67
65
|
local cmd="${COMP_WORDS[1]}"
|
|
68
66
|
case "$cmd" in
|
|
@@ -86,14 +84,16 @@ if [ -n "$BASH_VERSION" ]; then
|
|
|
86
84
|
fi
|
|
87
85
|
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
88
86
|
;;
|
|
87
|
+
create-app)
|
|
88
|
+
opts="$device_opts $tutorial_opts"
|
|
89
|
+
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
90
|
+
;;
|
|
89
91
|
*)
|
|
90
92
|
COMPREPLY=()
|
|
91
93
|
;;
|
|
92
94
|
esac
|
|
93
95
|
}
|
|
94
|
-
|
|
95
96
|
complete -F _dana dana
|
|
96
|
-
|
|
97
97
|
elif [ -n "$ZSH_VERSION" ]; then
|
|
98
98
|
# Zsh completion
|
|
99
99
|
_dana() {
|
|
@@ -104,7 +104,6 @@ elif [ -n "$ZSH_VERSION" ]; then
|
|
|
104
104
|
compadd -a commands
|
|
105
105
|
return
|
|
106
106
|
fi
|
|
107
|
-
|
|
108
107
|
# Complete option values
|
|
109
108
|
local prev=${words[CURRENT-1]}
|
|
110
109
|
case "$prev" in
|
|
@@ -125,7 +124,6 @@ elif [ -n "$ZSH_VERSION" ]; then
|
|
|
125
124
|
return
|
|
126
125
|
;;
|
|
127
126
|
esac
|
|
128
|
-
|
|
129
127
|
# Complete options for commands
|
|
130
128
|
local cmd=${words[2]}
|
|
131
129
|
case "$cmd" in
|
|
@@ -145,6 +143,8 @@ elif [ -n "$ZSH_VERSION" ]; then
|
|
|
145
143
|
compadd -- ${=org_opts}
|
|
146
144
|
fi
|
|
147
145
|
;;
|
|
146
|
+
create-app)
|
|
147
|
+
compadd -- ${device_opts} $={tutorial_opts}
|
|
148
148
|
esac
|
|
149
149
|
}
|
|
150
150
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiztivi/dana-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Dana create app CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
"lint": "eslint src tests",
|
|
15
15
|
"test": "vitest",
|
|
16
16
|
"test:coverage": "vitest run --coverage",
|
|
17
|
-
"build": "rimraf ./dist tsconfig.tsbuildinfo && tsc --build &&
|
|
18
|
-
"ci": "npm run build && npm run lint && npm run test:coverage"
|
|
17
|
+
"build": "rimraf ./dist tsconfig.tsbuildinfo && tsc --build && npm run add_files_to_dist",
|
|
18
|
+
"ci": "npm run build && npm run lint && npm run test:coverage",
|
|
19
|
+
"add_files_to_dist": "cp dana_completion.sh ../../README.md dist/"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
22
|
"dist",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"@aws-sdk/client-codeartifact": "^3.859.0",
|
|
26
27
|
"@clack/prompts": "0.10.0",
|
|
27
|
-
"@wiztivi/dana-templates": "^0.0.
|
|
28
|
+
"@wiztivi/dana-templates": "^0.0.7",
|
|
28
29
|
"child_process": "1.0.x",
|
|
29
30
|
"command-exists": "1.2.9",
|
|
30
31
|
"commander": "11.1.x",
|