@airfleet/generator-init 0.38.0 → 0.39.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.
Files changed (95) hide show
  1. package/generators/plugin/index.js +115 -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 +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 +14 -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 +85 -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 +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/generators/plugin/templates/.prettierignore +0 -15
@@ -10,7 +10,7 @@ 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 objectPropertyFromValue from "../../utils/objectPropertyFromValue.js";
14
14
 
15
15
  export default class extends Generator {
16
16
  async prompting() {
@@ -77,35 +77,64 @@ export default class extends Generator {
77
77
  name: "pluginPhpVersion",
78
78
  message: "What's the required PHP version?",
79
79
  validate: requiredText("Please enter the PHP version"),
80
- default: ">=8.2",
80
+ default: ">=8.3",
81
81
  },
82
82
  {
83
83
  type: "input",
84
84
  name: "pluginNodeVersion",
85
85
  message: "What's the required Node version?",
86
86
  validate: requiredText("Please enter the Node version"),
87
- default: ">=16",
87
+ default: ">=24",
88
+ },
89
+ {
90
+ type: "confirm",
91
+ name: "useScopedFramework",
92
+ message: "Use scoped framework?",
93
+ default: false,
94
+ },
95
+ {
96
+ type: "confirm",
97
+ name: "addScoper",
98
+ message: "Add scoper setup?",
99
+ default: false,
100
+ },
101
+ {
102
+ type: "confirm",
103
+ name: "hasDependencies",
104
+ message: "Specify plugin dependencies?",
105
+ default: true,
106
+ },
107
+ {
108
+ type: "input",
109
+ name: "dependencies",
110
+ message: "Plugin dependencies (comma separated slugs)",
111
+ default:
112
+ "advanced-custom-fields-pro, airfleet-framework, airfleet-views, airfleet-elements-core",
113
+ when: (answers) => answers.hasDependencies,
88
114
  },
89
115
  {
90
116
  type: "list",
91
117
  name: "viewsPrefix",
92
- message:
93
- "Views prefix?",
94
- choices: [viewsPrefixOptions.none, viewsPrefixOptions.elements, viewsPrefixOptions.pluginSlug],
95
- default: viewsPrefixOptions.elements,
118
+ message: "Views prefix?",
119
+ choices: [
120
+ viewsPrefixOptions.none,
121
+ viewsPrefixOptions.elements,
122
+ viewsPrefixOptions.pluginSlug,
123
+ ],
124
+ default: viewsPrefixOptions.elements,
96
125
  },
97
126
  {
98
127
  type: "list",
99
128
  name: "pluginCreateOptions",
100
129
  message: "Create options page?",
101
130
  choices: ["No", "Framework", "ACF"],
102
- default: "Framework",
131
+ default: "ACF",
103
132
  },
104
133
  {
105
134
  type: "confirm",
106
135
  name: "pluginAcfLocalJson",
107
136
  message: "Add ACF Local JSON?",
108
- default: false,
137
+ default: true,
109
138
  },
110
139
  {
111
140
  type: "list",
@@ -132,8 +161,12 @@ export default class extends Generator {
132
161
  this.answers = await this.prompt(prompts);
133
162
  this.name = nameCases(this.answers.pluginName);
134
163
  this.ajaxVariables = {
135
- frontend: this.answers.pluginAjaxVariables === 'Both' || this.answers.pluginAjaxVariables === 'Frontend',
136
- admin: this.answers.pluginAjaxVariables === 'Both' || this.answers.pluginAjaxVariables === 'Admin',
164
+ frontend:
165
+ this.answers.pluginAjaxVariables === "Both" ||
166
+ this.answers.pluginAjaxVariables === "Frontend",
167
+ admin:
168
+ this.answers.pluginAjaxVariables === "Both" ||
169
+ this.answers.pluginAjaxVariables === "Admin",
137
170
  };
138
171
  this.optionsPage = paramCase(this.answers.pluginCreateOptions);
139
172
 
@@ -141,7 +174,11 @@ export default class extends Generator {
141
174
  .replace(/^airfleet/i, "")
142
175
  .trim();
143
176
  this.nameNoAirfleet = nameCases(nameNoAirfleet);
144
- this.viewsPrefix = this._getViewsPrefix(this.answers, viewsPrefixOptions, this.nameNoAirfleet);
177
+ this.viewsPrefix = this._getViewsPrefix(
178
+ this.answers,
179
+ viewsPrefixOptions,
180
+ this.nameNoAirfleet
181
+ );
145
182
  this.data = {
146
183
  answers: this.answers,
147
184
  name: this.name,
@@ -154,12 +191,16 @@ export default class extends Generator {
154
191
  optionsPage: this.optionsPage,
155
192
  viewsPrefix: this.viewsPrefix,
156
193
  phpVersion: this._getPhpVersion(this.answers.pluginPhpVersion),
194
+ frameworkNamespace: this.answers.useScopedFramework
195
+ ? `Airfleet\\Plugins\\${this.nameNoAirfleet.pascal}\\Vendor\\Airfleet\\Framework`
196
+ : `Airfleet\\Framework`,
157
197
  };
158
198
  }
159
199
 
160
200
  writing() {
161
201
  const files = [
162
202
  ".github/workflows/create-asana-attachment.yaml",
203
+ ".github/workflows/release-plugin-preview.yml",
163
204
  ".github/workflows/release-plugin.yml",
164
205
  ".github/workflows/test-wordpress.yml",
165
206
  ".husky/pre-commit",
@@ -179,20 +220,23 @@ export default class extends Generator {
179
220
  "inc/Setup.php.ejs",
180
221
  "views/parcelkeep.entry.scss",
181
222
  ".airfleet-release",
223
+ ".browserslistrc",
224
+ ".dprint.json",
182
225
  ".editorconfig",
183
226
  ".env",
184
227
  ".gitattributes",
228
+ ".lintstagedrc.json",
229
+ ".node-version.ejs",
230
+ ".oxlintrc.json",
185
231
  ".parcelrc",
186
- ".prettierignore",
232
+ ".stylelintrc.json",
187
233
  "CHANGELOG.md",
188
- "composer-scoped.json.ejs",
189
- "composer.json.ejs",
234
+ "globals.d.ts",
190
235
  "index.php",
191
236
  "LICENSE.ejs",
192
237
  "package.json.ejs",
193
238
  "phpcs.xml.ejs",
194
239
  "README.md.ejs",
195
- "scoper.custom.php.ejs",
196
240
  ];
197
241
  const templates = [
198
242
  ...mapFilesToTemplates(files),
@@ -207,8 +251,18 @@ export default class extends Generator {
207
251
  isEnabled: true,
208
252
  },
209
253
  {
210
- template: "plugin-name.php.ejs",
254
+ template: "plugin-name-scoped-framework.php.ejs",
211
255
  destination: `${this.name.slug}.php`,
256
+ isEnabled: this.answers.useScopedFramework,
257
+ },
258
+ {
259
+ template: "plugin-name-unscoped-framework.php.ejs",
260
+ destination: `${this.name.slug}.php`,
261
+ isEnabled: !this.answers.useScopedFramework,
262
+ },
263
+ {
264
+ template: "plugin-name-api.php",
265
+ destination: `${this.name.slug}-api.php`,
212
266
  isEnabled: true,
213
267
  },
214
268
  {
@@ -224,17 +278,17 @@ export default class extends Generator {
224
278
  {
225
279
  template: "inc/Options.php.ejs",
226
280
  destination: `inc/Options.php`,
227
- isEnabled: this.optionsPage === 'framework',
281
+ isEnabled: this.optionsPage === "framework",
228
282
  },
229
283
  {
230
284
  template: "inc/Options/GeneralOptions.php.ejs",
231
285
  destination: `inc/Options/GeneralOptions.php`,
232
- isEnabled: this.optionsPage === 'framework',
286
+ isEnabled: this.optionsPage === "framework",
233
287
  },
234
288
  {
235
289
  template: "inc/Pages.php.ejs",
236
290
  destination: `inc/Pages.php`,
237
- isEnabled: this.optionsPage === 'framework',
291
+ isEnabled: this.optionsPage === "framework",
238
292
  },
239
293
  {
240
294
  template: "acf-json/.gitkeep",
@@ -256,19 +310,55 @@ export default class extends Generator {
256
310
  destination: ".airfleet-visible",
257
311
  isEnabled: true,
258
312
  },
313
+ {
314
+ template: "composer-with-scoper.json.ejs",
315
+ destination: "composer.json",
316
+ isEnabled: this.answers.addScoper,
317
+ },
318
+ {
319
+ template: "composer-without-scoper.json.ejs",
320
+ destination: "composer.json",
321
+ isEnabled: !this.answers.addScoper,
322
+ },
323
+ {
324
+ template: "composer-scoped-empty.json.ejs",
325
+ destination: "composer-scoped.json",
326
+ isEnabled: this.answers.addScoper && !this.answers.useScopedFramework,
327
+ },
328
+ {
329
+ template: "composer-scoped-empty.lock.ejs",
330
+ destination: "composer-scoped.lock",
331
+ isEnabled: this.answers.addScoper && !this.answers.useScopedFramework,
332
+ },
333
+ {
334
+ template: "composer-scoped-framework.json.ejs",
335
+ destination: "composer-scoped.json",
336
+ isEnabled: this.answers.addScoper && this.answers.useScopedFramework,
337
+ },
338
+ {
339
+ template: "composer-scoped-framework.lock.ejs",
340
+ destination: "composer-scoped.lock",
341
+ isEnabled: this.answers.addScoper && this.answers.useScopedFramework,
342
+ },
343
+ {
344
+ template: "scoper.custom.php.ejs",
345
+ destination: "scoper.custom.php",
346
+ isEnabled: this.answers.addScoper,
347
+ },
259
348
  ];
260
349
 
261
350
  copyTemplates(this, templates, this.data);
262
351
  }
263
352
 
264
- install() {
265
- this.spawnCommand("composer", ["install"]);
353
+ async install() {
354
+ await this.spawnCommand("composer", ["install"]);
355
+ await this.spawnCommand("bun", ["install"]);
266
356
  }
267
357
 
268
358
  _getViewsPrefix(answers, options, nameNoAirfleet) {
269
- switch(answers.viewsPrefix) {
359
+ switch (answers.viewsPrefix) {
270
360
  case options.none:
271
- return '';
361
+ return "";
272
362
  case options.pluginSlug:
273
363
  return nameNoAirfleet.slug;
274
364
  default:
@@ -279,7 +369,7 @@ export default class extends Generator {
279
369
  }
280
370
 
281
371
  _getPhpVersion(pluginPhpVersion) {
282
- const toFind = ['=','>'];
372
+ const toFind = ["=", ">"];
283
373
 
284
374
  for (const char of toFind) {
285
375
  const index = pluginPhpVersion.indexOf(char);
@@ -291,5 +381,4 @@ export default class extends Generator {
291
381
 
292
382
  return pluginPhpVersion;
293
383
  }
294
-
295
384
  }
@@ -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
@@ -1,4 +1 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npx lint-staged
1
+ bunx lint-staged