@airfleet/generator-init 0.4.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.
- package/README.md +2 -1
- package/generators/npm/index.js +8 -2
- package/generators/npm/templates/.gitattributes +1 -0
- package/generators/npm/templates/gitignore +3 -0
- package/generators/npm/templates/package.json.ejs +0 -1
- package/generators/plugin/index.js +157 -0
- package/generators/plugin/templates/.airfleet-release +1 -0
- package/generators/plugin/templates/.editorconfig +18 -0
- package/generators/plugin/templates/.env +1 -0
- package/generators/plugin/templates/.gitattributes +12 -0
- package/generators/plugin/templates/.gitlab-ci.yml +8 -0
- package/generators/plugin/templates/.husky/pre-commit +4 -0
- package/generators/plugin/templates/.parcelrc +4 -0
- package/generators/plugin/templates/.prettierignore +12 -0
- package/generators/plugin/templates/.vscode/settings.json +10 -0
- package/generators/plugin/templates/CHANGELOG.md +10 -0
- package/generators/plugin/templates/LICENSE.ejs +2 -0
- package/generators/plugin/templates/README.md.ejs +20 -0
- package/generators/plugin/templates/assets/admin/scripts/admin.entry.js +1 -0
- package/generators/plugin/templates/assets/admin/styles/admin.scss +0 -0
- package/generators/plugin/templates/assets/frontend/fonts/.gitkeep +0 -0
- package/generators/plugin/templates/assets/frontend/images/.gitkeep +0 -0
- package/generators/plugin/templates/assets/frontend/scripts/index.entry.js +5 -0
- package/generators/plugin/templates/assets/frontend/styles/index.scss +0 -0
- package/generators/plugin/templates/composer.json.ejs +38 -0
- package/generators/plugin/templates/gitignore +11 -0
- package/generators/plugin/templates/inc/Setup.php.ejs +92 -0
- package/generators/plugin/templates/index.php +1 -0
- package/generators/plugin/templates/package.json.ejs +78 -0
- package/generators/plugin/templates/phpcs.xml.ejs +33 -0
- package/generators/plugin/templates/plugin-name.php.ejs +44 -0
- package/package.json +1 -1
- package/utils/nameCases.js +9 -1
package/README.md
CHANGED
|
@@ -22,7 +22,8 @@ npm install -g @airfleet/generator-init
|
|
|
22
22
|
| --------- | ------------------------------------- | ----------------------------------------- |
|
|
23
23
|
| Block | `yo @airfleet/init:block --force` | Create a block for the Airfleet Theme |
|
|
24
24
|
| Component | `yo @airfleet/init:component --force` | Create a component for the Airfleet Theme |
|
|
25
|
-
| npm | `yo @airfleet/init:npm
|
|
25
|
+
| npm | `yo @airfleet/init:npm` | Generate an npm package for publishing |
|
|
26
|
+
| Plugin | `yo @airfleet/init:plugin` | Create a WP plugin |
|
|
26
27
|
|
|
27
28
|
## Documentation
|
|
28
29
|
|
package/generators/npm/index.js
CHANGED
|
@@ -96,14 +96,20 @@ export default class extends Generator {
|
|
|
96
96
|
".airfleet-release",
|
|
97
97
|
".editorconfig",
|
|
98
98
|
".gitattributes",
|
|
99
|
-
".gitignore",
|
|
100
99
|
".gitlab-ci.yml",
|
|
101
100
|
"CHANGELOG.md",
|
|
102
101
|
"LICENSE.ejs",
|
|
103
102
|
"package.json.ejs",
|
|
104
103
|
"README.md.ejs",
|
|
105
104
|
];
|
|
106
|
-
const templates =
|
|
105
|
+
const templates = [
|
|
106
|
+
...mapFilesToTemplates(files),
|
|
107
|
+
{
|
|
108
|
+
template: "gitignore",
|
|
109
|
+
destination: `.gitignore`,
|
|
110
|
+
isEnabled: true,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
107
113
|
|
|
108
114
|
copyTemplates(this, templates, this.data);
|
|
109
115
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
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 mapFilesToTemplates from "../../utils/mapFilesToTemplates.js";
|
|
7
|
+
import requiredText from "../../utils/validation/requiredText.js";
|
|
8
|
+
import title from "../../utils/log/title.js";
|
|
9
|
+
import highlightText from "../../utils/log/text/highlightText.js";
|
|
10
|
+
import lines from "../../utils/log/text/lines.js";
|
|
11
|
+
import brandText from "../../utils/log/text/brandText.js";
|
|
12
|
+
import dangerText from "../../utils/log/text/dangerText.js";
|
|
13
|
+
import infoBox from "../../utils/log/boxes/infoBox.js";
|
|
14
|
+
|
|
15
|
+
export default class extends Generator {
|
|
16
|
+
async prompting() {
|
|
17
|
+
this.log(
|
|
18
|
+
lines([
|
|
19
|
+
title(`Let's generate a ${highlightText("WordPress plugin")}!`),
|
|
20
|
+
infoBox(
|
|
21
|
+
lines([
|
|
22
|
+
"This will create the files for a WP plugin.",
|
|
23
|
+
"",
|
|
24
|
+
"Before starting you should have:",
|
|
25
|
+
" - Created a repository",
|
|
26
|
+
" - Created the Notion page (can start empty)",
|
|
27
|
+
"",
|
|
28
|
+
"All the files will be created in the current",
|
|
29
|
+
"folder. Make sure to navigate to repo folder",
|
|
30
|
+
"first.",
|
|
31
|
+
])
|
|
32
|
+
),
|
|
33
|
+
"",
|
|
34
|
+
])
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const prompts = [
|
|
38
|
+
{
|
|
39
|
+
type: "input",
|
|
40
|
+
name: "pluginName",
|
|
41
|
+
message: 'What is the name of the plugin? (start with "Airfleet")',
|
|
42
|
+
validate: requiredText("Please enter a name"),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: "input",
|
|
46
|
+
name: "pluginDescription",
|
|
47
|
+
message: "How would you describe the plugin?",
|
|
48
|
+
validate: requiredText("Please enter a description"),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "input",
|
|
52
|
+
name: "pluginRepository",
|
|
53
|
+
message:
|
|
54
|
+
"What's the repository URL? (start with https and end with .git)",
|
|
55
|
+
validate: requiredText("Please enter the repository URL"),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: "input",
|
|
59
|
+
name: "pluginDocumentationUrl",
|
|
60
|
+
message: "What's the documentation URL? (Notion page)",
|
|
61
|
+
validate: requiredText("Please enter the documentation URL"),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "confirm",
|
|
65
|
+
name: "pluginCreateOptions",
|
|
66
|
+
message: "Create theme options page?",
|
|
67
|
+
default: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: "input",
|
|
71
|
+
name: "pluginVersion",
|
|
72
|
+
message: "What's the starting version for the plugin?",
|
|
73
|
+
validate: requiredText("Please enter the starting version"),
|
|
74
|
+
default: "0.0.0",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "input",
|
|
78
|
+
name: "pluginPhpVersion",
|
|
79
|
+
message: "What's the required PHP version?",
|
|
80
|
+
validate: requiredText("Please enter the PHP version"),
|
|
81
|
+
default: ">=7.4",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "input",
|
|
85
|
+
name: "pluginNodeVersion",
|
|
86
|
+
message: "What's the required Node version?",
|
|
87
|
+
validate: requiredText("Please enter the Node version"),
|
|
88
|
+
default: ">=14",
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
this.answers = await this.prompt(prompts);
|
|
93
|
+
this.name = nameCases(this.answers.pluginName);
|
|
94
|
+
|
|
95
|
+
const nameNoAirfleet = this.answers.pluginName
|
|
96
|
+
.replace(/^airfleet/i, "")
|
|
97
|
+
.trim();
|
|
98
|
+
this.nameNoAirfleet = nameCases(nameNoAirfleet);
|
|
99
|
+
this.data = {
|
|
100
|
+
answers: this.answers,
|
|
101
|
+
name: this.name,
|
|
102
|
+
nameNoAirfleet: this.nameNoAirfleet,
|
|
103
|
+
repositoryBase: this.answers.pluginRepository.replace(/\.git$/, ""),
|
|
104
|
+
packageName: `@airfleet/${this.nameNoAirfleet.slug}-wp-plugin`,
|
|
105
|
+
mainBranch: "main",
|
|
106
|
+
year: new Date().getFullYear(),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
writing() {
|
|
111
|
+
const files = [
|
|
112
|
+
".husky/.gitignore",
|
|
113
|
+
".husky/pre-commit",
|
|
114
|
+
".vscode/settings.json",
|
|
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",
|
|
121
|
+
"inc/Setup.php.ejs",
|
|
122
|
+
".airfleet-release",
|
|
123
|
+
".editorconfig",
|
|
124
|
+
".env",
|
|
125
|
+
".gitattributes",
|
|
126
|
+
".gitlab-ci.yml",
|
|
127
|
+
".parcelrc",
|
|
128
|
+
".prettierignore",
|
|
129
|
+
"CHANGELOG.md",
|
|
130
|
+
"composer.json.ejs",
|
|
131
|
+
"index.php",
|
|
132
|
+
"LICENSE.ejs",
|
|
133
|
+
"package.json.ejs",
|
|
134
|
+
"phpcs.xml.ejs",
|
|
135
|
+
"README.md.ejs",
|
|
136
|
+
];
|
|
137
|
+
const templates = [
|
|
138
|
+
...mapFilesToTemplates(files),
|
|
139
|
+
{
|
|
140
|
+
template: "gitignore",
|
|
141
|
+
destination: `.gitignore`,
|
|
142
|
+
isEnabled: true,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
template: "plugin-name.php.ejs",
|
|
146
|
+
destination: `${this.name.slug}.php`,
|
|
147
|
+
isEnabled: true,
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
copyTemplates(this, templates, this.data);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
install() {
|
|
155
|
+
this.spawnCommand("composer", ["install"]);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
minor
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# editorconfig.org
|
|
2
|
+
|
|
3
|
+
root = true
|
|
4
|
+
|
|
5
|
+
[*]
|
|
6
|
+
charset = utf-8
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
insert_final_newline = true
|
|
12
|
+
|
|
13
|
+
[*.md]
|
|
14
|
+
trim_trailing_whitespace = false
|
|
15
|
+
|
|
16
|
+
[*.php]
|
|
17
|
+
indent_style = tab
|
|
18
|
+
indent_size = 4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PARCEL_WORKER_BACKEND=process
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# <%= name.title %> WordPress Plugin
|
|
2
|
+
|
|
3
|
+
[](<%= repositoryBase %>/-/commits/main)
|
|
4
|
+
|
|
5
|
+
<%= answers.pluginDescription %>
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
composer install
|
|
11
|
+
npm install
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Documentation
|
|
15
|
+
|
|
16
|
+
- [Documentation](<%= answers.pluginDocumentationUrl %>).
|
|
17
|
+
|
|
18
|
+
## License
|
|
19
|
+
|
|
20
|
+
© [Airfleet](https://www.airfleet.co/)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../styles/admin.scss";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "airfleet/<%= name.slug %>",
|
|
3
|
+
"type": "wordpress-plugin",
|
|
4
|
+
"authors": [
|
|
5
|
+
{
|
|
6
|
+
"name": "Airfleet",
|
|
7
|
+
"email": "dev@airfleet.co"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"require": {
|
|
11
|
+
"php": "<%- answers.pluginPhpVersion %>",
|
|
12
|
+
"composer/installers": "^2.0"
|
|
13
|
+
},
|
|
14
|
+
"require-dev": {
|
|
15
|
+
"airfleet/wordpress-dev": "^1.0"
|
|
16
|
+
},
|
|
17
|
+
"autoload": {
|
|
18
|
+
"psr-4": {
|
|
19
|
+
"Airfleet\\Plugins\\<%= nameNoAirfleet.pascal %>\\": "inc/"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"lint": "phpcs",
|
|
24
|
+
"fix": "phpcbf",
|
|
25
|
+
"install-codestandards": [
|
|
26
|
+
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
|
|
27
|
+
],
|
|
28
|
+
"post-install-cmd": [
|
|
29
|
+
"@install-codestandards"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"config": {
|
|
33
|
+
"allow-plugins": {
|
|
34
|
+
"composer/installers": true,
|
|
35
|
+
"dealerdirect/phpcodesniffer-composer-installer": true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Airfleet\Plugins\<%= nameNoAirfleet.pascal %>;
|
|
4
|
+
|
|
5
|
+
class Setup {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Setup the plugin.
|
|
9
|
+
*
|
|
10
|
+
* @return void
|
|
11
|
+
*/
|
|
12
|
+
public function initialize() {
|
|
13
|
+
<%_ if (answers.pluginCreateOptions) { _%>
|
|
14
|
+
$this->add_option_pages();
|
|
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
|
+
);
|
|
63
|
+
}
|
|
64
|
+
<%_ if (answers.pluginCreateOptions) {%>
|
|
65
|
+
/**
|
|
66
|
+
* Add theme options pages.
|
|
67
|
+
*
|
|
68
|
+
* @return void
|
|
69
|
+
*/
|
|
70
|
+
public function add_option_pages() {
|
|
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
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
<% } _%>
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?php // Silence is golden
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= packageName %>",
|
|
3
|
+
"description": "<%= answers.pluginDescription %>",
|
|
4
|
+
"version": "<%= answers.pluginVersion %>",
|
|
5
|
+
"scripts": {
|
|
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",
|
|
9
|
+
"base:prettier": "prettier \"**/*.{js,jsx,ts,tsx,json,css,scss,xml,yaml,yml,md}\"",
|
|
10
|
+
"base:stylelint": "stylelint \"**/*.{css,scss}\" --cache --ignore-path .gitignore",
|
|
11
|
+
"lint": "run-s --continue-on-error lint:*",
|
|
12
|
+
"lint:prettier": "npm run base:prettier -- --check",
|
|
13
|
+
"lint:eslint": "npm run base:eslint",
|
|
14
|
+
"lint:stylelint": "npm run base:stylelint",
|
|
15
|
+
"lint:phpcs": "composer run lint",
|
|
16
|
+
"fix": "run-s fix:*",
|
|
17
|
+
"fix:prettier": "npm run base:prettier -- --write",
|
|
18
|
+
"fix:eslint": "npm run base:eslint -- --fix",
|
|
19
|
+
"fix:stylelint": "npm run base:stylelint -- --fix",
|
|
20
|
+
"fix:phpcs": "composer run fix",
|
|
21
|
+
"pretest": "npm run lint",
|
|
22
|
+
"test": "echo Testing done",
|
|
23
|
+
"prepare": "husky install",
|
|
24
|
+
"cz": "git-cz"
|
|
25
|
+
},
|
|
26
|
+
"private": true,
|
|
27
|
+
"keywords": [
|
|
28
|
+
"airfleet"
|
|
29
|
+
],
|
|
30
|
+
"homepage": "https://www.airfleet.co",
|
|
31
|
+
"author": {
|
|
32
|
+
"name": "Airfleet",
|
|
33
|
+
"email": "dev@airfleet.co",
|
|
34
|
+
"url": "https://www.airfleet.co/"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "<%= answers.pluginRepository %>"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": "<%- answers.pluginNodeVersion %>"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@airfleet/wordpress-dev": "^0.3.0"
|
|
46
|
+
},
|
|
47
|
+
"browserslist": [
|
|
48
|
+
"defaults",
|
|
49
|
+
"not IE 11",
|
|
50
|
+
"not op_mini all"
|
|
51
|
+
],
|
|
52
|
+
"prettier": "@airfleet/prettier-config-wordpress",
|
|
53
|
+
"stylelint": {
|
|
54
|
+
"extends": [
|
|
55
|
+
"@airfleet/stylelint-config-wordpress"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"eslintConfig": {
|
|
59
|
+
"extends": [
|
|
60
|
+
"@airfleet/eslint-config-wordpress",
|
|
61
|
+
"plugin:no-jquery/all"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"lint-staged": {
|
|
65
|
+
"*.{js,jsx,ts,tsx,json,css,scss,xml,yaml,yml,md}": "prettier --write",
|
|
66
|
+
"*.{js,jsx}": "eslint --cache --ignore-path .gitignore --fix",
|
|
67
|
+
"*.{css,scss}": "stylelint --cache --ignore-path .gitignore --fix",
|
|
68
|
+
"*.php": [
|
|
69
|
+
"composer run fix",
|
|
70
|
+
"composer run lint"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"config": {
|
|
74
|
+
"commitizen": {
|
|
75
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?xml version="1.0" ?>
|
|
2
|
+
<ruleset
|
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
+
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"
|
|
5
|
+
>
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
#############################################################################
|
|
9
|
+
COMMAND LINE ARGUMENTS
|
|
10
|
+
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
|
|
11
|
+
#############################################################################
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
<!-- Set cache file -->
|
|
15
|
+
<arg name="cache" value=".phpcscache" />
|
|
16
|
+
|
|
17
|
+
<!-- Check all files in this directory and the directories below it. -->
|
|
18
|
+
<file>.</file>
|
|
19
|
+
|
|
20
|
+
<!-- Airfleet config -->
|
|
21
|
+
<rule ref="Airfleet" />
|
|
22
|
+
|
|
23
|
+
<!-- Custom i18n text domain -->
|
|
24
|
+
<rule ref="WordPress.WP.I18n">
|
|
25
|
+
<properties>
|
|
26
|
+
<property name="text_domain" type="array">
|
|
27
|
+
<element value="airfleet" />
|
|
28
|
+
<element value="<%= name.slug %>" />
|
|
29
|
+
</property>
|
|
30
|
+
</properties>
|
|
31
|
+
</rule>
|
|
32
|
+
|
|
33
|
+
</ruleset>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* <%= name.title %>
|
|
5
|
+
*
|
|
6
|
+
* @package Airfleet\Plugins\<%= nameNoAirfleet.pascal %>
|
|
7
|
+
* @version <%= answers.pluginVersion %>
|
|
8
|
+
* @author Airfleet
|
|
9
|
+
* @link https://www.airfleet.co/
|
|
10
|
+
*
|
|
11
|
+
* @wordpress-plugin
|
|
12
|
+
* Plugin Name: <%= name.title %>
|
|
13
|
+
* Plugin URI: <%= answers.pluginDocumentationUrl %>
|
|
14
|
+
* Description: <%= answers.pluginDescription %>
|
|
15
|
+
* Version: <%= answers.pluginVersion %>
|
|
16
|
+
* Author: Airfleet
|
|
17
|
+
* Author URI: https://www.airfleet.co/
|
|
18
|
+
* Text Domain: <%= name.slug %>
|
|
19
|
+
* GitLab Plugin URI: <%= repositoryBase %>
|
|
20
|
+
* Primary Branch: <%= mainBranch %>
|
|
21
|
+
* Release Asset: true
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Exit if accessed directly.
|
|
25
|
+
if ( ! defined( 'ABSPATH' ) ) {
|
|
26
|
+
die;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Plugin version.
|
|
30
|
+
define( '<%= name.constant %>_VERSION', '<%= answers.pluginVersion %>' );
|
|
31
|
+
|
|
32
|
+
// Autoload classes.
|
|
33
|
+
require_once __DIR__ . '/vendor/autoload.php';
|
|
34
|
+
|
|
35
|
+
// Initialize plugin.
|
|
36
|
+
$<%= name.snake %> = new \Airfleet\Plugins\<%= nameNoAirfleet.pascal %>\Setup();
|
|
37
|
+
$<%= name.snake %>->initialize();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
41
|
+
* ! Do not make changes to this file.
|
|
42
|
+
* ! Edit the plugin class in folder src/.
|
|
43
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
44
|
+
*/
|
package/package.json
CHANGED
package/utils/nameCases.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { camelCase, noCase, paramCase, pascalCase } from "change-case";
|
|
1
|
+
import { camelCase, constantCase, noCase, paramCase, pascalCase, snakeCase } from "change-case";
|
|
2
2
|
import { titleCase } from "title-case";
|
|
3
3
|
|
|
4
4
|
export default function nameCases(name) {
|
|
@@ -20,5 +20,13 @@ export default function nameCases(name) {
|
|
|
20
20
|
|
|
21
21
|
// "test string"
|
|
22
22
|
noCase: noCase(name),
|
|
23
|
+
|
|
24
|
+
// "TEST_STRING"
|
|
25
|
+
constant: constantCase(name),
|
|
26
|
+
|
|
27
|
+
// "test_string"
|
|
28
|
+
snake: snakeCase(name),
|
|
29
|
+
|
|
30
|
+
// For more utilities see https://github.com/blakeembrey/change-case
|
|
23
31
|
};
|
|
24
32
|
}
|