@airfleet/generator-init 0.6.0 → 0.7.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,19 @@ 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
+ "assets/admin/scripts/admin.entry.js",
116
+ "assets/admin/styles/admin.scss",
117
+ "assets/frontend/fonts/.gitkeep",
118
+ "assets/frontend/images/.gitkeep",
119
+ "assets/frontend/scripts/index.entry.js",
120
+ "assets/frontend/styles/index.scss",
117
121
  "inc/Setup.php.ejs",
118
122
  ".airfleet-release",
119
123
  ".editorconfig",
124
+ ".env",
120
125
  ".gitattributes",
121
126
  ".gitlab-ci.yml",
127
+ ".parcelrc",
122
128
  ".prettierignore",
123
129
  "CHANGELOG.md",
124
130
  "composer.json.ejs",
@@ -0,0 +1 @@
1
+ PARCEL_WORKER_BACKEND=process
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "@parcel/config-default",
3
+ "reporters": ["...", "parcel-reporter-bundle-manifest"]
4
+ }
@@ -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
+ }
@@ -8,3 +8,4 @@ dist
8
8
  .stylelintcache
9
9
  .phpcscache
10
10
  .composer-cache
11
+ .env
@@ -11,8 +11,55 @@ class Setup {
11
11
  */
12
12
  public function initialize() {
13
13
  <%_ if (answers.pluginCreateOptions) { _%>
14
- add_action( 'acf/init', [ $this, 'add_option_pages' ] );
14
+ $this->add_option_pages();
15
15
  <%_ } _%>
16
+ $this->enqueue();
17
+ }
18
+
19
+ /**
20
+ * Enqueue the scripts and styles.
21
+ *
22
+ * @return void
23
+ */
24
+ public function enqueue() {
25
+ $version = <%= name.constant %>_VERSION;
26
+
27
+ add_action(
28
+ 'wp_enqueue_scripts',
29
+ function () use ( $version ) {
30
+ wp_enqueue_style(
31
+ '<%= name.slug %>-styles',
32
+ plugins_url( '/dist/frontend/scripts/index.entry.css', __DIR__ ),
33
+ [],
34
+ $version
35
+ );
36
+ wp_enqueue_script(
37
+ '<%= name.slug %>-scripts',
38
+ plugins_url( '/dist/frontend/scripts/index.entry.js', __DIR__ ),
39
+ [],
40
+ $version,
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
+ );
16
63
  }
17
64
  <%_ if (answers.pluginCreateOptions) {%>
18
65
  /**
@@ -21,22 +68,24 @@ class Setup {
21
68
  * @return void
22
69
  */
23
70
  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
- ]
71
+ add_action(
72
+ 'acf/init',
73
+ function () {
74
+ \acf_add_options_page(
75
+ [
76
+ 'page_title' => __( 'Airfleet Theme Settings', 'airfleet' ),
77
+ 'menu_title' => __( 'Airfleet', 'airfleet' ),
78
+ 'menu_slug' => 'airfleet-settings',
79
+ ]
80
+ );
81
+ \acf_add_options_sub_page(
82
+ [
83
+ 'page_title' => __( '<%= name.title %> Settings', '<%= name.slug %>' ),
84
+ 'menu_title' => __( '<%= nameNoAirfleet.title %>', '<%= name.slug %>' ),
85
+ 'parent_slug' => 'airfleet-settings',
86
+ ]
87
+ );
88
+ }
40
89
  );
41
90
  }
42
91
  <% } _%>
@@ -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.0"
45
46
  },
46
47
  "browserslist": [
47
48
  "defaults",
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.7.0",
5
5
  "scripts": {},
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -1 +0,0 @@
1
- /* eslint-disable unicorn/no-empty-file */