@airfleet/generator-init 0.22.0 → 0.23.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/README.md +3 -1
- package/generators/plugin/templates/gitignore +1 -0
- package/generators/plugin/templates/inc/RegisterViews.php.ejs +1 -1
- package/generators/project/index.js +94 -0
- package/generators/project/info.js +39 -0
- package/generators/project/prompts.js +114 -0
- package/generators/project/templates/.deployignore +42 -0
- package/generators/project/templates/.editorconfig +18 -0
- package/generators/project/templates/.gitattributes +12 -0
- package/generators/project/templates/.github/workflows/create-asana-attachment.yaml +19 -0
- package/generators/project/templates/.github/workflows/test-wordpress-root-lightyear.yml +61 -0
- package/generators/project/templates/.husky/pre-commit +5 -0
- package/generators/project/templates/.vscode/airfleet.code-snippets +173 -0
- package/generators/project/templates/.vscode/settings.json +51 -0
- package/generators/project/templates/README.md.ejs +27 -0
- package/generators/project/templates/gitignore +57 -0
- package/generators/project/templates.js +32 -0
- package/package.json +1 -1
- package/utils/log/text/infoText.js +5 -0
- package/utils/log/text/messageText.js +5 -0
package/README.md
CHANGED
|
@@ -18,12 +18,14 @@ npm install -g @airfleet/generator-init
|
|
|
18
18
|
|
|
19
19
|
## Generators
|
|
20
20
|
|
|
21
|
-
| Generator |
|
|
21
|
+
| Generator | Command | Description |
|
|
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
25
|
| npm | `yo @airfleet/init:npm` | Generate an npm package for publishing |
|
|
26
26
|
| Plugin | `yo @airfleet/init:plugin` | Create a WP plugin |
|
|
27
|
+
| Project | `yo @airfleet/init:project` | Create a new WP project |
|
|
28
|
+
| Snippets | `yo @airfleet/init:snippets` | Add VS Code snippets to existing project |
|
|
27
29
|
| View | `yo @airfleet/init:view` | Create a view for the Airfleet Views plugin |
|
|
28
30
|
|
|
29
31
|
## Documentation
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import Generator from "yeoman-generator";
|
|
3
|
+
|
|
4
|
+
import copyTemplates from "../../utils/copyTemplates.js";
|
|
5
|
+
import Info from "./info.js";
|
|
6
|
+
import Prompts from "./prompts.js";
|
|
7
|
+
import Templates from "./templates.js";
|
|
8
|
+
|
|
9
|
+
export default class extends Generator {
|
|
10
|
+
constructor(args, opts) {
|
|
11
|
+
super(args, opts);
|
|
12
|
+
this.info = new Info(this);
|
|
13
|
+
this.prompts = new Prompts(this);
|
|
14
|
+
this.templates = new Templates(this);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async prompting() {
|
|
18
|
+
this.info.logInfo();
|
|
19
|
+
this.answers = await this.prompts.prompt();
|
|
20
|
+
this.data = {
|
|
21
|
+
answers: this.answers,
|
|
22
|
+
repositoryBase: this.answers.repository.replace(/\.git$/, ""),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
writing() {
|
|
27
|
+
copyTemplates(this, this.templates.templates(), this.data);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async install() {
|
|
31
|
+
await this._copyTheme();
|
|
32
|
+
this._fixHusky();
|
|
33
|
+
await this._installTheme();
|
|
34
|
+
await this._handleBootstrap();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async _copyTheme() {
|
|
38
|
+
const repository = this._themeRepository();
|
|
39
|
+
const themeFolder = this._themeFolder();
|
|
40
|
+
await this.spawnCommand('git', ['clone', '--depth=1', repository, themeFolder]);
|
|
41
|
+
this._deleteFolder(`${themeFolder}/.git`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async _handleBootstrap() {
|
|
45
|
+
const themeFolder = this._themeFolder();
|
|
46
|
+
|
|
47
|
+
if (this.answers.addBootstrap) {
|
|
48
|
+
this._deleteFolder(`${themeFolder}/assets`);
|
|
49
|
+
this._moveFolder(`${themeFolder}/assets-bootstrap`, `${themeFolder}/assets`);
|
|
50
|
+
this._deleteFolder(`${themeFolder}/assets-bootstrap`);
|
|
51
|
+
} else {
|
|
52
|
+
this._deleteFolder(`${themeFolder}/assets-bootstrap`);
|
|
53
|
+
await this._spawnThemeCommand('npm', ['uninstall', "@popperjs/core", "bootstrap"]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async _installTheme() {
|
|
58
|
+
await this._spawnThemeCommand('composer', ['install']);
|
|
59
|
+
await this._spawnThemeCommand('npm', ['install']);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_fixHusky() {
|
|
63
|
+
// Fix package.json
|
|
64
|
+
const packageJsonPath = `${this._themeFolder()}/package.json`;
|
|
65
|
+
const packageJson = this.readDestinationJSON(packageJsonPath);
|
|
66
|
+
|
|
67
|
+
packageJson.scripts.prepare = "cd .. && cd .. && cd .. && husky install";
|
|
68
|
+
this.writeDestinationJSON(packageJsonPath, packageJson);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_themeRepository() {
|
|
72
|
+
return "git@github.com:airfleet/airfleet-lightyear-theme.git";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_themeFolder() {
|
|
76
|
+
const themeName = "airfleet-lightyear";
|
|
77
|
+
|
|
78
|
+
return `wp-content/themes/${themeName}`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_moveFolder(source, destination) {
|
|
82
|
+
this.moveDestination(source, destination, { globOptions: {dot: true} });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_deleteFolder(path) {
|
|
86
|
+
this.deleteDestination(`${path}/**`);
|
|
87
|
+
this.deleteDestination(`${path}/**/.*`);
|
|
88
|
+
this.deleteDestination(`${path}/**/*`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async _spawnThemeCommand(command, params ) {
|
|
92
|
+
return await this.spawnCommand(command, params, { cwd: this.destinationPath(this._themeFolder())});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import title from "../../utils/log/title.js";
|
|
4
|
+
import highlightText from "../../utils/log/text/highlightText.js";
|
|
5
|
+
import lines from "../../utils/log/text/lines.js";
|
|
6
|
+
import infoBox from "../../utils/log/boxes/infoBox.js";
|
|
7
|
+
|
|
8
|
+
export default class {
|
|
9
|
+
constructor(generator) {
|
|
10
|
+
this.generator = generator;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async logInfo() {
|
|
14
|
+
this.generator.log(
|
|
15
|
+
lines([
|
|
16
|
+
title(`Let's generate a ${highlightText("WordPress project")}!`),
|
|
17
|
+
infoBox(
|
|
18
|
+
lines([
|
|
19
|
+
"This will create the base files for a new WP project",
|
|
20
|
+
"that uses the Lightyear theme.",
|
|
21
|
+
"",
|
|
22
|
+
"Before starting you should have:",
|
|
23
|
+
" - Created and cloned the project repository",
|
|
24
|
+
" - Navigated to the project folder on the command line",
|
|
25
|
+
"",
|
|
26
|
+
"Requirements for running the theme:",
|
|
27
|
+
" - Node >= 16",
|
|
28
|
+
" - PHP 8.2",
|
|
29
|
+
" - Composer 2",
|
|
30
|
+
" - Required WP plugins (see the theme Notion docs)",
|
|
31
|
+
"",
|
|
32
|
+
"Let's get started!",
|
|
33
|
+
])
|
|
34
|
+
),
|
|
35
|
+
"",
|
|
36
|
+
])
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import requiredText from "../../utils/validation/requiredText.js";
|
|
4
|
+
import messageText from "../../utils/log/text/messageText.js";
|
|
5
|
+
import infoText from "../../utils/log/text/infoText.js";
|
|
6
|
+
|
|
7
|
+
export default class {
|
|
8
|
+
constructor(generator) {
|
|
9
|
+
this.generator = generator;
|
|
10
|
+
this.defaults = {
|
|
11
|
+
title: undefined,
|
|
12
|
+
description: undefined,
|
|
13
|
+
repository: undefined,
|
|
14
|
+
productionUrl: undefined,
|
|
15
|
+
stagingUrl: undefined,
|
|
16
|
+
addBootstrap: false,
|
|
17
|
+
}
|
|
18
|
+
this.answers = {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async prompt() {
|
|
22
|
+
await this._promptNext([
|
|
23
|
+
this._titlePrompt(),
|
|
24
|
+
this._descriptionPrompt(),
|
|
25
|
+
this._repositoryPrompt(),
|
|
26
|
+
this._productionUrlPrompt(),
|
|
27
|
+
this._stagingUrlPrompt(),
|
|
28
|
+
this._addBootstrapPrompt(),
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
return this.answers;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async _promptNext(questions) {
|
|
35
|
+
this.answers = {
|
|
36
|
+
...(this.answers || {}),
|
|
37
|
+
...(await this.generator.prompt(questions)),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_message(message, info) {
|
|
42
|
+
return messageText(message) + (info ? " " + infoText(info) : "");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
_titlePrompt() {
|
|
46
|
+
return {
|
|
47
|
+
type: "input",
|
|
48
|
+
name: "title",
|
|
49
|
+
message: this._message(`What is the name of the project?`, `(e.g. "Zenity Website 2023")`),
|
|
50
|
+
validate: requiredText("Please enter a name"),
|
|
51
|
+
default: this.defaults.title,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_descriptionPrompt() {
|
|
56
|
+
return {
|
|
57
|
+
type: "input",
|
|
58
|
+
name: "description",
|
|
59
|
+
message: this._message("How would you describe the project?"),
|
|
60
|
+
validate: requiredText("Please enter a description"),
|
|
61
|
+
default: this.defaults.description,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_repositoryPrompt() {
|
|
66
|
+
return {
|
|
67
|
+
type: "input",
|
|
68
|
+
name: "repository",
|
|
69
|
+
message: this._message("What's the repository URL?", `(start with https and end with .git)`),
|
|
70
|
+
validate: function requiredText(text) {
|
|
71
|
+
if (!text) {
|
|
72
|
+
return "Please enter the repository URL";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const matches = text.match(/^https:\/\/.+\.git$/);
|
|
76
|
+
|
|
77
|
+
if (!matches) {
|
|
78
|
+
return "Repository URL must start with https:// and end in .git";
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return true;
|
|
82
|
+
},
|
|
83
|
+
default: this.defaults.repository,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_productionUrlPrompt() {
|
|
88
|
+
return {
|
|
89
|
+
type: "input",
|
|
90
|
+
name: "productionUrl",
|
|
91
|
+
message: this._message("What's the production URL?", `(optional)`),
|
|
92
|
+
default: this.defaults.productionUrl,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_stagingUrlPrompt() {
|
|
97
|
+
return {
|
|
98
|
+
type: "input",
|
|
99
|
+
name: "stagingUrl",
|
|
100
|
+
message: this._message("What's the staging URL?", `(optional)`),
|
|
101
|
+
default: this.defaults.stagingUrl,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_addBootstrapPrompt() {
|
|
106
|
+
return {
|
|
107
|
+
type: "confirm",
|
|
108
|
+
name: "addBootstrap",
|
|
109
|
+
message: this._message("Add Bootstrap?"),
|
|
110
|
+
default: this.defaults.addBootstrap,
|
|
111
|
+
store: true,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
**/.cache-loader/**
|
|
2
|
+
**/.composer-cache/**
|
|
3
|
+
**/.husky/**
|
|
4
|
+
**/.imagemin-cache/**
|
|
5
|
+
**/.gitlab/**
|
|
6
|
+
**/.github/**
|
|
7
|
+
**/.parcel-cache/**
|
|
8
|
+
**/.vscode/**
|
|
9
|
+
**/.yarn/**
|
|
10
|
+
**/node_modules/**
|
|
11
|
+
**/*.scss
|
|
12
|
+
**/.airfleet-release
|
|
13
|
+
**/.deployignore
|
|
14
|
+
**/.editorconfig
|
|
15
|
+
**/.env
|
|
16
|
+
**/.eslintcache
|
|
17
|
+
**/.eslintrc.js
|
|
18
|
+
**/.gitattributes
|
|
19
|
+
**/.gitignore
|
|
20
|
+
**/.gitkeep
|
|
21
|
+
**/.gitlab-ci.yml
|
|
22
|
+
**/.parcelrc
|
|
23
|
+
**/.phpcscache
|
|
24
|
+
**/.prettierignore
|
|
25
|
+
**/.stylelintcache
|
|
26
|
+
**/.stylelintrc.js
|
|
27
|
+
**/.stylelintrc.json
|
|
28
|
+
**/.travis
|
|
29
|
+
**/CHANGELOG
|
|
30
|
+
**/CHANGELOG.md
|
|
31
|
+
**/CODE_OF_CONDUCT
|
|
32
|
+
**/CODE_OF_CONDUCT.md
|
|
33
|
+
**/composer.json
|
|
34
|
+
**/composer.lock
|
|
35
|
+
**/LICENSE
|
|
36
|
+
**/LICENSE.md
|
|
37
|
+
**/package-lock.json
|
|
38
|
+
**/package.json
|
|
39
|
+
**/phpcs.xml
|
|
40
|
+
**/README
|
|
41
|
+
**/README.md
|
|
42
|
+
**/yarn.lock
|
|
@@ -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,19 @@
|
|
|
1
|
+
name: ✍️ Asana Create PR Attachment
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, reopened]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
create-asana-attachment-job:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
timeout-minutes: 1
|
|
11
|
+
name: Create pull request attachments on Asana tasks
|
|
12
|
+
steps:
|
|
13
|
+
- name: Create pull request attachments
|
|
14
|
+
uses: Asana/create-app-attachment-github-action@latest
|
|
15
|
+
id: postAttachment
|
|
16
|
+
with:
|
|
17
|
+
asana-secret: ${{ secrets.ASANA_SECRET }}
|
|
18
|
+
- name: Log output status
|
|
19
|
+
run: echo "Status is ${{ steps.postAttachment.outputs.status }}"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: 🧪 Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main", "staging", "development"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main", "staging", "development"]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
defaults:
|
|
15
|
+
run:
|
|
16
|
+
working-directory: ./wp-content/themes/airfleet-lightyear
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: 🚚 Get latest code
|
|
20
|
+
uses: actions/checkout@v3
|
|
21
|
+
|
|
22
|
+
- name: ⚙️ Setup PHP
|
|
23
|
+
uses: shivammathur/setup-php@v2
|
|
24
|
+
with:
|
|
25
|
+
php-version: "8.2"
|
|
26
|
+
ini-values: short_open_tag=1
|
|
27
|
+
env:
|
|
28
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
+
|
|
30
|
+
- name: ⚙️ Setup Node
|
|
31
|
+
uses: actions/setup-node@v3
|
|
32
|
+
with:
|
|
33
|
+
node-version: 16
|
|
34
|
+
cache: "npm"
|
|
35
|
+
cache-dependency-path: "./wp-content/themes/airfleet-lightyear/package-lock.json"
|
|
36
|
+
|
|
37
|
+
- name: ⚙️ Get Composer cache directory
|
|
38
|
+
id: composer-cache
|
|
39
|
+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
40
|
+
|
|
41
|
+
- name: ⚙️ Cache Composer dependencies
|
|
42
|
+
uses: actions/cache@v3
|
|
43
|
+
with:
|
|
44
|
+
path: ${{ steps.composer-cache.outputs.dir }}
|
|
45
|
+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
46
|
+
restore-keys: ${{ runner.os }}-composer-
|
|
47
|
+
|
|
48
|
+
- name: 🔨 Increase composer timeout
|
|
49
|
+
run: composer --global config process-timeout 1500
|
|
50
|
+
|
|
51
|
+
- name: 🔨 Composer install
|
|
52
|
+
run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
|
|
53
|
+
|
|
54
|
+
- name: 🔨 npm install
|
|
55
|
+
run: npm ci
|
|
56
|
+
|
|
57
|
+
- name: 🔬 Test
|
|
58
|
+
run: npm test
|
|
59
|
+
|
|
60
|
+
- name: 📦 Build
|
|
61
|
+
run: npm run build --if-present
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Airfleet Feature": {
|
|
3
|
+
"scope": "php,html",
|
|
4
|
+
"prefix": "affeat",
|
|
5
|
+
"body": [
|
|
6
|
+
"<?php",
|
|
7
|
+
"",
|
|
8
|
+
"namespace Airfleet\\Themes\\Lightyear\\\\${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/};",
|
|
9
|
+
"",
|
|
10
|
+
"use Airfleet\\Themes\\Lightyear\\Vendor\\Airfleet\\Framework\\Features\\Feature;",
|
|
11
|
+
"",
|
|
12
|
+
"class $TM_FILENAME_BASE implements Feature {",
|
|
13
|
+
" public function initialize(): void {",
|
|
14
|
+
" $0",
|
|
15
|
+
" }",
|
|
16
|
+
"}",
|
|
17
|
+
""
|
|
18
|
+
],
|
|
19
|
+
"description": "Create a new feature"
|
|
20
|
+
},
|
|
21
|
+
"Airfleet View Controller": {
|
|
22
|
+
"scope": "php,html",
|
|
23
|
+
"prefix": "afctrl",
|
|
24
|
+
"body": [
|
|
25
|
+
"<?php",
|
|
26
|
+
"",
|
|
27
|
+
"namespace Airfleet\\Themes\\Lightyear\\\\${1|Views,ViewsElements|}\\\\${2|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
|
+
" $3",
|
|
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\\Themes\\Lightyear\\\\${1|Views,ViewsElements|}\\\\${2|Components,Blocks,Partials,Templates,CustomTemplates|}\\\\${TM_FILENAME_BASE/(.+)Setup/$1/};",
|
|
45
|
+
"",
|
|
46
|
+
"use Airfleet\\Plugins\\Views\\View\\ViewSetup;",
|
|
47
|
+
"",
|
|
48
|
+
"class $TM_FILENAME_BASE extends ViewSetup {",
|
|
49
|
+
" public function initialize(): void {",
|
|
50
|
+
" $3",
|
|
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:/pascalcase}/} {",
|
|
62
|
+
" initialize() {",
|
|
63
|
+
" const { domReady } = window._airfleet.elements.core;",
|
|
64
|
+
"",
|
|
65
|
+
" domReady(() => {",
|
|
66
|
+
" $1",
|
|
67
|
+
" });",
|
|
68
|
+
" }",
|
|
69
|
+
"}",
|
|
70
|
+
"",
|
|
71
|
+
"new ${TM_FILENAME_BASE/([^.]*)(\\..+)*$/${1:/pascalcase}/}().initialize();",
|
|
72
|
+
""
|
|
73
|
+
],
|
|
74
|
+
"description": "Create a view script"
|
|
75
|
+
},
|
|
76
|
+
"Airfleet Stylesheet": {
|
|
77
|
+
"scope": "scss,css,postcss",
|
|
78
|
+
"prefix": "afcss",
|
|
79
|
+
"body": [
|
|
80
|
+
"@import '../../../assets/shared/styles/lib';",
|
|
81
|
+
"",
|
|
82
|
+
".${1|afc,afb,afp,aft|}-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/} {",
|
|
83
|
+
" $2",
|
|
84
|
+
"}",
|
|
85
|
+
""
|
|
86
|
+
],
|
|
87
|
+
"description": "Create a view stylesheet"
|
|
88
|
+
},
|
|
89
|
+
"Airfleet Block Meta": {
|
|
90
|
+
"scope": "json",
|
|
91
|
+
"prefix": "afblockmeta",
|
|
92
|
+
"body": [
|
|
93
|
+
"{",
|
|
94
|
+
" \"$schema\": \"https://advancedcustomfields.com/schemas/json/main/block.json\",",
|
|
95
|
+
" \"name\": \"${1|airfleet/,airfleet/elements-|}${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}\",",
|
|
96
|
+
" \"title\": \"$2${TM_FILENAME_BASE/([^\\.]*)(\\.block)?$/${1:/capitalize}/}\",",
|
|
97
|
+
" \"description\": \"$3\",",
|
|
98
|
+
" \"keywords\": [\"airfleet\", \"${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}\"$4]",
|
|
99
|
+
"}",
|
|
100
|
+
""
|
|
101
|
+
],
|
|
102
|
+
"description": "Create a JSON meta file for a block"
|
|
103
|
+
},
|
|
104
|
+
"Airfleet Block Template (PHP)": {
|
|
105
|
+
"scope": "php,html",
|
|
106
|
+
"prefix": "afblockphp",
|
|
107
|
+
"body": [
|
|
108
|
+
"<section <?php echo \\$_all_attrs( [ 'class' => 'afb-$TM_FILENAME_BASE' ] ); ?>>",
|
|
109
|
+
" $1",
|
|
110
|
+
"</section>",
|
|
111
|
+
""
|
|
112
|
+
],
|
|
113
|
+
"description": "Bootstrap a PHP template for a block"
|
|
114
|
+
},
|
|
115
|
+
"Airfleet Block Template (Blade)": {
|
|
116
|
+
"scope": "blade",
|
|
117
|
+
"prefix": "afblock",
|
|
118
|
+
"body": [
|
|
119
|
+
"<section @all_attrs( [ 'class' => 'afb-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
120
|
+
" $1",
|
|
121
|
+
"</section>",
|
|
122
|
+
""
|
|
123
|
+
],
|
|
124
|
+
"description": "Bootstrap a Blade template for a block"
|
|
125
|
+
},
|
|
126
|
+
"Airfleet Component Template (PHP)": {
|
|
127
|
+
"scope": "php,html",
|
|
128
|
+
"prefix": "afcompphp",
|
|
129
|
+
"body": [
|
|
130
|
+
"<div <?php echo \\$_all_attrs( [ 'class' => 'afc-$TM_FILENAME_BASE' ] ); ?>>",
|
|
131
|
+
" $1",
|
|
132
|
+
" <?php echo \\$_slot; ?>",
|
|
133
|
+
"</div>",
|
|
134
|
+
""
|
|
135
|
+
],
|
|
136
|
+
"description": "Bootstrap a PHP template for a component"
|
|
137
|
+
},
|
|
138
|
+
"Airfleet Component Template (Blade)": {
|
|
139
|
+
"scope": "blade",
|
|
140
|
+
"prefix": "afcomp",
|
|
141
|
+
"body": [
|
|
142
|
+
"<div @all_attrs( [ 'class' => 'afc-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
143
|
+
" $1",
|
|
144
|
+
" {!! \\$_slot !!}",
|
|
145
|
+
"</div>",
|
|
146
|
+
""
|
|
147
|
+
],
|
|
148
|
+
"description": "Bootstrap a Blade template for a component"
|
|
149
|
+
},
|
|
150
|
+
"Airfleet Partial Template (PHP)": {
|
|
151
|
+
"scope": "php,html",
|
|
152
|
+
"prefix": "afpartialphp",
|
|
153
|
+
"body": [
|
|
154
|
+
"<div <?php echo \\$_all_attrs( [ 'class' => 'afp-$TM_FILENAME_BASE' ] ); ?>>",
|
|
155
|
+
" $1",
|
|
156
|
+
" <?php echo \\$_slot; ?>",
|
|
157
|
+
"</div>",
|
|
158
|
+
""
|
|
159
|
+
],
|
|
160
|
+
"description": "Bootstrap a PHP template for a partial"
|
|
161
|
+
},
|
|
162
|
+
"Airfleet Partial Template (Blade)": {
|
|
163
|
+
"prefix": "afpartial",
|
|
164
|
+
"body": [
|
|
165
|
+
"<div @all_attrs( [ 'class' => 'afp-${TM_FILENAME_BASE/([^.]*)(\\..+)*$/$1/}' ] )>",
|
|
166
|
+
" $1",
|
|
167
|
+
" {!! \\$_slot !!}",
|
|
168
|
+
"</div>",
|
|
169
|
+
""
|
|
170
|
+
],
|
|
171
|
+
"description": "Bootstrap a Blade template for a partial"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"editor.codeActionsOnSave": {
|
|
3
|
+
"source.fixAll": "explicit",
|
|
4
|
+
"source.fixAll.eslint": "explicit"
|
|
5
|
+
},
|
|
6
|
+
"editor.formatOnSave": true,
|
|
7
|
+
"stylelint.validate": ["css", "scss", "postcss"],
|
|
8
|
+
"phpSniffer.executablesFolder": "./wp-content/themes/airfleet-lightyear/vendor/bin/",
|
|
9
|
+
"eslint.workingDirectories": [
|
|
10
|
+
"./wp-content/themes/airfleet-lightyear"
|
|
11
|
+
],
|
|
12
|
+
"phpcs.composerJsonPath": "wp-content/themes/airfleet-lightyear/composer.json",
|
|
13
|
+
"intelephense.files.exclude": [
|
|
14
|
+
"**/.git/**",
|
|
15
|
+
"**/.svn/**",
|
|
16
|
+
"**/.hg/**",
|
|
17
|
+
"**/CVS/**",
|
|
18
|
+
"**/.DS_Store/**",
|
|
19
|
+
"**/node_modules/**",
|
|
20
|
+
"**/bower_components/**",
|
|
21
|
+
"**/vendor/**/{Test,test,Tests,tests}/**",
|
|
22
|
+
"**/vendor-scoped/**/{Test,test,Tests,tests}/**",
|
|
23
|
+
"**/wp-admin/**",
|
|
24
|
+
"**/wp-includes/**",
|
|
25
|
+
"**/wp-content/plugins/**"
|
|
26
|
+
],
|
|
27
|
+
"[php]": {
|
|
28
|
+
"editor.defaultFormatter": "wongjn.php-sniffer"
|
|
29
|
+
},
|
|
30
|
+
"[javascript]": {
|
|
31
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
32
|
+
},
|
|
33
|
+
"[javascriptreact]": {
|
|
34
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
35
|
+
},
|
|
36
|
+
"[typescript]": {
|
|
37
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
38
|
+
},
|
|
39
|
+
"[typescriptreact]": {
|
|
40
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
41
|
+
},
|
|
42
|
+
"[postcss]": {
|
|
43
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
44
|
+
},
|
|
45
|
+
"[scss]": {
|
|
46
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
47
|
+
},
|
|
48
|
+
"[css]": {
|
|
49
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# <%= answers.title %>
|
|
2
|
+
|
|
3
|
+
[](<%= repositoryBase %>/actions/workflows/test-wordpress-root-lightyear.yml)
|
|
4
|
+
|
|
5
|
+
<%= answers.description %>
|
|
6
|
+
|
|
7
|
+
## Environments
|
|
8
|
+
|
|
9
|
+
- Production: <%= answers.productionUrl %>
|
|
10
|
+
- Staging: <%= answers.stagingUrl %>
|
|
11
|
+
|
|
12
|
+
## Getting Started
|
|
13
|
+
|
|
14
|
+
Navigate to the theme folder (`wp-content/themes/airfleet-lightyear`) and run:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
composer install
|
|
18
|
+
npm install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
- [Theme Documentation](https://www.notion.so/codersclan/Airfleet-Lightyear-257b3055301e4899982364f4e8b6a229).
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
© [Airfleet](https://www.airfleet.co/)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
##########################################
|
|
2
|
+
# ROOT
|
|
3
|
+
##########################################
|
|
4
|
+
|
|
5
|
+
# Ignore all files and folders in root
|
|
6
|
+
/*
|
|
7
|
+
|
|
8
|
+
# Include desired files in root
|
|
9
|
+
!.deployignore
|
|
10
|
+
!.editorconfig
|
|
11
|
+
!.gitattributes
|
|
12
|
+
!.gitignore
|
|
13
|
+
!README.md
|
|
14
|
+
|
|
15
|
+
# Include .github folder
|
|
16
|
+
!.github/
|
|
17
|
+
|
|
18
|
+
# Include VS Code settings to share with other devs
|
|
19
|
+
!.vscode/
|
|
20
|
+
|
|
21
|
+
# Include wp-content folder... (so that we can include sub-folders of it)
|
|
22
|
+
!wp-content/
|
|
23
|
+
|
|
24
|
+
# But exclude everything in wp-content folder
|
|
25
|
+
wp-content/*
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
##########################################
|
|
30
|
+
# THEME
|
|
31
|
+
##########################################
|
|
32
|
+
|
|
33
|
+
# Include the themes folder...
|
|
34
|
+
!wp-content/themes/
|
|
35
|
+
|
|
36
|
+
# But exclude everything in themes folder... (so that we can include only specific sub-folders of it)
|
|
37
|
+
wp-content/themes/*
|
|
38
|
+
|
|
39
|
+
# Include the theme folder and all its files and sub-folders
|
|
40
|
+
!wp-content/themes/airfleet-lightyear/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
##########################################
|
|
45
|
+
# PLUGINS
|
|
46
|
+
# Uncomment lines below to include specific plugins.
|
|
47
|
+
# In general, don't store external plugins in the repository, unless it's a custom plugin/version.
|
|
48
|
+
##########################################
|
|
49
|
+
|
|
50
|
+
# Include the plugins folder...
|
|
51
|
+
# !wp-content/plugins/
|
|
52
|
+
|
|
53
|
+
# But exclude everything in plugins folder... (so that we can include only specific sub-folders of it)
|
|
54
|
+
# wp-content/plugins/*
|
|
55
|
+
|
|
56
|
+
# Include specific plugins and all its files and sub-folders
|
|
57
|
+
# !wp-content/plugins/advanced-custom-fields-pro/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import mapFilesToTemplates from "../../utils/mapFilesToTemplates.js";
|
|
4
|
+
|
|
5
|
+
export default class {
|
|
6
|
+
constructor(generator) {
|
|
7
|
+
this.generator = generator;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
templates() {
|
|
11
|
+
const files = [
|
|
12
|
+
".github/workflows/create-asana-attachment.yaml",
|
|
13
|
+
".github/workflows/test-wordpress-root-lightyear.yml",
|
|
14
|
+
".husky/pre-commit",
|
|
15
|
+
".vscode/airfleet.code-snippets",
|
|
16
|
+
".vscode/settings.json",
|
|
17
|
+
".deployignore",
|
|
18
|
+
".editorconfig",
|
|
19
|
+
".gitattributes",
|
|
20
|
+
"README.md.ejs",
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
return [
|
|
24
|
+
...mapFilesToTemplates(files),
|
|
25
|
+
{
|
|
26
|
+
template: "gitignore",
|
|
27
|
+
destination: `.gitignore`,
|
|
28
|
+
isEnabled: true,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
}
|
package/package.json
CHANGED