@airfleet/generator-init 0.7.0 → 0.10.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/npm/templates/README.md.ejs +1 -1
- package/generators/plugin/index.js +1 -0
- package/generators/plugin/templates/.env +0 -1
- package/generators/plugin/templates/.gitlab-ci.yml +6 -0
- package/generators/plugin/templates/acf-json/.gitkeep +0 -0
- package/generators/plugin/templates/composer.json.ejs +1 -1
- package/generators/plugin/templates/inc/Setup.php.ejs +41 -64
- package/generators/plugin/templates/package.json.ejs +1 -1
- package/generators/plugin/templates/plugin-name.php.ejs +3 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <%= answers.npmTitle %>
|
|
2
2
|
|
|
3
|
-

|
|
3
|
+
[](https://www.npmjs.com/package/<%= packageName %>)
|
|
4
4
|
[](<%= repositoryBase %>/-/commits/main)
|
|
5
5
|
|
|
6
6
|
<%= answers.npmDescription %>
|
|
@@ -112,6 +112,7 @@ export default class extends Generator {
|
|
|
112
112
|
".husky/.gitignore",
|
|
113
113
|
".husky/pre-commit",
|
|
114
114
|
".vscode/settings.json",
|
|
115
|
+
"acf-json/.gitkeep",
|
|
115
116
|
"assets/admin/scripts/admin.entry.js",
|
|
116
117
|
"assets/admin/styles/admin.scss",
|
|
117
118
|
"assets/frontend/fonts/.gitkeep",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
PARCEL_WORKER_BACKEND=process
|
|
File without changes
|
|
@@ -9,84 +9,61 @@ class Setup {
|
|
|
9
9
|
*
|
|
10
10
|
* @return void
|
|
11
11
|
*/
|
|
12
|
-
public function initialize() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
public function initialize(): void {
|
|
13
|
+
$this->show_admin_notice_if_missing_framework();
|
|
14
|
+
add_action(
|
|
15
|
+
'airfleet/init',
|
|
16
|
+
function () {
|
|
17
|
+
$this->plugin_basic_setup();
|
|
18
|
+
}
|
|
19
|
+
);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
|
-
*
|
|
23
|
+
* Basic setup for the plugin. Enqueue assets and add options page
|
|
21
24
|
*
|
|
22
25
|
* @return void
|
|
23
26
|
*/
|
|
24
|
-
public function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
true
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
add_action(
|
|
46
|
-
'admin_enqueue_scripts',
|
|
47
|
-
function () use ( $version ) {
|
|
48
|
-
wp_enqueue_style(
|
|
49
|
-
'<%= name.slug %>-admin-styles',
|
|
50
|
-
plugins_url( '/dist/admin/scripts/admin.entry.css', __DIR__ ),
|
|
51
|
-
[],
|
|
52
|
-
$version
|
|
53
|
-
);
|
|
54
|
-
wp_enqueue_script(
|
|
55
|
-
'<%= name.slug %>-admin-scripts',
|
|
56
|
-
plugins_url( '/dist/admin/scripts/admin.entry.js', __DIR__ ),
|
|
57
|
-
[],
|
|
58
|
-
$version,
|
|
59
|
-
true
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
);
|
|
27
|
+
public function plugin_basic_setup(): void {
|
|
28
|
+
$plugin = new \Airfleet\Plugin(
|
|
29
|
+
[
|
|
30
|
+
'slug' => '<%= name.slug %>',
|
|
31
|
+
'title' => '<%= name.title %>',
|
|
32
|
+
'short_title' => '<%= nameNoAirfleet.title %>',
|
|
33
|
+
'url' => \<%= name.constant %>_URL,
|
|
34
|
+
'path' => \<%= name.constant %>_PATH,
|
|
35
|
+
'version' => \<%= name.constant %>_VERSION,
|
|
36
|
+
]
|
|
37
|
+
);
|
|
38
|
+
$plugin->setup_acf_json();
|
|
39
|
+
$plugin->enqueue();
|
|
40
|
+
$plugin->enqueue_admin();
|
|
41
|
+
<%_ if (answers.pluginCreateOptions) { _%>
|
|
42
|
+
$plugin->add_options_page();
|
|
43
|
+
<%_ } _%>
|
|
63
44
|
}
|
|
64
|
-
|
|
45
|
+
|
|
65
46
|
/**
|
|
66
|
-
*
|
|
47
|
+
* Show and admin notification if the Airfleet Framework plugin is not enabled.
|
|
67
48
|
*
|
|
68
49
|
* @return void
|
|
69
50
|
*/
|
|
70
|
-
public function
|
|
51
|
+
public function show_admin_notice_if_missing_framework(): void {
|
|
71
52
|
add_action(
|
|
72
|
-
'
|
|
53
|
+
'admin_notices',
|
|
73
54
|
function () {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
'parent_slug' => 'airfleet-settings',
|
|
86
|
-
]
|
|
87
|
-
);
|
|
55
|
+
global $airfleet_framework_missing_notice;
|
|
56
|
+
|
|
57
|
+
if ( $airfleet_framework_missing_notice || defined( 'AIRFLEET_FRAMEWORK_VERSION' ) ) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
$airfleet_framework_missing_notice = true;
|
|
61
|
+
?>
|
|
62
|
+
<div class="notice notice-error">
|
|
63
|
+
<p>Please install the Airfleet Framework to enable the Airfleet plugins.</p>
|
|
64
|
+
</div>
|
|
65
|
+
<?php
|
|
88
66
|
}
|
|
89
67
|
);
|
|
90
68
|
}
|
|
91
|
-
<% } _%>
|
|
92
69
|
}
|
|
@@ -26,8 +26,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
|
26
26
|
die;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
// Plugin
|
|
29
|
+
// Plugin constants.
|
|
30
30
|
define( '<%= name.constant %>_VERSION', '<%= answers.pluginVersion %>' );
|
|
31
|
+
define( '<%= name.constant %>_PATH', plugin_dir_path( __FILE__ ) );
|
|
32
|
+
define( '<%= name.constant %>_URL', plugin_dir_url( __FILE__ ) );
|
|
31
33
|
|
|
32
34
|
// Autoload classes.
|
|
33
35
|
require_once __DIR__ . '/vendor/autoload.php';
|