@airfleet/generator-init 0.38.0 → 0.39.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.
Files changed (96) hide show
  1. package/generators/plugin/index.js +122 -26
  2. package/generators/plugin/templates/.browserslistrc +2 -0
  3. package/generators/plugin/templates/.dprint.json +3 -0
  4. package/generators/plugin/templates/.github/workflows/release-plugin-preview.yml +197 -0
  5. package/generators/plugin/templates/.github/workflows/release-plugin.yml +24 -18
  6. package/generators/plugin/templates/.github/workflows/test-wordpress.yml +43 -10
  7. package/generators/plugin/templates/.husky/pre-commit +1 -4
  8. package/generators/plugin/templates/.lintstagedrc.json +12 -0
  9. package/generators/plugin/templates/.node-version.ejs +1 -0
  10. package/generators/plugin/templates/.oxlintrc.json +3 -0
  11. package/generators/plugin/templates/.parcelrc +1 -2
  12. package/generators/plugin/templates/.stylelintrc.json +4 -0
  13. package/generators/plugin/templates/.vscode/airfleet.code-snippets.ejs +5 -1
  14. package/generators/plugin/templates/.vscode/settings.json +18 -8
  15. package/generators/plugin/templates/README.md.ejs +0 -11
  16. package/generators/plugin/templates/composer-scoped-empty.json.ejs +6 -0
  17. package/generators/plugin/templates/composer-scoped-empty.lock.ejs +18 -0
  18. package/generators/{project-plugin/templates/composer-scoped.json.ejs → plugin/templates/composer-scoped-framework.json.ejs} +1 -1
  19. package/generators/{project-plugin/templates/composer-scoped.lock.ejs → plugin/templates/composer-scoped-framework.lock.ejs} +19 -20
  20. package/generators/{project-plugin/templates/composer.json.ejs → plugin/templates/composer-with-scoper.json.ejs} +5 -4
  21. package/generators/plugin/templates/composer-without-scoper.json.ejs +40 -0
  22. package/generators/plugin/templates/gitignore +1 -0
  23. package/generators/plugin/templates/globals.d.ts +1 -0
  24. package/generators/plugin/templates/inc/AjaxVariables.php.ejs +1 -1
  25. package/generators/plugin/templates/inc/AjaxVariablesAdmin.php.ejs +1 -1
  26. package/generators/plugin/templates/inc/Options/GeneralOptions.php.ejs +2 -2
  27. package/generators/plugin/templates/inc/Pages.php.ejs +3 -3
  28. package/generators/plugin/templates/inc/RegisterViews.php.ejs +1 -1
  29. package/generators/plugin/templates/inc/Setup.php.ejs +6 -6
  30. package/generators/plugin/templates/package.json.ejs +9 -53
  31. package/generators/plugin/templates/plugin-name-api.php +1 -0
  32. package/generators/{project-plugin/templates/plugin-name.php.ejs → plugin/templates/plugin-name-scoped-framework.php.ejs} +11 -1
  33. package/generators/plugin/templates/plugin-name-unscoped-framework.php.ejs +82 -0
  34. package/generators/project/index.js +17 -21
  35. package/generators/project/info.js +2 -2
  36. package/generators/project/prompts.js +10 -16
  37. package/generators/project/templates/.deployignore +8 -0
  38. package/generators/project/templates/.github/workflows/test-wordpress-root-lightyear.yml +46 -9
  39. package/generators/project/templates/.husky/pre-commit +1 -4
  40. package/generators/project/templates/.vscode/airfleet.code-snippets +2 -2
  41. package/generators/project/templates/.vscode/settings.json +18 -8
  42. package/generators/project/templates/README.md.ejs +0 -9
  43. package/generators/project-plugin/index.js +92 -14
  44. package/generators/project-plugin/templates/.browserslistrc +2 -0
  45. package/generators/project-plugin/templates/.deployignore +38 -8
  46. package/generators/project-plugin/templates/.dprint.json +3 -0
  47. package/generators/project-plugin/templates/.github/workflows/test-wordpress.yml +43 -12
  48. package/generators/project-plugin/templates/.husky/pre-commit +1 -4
  49. package/generators/project-plugin/templates/.lintstagedrc.json +12 -0
  50. package/generators/project-plugin/templates/.node-version.ejs +1 -0
  51. package/generators/project-plugin/templates/.oxlintrc.json +3 -0
  52. package/generators/project-plugin/templates/.parcelrc +1 -2
  53. package/generators/project-plugin/templates/.stylelintrc.json +4 -0
  54. package/generators/project-plugin/templates/.vscode/airfleet.code-snippets.ejs +5 -1
  55. package/generators/project-plugin/templates/.vscode/settings.json +18 -8
  56. package/generators/project-plugin/templates/README.md.ejs +0 -7
  57. package/generators/project-plugin/templates/assets/admin/styles/admin.entry.scss +2 -2
  58. package/generators/project-plugin/templates/assets/editor/styles/editor.entry.scss +8 -7
  59. package/generators/project-plugin/templates/assets/frontend/styles/_main.scss +7 -3
  60. package/generators/project-plugin/templates/assets/frontend/styles/_placeholders.scss +9 -3
  61. package/generators/project-plugin/templates/assets/frontend/styles/_root.scss +2 -2
  62. package/generators/project-plugin/templates/assets/frontend/styles/critical.entry.scss +1 -1
  63. package/generators/project-plugin/templates/assets/frontend/styles/index.entry.scss +7 -5
  64. package/generators/project-plugin/templates/assets/frontend/styles/main/_body.scss +6 -4
  65. package/generators/project-plugin/templates/assets/frontend/styles/main/_reset.scss +98 -96
  66. package/generators/project-plugin/templates/assets/frontend/styles/placeholders/_button.scss +42 -40
  67. package/generators/project-plugin/templates/assets/frontend/styles/placeholders/_container.scss +12 -10
  68. package/generators/project-plugin/templates/assets/frontend/styles/placeholders/_sections.scss +6 -4
  69. package/generators/project-plugin/templates/assets/frontend/styles/root/_fonts.scss +2 -2
  70. package/generators/project-plugin/templates/assets/shared/styles/_figma-variables.scss +2 -5
  71. package/generators/project-plugin/templates/assets/shared/styles/_lib.scss +2 -2
  72. package/generators/project-plugin/templates/assets/shared/styles/_root.scss +2 -2
  73. package/generators/project-plugin/templates/assets/shared/styles/lib/_mixins.scss +6 -6
  74. package/generators/project-plugin/templates/assets/shared/styles/lib/mixins/_breakpoints.scss +1 -0
  75. package/generators/project-plugin/templates/composer-scoped-empty.json.ejs +6 -0
  76. package/generators/project-plugin/templates/composer-scoped-empty.lock.ejs +18 -0
  77. package/generators/{plugin/templates/composer-scoped.json.ejs → project-plugin/templates/composer-scoped-framework.json.ejs} +1 -1
  78. package/generators/{plugin/templates/composer-scoped.lock.ejs → project-plugin/templates/composer-scoped-framework.lock.ejs} +19 -20
  79. package/generators/{plugin/templates/composer.json.ejs → project-plugin/templates/composer-with-scoper.json.ejs} +5 -4
  80. package/generators/project-plugin/templates/composer-without-scoper.json.ejs +40 -0
  81. package/generators/project-plugin/templates/gitignore +1 -0
  82. package/generators/project-plugin/templates/globals.d.ts +1 -0
  83. package/generators/project-plugin/templates/inc/Features/Menus.php.ejs +1 -1
  84. package/generators/project-plugin/templates/inc/Setup/AjaxVariables.php.ejs +1 -1
  85. package/generators/project-plugin/templates/inc/Setup/AjaxVariablesAdmin.php.ejs +1 -1
  86. package/generators/project-plugin/templates/inc/Setup/Breakpoints.php.ejs +1 -1
  87. package/generators/project-plugin/templates/inc/Setup/Colors.php.ejs +1 -1
  88. package/generators/project-plugin/templates/inc/Setup/RegisterViews.php.ejs +1 -1
  89. package/generators/project-plugin/templates/inc/Setup.php.ejs +3 -3
  90. package/generators/project-plugin/templates/package.json.ejs +9 -58
  91. package/generators/{plugin/templates/plugin-name.php.ejs → project-plugin/templates/plugin-name-scoped-framework.php.ejs} +6 -1
  92. package/generators/project-plugin/templates/plugin-name-unscoped-framework.php.ejs +79 -0
  93. package/generators/snippets/templates/airfleet.code-snippets.ejs +2 -2
  94. package/package.json +1 -1
  95. package/utils/configureBunPackageManager.js +13 -0
  96. package/generators/plugin/templates/.prettierignore +0 -15
