@airfleet/generator-init 0.6.0 → 0.10.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.
@@ -112,13 +112,20 @@ export default class extends Generator {
112
112
  ".husky/.gitignore",
113
113
  ".husky/pre-commit",
114
114
  ".vscode/settings.json",
115
- "assets/scripts/index.js",
116
- "assets/styles/index.scss",
115
+ "acf-json/.gitkeep",
116
+ "assets/admin/scripts/admin.entry.js",
117
+ "assets/admin/styles/admin.scss",
118
+ "assets/frontend/fonts/.gitkeep",
119
+ "assets/frontend/images/.gitkeep",
120
+ "assets/frontend/scripts/index.entry.js",
121
+ "assets/frontend/styles/index.scss",
117
122
  "inc/Setup.php.ejs",
118
123
  ".airfleet-release",
119
124
  ".editorconfig",
125
+ ".env",
120
126
  ".gitattributes",
121
127
  ".gitlab-ci.yml",
128
+ ".parcelrc",
122
129
  ".prettierignore",
123
130
  "CHANGELOG.md",
124
131
  "composer.json.ejs",
@@ -1,7 +1,13 @@
1
1
  stages:
2
+ - test
2
3
  - release
4
+ - upload
3
5
 
4
6
  include:
7
+ # Test
8
+ - project: "codersclan/tools/gitlab-ci-templates"
9
+ ref: main
10
+ file: "/test/wordpress.yaml"
5
11
  # Release process
6
12
  - project: "codersclan/tools/gitlab-ci-templates"
7
13
  ref: main
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "@parcel/config-default",
3
+ "reporters": ["...", "parcel-reporter-bundle-manifest"]
4
+ }
File without changes
@@ -0,0 +1 @@
1
+ import "../styles/admin.scss";
@@ -0,0 +1,5 @@
1
+ import "../styles/index.scss";
2
+
3
+ if (module.hot) {
4
+ module.hot.accept();
5
+ }
@@ -12,7 +12,7 @@
12
12
  "composer/installers": "^2.0"
13
13
  },
14
14
  "require-dev": {
15
- "airfleet/wordpress-dev": "^1.0"
15
+ "airfleet/wordpress-dev": "^2.0"
16
16
  },
17
17
  "autoload": {
18
18
  "psr-4": {
@@ -8,3 +8,4 @@ dist
8
8
  .stylelintcache
9
9
  .phpcscache
10
10
  .composer-cache
11
+ .env
@@ -9,35 +9,52 @@ class Setup {
9
9
  *
10
10
  * @return void
11
11
  */
12
- public function initialize() {
13
- <%_ if (answers.pluginCreateOptions) { _%>
14
- add_action( 'acf/init', [ $this, 'add_option_pages' ] );
15
- <%_ } _%>
12
+ public function initialize(): void {
13
+ $this->show_admin_notice_if_missing_framework();
14
+ add_action(
15
+ 'airfleet/init',
16
+ function () {
17
+ $plugin = new \Airfleet\Plugin(
18
+ [
19
+ 'slug' => '<%= name.slug %>',
20
+ 'title' => '<%= name.title %>',
21
+ 'short_title' => '<%= nameNoAirfleet.title %>',
22
+ 'url' => \<%= name.constant %>_URL,
23
+ 'path' => \<%= name.constant %>_PATH,
24
+ 'version' => \<%= name.constant %>_VERSION,
25
+ ]
26
+ );
27
+ $plugin->setup_acf_json();
28
+ $plugin->enqueue();
29
+ $plugin->enqueue_admin();
30
+ <%_ if (answers.pluginCreateOptions) { _%>
31
+ $plugin->add_options_page();
32
+ <%_ } _%>
33
+ }
34
+ );
16
35
  }
17
- <%_ if (answers.pluginCreateOptions) {%>
36
+
18
37
  /**
19
- * Add theme options pages.
38
+ * Show and admin notification if the Airfleet Framework plugin is not enabled.
20
39
  *
21
40
  * @return void
22
41
  */
23
- public function add_option_pages() {
24
- if ( ! function_exists( 'acf_add_options_page' ) ) {
25
- return;
26
- }
27
- acf_add_options_page(
28
- [
29
- 'page_title' => __( 'Airfleet Theme Settings', 'airfleet' ),
30
- 'menu_title' => __( 'Airfleet', 'airfleet' ),
31
- 'menu_slug' => 'airfleet-settings',
32
- ]
33
- );
34
- acf_add_options_sub_page(
35
- [
36
- 'page_title' => __( '<%= name.title %> Settings', '<%= name.slug %>' ),
37
- 'menu_title' => __( '<%= nameNoAirfleet.title %>', '<%= name.slug %>' ),
38
- 'parent_slug' => 'airfleet-settings',
39
- ]
42
+ public function show_admin_notice_if_missing_framework(): void {
43
+ add_action(
44
+ 'admin_notices',
45
+ function () {
46
+ global $airfleet_framework_missing_notice;
47
+
48
+ if ( $airfleet_framework_missing_notice || defined( 'AIRFLEET_FRAMEWORK_VERSION' ) ) {
49
+ return;
50
+ }
51
+ $airfleet_framework_missing_notice = true;
52
+ ?>
53
+ <div class="notice notice-error">
54
+ <p>Please install the Airfleet Framework to enable the Airfleet plugins.</p>
55
+ </div>
56
+ <?php
57
+ }
40
58
  );
41
59
  }
42
- <% } _%>
43
60
  }
@@ -3,8 +3,9 @@
3
3
  "description": "<%= answers.pluginDescription %>",
4
4
  "version": "<%= answers.pluginVersion %>",
5
5
  "scripts": {
6
- "build": "echo Done",
7
- "base:eslint": "eslint assets/scripts --ext .js,.jsx --cache --ignore-path .gitignore",
6
+ "build": "dotenv -- parcel build --log-level verbose ./assets/**/*.entry.js",
7
+ "start": "dotenv -- parcel serve --hmr-port 1236 --port 1234 --log-level verbose ./assets/**/*.entry.js",
8
+ "base:eslint": "eslint assets --ext .js,.jsx --cache --ignore-path .gitignore",
8
9
  "base:prettier": "prettier \"**/*.{js,jsx,ts,tsx,json,css,scss,xml,yaml,yml,md}\"",
9
10
  "base:stylelint": "stylelint \"**/*.{css,scss}\" --cache --ignore-path .gitignore",
10
11
  "lint": "run-s --continue-on-error lint:*",
@@ -41,7 +42,7 @@
41
42
  },
42
43
  "dependencies": {},
43
44
  "devDependencies": {
44
- "@airfleet/wordpress-dev": "^0.2.0"
45
+ "@airfleet/wordpress-dev": "^0.3.1"
45
46
  },
46
47
  "browserslist": [
47
48
  "defaults",
@@ -28,6 +28,8 @@ if ( ! defined( 'ABSPATH' ) ) {
28
28
 
29
29
  // Plugin version.
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';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airfleet/generator-init",
3
3
  "description": "A Yeoman generator to scaffold common Airfleet features",
4
- "version": "0.6.0",
4
+ "version": "0.10.0",
5
5
  "scripts": {},
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -1 +0,0 @@
1
- /* eslint-disable unicorn/no-empty-file */