@newlogic-digital/cli 0.1.0 → 0.2.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/package.json +5 -6
- package/src/commands/cms/prepare.mjs +20 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlogic-digital/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "index.mjs",
|
|
5
5
|
"bin": {
|
|
6
6
|
"newlogic-cli": "index.mjs",
|
|
@@ -12,14 +12,13 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"lodash": "^4.17.21",
|
|
14
14
|
"prompts": "^2.4.2",
|
|
15
|
-
"fs-extra": "^11.
|
|
15
|
+
"fs-extra": "^11.2.0",
|
|
16
16
|
"picocolors": "^1.0.0",
|
|
17
|
-
"fast-glob": "^3.2
|
|
18
|
-
"dedent": "^
|
|
17
|
+
"fast-glob": "^3.3.2",
|
|
18
|
+
"dedent": "^1.5.3"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"eslint": "^
|
|
22
|
-
"eslint-config-standard": "^17.0.0"
|
|
21
|
+
"eslint-config-standard": "^17.1.0"
|
|
23
22
|
},
|
|
24
23
|
"files": [
|
|
25
24
|
"index.js",
|
|
@@ -59,30 +59,30 @@ export default function prepare(options) {
|
|
|
59
59
|
|
|
60
60
|
const getField = (control, type) => {
|
|
61
61
|
if (type === 'number') {
|
|
62
|
-
return '
|
|
62
|
+
return 'INT'
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
if (control.startsWith('table')) {
|
|
66
|
-
return '
|
|
66
|
+
return 'TABLE'
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (control === 'heading' || control === 'title') {
|
|
70
|
-
return '
|
|
70
|
+
return 'TEXT'
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (control === 'content') {
|
|
74
|
-
return '
|
|
74
|
+
return 'WSW'
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
if (type === 'string') {
|
|
78
|
-
return '
|
|
78
|
+
return 'TEXTAREA'
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
if (type === 'boolean') {
|
|
82
|
-
return
|
|
82
|
+
return 'BOOLEAN'
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
return
|
|
85
|
+
return 'OTHER'
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
const getTitle = (control) => {
|
|
@@ -121,11 +121,8 @@ export default function prepare(options) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
annotations.push(`
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
* @title ${getTitle(control)}
|
|
127
|
-
* @value ${value}
|
|
128
|
-
*/
|
|
124
|
+
#[FieldType(FieldType::${getField(control, type)})]
|
|
125
|
+
#[FieldName('${getTitle(control)}')]
|
|
129
126
|
public ${phpType} $${control}${type === 'string' ? " = '" + value + "'" : ''};
|
|
130
127
|
`)
|
|
131
128
|
|
|
@@ -152,16 +149,23 @@ export default function prepare(options) {
|
|
|
152
149
|
fs.writeFileSync(join(options.path.app.sections, `${name}.php`),
|
|
153
150
|
dedent`
|
|
154
151
|
<?php
|
|
155
|
-
|
|
152
|
+
|
|
153
|
+
declare(strict_types=1);
|
|
154
|
+
|
|
156
155
|
namespace App\Sections;
|
|
157
156
|
|
|
157
|
+
use App\Sections\Attributes\FieldName;
|
|
158
|
+
use App\Sections\Attributes\FieldType;
|
|
159
|
+
use App\Sections\Attributes\SectionName;
|
|
160
|
+
|
|
161
|
+
#[SectionName('${name}')]
|
|
158
162
|
class ${name} extends BaseSection
|
|
159
163
|
{
|
|
160
164
|
${annotations}
|
|
161
165
|
public function render() : void
|
|
162
166
|
{
|
|
163
167
|
${objects}
|
|
164
|
-
$this->
|
|
168
|
+
$this->template->render(TEMPLATES_DIR . '/${path}');
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
`
|
|
@@ -177,6 +181,8 @@ export default function prepare(options) {
|
|
|
177
181
|
fs.writeFileSync(join(options.path.app.sectionsFactory, `${name}Factory.php`),
|
|
178
182
|
dedent`
|
|
179
183
|
<?php
|
|
184
|
+
|
|
185
|
+
declare(strict_types=1);
|
|
180
186
|
|
|
181
187
|
namespace App\Sections\Factory;
|
|
182
188
|
|