@@ -5,10 +5,12 @@ import copyTemplates from "../../utils/copyTemplates.js";
5
5
  import Info from "./info.js";
6
6
  import Prompts from "./prompts.js";
7
7
  import Templates from "./templates.js";
8
+ import configureBunPackageManager from "../../utils/configureBunPackageManager.js";
8
9
 
9
10
  export default class extends Generator {
10
11
  constructor(args, opts) {
11
12
  super(args, opts);
13
+ configureBunPackageManager(this);
12
14
  this.info = new Info(this);
13
15
  this.prompts = new Prompts(this);
14
16
  this.templates = new Templates(this);
@@ -31,32 +33,24 @@ export default class extends Generator {
31
33
  await this._copyTheme();
32
34
  this._fixHusky();
33
35
  await this._installTheme();
34
- await this._handleBootstrap();
35
36
  }
36
37
 
37
38
  async _copyTheme() {
38
39
  const repository = this._themeRepository();
39
40
  const themeFolder = this._themeFolder();
40
- await this.spawnCommand('git', ['clone', '--depth=1', repository, themeFolder]);
41
+ await this.spawnCommand("git", [
42
+ "clone",
43
+ "--depth=1",
44
+ repository,
45
+ themeFolder,
46
+ ]);
41
47
  this._deleteFolder(`${themeFolder}/.git`);
42
48
  }
43
49
 
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", "--save"]);
54
- }
55
- }
56
-
57
50
  async _installTheme() {
58
- await this._spawnThemeCommand('composer', ['install']);
59
- await this._spawnThemeCommand('npm', ['install']);
51
+ await this._spawnThemeCommand("composer", ["install"]);
52
+ await this._spawnThemeCommand("bun", ["install"]);
53
+ await this._spawnThemeCommand("bun", ["pm", "trust", "--all"]);
60
54
  }
