@airfleet/generator-init 0.20.17 → 0.21.1
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/generators/plugin/index.js +5 -0
- package/generators/plugin/templates/.vscode/airfleet.code-snippets.ejs +171 -0
- package/generators/plugin/templates/.vscode/settings.json +2 -2
- package/generators/snippets/index.js +58 -0
- package/generators/snippets/templates/airfleet.code-snippets.ejs +171 -0
- package/generators/view/templates/blocks/block-meta.json.ejs +1 -0
- package/package.json +1 -1
|
@@ -228,6 +228,11 @@ export default class extends Generator {
|
|
|
228
228
|
destination: `acf-json/.gitkeep`,
|
|
229
229
|
isEnabled: this.answers.pluginAcfLocalJson,
|
|
230
230
|
},
|
|
231
|
+
{
|
|
232
|
+
template: ".vscode/airfleet.code-snippets.ejs",
|
|
233
|
+
destination: ".vscode/airfleet.code-snippets",
|
|
234
|
+
isEnabled: true,
|
|
235
|
+
},
|
|
231
236
|
];
|
|
232
237
|
|
|
233
238
|
copyTemplates(this, templates, this.data);
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Airfleet Feature": {
|
|
3
|
+
"scope": "php,html",
|
|
4
|
+
"prefix": "affeat",
|
|
5
|
+
"body": [
|
|
6
|
+
"<?php",
|
|
7
|
+
"",
|
|
8
|
+
"namespace Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\Features;",
|
|
9
|
+
"",
|
|
10
|
+
"use Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\Vendor\\Airfleet\\Framework\\Features\\BasePluginFeature;",
|
|
11
|
+
"",
|
|
12
|
+
"class $TM_FILENAME_BASE extends BasePluginFeature {",
|
|
13
|
+
" public function initialize(): void {",
|
|
14
|
+
" $0",
|
|
15
|
+
" }",
|
|
16
|
+
"}",
|
|
17
|
+
""
|
|
18
|
+
],
|
|
19
|
+
"description": "Create a new plugin feature"
|
|
20
|
+
},
|
|
21
|
+
"Airfleet View Controller": {
|
|
22
|
+
"scope": "php,html",
|
|
23
|
+
"prefix": "afctrl",
|
|
24
|
+
"body": [
|
|
25
|
+
"<?php",
|
|
26
|
+
"",
|
|
27
|
+
"namespace Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\Views\\\\${1|Components,Blocks,Partials,Templates,CustomTemplates|}\\\\${TM_FILENAME_BASE/(.+)Controller/$1/};",
|
|
28
|
+
"",
|
|
29
|
+
"use Airfleet\\Plugins\\Views\\View\\ViewController;",
|
|
30
|
+
"",
|
|
31
|
+
"class $TM_FILENAME_BASE extends ViewController {",
|
|
32
|
+
" $2",
|
|
33
|
+
"}",
|
|
34
|
+
""
|
|
35
|
+
],
|
|
36
|
+
"description": "Create a new view controller"
|
|
37
|
+
},
|
|
38
|
+
"Airfleet View Setup": {
|
|
39
|
+
"scope": "php,html",
|
|
40
|
+
"prefix": "afsetup",
|
|
41
|
+
"body": [
|
|
42
|
+
"<?php",
|
|
43
|
+
"",
|
|
44
|
+
"namespace Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\Views\\\\${1|Components,Blocks,Partials,Templates,CustomTemplates|}\\\\${TM_FILENAME_BASE/(.+)Controller/$1/};",
|
|
45
|
+
"",
|
|
46
|
+
"use Airfleet\\Plugins\\Views\\View\\ViewSetup;",
|
|
47
|
+
"",
|
|
48
|
+
"class $TM_FILENAME_BASE extends ViewSetup {",
|
|
49
|
+
" public function initialize(): void {",
|
|
50
|
+
" $2",
|
|
51
|
+
" }",
|
|
52
|
+
"}",
|
|
53
|
+
""
|
|
54
|
+
],
|
|
55
|
+
"description": "Create a new view setup file"
|
|
56
|
+
},
|
|
57
|
+
"Airfleet Script": {
|
|
58
|
+
"scope": "javascript",
|
|
59
|
+
"prefix": "afjs",
|
|
60
|
+
"body": [
|
|
61
|
+
"export class ${TM_FILENAME_BASE/(.)([^-]*)-?/${1:/upcase}${2}/g} {",
|
|
62
|
+
" initialize() {",
|
|
63
|
+
" const { domReady } = window._airfleet.elements.core;",
|
|
64
|
+
"",
|
|
65
|
+
" domReady(() => {",
|
|
66
|
+
" $1",
|
|
67
|
+
" });",
|
|
68
|
+
" }",
|
|
69
|
+
"}",
|
|
70
|
+
"",
|
|
71
|
+
"new ${TM_FILENAME_BASE/(.)([^-]*)-?/${1:/upcase}${2}/g}().initialize();",
|
|
72
|
+
""
|
|
73
|
+
],
|
|
74
|
+
"description": "Create a view script"
|
|
75
|
+
},
|
|
76
|
+
"Airfleet Stylesheet": {
|
|
77
|
+
"scope": "scss,css,postcss",
|
|
78
|
+
"prefix": "afcss",
|
|
79
|
+
"body": [
|
|
80
|
+
".${1|afc,afb,afp,aft|}-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/} {",
|
|
81
|
+
" $2",
|
|
82
|
+
"}",
|
|
83
|
+
""
|
|
84
|
+
],
|
|
85
|
+
"description": "Create a view stylesheet"
|
|
86
|
+
},
|
|
87
|
+
"Airfleet Block Meta": {
|
|
88
|
+
"scope": "json",
|
|
89
|
+
"prefix": "afblockmeta",
|
|
90
|
+
"body": [
|
|
91
|
+
"{",
|
|
92
|
+
" \"$schema\": \"https://advancedcustomfields.com/schemas/json/main/block.json\",",
|
|
93
|
+
" \"name\": \"${1|airfleet/,airfleet/elements-|}$TM_FILENAME_BASE\",",
|
|
94
|
+
" \"title\": \"$2${TM_FILENAME_BASE/-/ /g}\",",
|
|
95
|
+
" \"description\": \"$3\",",
|
|
96
|
+
" \"keywords\": [\"airfleet\", \"${TM_FILENAME_BASE/-/\", \"/g}\"$4]",
|
|
97
|
+
"}",
|
|
98
|
+
""
|
|
99
|
+
],
|
|
100
|
+
"description": "Create a JSON meta file for a block"
|
|
101
|
+
},
|
|
102
|
+
"Airfleet Block Template (PHP)": {
|
|
103
|
+
"scope": "php,html",
|
|
104
|
+
"prefix": "afblockphp",
|
|
105
|
+
"body": [
|
|
106
|
+
"<section <?php echo \\$_all_attrs( [ 'class' => 'afb-$TM_FILENAME_BASE' ] ); ?>>",
|
|
107
|
+
" $1",
|
|
108
|
+
"</section>",
|
|
109
|
+
""
|
|
110
|
+
],
|
|
111
|
+
"description": "Bootstrap a PHP template for a block"
|
|
112
|
+
},
|
|
113
|
+
"Airfleet Block Template (Blade)": {
|
|
114
|
+
"scope": "blade",
|
|
115
|
+
"prefix": "afblock",
|
|
116
|
+
"body": [
|
|
117
|
+
"<section @all_attrs( [ 'class' => 'afb-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
118
|
+
" $1",
|
|
119
|
+
"</section>",
|
|
120
|
+
""
|
|
121
|
+
],
|
|
122
|
+
"description": "Bootstrap a Blade template for a block"
|
|
123
|
+
},
|
|
124
|
+
"Airfleet Component Template (PHP)": {
|
|
125
|
+
"scope": "php,html",
|
|
126
|
+
"prefix": "afcompphp",
|
|
127
|
+
"body": [
|
|
128
|
+
"<div <?php echo \\$_all_attrs( [ 'class' => 'afc-$TM_FILENAME_BASE' ] ); ?>>",
|
|
129
|
+
" $1",
|
|
130
|
+
" <?php echo \\$_slot; ?>",
|
|
131
|
+
"</div>",
|
|
132
|
+
""
|
|
133
|
+
],
|
|
134
|
+
"description": "Bootstrap a PHP template for a component"
|
|
135
|
+
},
|
|
136
|
+
"Airfleet Component Template (Blade)": {
|
|
137
|
+
"scope": "blade",
|
|
138
|
+
"prefix": "afcomp",
|
|
139
|
+
"body": [
|
|
140
|
+
"<div @all_attrs( [ 'class' => 'afc-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
141
|
+
" $1",
|
|
142
|
+
" {!! \\$_slot !!}",
|
|
143
|
+
"</div>",
|
|
144
|
+
""
|
|
145
|
+
],
|
|
146
|
+
"description": "Bootstrap a Blade template for a component"
|
|
147
|
+
},
|
|
148
|
+
"Airfleet Partial Template (PHP)": {
|
|
149
|
+
"scope": "php,html",
|
|
150
|
+
"prefix": "afpartialphp",
|
|
151
|
+
"body": [
|
|
152
|
+
"<div <?php echo \\$_all_attrs( [ 'class' => 'afp-$TM_FILENAME_BASE' ] ); ?>>",
|
|
153
|
+
" $1",
|
|
154
|
+
" <?php echo \\$_slot; ?>",
|
|
155
|
+
"</div>",
|
|
156
|
+
""
|
|
157
|
+
],
|
|
158
|
+
"description": "Bootstrap a PHP template for a partial"
|
|
159
|
+
},
|
|
160
|
+
"Airfleet Partial Template (Blade)": {
|
|
161
|
+
"prefix": "afpartial",
|
|
162
|
+
"body": [
|
|
163
|
+
"<div @all_attrs( [ 'class' => 'afp-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
164
|
+
" $1",
|
|
165
|
+
" {!! \\$_slot !!}",
|
|
166
|
+
"</div>",
|
|
167
|
+
""
|
|
168
|
+
],
|
|
169
|
+
"description": "Airfleet Partial Template (Blade)"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import Generator from "yeoman-generator";
|
|
3
|
+
|
|
4
|
+
import nameCases from "../../utils/nameCases.js";
|
|
5
|
+
import copyTemplates from "../../utils/copyTemplates.js";
|
|
6
|
+
import requiredText from "../../utils/validation/requiredText.js";
|
|
7
|
+
import title from "../../utils/log/title.js";
|
|
8
|
+
import highlightText from "../../utils/log/text/highlightText.js";
|
|
9
|
+
import lines from "../../utils/log/text/lines.js";
|
|
10
|
+
import infoBox from "../../utils/log/boxes/infoBox.js";
|
|
11
|
+
|
|
12
|
+
export default class extends Generator {
|
|
13
|
+
async prompting() {
|
|
14
|
+
this.log(
|
|
15
|
+
lines([
|
|
16
|
+
title(`Let's generate ${highlightText("VS Code snippets")}!`),
|
|
17
|
+
infoBox(
|
|
18
|
+
lines([
|
|
19
|
+
"This will create the files inside .vscode folder.",
|
|
20
|
+
])
|
|
21
|
+
),
|
|
22
|
+
"",
|
|
23
|
+
])
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const prompts = [
|
|
27
|
+
{
|
|
28
|
+
type: "input",
|
|
29
|
+
name: "pluginName",
|
|
30
|
+
message: 'Name of the plugin? (start with "Airfleet", e.g. "Airfleet Elements - Videos")',
|
|
31
|
+
validate: requiredText("Please enter a name"),
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
this.answers = await this.prompt(prompts);
|
|
36
|
+
this.name = nameCases(this.answers.pluginName);
|
|
37
|
+
this.nameNoAirfleet = nameCases(this.answers.pluginName
|
|
38
|
+
.replace(/^airfleet/i, "")
|
|
39
|
+
.trim());
|
|
40
|
+
this.data = {
|
|
41
|
+
answers: this.answers,
|
|
42
|
+
name: this.name,
|
|
43
|
+
nameNoAirfleet: this.nameNoAirfleet,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
writing() {
|
|
48
|
+
const templates = [
|
|
49
|
+
{
|
|
50
|
+
template: "airfleet.code-snippets.ejs",
|
|
51
|
+
destination: ".vscode/airfleet.code-snippets",
|
|
52
|
+
isEnabled: true,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
copyTemplates(this, templates, this.data);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Airfleet Feature": {
|
|
3
|
+
"scope": "php,html",
|
|
4
|
+
"prefix": "affeat",
|
|
5
|
+
"body": [
|
|
6
|
+
"<?php",
|
|
7
|
+
"",
|
|
8
|
+
"namespace Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\Features;",
|
|
9
|
+
"",
|
|
10
|
+
"use Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\Vendor\\Airfleet\\Framework\\Features\\BasePluginFeature;",
|
|
11
|
+
"",
|
|
12
|
+
"class $TM_FILENAME_BASE extends BasePluginFeature {",
|
|
13
|
+
" public function initialize(): void {",
|
|
14
|
+
" $0",
|
|
15
|
+
" }",
|
|
16
|
+
"}",
|
|
17
|
+
""
|
|
18
|
+
],
|
|
19
|
+
"description": "Create a new plugin feature"
|
|
20
|
+
},
|
|
21
|
+
"Airfleet View Controller": {
|
|
22
|
+
"scope": "php,html",
|
|
23
|
+
"prefix": "afctrl",
|
|
24
|
+
"body": [
|
|
25
|
+
"<?php",
|
|
26
|
+
"",
|
|
27
|
+
"namespace Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\Views\\\\${1|Components,Blocks,Partials,Templates,CustomTemplates|}\\\\${TM_FILENAME_BASE/(.+)Controller/$1/};",
|
|
28
|
+
"",
|
|
29
|
+
"use Airfleet\\Plugins\\Views\\View\\ViewController;",
|
|
30
|
+
"",
|
|
31
|
+
"class $TM_FILENAME_BASE extends ViewController {",
|
|
32
|
+
" $2",
|
|
33
|
+
"}",
|
|
34
|
+
""
|
|
35
|
+
],
|
|
36
|
+
"description": "Create a new view controller"
|
|
37
|
+
},
|
|
38
|
+
"Airfleet View Setup": {
|
|
39
|
+
"scope": "php,html",
|
|
40
|
+
"prefix": "afsetup",
|
|
41
|
+
"body": [
|
|
42
|
+
"<?php",
|
|
43
|
+
"",
|
|
44
|
+
"namespace Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\Views\\\\${1|Components,Blocks,Partials,Templates,CustomTemplates|}\\\\${TM_FILENAME_BASE/(.+)Controller/$1/};",
|
|
45
|
+
"",
|
|
46
|
+
"use Airfleet\\Plugins\\Views\\View\\ViewSetup;",
|
|
47
|
+
"",
|
|
48
|
+
"class $TM_FILENAME_BASE extends ViewSetup {",
|
|
49
|
+
" public function initialize(): void {",
|
|
50
|
+
" $2",
|
|
51
|
+
" }",
|
|
52
|
+
"}",
|
|
53
|
+
""
|
|
54
|
+
],
|
|
55
|
+
"description": "Create a new view setup file"
|
|
56
|
+
},
|
|
57
|
+
"Airfleet Script": {
|
|
58
|
+
"scope": "javascript",
|
|
59
|
+
"prefix": "afjs",
|
|
60
|
+
"body": [
|
|
61
|
+
"export class ${TM_FILENAME_BASE/(.)([^-]*)-?/${1:/upcase}${2}/g} {",
|
|
62
|
+
" initialize() {",
|
|
63
|
+
" const { domReady } = window._airfleet.elements.core;",
|
|
64
|
+
"",
|
|
65
|
+
" domReady(() => {",
|
|
66
|
+
" $1",
|
|
67
|
+
" });",
|
|
68
|
+
" }",
|
|
69
|
+
"}",
|
|
70
|
+
"",
|
|
71
|
+
"new ${TM_FILENAME_BASE/(.)([^-]*)-?/${1:/upcase}${2}/g}().initialize();",
|
|
72
|
+
""
|
|
73
|
+
],
|
|
74
|
+
"description": "Create a view script"
|
|
75
|
+
},
|
|
76
|
+
"Airfleet Stylesheet": {
|
|
77
|
+
"scope": "scss,css,postcss",
|
|
78
|
+
"prefix": "afcss",
|
|
79
|
+
"body": [
|
|
80
|
+
".${1|afc,afb,afp,aft|}-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/} {",
|
|
81
|
+
" $2",
|
|
82
|
+
"}",
|
|
83
|
+
""
|
|
84
|
+
],
|
|
85
|
+
"description": "Create a view stylesheet"
|
|
86
|
+
},
|
|
87
|
+
"Airfleet Block Meta": {
|
|
88
|
+
"scope": "json",
|
|
89
|
+
"prefix": "afblockmeta",
|
|
90
|
+
"body": [
|
|
91
|
+
"{",
|
|
92
|
+
" \"$schema\": \"https://advancedcustomfields.com/schemas/json/main/block.json\",",
|
|
93
|
+
" \"name\": \"${1|airfleet/,airfleet/elements-|}$TM_FILENAME_BASE\",",
|
|
94
|
+
" \"title\": \"$2${TM_FILENAME_BASE/-/ /g}\",",
|
|
95
|
+
" \"description\": \"$3\",",
|
|
96
|
+
" \"keywords\": [\"airfleet\", \"${TM_FILENAME_BASE/-/\", \"/g}\"$4]",
|
|
97
|
+
"}",
|
|
98
|
+
""
|
|
99
|
+
],
|
|
100
|
+
"description": "Create a JSON meta file for a block"
|
|
101
|
+
},
|
|
102
|
+
"Airfleet Block Template (PHP)": {
|
|
103
|
+
"scope": "php,html",
|
|
104
|
+
"prefix": "afblockphp",
|
|
105
|
+
"body": [
|
|
106
|
+
"<section <?php echo \\$_all_attrs( [ 'class' => 'afb-$TM_FILENAME_BASE' ] ); ?>>",
|
|
107
|
+
" $1",
|
|
108
|
+
"</section>",
|
|
109
|
+
""
|
|
110
|
+
],
|
|
111
|
+
"description": "Bootstrap a PHP template for a block"
|
|
112
|
+
},
|
|
113
|
+
"Airfleet Block Template (Blade)": {
|
|
114
|
+
"scope": "blade",
|
|
115
|
+
"prefix": "afblock",
|
|
116
|
+
"body": [
|
|
117
|
+
"<section @all_attrs( [ 'class' => 'afb-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
118
|
+
" $1",
|
|
119
|
+
"</section>",
|
|
120
|
+
""
|
|
121
|
+
],
|
|
122
|
+
"description": "Bootstrap a Blade template for a block"
|
|
123
|
+
},
|
|
124
|
+
"Airfleet Component Template (PHP)": {
|
|
125
|
+
"scope": "php,html",
|
|
126
|
+
"prefix": "afcompphp",
|
|
127
|
+
"body": [
|
|
128
|
+
"<div <?php echo \\$_all_attrs( [ 'class' => 'afc-$TM_FILENAME_BASE' ] ); ?>>",
|
|
129
|
+
" $1",
|
|
130
|
+
" <?php echo \\$_slot; ?>",
|
|
131
|
+
"</div>",
|
|
132
|
+
""
|
|
133
|
+
],
|
|
134
|
+
"description": "Bootstrap a PHP template for a component"
|
|
135
|
+
},
|
|
136
|
+
"Airfleet Component Template (Blade)": {
|
|
137
|
+
"scope": "blade",
|
|
138
|
+
"prefix": "afcomp",
|
|
139
|
+
"body": [
|
|
140
|
+
"<div @all_attrs( [ 'class' => 'afc-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
141
|
+
" $1",
|
|
142
|
+
" {!! \\$_slot !!}",
|
|
143
|
+
"</div>",
|
|
144
|
+
""
|
|
145
|
+
],
|
|
146
|
+
"description": "Bootstrap a Blade template for a component"
|
|
147
|
+
},
|
|
148
|
+
"Airfleet Partial Template (PHP)": {
|
|
149
|
+
"scope": "php,html",
|
|
150
|
+
"prefix": "afpartialphp",
|
|
151
|
+
"body": [
|
|
152
|
+
"<div <?php echo \\$_all_attrs( [ 'class' => 'afp-$TM_FILENAME_BASE' ] ); ?>>",
|
|
153
|
+
" $1",
|
|
154
|
+
" <?php echo \\$_slot; ?>",
|
|
155
|
+
"</div>",
|
|
156
|
+
""
|
|
157
|
+
],
|
|
158
|
+
"description": "Bootstrap a PHP template for a partial"
|
|
159
|
+
},
|
|
160
|
+
"Airfleet Partial Template (Blade)": {
|
|
161
|
+
"prefix": "afpartial",
|
|
162
|
+
"body": [
|
|
163
|
+
"<div @all_attrs( [ 'class' => 'afp-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
164
|
+
" $1",
|
|
165
|
+
" {!! \\$_slot !!}",
|
|
166
|
+
"</div>",
|
|
167
|
+
""
|
|
168
|
+
],
|
|
169
|
+
"description": "Airfleet Partial Template (Blade)"
|
|
170
|
+
}
|
|
171
|
+
}
|