@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
@@ -10,9 +10,15 @@ 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
+ import objectPropertyFromValue from "../../utils/objectPropertyFromValue.js";
14
15
 
15
16
  export default class extends Generator {
17
+ constructor(args, opts) {
18
+ super(args, opts);
19
+ configureBunPackageManager(this);
20
+ }
21
+
16
22
  async prompting() {
17
23
  this.log(
18
24
  lines([
@@ -77,35 +83,64 @@ export default class extends Generator {
77
83
  name: "pluginPhpVersion",
78
84
  message: "What's the required PHP version?",
79
85
  validate: requiredText("Please enter the PHP version"),
80
- default: ">=8.2",
86
+ default: ">=8.3",
81
87
  },
82
88
  {
83
89
  type: "input",
84
90
  name: "pluginNodeVersion",
85
91
  message: "What's the required Node version?",
86
92
  validate: requiredText("Please enter the Node version"),
87
- default: ">=16",
93
+ default: ">=24",
94
+ },
95
+ {
96
+ type: "confirm",
97
+ name: "useScopedFramework",
98
+ message: "Use scoped framework?",
99
+ default: false,
100
+ },
101
+ {
102
+ type: "confirm",
103
+ name: "addScoper",
104
+ message: "Add scoper setup?",
105
+ default: false,
106
+ },
107
+ {
108
+ type: "confirm",
109
+ name: "hasDependencies",
110
+ message: "Specify plugin dependencies?",
111
+ default: true,
112
+ },
113
+ {
114
+ type: "input",
115
+ name: "dependencies",
116
+ message: "Plugin dependencies (comma separated slugs)",
117
+ default:
118
+ "advanced-custom-fields-pro, airfleet-framework, airfleet-views, airfleet-elements-core",
119
+ when: (answers) => answers.hasDependencies,
88
120
  },
89
121
  {
90
122
  type: "list",
91
123
  name: "viewsPrefix",
92
- message:
93
- "Views prefix?",
94
- choices: [viewsPrefixOptions.none, viewsPrefixOptions.elements, viewsPrefixOptions.pluginSlug],
95
- default: viewsPrefixOptions.elements,
124
+ message: "Views prefix?",
125
+ choices: [
126
+ viewsPrefixOptions.none,
127
+ viewsPrefixOptions.elements,
128
+ viewsPrefixOptions.pluginSlug,
129
+ ],
130
+ default: viewsPrefixOptions.elements,
96
131
  },
97
132
  {
98
133
  type: "list",
99
134
  name: "pluginCreateOptions",
100
135
  message: "Create options page?",
101
136
  choices: ["No", "Framework", "ACF"],
102
- default: "Framework",
137
+ default: "ACF",
103
138
  },
104
139
  {
105
140
  type: "confirm",
106
141
  name: "pluginAcfLocalJson",
107
142
  message: "Add ACF Local JSON?",
108
- default: false,
143
+ default: true,
109
144
  },
110
145
  {
111
146
  type: "list",
@@ -132,8 +167,12 @@ export default class extends Generator {
132
167
  this.answers = await this.prompt(prompts);
133
168
  this.name = nameCases(this.answers.pluginName);
134
169
  this.ajaxVariables = {
135
- frontend: this.answers.pluginAjaxVariables === 'Both' || this.answers.pluginAjaxVariables === 'Frontend',
136
- admin: this.answers.pluginAjaxVariables === 'Both' || this.answers.pluginAjaxVariables === 'Admin',
170
+ frontend:
171
+ this.answers.pluginAjaxVariables === "Both" ||
172
+ this.answers.pluginAjaxVariables === "Frontend",
173
+ admin:
174
+ this.answers.pluginAjaxVariables === "Both" ||
175
+ this.answers.pluginAjaxVariables === "Admin",
137
176
  };
138
177
  this.optionsPage = paramCase(this.answers.pluginCreateOptions);
139
178
 
@@ -141,7 +180,11 @@ export default class extends Generator {
141
180
  .replace(/^airfleet/i, "")
142
181
  .trim();
143
182
  this.nameNoAirfleet = nameCases(nameNoAirfleet);
144
- this.viewsPrefix = this._getViewsPrefix(this.answers, viewsPrefixOptions, this.nameNoAirfleet);
183
+ this.viewsPrefix = this._getViewsPrefix(
184
+ this.answers,
185
+ viewsPrefixOptions,
186
+ this.nameNoAirfleet
187
+ );
145
188
  this.data = {
146
189
  answers: this.answers,
147
190
  name: this.name,
@@ -154,12 +197,16 @@ export default class extends Generator {
154
197
  optionsPage: this.optionsPage,
155
198
  viewsPrefix: this.viewsPrefix,
156
199
  phpVersion: this._getPhpVersion(this.answers.pluginPhpVersion),
200
+ frameworkNamespace: this.answers.useScopedFramework
201
+ ? `Airfleet\\Plugins\\${this.nameNoAirfleet.pascal}\\Vendor\\Airfleet\\Framework`
202
+ : `Airfleet\\Framework`,
157
203
  };
158
204
  }
159
205
 
160
206
  writing() {
161
207
  const files = [
162
208
  ".github/workflows/create-asana-attachment.yaml",
209
+ ".github/workflows/release-plugin-preview.yml",
163
210
  ".github/workflows/release-plugin.yml",
164
211
  ".github/workflows/test-wordpress.yml",
165
212
  ".husky/pre-commit",
@@ -179,20 +226,23 @@ export default class extends Generator {
179
226
  "inc/Setup.php.ejs",
180
227
  "views/parcelkeep.entry.scss",
181
228
  ".airfleet-release",
229
+ ".browserslistrc",
230
+ ".dprint.json",
182
231
  ".editorconfig",
183
232
  ".env",
184
233
  ".gitattributes",
234
+ ".lintstagedrc.json",
235
+ ".node-version.ejs",
236
+ ".oxlintrc.json",
185
237
  ".parcelrc",
186
- ".prettierignore",
238
+ ".stylelintrc.json",
187
239
  "CHANGELOG.md",
188
- "composer-scoped.json.ejs",
189
- "composer.json.ejs",
240
+ "globals.d.ts",
190
241
  "index.php",
191
242
  "LICENSE.ejs",
192
243
  "package.json.ejs",
193
244
  "phpcs.xml.ejs",
194
245
  "README.md.ejs",
195
- "scoper.custom.php.ejs",
196
246
  ];
197
247
  const templates = [
198
248
  ...mapFilesToTemplates(files),
@@ -207,8 +257,18 @@ export default class extends Generator {
207
257
  isEnabled: true,
208
258
  },
209
259
  {
210
- template: "plugin-name.php.ejs",
260
+ template: "plugin-name-scoped-framework.php.ejs",
211
261
  destination: `${this.name.slug}.php`,
262
+ isEnabled: this.answers.useScopedFramework,
263
+ },
264
+ {
265
+ template: "plugin-name-unscoped-framework.php.ejs",
266
+ destination: `${this.name.slug}.php`,
267
+ isEnabled: !this.answers.useScopedFramework,
268
+ },
269
+ {
270
+ template: "plugin-name-api.php",
271
+ destination: `${this.name.slug}-api.php`,
212
272
  isEnabled: true,
213
273
  },
214
274
  {
@@ -224,17 +284,17 @@ export default class extends Generator {
224
284
  {
225
285
  template: "inc/Options.php.ejs",
226
286
  destination: `inc/Options.php`,
227
- isEnabled: this.optionsPage === 'framework',
287
+ isEnabled: this.optionsPage === "framework",
228
288
  },
229
289
  {
230
290
  template: "inc/Options/GeneralOptions.php.ejs",
231
291
  destination: `inc/Options/GeneralOptions.php`,
232
- isEnabled: this.optionsPage === 'framework',
292
+ isEnabled: this.optionsPage === "framework",
233
293
  },
234
294
  {
235
295
  template: "inc/Pages.php.ejs",
236
296
  destination: `inc/Pages.php`,
237
- isEnabled: this.optionsPage === 'framework',
297
+ isEnabled: this.optionsPage === "framework",
238
298
  },
239
299
  {
240
300
  template: "acf-json/.gitkeep",
@@ -256,19 +316,56 @@ export default class extends Generator {
256
316
  destination: ".airfleet-visible",
257
317
  isEnabled: true,
258
318
  },
319
+ {
320
+ template: "composer-with-scoper.json.ejs",
321
+ destination: "composer.json",
322
+ isEnabled: this.answers.addScoper,
323
+ },
324
+ {
325
+ template: "composer-without-scoper.json.ejs",
326
+ destination: "composer.json",
327
+ isEnabled: !this.answers.addScoper,
328
+ },
329
+ {
330
+ template: "composer-scoped-empty.json.ejs",
331
+ destination: "composer-scoped.json",
332
+ isEnabled: this.answers.addScoper && !this.answers.useScopedFramework,
333
+ },
334
+ {
335
+ template: "composer-scoped-empty.lock.ejs",
336
+ destination: "composer-scoped.lock",
337
+ isEnabled: this.answers.addScoper && !this.answers.useScopedFramework,
338
+ },
339
+ {
340
+ template: "composer-scoped-framework.json.ejs",
341
+ destination: "composer-scoped.json",
342
+ isEnabled: this.answers.addScoper && this.answers.useScopedFramework,
343
+ },
344
+ {
345
+ template: "composer-scoped-framework.lock.ejs",
346
+ destination: "composer-scoped.lock",
347
+ isEnabled: this.answers.addScoper && this.answers.useScopedFramework,
348
+ },
349
+ {
350
+ template: "scoper.custom.php.ejs",
351
+ destination: "scoper.custom.php",
352
+ isEnabled: this.answers.addScoper,
353
+ },
259
354
  ];
260
355
 
261
356
  copyTemplates(this, templates, this.data);
262
357
  }
263
358
 
264
- install() {
265
- this.spawnCommand("composer", ["install"]);
359
+ async install() {
360
+ await this.spawnCommand("composer", ["install"]);
361
+ await this.spawnCommand("bun", ["install"]);
362
+ await this.spawnCommand("bun", ["pm", "trust", "--all"]);
266
363
  }
267
364
 
268
365
  _getViewsPrefix(answers, options, nameNoAirfleet) {
269
- switch(answers.viewsPrefix) {
366
+ switch (answers.viewsPrefix) {
270
367
  case options.none:
271
- return '';
368
+ return "";
272
369
  case options.pluginSlug:
273
370
  return nameNoAirfleet.slug;
274
371
  default:
@@ -279,7 +376,7 @@ export default class extends Generator {
279
376
  }
280
377
 
281
378
  _getPhpVersion(pluginPhpVersion) {
282
- const toFind = ['=','>'];
379
+ const toFind = ["=", ">"];
283
380
 
284
381
  for (const char of toFind) {
285
382
  const index = pluginPhpVersion.indexOf(char);
@@ -291,5 +388,4 @@ export default class extends Generator {
291
388
 
292
389
  return pluginPhpVersion;
293
390
  }
294
-
295
391
  }
@@ -0,0 +1,2 @@
1
+ > 0.5% and last 2 versions
2
+ not dead
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "node_modules/@airfleet/wordpress-dev/config/.dprint.json"
3
+ }
@@ -0,0 +1,197 @@
1
+ name: 📦 Release (Plugin Preview)
2
+
3
+ on:
4
+ push:
5
+ branches: ["release/*"]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: 🚚 Get latest code
14
+ uses: actions/checkout@v6
15
+ with:
16
+ token: ${{ secrets.CI_WRITE_TOKEN }}
17
+ fetch-depth: 0
18
+
19
+ - name: ⚙️ Setup PHP
20
+ uses: shivammathur/setup-php@v2
21
+ with:
22
+ php-version: "8.2"
23
+ ini-values: short_open_tag=1
24
+ env:
25
+ GITHUB_TOKEN: ${{ secrets.CI_WRITE_TOKEN }}
26
+
27
+ - name: ⚙️ Install bun
28
+ uses: oven-sh/setup-bun@v2
29
+
30
+ - name: 🔨 Increase composer timeout
31
+ run: composer --global config process-timeout 1500
32
+
33
+ - name: 🔨 Composer install (with dev dependencies)
34
+ run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
35
+
36
+ - name: 🔨 Bun install
37
+ run: bun ci
38
+
39
+ - name: 🔬 Lint
40
+ run: bun run --if-present lint
41
+
42
+ - name: 🔬 Test
43
+ run: bun run --if-present test
44
+
45
+ - name: 🔨 Composer install (without dev dependencies)
46
+ run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-dev --optimize-autoloader
47
+
48
+ - name: 🔨 Install release dependencies
49
+ run: bun install -g release-it@^15 @release-it/keep-a-changelog@^3
50
+
51
+ - name: 🔨 Additional release dependencies
52
+ run: |
53
+ bun install -g @release-it/bumper@^4 json
54
+ sudo apt-get install -y jo
55
+
56
+ - name: 🔧 Get plugin name
57
+ id: plugin
58
+ run: |
59
+ NAME=${GITHUB_REPOSITORY#*/}
60
+ NAME=${NAME%-plugin}
61
+ echo "Plugin name: ${NAME}"
62
+ echo "PLUGIN_NAME=$NAME" >> $GITHUB_OUTPUT
63
+
64
+ - name: 🔧 Get branch name and commit hash
65
+ id: version
66
+ run: |
67
+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
68
+ BRANCH_NAME=${BRANCH_NAME#release/}
69
+ COMMIT_HASH=${GITHUB_SHA:0:7}
70
+ PRERELEASE_NAME="${BRANCH_NAME}-${COMMIT_HASH}"
71
+ echo "Branch name: ${BRANCH_NAME}"
72
+ echo "Commit hash: ${COMMIT_HASH}"
73
+ echo "Prerelease name: ${PRERELEASE_NAME}"
74
+ echo "PRERELEASE_NAME=${PRERELEASE_NAME}" >> $GITHUB_OUTPUT
75
+
76
+ - name: 📦 Release
77
+ run: |
78
+ export PLUGIN="${{ steps.plugin.outputs.PLUGIN_NAME }}" && bunx release-it $(cat .airfleet-release) \
79
+ -VV \
80
+ --ci \
81
+ --preRelease=${{ steps.version.outputs.PRERELEASE_NAME }} \
82
+ --no-git \
83
+ --hooks.before:release='echo Building $PLUGIN' \
84
+ --hooks.before:release='bun run --if-present build' \
85
+ --hooks.before:release='mkdir -p $RUNNER_TEMP/.release-dist/$PLUGIN/' \
86
+ --hooks.before:release='rsync -a . $RUNNER_TEMP/.release-dist/$PLUGIN/' \
87
+ --hooks.before:release='cd $RUNNER_TEMP/.release-dist && du -hs $PLUGIN' \
88
+ --hooks.before:release='rm -rf $RUNNER_TEMP/.release-dist/$PLUGIN/.git/' \
89
+ --hooks.before:release='rm -rf $RUNNER_TEMP/.release-dist/$PLUGIN/node_modules/' \
90
+ --hooks.before:release='rm -rf $RUNNER_TEMP/.release-dist/$PLUGIN/.parcel-cache/' \
91
+ --hooks.before:release='cd $RUNNER_TEMP/.release-dist && du -hs $PLUGIN' \
92
+ --hooks.before:release='cd $RUNNER_TEMP/.release-dist && ls -la' \
93
+ --hooks.before:release='cd $RUNNER_TEMP/.release-dist/$PLUGIN/ && ls -la' \
94
+ --hooks.before:release='cd $RUNNER_TEMP/.release-dist && zip -rq $PLUGIN.zip $PLUGIN' \
95
+ --hooks.before:release='cd $RUNNER_TEMP/.release-dist && du -hs $PLUGIN.zip' \
96
+ --hooks.before:release='rm -rf $RUNNER_TEMP/.release-dist/$PLUGIN/' \
97
+ --hooks.before:release='cd $RUNNER_TEMP/.release-dist && ls -la' \
98
+ --hooks.before:release='cp -R $RUNNER_TEMP/.release-dist dist/.release-dist' \
99
+ --no-npm.publish \
100
+ --plugins.@release-it/bumper.out.file=*.php \
101
+ --plugins.@release-it/bumper.out.type=text/php
102
+ env:
103
+ GITHUB_TOKEN: ${{ secrets.CI_WRITE_TOKEN }}
104
+
105
+ - name: ⚒️ Build plugin.json
106
+ run: |
107
+ PLUGIN="${{ steps.plugin.outputs.PLUGIN_NAME }}"
108
+ NAME="$(grep 'Plugin Name' $PLUGIN.php | sed 's/\*//; s/Plugin Name://; s/^[ \t]*//')"
109
+ DESCRIPTION="$(cat package.json | json description)"
110
+ LICENSE="$([ -f .airfleet-license ] && cat .airfleet-license || echo 'essential')"
111
+ VISIBLE="$([ -f .airfleet-visible ] && cat .airfleet-visible || echo 'true')"
112
+ SLUG="$PLUGIN/$PLUGIN.php"
113
+ VERSION="$(cat package.json | json version)"
114
+ DATE="$(date -u +%FT%TZ)"
115
+ VERSIONS="[$(jo version="$VERSION" date="$DATE")]"
116
+ echo "Plugin: $PLUGIN"
117
+ echo "Name: $NAME"
118
+ echo "Description: $DESCRIPTION"
119
+ echo "License: $LICENSE"
120
+ echo "Visible: $VISIBLE"
121
+ echo "Slug: $SLUG"
122
+ echo "Version: $VERSION"
123
+ echo "Date: $DATE"
124
+ echo "Versions: $VERSIONS"
125
+ jo -p name="$NAME" description="$DESCRIPTION" license="$LICENSE" visible="$VISIBLE" slug="$SLUG" versions="$VERSIONS" > $RUNNER_TEMP/plugin.json
126
+ cat $RUNNER_TEMP/plugin.json
127
+
128
+ - name: ⚙️ Configure AWS Credentials
129
+ uses: aws-actions/configure-aws-credentials@v5
130
+ with:
131
+ aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
132
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
133
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
134
+
135
+ - name: 🚀 Upload plugin zip file to AWS
136
+ run: |
137
+ PLUGIN="${{ steps.plugin.outputs.PLUGIN_NAME }}"
138
+ BUCKET="${{ secrets.AWS_S3_BUCKET }}"
139
+ FILENAME="$PLUGIN.$(cat $RUNNER_TEMP/plugin.json | json versions.0.version).zip"
140
+ aws s3 cp $RUNNER_TEMP/.release-dist/$PLUGIN.zip s3://$BUCKET/$PLUGIN/$FILENAME
141
+
142
+ - name: 📥 Download previews list from AWS
143
+ run: |
144
+ BUCKET="${{ secrets.AWS_S3_BUCKET }}"
145
+ aws s3 cp s3://$BUCKET/previews.json $RUNNER_TEMP/previews.json || echo '{"plugins":[]}' > $RUNNER_TEMP/previews.json
146
+ echo "Current previews.json from S3"
147
+ cat $RUNNER_TEMP/previews.json | json
148
+
149
+ - name: ⚒️ Build new previews list
150
+ run: |
151
+ NL=$'\n'
152
+ echo "Previews current:"
153
+ cat $RUNNER_TEMP/previews.json | json
154
+ echo "$NL $NL $NL"
155
+ PLUGIN_SLUG=$(cat $RUNNER_TEMP/plugin.json | json slug)
156
+ echo "Plugin slug: $PLUGIN_SLUG"
157
+ echo "$NL $NL $NL"
158
+ echo "Plugin versions:"
159
+ cat $RUNNER_TEMP/plugin.json | json versions > $RUNNER_TEMP/plugin_new_version.json
160
+ cat $RUNNER_TEMP/previews.json | json plugins | json -c "this.slug === '$PLUGIN_SLUG'" | json 0.versions > $RUNNER_TEMP/plugin_existing_versions.json
161
+ cat $RUNNER_TEMP/plugin_new_version.json $RUNNER_TEMP/plugin_existing_versions.json | json --group > $RUNNER_TEMP/plugin_versions.json
162
+ printf '%s\n%s\n%s\n' '{"versions":' "$(cat $RUNNER_TEMP/plugin_versions.json)" '}' | json > $RUNNER_TEMP/plugin_versions_final.json
163
+ cat $RUNNER_TEMP/plugin_versions_final.json
164
+ echo "$NL $NL $NL"
165
+ echo "Plugin updated:"
166
+ cat $RUNNER_TEMP/previews.json | json plugins | json -c "this.slug === '$PLUGIN_SLUG'" | json 0 > $RUNNER_TEMP/plugin_existing.json
167
+ cat $RUNNER_TEMP/plugin.json | json > $RUNNER_TEMP/plugin_formatted.json
168
+ cat $RUNNER_TEMP/plugin_existing.json $RUNNER_TEMP/plugin_formatted.json $RUNNER_TEMP/plugin_versions_final.json | json --merge | json > $RUNNER_TEMP/plugin_updated.json
169
+ cat $RUNNER_TEMP/plugin_updated.json
170
+ echo "$NL $NL $NL"
171
+
172
+ echo "Previews list updated:"
173
+ cat $RUNNER_TEMP/previews.json | json plugins | json -c "this.slug !== '$PLUGIN_SLUG'" > $RUNNER_TEMP/previews_list_excluded.json
174
+ cat $RUNNER_TEMP/plugin_updated.json | json --group > $RUNNER_TEMP/previews_list_added.json
175
+ # Check if excluded list is empty and handle accordingly
176
+ if [ "$(cat $RUNNER_TEMP/previews_list_excluded.json)" = "[]" ]; then
177
+ cat $RUNNER_TEMP/previews_list_added.json > $RUNNER_TEMP/previews_list_updated.json
178
+ else
179
+ cat $RUNNER_TEMP/previews_list_excluded.json $RUNNER_TEMP/previews_list_added.json | json --group > $RUNNER_TEMP/previews_list_updated.json
180
+ fi
181
+ cat $RUNNER_TEMP/previews_list_updated.json
182
+ echo "$NL $NL $NL"
183
+ echo "Previews updated:"
184
+ printf '%s\n%s\n%s\n' '{"plugins":' "$(cat $RUNNER_TEMP/previews_list_updated.json)" '}' | json > $RUNNER_TEMP/previews_new.json
185
+ cat $RUNNER_TEMP/previews_new.json
186
+ echo "$NL $NL $NL"
187
+ echo "Final merge:"
188
+ cat $RUNNER_TEMP/previews.json $RUNNER_TEMP/previews_new.json | json --merge > $RUNNER_TEMP/previews_updated.json
189
+ cat $RUNNER_TEMP/previews_updated.json
190
+
191
+ echo "Final previews list:"
192
+ cat $RUNNER_TEMP/previews_updated.json
193
+
194
+ - name: 🚀 Upload updated previews list to AWS
195
+ run: |
196
+ BUCKET="${{ secrets.AWS_S3_BUCKET }}"
197
+ aws s3 cp $RUNNER_TEMP/previews_updated.json s3://$BUCKET/previews.json
@@ -11,9 +11,10 @@ jobs:
11
11
 
12
12
  steps:
13
13
  - name: 🚚 Get latest code
14
- uses: actions/checkout@v3
14
+ uses: actions/checkout@v6
15
15
  with:
16
16
  token: ${{ secrets.CI_WRITE_TOKEN }}
17
+ fetch-depth: 0
17
18
 
18
19
  - name: ⚙️ Setup PHP
19
20
  uses: shivammathur/setup-php@v2
@@ -23,10 +24,8 @@ jobs:
23
24
  env:
24
25
  GITHUB_TOKEN: ${{ secrets.CI_WRITE_TOKEN }}
25
26
 
26
- - name: ⚙️ Setup Node
27
- uses: actions/setup-node@v3
28
- with:
29
- node-version: 16
27
+ - name: ⚙️ Install bun
28
+ uses: oven-sh/setup-bun@v2
30
29
 
31
30
  - name: 🔨 Increase composer timeout
32
31
  run: composer --global config process-timeout 1500
@@ -34,22 +33,25 @@ jobs:
34
33
  - name: 🔨 Composer install (with dev dependencies)
35
34
  run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
36
35
 
37
- - name: 🔨 npm install
38
- run: npm ci
36
+ - name: 🔨 Bun install
37
+ run: bun ci
38
+
39
+ - name: 🔬 Lint
40
+ run: bun run --if-present lint
39
41
 
40
42
  - name: 🔬 Test
41
- run: npm test
43
+ run: bun run --if-present test
42
44
 
43
45
  - name: 🔨 Composer install (without dev dependencies)
44
46
  run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-dev --optimize-autoloader
45
47
 
46
48
  - name: 🔨 Install release dependencies
47
- run: npm install -g release-it@^15 @release-it/keep-a-changelog@^3
49
+ run: bun install -g release-it@^15 @release-it/keep-a-changelog@^3
48
50
 
49
51
  - name: 🔨 Additional release dependencies
50
52
  run: |
51
- npm install -g @release-it/bumper@^4 json
52
- sudo apt-get install jo
53
+ bun install -g @release-it/bumper@^4 json
54
+ sudo apt-get install -y jo
53
55
 
54
56
  - name: 🔨 Config git
55
57
  run: |
@@ -66,7 +68,7 @@ jobs:
66
68
  NAME=${GITHUB_REPOSITORY#*/}
67
69
  NAME=${NAME%-plugin}
68
70
  echo "Plugin name: ${NAME}"
69
- echo "::set-output name=PLUGIN_NAME::$NAME"
71
+ echo "PLUGIN_NAME=$NAME" >> $GITHUB_OUTPUT
70
72
 
71
73
  - name: 🔧 Get changelog
72
74
  id: changelog
@@ -76,11 +78,11 @@ jobs:
76
78
 
77
79
  - name: 📦 Release
78
80
  run:
79
- export PLUGIN="${{ steps.plugin.outputs.PLUGIN_NAME }}" && npx release-it $(cat .airfleet-release)
81
+ export PLUGIN="${{ steps.plugin.outputs.PLUGIN_NAME }}" && bunx release-it $(cat .airfleet-release)
80
82
  -VV
81
83
  --ci
82
84
  --hooks.before:release='echo Building $PLUGIN'
83
- --hooks.before:release='npm run build --if-present'
85
+ --hooks.before:release='bun run --if-present build'
84
86
  --hooks.before:release='mkdir -p $RUNNER_TEMP/.release-dist/$PLUGIN/'
85
87
  --hooks.before:release='rsync -a . $RUNNER_TEMP/.release-dist/$PLUGIN/'
86
88
  --hooks.before:release='cd $RUNNER_TEMP/.release-dist && du -hs $PLUGIN'
@@ -114,8 +116,10 @@ jobs:
114
116
  - name: ⚒️ Build plugin.json
115
117
  run: |
116
118
  PLUGIN="${{ steps.plugin.outputs.PLUGIN_NAME }}"
117
- NAME="$(grep 'Plugin Name' $PLUGIN.php | sed 's/\*//; s/Plugin Name://; s/^[ t]*//')"
119
+ NAME="$(grep 'Plugin Name' $PLUGIN.php | sed 's/\*//; s/Plugin Name://; s/^[ \t]*//')"
118
120
  DESCRIPTION="$(cat package.json | json description)"
121
+ LICENSE="$([ -f .airfleet-license ] && cat .airfleet-license || echo 'essential')"
122
+ VISIBLE="$([ -f .airfleet-visible ] && cat .airfleet-visible || echo 'true')"
119
123
  SLUG="$PLUGIN/$PLUGIN.php"
120
124
  VERSION="$(cat package.json | json version)"
121
125
  DATE="$(date -u +%FT%TZ)"
@@ -124,16 +128,18 @@ jobs:
124
128
  echo "Plugin: $PLUGIN"
125
129
  echo "Name: $NAME"
126
130
  echo "Description: $DESCRIPTION"
131
+ echo "License: $LICENSE"
132
+ echo "Visible: $VISIBLE"
127
133
  echo "Slug: $SLUG"
128
134
  echo "Version: $VERSION"
129
135
  echo "Date: $DATE"
130
136
  echo "Changelog: $CHANGELOG"
131
137
  echo "Versions: $VERSIONS"
132
- jo -p name="$NAME" description="$DESCRIPTION" slug="$SLUG" versions="$VERSIONS" > $RUNNER_TEMP/plugin.json
138
+ jo -p name="$NAME" description="$DESCRIPTION" license="$LICENSE" visible="$VISIBLE" slug="$SLUG" versions="$VERSIONS" > $RUNNER_TEMP/plugin.json
133
139
  cat $RUNNER_TEMP/plugin.json
134
140
 
135
141
  - name: ⚙️ Configure AWS Credentials
136
- uses: aws-actions/configure-aws-credentials@v1
142
+ uses: aws-actions/configure-aws-credentials@v5
137
143
  with:
138
144
  aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
139
145
  aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -193,4 +199,4 @@ jobs:
193
199
  - name: 🚀 Upload updated plugins list to AWS
194
200
  run: |
195
201
  BUCKET="${{ secrets.AWS_S3_BUCKET }}"
196
- aws s3 cp $RUNNER_TEMP/plugins_updated.json s3://$BUCKET/plugins.json
202
+ aws s3 cp $RUNNER_TEMP/plugins_updated.json s3://$BUCKET/plugins.json
@@ -2,7 +2,7 @@ name: 🧪 Test
2
2
 
3
3
  on:
4
4
  push:
5
- branches: ["staging", "development"]
5
+ branches: ["main", "staging", "development"]
6
6
  pull_request:
7
7
  branches: ["main", "staging", "development"]
8
8
  workflow_dispatch:
@@ -13,7 +13,7 @@ jobs:
13
13
 
14
14
  steps:
15
15
  - name: 🚚 Get latest code
16
- uses: actions/checkout@v3
16
+ uses: actions/checkout@v6
17
17
 
18
18
  - name: ⚙️ Setup PHP
19
19
  uses: shivammathur/setup-php@v2
@@ -21,10 +21,8 @@ jobs:
21
21
  php-version: "8.2"
22
22
  ini-values: short_open_tag=1
23
23
 
24
- - name: ⚙️ Setup Node
25
- uses: actions/setup-node@v3
26
- with:
27
- node-version: 16
24
+ - name: ⚙️ Install bun
25
+ uses: oven-sh/setup-bun@v2
28
26
 
29
27
  - name: 🔨 Increase composer timeout
30
28
  run: composer --global config process-timeout 1500
@@ -32,11 +30,46 @@ jobs:
32
30
  - name: 🔨 Composer install
33
31
  run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
34
32
 
35
- - name: 🔨 npm install
36
- run: npm ci
33
+ - name: 🔨 Bun install
34
+ run: bun ci
35
+
36
+ - name: 🔬 Lint
37
+ run: bun run --if-present lint
37
38
 
38
39
  - name: 🔬 Test
39
- run: npm test
40
+ run: bun run --if-present test
40
41
 
41
42
  - name: 📦 Build
42
- run: npm run build --if-present
43
+ run: bun run --if-present build
44
+
45
+ test-php:
46
+ runs-on: ubuntu-latest
47
+
48
+ strategy:
49
+ matrix:
50
+ php-versions: ["8.2", "8.3", "8.4", "8.5"]
51
+
52
+ steps:
53
+ - name: 🚚 Get latest code
54
+ uses: actions/checkout@v6
55
+
56
+ - name: ⚙️ Setup PHP
57
+ uses: shivammathur/setup-php@v2
58
+ with:
59
+ php-version: "${{ matrix.php-versions }}"
60
+ ini-values: short_open_tag=1
61
+
62
+ - name: ⚙️ Install bun
63
+ uses: oven-sh/setup-bun@v2
64
+
65
+ - name: 🔨 Increase composer timeout
66
+ run: composer --global config process-timeout 1500
67
+
68
+ - name: 🔨 Composer install
69
+ run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
70
+
71
+ - name: 🔨 Bun install
72
+ run: bun ci
73
+
74
+ - name: 🔬 Lint
75
+ run: bun run lint --php