61
55
 
62
56
  _fixHusky() {
@@ -64,7 +58,7 @@ export default class extends Generator {
64
58
  const packageJsonPath = `${this._themeFolder()}/package.json`;
65
59
  const packageJson = this.readDestinationJSON(packageJsonPath);
66
60
 
67
- packageJson.scripts.prepare = "cd .. && cd .. && cd .. && husky install";
61
+ packageJson.scripts.prepare = "cd .. && cd .. && cd .. && husky";
68
62
  this.writeDestinationJSON(packageJsonPath, packageJson);
69
63
  }
70
64
 
@@ -79,7 +73,7 @@ export default class extends Generator {
79
73
  }
80
74
 
81
75
  _moveFolder(source, destination) {
82
- this.moveDestination(source, destination, { globOptions: {dot: true} });
76
+ this.moveDestination(source, destination, { globOptions: { dot: true } });
83
77
  }
84
78
 
85
79
  _deleteFolder(path) {
@@ -88,7 +82,9 @@ export default class extends Generator {
88
82
  this.deleteDestination(`${path}/**/*`);
89
83
  }
90
84
 
91
- async _spawnThemeCommand(command, params ) {
92
- return await this.spawnCommand(command, params, { cwd: this.destinationPath(this._themeFolder())});
85
+ async _spawnThemeCommand(command, params) {
86
+ return await this.spawnCommand(command, params, {
87
+ cwd: this.destinationPath(this._themeFolder()),
88
+ });
93
89
  }
94
90
  }
@@ -24,8 +24,8 @@ export default class {
24
24
  " - Navigated to the project folder on the command line",
25
25
  "",
26
26
  "Requirements for running the theme:",
27
- " - Node >= 16",
28
- " - PHP 8.2",
27
+ " - Node >= 24",
28
+ " - PHP 8.3",
29
29
  " - Composer 2",
30
30
  " - Required WP plugins (see the theme Notion docs)",
31
31
  "",
@@ -13,8 +13,7 @@ export default class {
13
13
  repository: undefined,
14
14
  productionUrl: undefined,
15
15
  stagingUrl: undefined,
16
- addBootstrap: false,
17
- }
16
+ };
18
17
  this.answers = {};
19
18
  }
20
19
 
@@ -25,7 +24,6 @@ export default class {
25
24
  this._repositoryPrompt(),
26
25
  this._productionUrlPrompt(),
27
26
  this._stagingUrlPrompt(),
28
- this._addBootstrapPrompt(),
29
27
  ]);
30
28
 
31
29
  return this.answers;
@@ -46,7 +44,10 @@ export default class {
46
44
  return {
47
45
  type: "input",
48
46
  name: "title",
49
- message: this._message(`What is the name of the project?`, `(e.g. "Zenity Website 2023")`),
47
+ message: this._message(
48
+ `What is the name of the project?`,
49
+ `(e.g. "Zenity Website 2023")`
50
+ ),
50
51
  validate: requiredText("Please enter a name"),
51
52
  default: this.defaults.title,
52
53
  };
@@ -66,7 +67,10 @@ export default class {
66
67
  return {
67
68
  type: "input",
68
69
  name: "repository",
69
- message: this._message("What's the repository URL?", `(start with https and end with .git)`),
70
+ message: this._message(
71
+ "What's the repository URL?",
72
+ `(start with https and end with .git)`
73
+ ),
70
74
  validate: function requiredText(text) {
71
75
  if (!text) {
72
76
  return "Please enter the repository URL";
@@ -76,7 +80,7 @@ export default class {
76
80
 
77
81
  if (!matches) {
78
82
  return "Repository URL must start with https:// and end in .git";
79
- };
83
+ }
80
84
 
81
85
  return true;
82
86
  },
@@ -101,14 +105,4 @@ export default class {
101
105
  default: this.defaults.stagingUrl,
102
106
  };
103
107
  }
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
108
  }
@@ -12,7 +12,9 @@
12
12
  **/.airfleet-release
13
13
  **/.airfleet-license
14
14
  **/.airfleet-visible
15
+ **/.browserslistrc
15
16
  **/.deployignore
17
+ **/.dprint.json
16
18
  **/.editorconfig
17
19
  .editorconfig
18
20
  **/.env
@@ -24,6 +26,9 @@
24
26
  .gitignore
25
27
  **/.gitkeep
26
28
  **/.gitlab-ci.yml
29
+ **/.lintstagedrc.json
30
+ **/.node-version
31
+ **/.oxlintrc.json
27
32
  **/.parcelrc
28
33
  **/.phpcscache
29
34
  **/.prettierignore
@@ -31,12 +36,15 @@
31
36
  **/.stylelintrc.js
32
37
  **/.stylelintrc.json
33
38
  **/.travis
39
+ **/AGENTS.md
40
+ **/bun.lock
34
41
  **/CHANGELOG
35
42
  **/CHANGELOG.md
36
43
  **/CODE_OF_CONDUCT
37
44
  **/CODE_OF_CONDUCT.md
38
45
  **/composer.json
39
46
  **/composer.lock
47
+ **/globals.d.ts
40
48
  **/LICENSE
41
49
  **/LICENSE.md
42
50
  **/package-lock.json
@@ -17,7 +17,7 @@ jobs:
17
17
 
18
18
  steps:
19
19
  - name: 🚚 Get latest code
20
- uses: actions/checkout@v3
20
+ uses: actions/checkout@v6
21
21
 
22
22
  - name: ⚙️ Setup PHP
23
23
  uses: shivammathur/setup-php@v2
@@ -25,10 +25,8 @@ jobs:
25
25
  php-version: "8.2"
26
26
  ini-values: short_open_tag=1
27
27
 
28
- - name: ⚙️ Setup Node
29
- uses: actions/setup-node@v3
30
- with:
31
- node-version: 16
28
+ - name: ⚙️ Install bun
29
+ uses: oven-sh/setup-bun@v2
32
30
 
33
31
  - name: 🔨 Increase composer timeout
34
32
  run: composer --global config process-timeout 1500
@@ -36,11 +34,50 @@ jobs:
36
34
  - name: 🔨 Composer install
37
35
  run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
38
36
 
39
- - name: 🔨 npm install
40
- run: npm ci
37
+ - name: 🔨 Bun install
38
+ run: bun ci
39
+
40
+ - name: 🔬 Lint
41
+ run: bun run --if-present lint
41
42
 
42
43
  - name: 🔬 Test
43
- run: npm test
44
+ run: bun run --if-present test
44
45
 
45
46
  - name: 📦 Build
46
- run: npm run build --if-present
47
+ run: bun run --if-present build
48
+
49
+ test-php:
50
+ runs-on: ubuntu-latest
51
+
52
+ defaults:
53
+ run:
54
+ working-directory: ./wp-content/themes/airfleet-lightyear
55
+
56
+ strategy:
57
+ matrix:
58
+ php-versions: ["8.2", "8.3", "8.4", "8.5"]
59
+
60
+ steps:
61
+ - name: 🚚 Get latest code
62
+ uses: actions/checkout@v6
63
+
64
+ - name: ⚙️ Setup PHP
65
+ uses: shivammathur/setup-php@v2
66
+ with:
67
+ php-version: "${{ matrix.php-versions }}"
68
+ ini-values: short_open_tag=1
69
+
70
+ - name: ⚙️ Install bun
71
+ uses: oven-sh/setup-bun@v2
72
+
73
+ - name: 🔨 Increase composer timeout
74
+ run: composer --global config process-timeout 1500
75
+
76
+ - name: 🔨 Composer install
77
+ run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
78
+
79
+ - name: 🔨 Bun install
80
+ run: bun ci
81
+
82
+ - name: 🔬 Lint
83
+ run: bun run lint --php
@@ -1,5 +1,2 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
1
  cd wp-content/themes/airfleet-lightyear
5
- npx lint-staged
2
+ bunx lint-staged
@@ -7,7 +7,7 @@
7
7
  "",
8
8
  "namespace Airfleet\\Themes\\Lightyear\\\\${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/};",
9
9
  "",
10
- "use Airfleet\\Themes\\Lightyear\\Vendor\\Airfleet\\Framework\\Features\\Feature;",
10
+ "use Airfleet\\Framework\\Features\\Feature;",
11
11
  "",
12
12
  "class $TM_FILENAME_BASE implements Feature {",
13
13
  " public function initialize(): void {",
@@ -168,4 +168,4 @@
168
168
  ],
169
169
  "description": "Bootstrap a Blade template for a partial"
170
170
  }
171
- }
171
+ }
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "editor.codeActionsOnSave": {
3
3
  "source.fixAll": "explicit",
4
- "source.fixAll.eslint": "explicit"
4
+ "source.fixAll.oxc": "explicit"
5
5
  },
6
+ "editor.defaultFormatter": "dprint.dprint",
6
7
  "editor.formatOnSave": true,
7
8
  "stylelint.validate": ["css", "scss", "postcss"],
8
9
  "phpSniffer.executablesFolder": "./wp-content/themes/airfleet-lightyear/vendor/bin/",
@@ -28,24 +29,33 @@
28
29
  "editor.defaultFormatter": "wongjn.php-sniffer"
29
30
  },
30
31
  "[javascript]": {
31
- "editor.defaultFormatter": "dbaeumer.vscode-eslint"
32
+ "editor.defaultFormatter": "dprint.dprint"
32
33
  },
33
34
  "[javascriptreact]": {
34
- "editor.defaultFormatter": "dbaeumer.vscode-eslint"
35
+ "editor.defaultFormatter": "dprint.dprint"
35
36
  },
36
37
  "[typescript]": {
37
- "editor.defaultFormatter": "dbaeumer.vscode-eslint"
38
+ "editor.defaultFormatter": "dprint.dprint"
38
39
  },
39
40
  "[typescriptreact]": {
40
- "editor.defaultFormatter": "dbaeumer.vscode-eslint"
41
+ "editor.defaultFormatter": "dprint.dprint"
41
42
  },
42
43
  "[postcss]": {
43
- "editor.defaultFormatter": "esbenp.prettier-vscode"
44
+ "editor.defaultFormatter": "dprint.dprint"
44
45
  },
45
46
  "[scss]": {
46
- "editor.defaultFormatter": "esbenp.prettier-vscode"
47
+ "editor.defaultFormatter": "dprint.dprint"
47
48
  },
48
49
  "[css]": {
49
- "editor.defaultFormatter": "esbenp.prettier-vscode"
50
+ "editor.defaultFormatter": "dprint.dprint"
51
+ },
52
+ "[json]": {
53
+ "editor.defaultFormatter": "dprint.dprint"
54
+ },
55
+ "[yaml]": {
56
+ "editor.defaultFormatter": "dprint.dprint"
57
+ },
58
+ "[markdown]": {
59
+ "editor.defaultFormatter": "dprint.dprint"
50
60
  }
51
61
  }
@@ -4,15 +4,6 @@
4
4
 
5
5
  <%= answers.description %>
6
6
 
7
- ## Getting Started
8
-
9
- Navigate to the theme folder (`wp-content/themes/airfleet-lightyear`) and run:
10
-
11
- ```bash
12
- composer install
13
- npm install
14
- ```
15
-
16
7
  ## License
17
8
 
18
9
  © [Airfleet](https://www.airfleet.co/)
@@ -10,9 +10,14 @@ import title from "../../utils/log/title.js";
10
10
  import highlightText from "../../utils/log/text/highlightText.js";
11
11
  import lines from "../../utils/log/text/lines.js";
12
12
  import infoBox from "../../utils/log/boxes/infoBox.js";
13
- import objectPropertyFromValue from '../../utils/objectPropertyFromValue.js';
13
+ import configureBunPackageManager from "../../utils/configureBunPackageManager.js";
14
14
 
15
15
  export default class extends Generator {
16
+ constructor(args, opts) {
17
+ super(args, opts);
18
+ configureBunPackageManager(this);
19
+ }
20
+
16
21
  async prompting() {
17
22
  this.log(
18
23
  lines([
@@ -58,14 +63,40 @@ export default class extends Generator {
58
63
  name: "pluginPhpVersion",
59
64
  message: "What's the required PHP version?",
60
65
  validate: requiredText("Please enter the PHP version"),
61
- default: ">=8.2",
66
+ default: ">=8.3",
62
67
  },
63
68
  {
64
69
  type: "input",
65
70
  name: "pluginNodeVersion",
66
71
  message: "What's the required Node version?",
67
72
  validate: requiredText("Please enter the Node version"),
68
- default: ">=16",
73
+ default: ">=24",
74
+ },
75
+ {
76
+ type: "confirm",
77
+ name: "useScopedFramework",
78
+ message: "Use scoped framework?",
79
+ default: false,
80
+ },
81
+ {
82
+ type: "confirm",
83
+ name: "addScoper",
84
+ message: "Add scoper setup?",
85
+ default: false,
86
+ },
87
+ {
88
+ type: "confirm",
89
+ name: "hasDependencies",
90
+ message: "Specify plugin dependencies?",
91
+ default: true,
92
+ },
93
+ {
94
+ type: "input",
95
+ name: "dependencies",
96
+ message: "Plugin dependencies (comma separated slugs)",
97
+ default:
98
+ "advanced-custom-fields-pro, airfleet-framework, airfleet-views, airfleet-elements-core",
99
+ when: (answers) => answers.hasDependencies,
69
100
  },
70
101
  {
71
102
  type: "confirm",
@@ -91,11 +122,14 @@ export default class extends Generator {
91
122
  mainBranch: "main",
92
123
  year: new Date().getFullYear(),
93
124
  phpVersion: this._getPhpVersion(this.answers.pluginPhpVersion),
125
+ frameworkNamespace: this.answers.useScopedFramework
126
+ ? `Airfleet\\Plugins\\${this.nameNoAirfleet.pascal}\\Vendor\\Airfleet\\Framework\\`
127
+ : `Airfleet\\Framework\\`,
94
128
  };
95
129
  }
96
130
 
97
131
  writing() {
98
- const templateExtension = this.answers.pluginUseBlade ? 'blade.php' : 'php';
132
+ const templateExtension = this.answers.pluginUseBlade ? "blade.php" : "php";
99
133
 
100
134
  const files = [
101
135
  ".github/workflows/create-asana-attachment.yaml",
@@ -161,20 +195,23 @@ export default class extends Generator {
161
195
  "views-elements/partials/button/ButtonSetup.php.ejs",
162
196
  "views-elements/.gitkeep",
163
197
  ".airfleet-release",
198
+ ".browserslistrc",
199
+ ".dprint.json",
164
200
  ".editorconfig",
165
201
  ".env",
166
202
  ".gitattributes",
203
+ ".lintstagedrc.json",
204
+ ".node-version.ejs",
205
+ ".oxlintrc.json",
167
206
  ".parcelrc",
168
- ".prettierignore",
207
+ ".stylelintrc.json",
169
208
  "CHANGELOG.md",
170
- "composer.json.ejs",
171
- "composer-scoped.json.ejs",
209
+ "globals.d.ts",
172
210
  "index.php",
173
211
  "LICENSE.ejs",
174
212
  "package.json.ejs",
175
213
  "phpcs.xml.ejs",
176
214
  "README.md.ejs",
177
- "scoper.custom.php.ejs",
178
215
  ".deployignore",
179
216
  ];
180
217
  const templates = [
@@ -190,9 +227,14 @@ export default class extends Generator {
190
227
  isEnabled: true,
191
228
  },
192
229
  {
193
- template: "plugin-name.php.ejs",
230
+ template: "plugin-name-scoped-framework.php.ejs",
194
231
  destination: `${this.name.slug}.php`,
195
- isEnabled: true,
232
+ isEnabled: this.answers.useScopedFramework,
233
+ },
234
+ {
235
+ template: "plugin-name-unscoped-framework.php.ejs",
236
+ destination: `${this.name.slug}.php`,
237
+ isEnabled: !this.answers.useScopedFramework,
196
238
  },
197
239
  {
198
240
  template: "acf-json/.gitkeep",
@@ -204,17 +246,54 @@ export default class extends Generator {
204
246
  destination: ".vscode/airfleet.code-snippets",
205
247
  isEnabled: true,
206
248
  },
249
+ {
250
+ template: "composer-with-scoper.json.ejs",
251
+ destination: "composer.json",
252
+ isEnabled: this.answers.addScoper,
253
+ },
254
+ {
255
+ template: "composer-without-scoper.json.ejs",
256
+ destination: "composer.json",
257
+ isEnabled: !this.answers.addScoper,
258
+ },
259
+ {
260
+ template: "composer-scoped-empty.json.ejs",
261
+ destination: "composer-scoped.json",
262
+ isEnabled: this.answers.addScoper && !this.answers.useScopedFramework,
263
+ },
264
+ {
265
+ template: "composer-scoped-empty.lock.ejs",
266
+ destination: "composer-scoped.lock",
267
+ isEnabled: this.answers.addScoper && !this.answers.useScopedFramework,
268
+ },
269
+ {
270
+ template: "composer-scoped-framework.json.ejs",
271
+ destination: "composer-scoped.json",
272
+ isEnabled: this.answers.addScoper && this.answers.useScopedFramework,
273
+ },
274
+ {
275
+ template: "composer-scoped-framework.lock.ejs",
276
+ destination: "composer-scoped.lock",
277
+ isEnabled: this.answers.addScoper && this.answers.useScopedFramework,
278
+ },
279
+ {
280
+ template: "scoper.custom.php.ejs",
281
+ destination: "scoper.custom.php",
282
+ isEnabled: this.answers.addScoper,
283
+ },
207
284
  ];
208
285
 
209
286
  copyTemplates(this, templates, this.data);
210
287
  }
211
288
 
212
- install() {
213
- this.spawnCommand("composer", ["install"]);
289
+ async install() {
290
+ await this.spawnCommand("composer", ["install"]);
291
+ await this.spawnCommand("bun", ["install"]);
292
+ await this.spawnCommand("bun", ["pm", "trust", "--all"]);
214
293
  }
215
294
 
216
295
  _getPhpVersion(pluginPhpVersion) {
217
- const toFind = ['=','>'];
296
+ const toFind = ["=", ">"];
218
297
 
219
298
  for (const char of toFind) {
220
299
  const index = pluginPhpVersion.indexOf(char);
@@ -226,5 +305,4 @@ export default class extends Generator {
226
305
 
227
306
  return pluginPhpVersion;
228
307
  }
229
-
230
308
  }
@@ -0,0 +1,2 @@
1
+ > 0.5% and last 2 versions
2
+ not dead
@@ -15,7 +15,12 @@
15
15
  .airfleet-license
16
16
  **/.airfleet-visible
17
17
  .airfleet-visible
18
+ **/.browserslistrc
19
+ .browserslistrc
18
20
  **/.deployignore
21
+ .deployignore
22
+ **/.dprint.json
23
+ .dprint.json
19
24
  **/.editorconfig
20
25
  .editorconfig
21
26
  **/.env
@@ -24,20 +29,51 @@
24
29
  **/.eslintrc.js
25
30
  **/.gitattributes
26
31
  .gitattributes
32
+ **/.gitignore
33
+ .gitignore
34
+ **/.gitkeep
35
+ .gitkeep
36
+ **/.lintstagedrc.json
37
+ .lintstagedrc.json
38
+ **/.node-version
39
+ .node-version
40
+ **/.oxlintrc.json
41
+ .oxlintrc.json
27
42
  **/.parcelrc
28
43
  .parcelrc
44
+ **/.phpcscache
45
+ .phpcscache
29
46
  **/.prettierignore
30
47
  .prettierignore
48
+ **/.stylelintcache
49
+ .stylelintcache
50
+ **/.stylelintrc.js
51
+ .stylelintrc.js
52
+ **/.stylelintrc.json
53
+ .stylelintrc.json
54
+ **/.travis
55
+ **/AGENTS.md
56
+ AGENTS.md
57
+ **/bun.lock
58
+ bun.lock
59
+ **/CHANGELOG
60
+ CHANGELOG
31
61
  **/CHANGELOG.md
32
62
  CHANGELOG.md
63
+ **/CODE_OF_CONDUCT
64
+ **/CODE_OF_CONDUCT.md
65
+ **/globals.d.ts
66
+ globals.d.ts
33
67
  **/LICENSE
34
68
  LICENSE
69
+ **/LICENSE.md
70
+ **/phpcs.xml
71
+ phpcs.xml
72
+ **/README
35
73
  **/README.md
36
74
  README.md
37
75
  **/*.md
38
76
  *.md
39
- **/.gitignore
40
- .gitignore
41
77
  **/package.json
42
78
  package.json
43
79
  **/composer-scoped.json
@@ -50,11 +86,5 @@ composer.json
50
86
  composer.lock
51
87
  **/package-lock.json
52
88
  package-lock.json
53
- **/phpcs.xml
54
- phpcs.xml
55
89
  **/scoper.custom.php
56
90
  scoper.custom.php
57
-
58
-
59
-
60
-
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "node_modules/@airfleet/wordpress-dev/config/.dprint.json"
3
+ }