@flarum/cli 2.0.0-beta.14 → 2.0.0-beta.17

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 (33) hide show
  1. package/README.md +1 -1
  2. package/bin/run +2 -1
  3. package/bin/splitsh-lite-darwin +0 -0
  4. package/bin/splitsh-lite-linux +0 -0
  5. package/boilerplate/skeleton/extension/.gitattributes +16 -15
  6. package/boilerplate/skeleton/extension/.github/workflows/backend.yml +1 -5
  7. package/boilerplate/skeleton/extension/.github/workflows/frontend.yml +1 -5
  8. package/boilerplate/skeleton/extension/composer.json +2 -2
  9. package/boilerplate/skeleton/extension/js/package.json +2 -1
  10. package/boilerplate/skeleton/extension/js/tsconfig.json +10 -2
  11. package/boilerplate/skeleton/extension/locale/en.yml +1 -1
  12. package/lib/base-command.js +21 -21
  13. package/lib/boilersmith/paths.js +5 -5
  14. package/lib/boilersmith/scaffolding/audit-step-factory.js +3 -3
  15. package/lib/boilersmith/scaffolding/module.js +27 -3
  16. package/lib/boilersmith/scaffolding/scaffolder.js +4 -4
  17. package/lib/boilersmith/steps/stub-base.js +2 -2
  18. package/lib/boilersmith/utils/read-tpl.js +2 -2
  19. package/lib/commands/monorepo/split.d.ts +15 -0
  20. package/lib/commands/monorepo/split.js +19 -0
  21. package/lib/providers/php-provider.js +2 -2
  22. package/lib/steps/gen-ext-scaffolder.d.ts +1 -1
  23. package/lib/steps/gen-ext-scaffolder.js +27 -33
  24. package/lib/steps/misc/composer.js +2 -2
  25. package/lib/steps/misc/npm.js +2 -2
  26. package/lib/steps/misc/yarn.js +2 -2
  27. package/lib/steps/monorepo/create.js +40 -35
  28. package/lib/steps/monorepo/split.d.ts +14 -0
  29. package/lib/steps/monorepo/split.js +95 -0
  30. package/lib/steps/stubs/backend/migration.js +2 -2
  31. package/lib/utils/monorepo.js +4 -4
  32. package/oclif.manifest.json +1 -1
  33. package/package.json +1 -1
package/README.md CHANGED
@@ -51,7 +51,7 @@ $ npm install -g @flarum/cli
51
51
  $ flarum-cli COMMAND
52
52
  running command...
53
53
  $ flarum-cli (-v|--version|version)
54
- @flarum/cli/2.0.0-beta.14 linux-x64 node-v16.14.0
54
+ @flarum/cli/2.0.0-beta.17 linux-x64 node-v16.13.2
55
55
  $ flarum-cli --help [COMMAND]
56
56
  USAGE
57
57
  $ flarum-cli COMMAND
package/bin/run CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ const { resolve } = require('path');
2
3
 
3
- require('module-alias').addAlias('boilersmith', `${__dirname}/../lib/boilersmith`);
4
+ require('module-alias').addAlias('boilersmith', resolve(__dirname, '..', 'lib', 'boilersmith'));
4
5
 
5
6
  const oclif = require('@oclif/core');
6
7
 
Binary file
Binary file
@@ -1,19 +1,20 @@
1
- .gitattributes export-ignore
2
- .gitignore export-ignore
3
- .gitmodules export-ignore
4
- .github export-ignore
5
- .travis export-ignore
6
- .travis.yml export-ignore
7
- .editorconfig export-ignore
8
- .styleci.yml export-ignore
1
+ **/.gitattributes export-ignore
2
+ **/.gitignore export-ignore
3
+ **/.gitmodules export-ignore
4
+ **/.github export-ignore
5
+ **/.travis export-ignore
6
+ **/.travis.yml export-ignore
7
+ **/.editorconfig export-ignore
8
+ **/.styleci.yml export-ignore
9
9
 
10
- phpunit.xml export-ignore
11
- tests export-ignore
10
+ **/phpunit.xml export-ignore
11
+ **/tests export-ignore
12
12
 
13
- js/dist/* -diff
14
- js/dist/* linguist-generated
15
- js/dist-typings/* linguist-generated
16
- js/yarn.lock -diff
17
- js/package-lock.json -diff
13
+ **/js/dist/**/* -diff
14
+ **/js/dist/**/* linguist-generated
15
+ **/js/dist-typings/**/* -diff
16
+ **/js/dist-typings/**/* linguist-generated
17
+ **/js/yarn.lock -diff
18
+ **/js/package-lock.json -diff
18
19
 
19
20
  * text=auto eol=lf
@@ -2,13 +2,9 @@ name: <%= params.extensionName %> PHP
2
2
 
3
3
  on: [workflow_dispatch, push, pull_request]
4
4
 
5
- # The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
6
- # This will break your current script.
7
- # When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
8
-
9
5
  jobs:
10
6
  run:
11
- uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
7
+ uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@main
12
8
  with:
13
9
  enable_backend_testing: <%= modules.backendTesting %>
14
10
 
@@ -2,13 +2,9 @@ name: <%= params.extensionName %> JS
2
2
 
3
3
  on: [workflow_dispatch, push, pull_request]
4
4
 
5
- # The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
6
- # This will break your current script.
7
- # When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
8
-
9
5
  jobs:
10
6
  run:
11
- uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
7
+ uses: flarum/framework/.github/workflows/REUSABLE_frontend.yml@main
12
8
  with:
13
9
  enable_bundlewatch: <%= modules.bundlewatch %>
14
10
  enable_prettier: <%= modules.prettier %>
@@ -22,13 +22,13 @@
22
22
  <% if (params.packageNamespace) { %>
23
23
  "autoload": {
24
24
  "psr-4": {
25
- "<%= params.packageNamespaceEscapedSlash %>\\": "src/"
25
+ "<%= params.packageNamespace %>\\": "src/"
26
26
  }
27
27
  },
28
28
  <% } %>
29
29
  "autoload-dev": {
30
30
  "psr-4": {
31
- "<%= params.packageNamespaceEscapedSlash %>\\Tests\\": "tests/"
31
+ "<%= params.packageNamespace %>\\Tests\\": "tests/"
32
32
  }
33
33
  },
34
34
  "extra": {
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@<%= params.packageName %>",
3
3
  "private": true,
4
+ "version": "0.0.0",
4
5
  "prettier": "@flarum/prettier-config",
5
6
  "dependencies": {
6
7
  },
@@ -21,7 +22,7 @@
21
22
  "format": "prettier --write src",
22
23
  "format-check": "prettier --check src",
23
24
  "clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
24
- "build-typings": "<%= params.jsPackageManager %> run clean-typings && [ -e src/@types ] && cp -r src/@types dist-typings/@types && tsc && <%= params.jsPackageManager %> run post-build-typings",
25
+ "build-typings": "<%= params.jsPackageManager %> run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && <%= params.jsPackageManager %> run post-build-typings",
25
26
  "post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'",
26
27
  "check-typings": "tsc --noEmit --emitDeclarationOnly false",
27
28
  "check-typings-coverage": "typescript-coverage-report"
@@ -4,13 +4,21 @@
4
4
  // This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
5
5
  // and also tells your Typescript server to read core's global typings for
6
6
  // access to `dayjs` and `$` in the global namespace.
7
- "include": ["src/**/*", "../vendor/flarum/core/js/dist-typings/@types/**/*", "@types/**/*"],
7
+ "include": [
8
+ "src/**/*",
9
+ "../vendor/*/*/js/dist-typings/@types/**/*",
10
+ // <CUSTOM-1>
11
+ // </CUSTOM-1>
12
+ "@types/**/*"
13
+ ],
8
14
  "compilerOptions": {
9
15
  // This will output typings to `dist-typings`
10
16
  "declarationDir": "./dist-typings",
11
17
  "baseUrl": ".",
12
18
  "paths": {
13
- "flarum/*": ["../vendor/flarum/core/js/dist-typings/*"]
19
+ "flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
20
+ // <CUSTOM-2>
21
+ // </CUSTOM-2>
14
22
  }
15
23
  }
16
24
  }
@@ -1,6 +1,6 @@
1
1
  <%= params.extensionId %>:
2
2
  # For more details on the format
3
- # Checkout https://docs.flarum.org/extend/i18n.html#appendix-a-standard-key-format
3
+ # Checkout https://docs.flarum.org/extend/i18n/#appendix-a-standard-key-format
4
4
  admin:
5
5
  my_cool_key: My Cool Key
6
6
 
@@ -4,10 +4,10 @@ exports.LocationType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@oclif/core");
6
6
  const cli_ux_1 = (0, tslib_1.__importDefault)(require("cli-ux"));
7
- const node_path_1 = require("node:path");
7
+ const path_1 = require("path");
8
8
  const globby_1 = (0, tslib_1.__importDefault)(require("globby"));
9
- const node_child_process_1 = require("node:child_process");
10
- const node_fs_1 = require("node:fs");
9
+ const child_process_1 = require("child_process");
10
+ const fs_1 = require("fs");
11
11
  const io_1 = require("boilersmith/io");
12
12
  const step_manager_1 = require("boilersmith/step-manager");
13
13
  const paths_1 = require("boilersmith/paths");
@@ -25,7 +25,7 @@ var LocationType;
25
25
  class BaseCommand extends core_1.Command {
26
26
  constructor() {
27
27
  super(...arguments);
28
- this.STUB_PATH = (0, node_path_1.resolve)(__dirname, '../boilerplate/stubs/');
28
+ this.STUB_PATH = (0, path_1.resolve)(__dirname, '../boilerplate/stubs/');
29
29
  this.dry = false;
30
30
  this.requireExistingExtension = true;
31
31
  }
@@ -53,7 +53,7 @@ class BaseCommand extends core_1.Command {
53
53
  requestedDir: path,
54
54
  package: extRoot,
55
55
  });
56
- const phpProvider = new php_provider_1.PhpSubsystemProvider((0, node_path_1.resolve)(__dirname, '../php-subsystem/index.php'));
56
+ const phpProvider = new php_provider_1.PhpSubsystemProvider((0, path_1.resolve)(__dirname, '../php-subsystem/index.php'));
57
57
  const out = await this.steps(new step_manager_1.StepManager(), extRoot).run(paths, this.genIO(), { php: phpProvider }, this.dry);
58
58
  const errorMessages = out.messages.filter((m) => m.type === 'error');
59
59
  this.log('\n\n');
@@ -134,12 +134,12 @@ class BaseCommand extends core_1.Command {
134
134
  }
135
135
  }
136
136
  isFlarumMonorepo(path) {
137
- return (0, node_fs_1.existsSync)((0, node_path_1.resolve)(path, 'flarum-monorepo.json'));
137
+ return (0, fs_1.existsSync)((0, path_1.resolve)(path, 'flarum-monorepo.json'));
138
138
  }
139
139
  isFlarumCore(path) {
140
140
  try {
141
- const composerJsonPath = (0, node_path_1.resolve)(path, 'composer.json');
142
- const val = JSON.parse((0, node_fs_1.readFileSync)(composerJsonPath, 'utf8'));
141
+ const composerJsonPath = (0, path_1.resolve)(path, 'composer.json');
142
+ const val = JSON.parse((0, fs_1.readFileSync)(composerJsonPath, 'utf8'));
143
143
  return val.name === 'flarum/core';
144
144
  }
145
145
  catch (_a) {
@@ -147,25 +147,25 @@ class BaseCommand extends core_1.Command {
147
147
  }
148
148
  }
149
149
  jsPackageManager(currDir) {
150
- if (!(0, node_fs_1.existsSync)((0, node_path_1.resolve)(currDir, 'js')))
150
+ if (!(0, fs_1.existsSync)((0, path_1.resolve)(currDir, 'js')))
151
151
  return null;
152
- return (0, node_fs_1.existsSync)((0, node_path_1.resolve)(currDir, 'js/yarn.lock')) ? 'yarn' : 'npm';
152
+ return (0, fs_1.existsSync)((0, path_1.resolve)(currDir, 'js/yarn.lock')) ? 'yarn' : 'npm';
153
153
  }
154
154
  async getFlarumExtensionRoot(currDir) {
155
- let currPath = (0, node_path_1.resolve)(currDir);
155
+ let currPath = (0, path_1.resolve)(currDir);
156
156
  while (currPath !== '/') {
157
- if ((0, node_fs_1.existsSync)((0, node_path_1.resolve)(currPath, 'flarum-monorepo.json'))) {
157
+ if ((0, fs_1.existsSync)((0, path_1.resolve)(currPath, 'flarum-monorepo.json'))) {
158
158
  return { path: currPath, type: LocationType.FLARUM_MONOREPO };
159
159
  }
160
- if ((0, node_fs_1.existsSync)((0, node_path_1.resolve)(currPath, 'composer.json')) && (0, node_fs_1.existsSync)((0, node_path_1.resolve)(currPath, 'extend.php'))) {
160
+ if ((0, fs_1.existsSync)((0, path_1.resolve)(currPath, 'composer.json')) && (0, fs_1.existsSync)((0, path_1.resolve)(currPath, 'extend.php'))) {
161
161
  return { path: currPath, type: LocationType.FLARUM_EXTENSION };
162
162
  }
163
163
  if (this.isFlarumCore(currPath)) {
164
164
  return { path: currPath, type: LocationType.FLARUM_CORE };
165
165
  }
166
- currPath = (0, node_path_1.resolve)(currPath, '..');
166
+ currPath = (0, path_1.resolve)(currPath, '..');
167
167
  }
168
- this.error(`${(0, node_path_1.resolve)(currDir)} is not located in a valid Flarum package!
168
+ this.error(`${(0, path_1.resolve)(currDir)} is not located in a valid Flarum package!
169
169
  - Flarum extensions must contain (at a minimum) 'extend.php' and 'composer.json' files.
170
170
  - Flarum core must contain a 'composer.json' file with the name 'flarum/core'.
171
171
  - Flarum monorepos must have a valid 'flarum-monorepo.json' file`);
@@ -174,14 +174,14 @@ class BaseCommand extends core_1.Command {
174
174
  const verify = await this.genIO().getParam({
175
175
  name: 'verify',
176
176
  type: 'confirm',
177
- message: `Work in Flarum package located at ${(0, node_path_1.resolve)(extRoot)}?`,
177
+ message: `Work in Flarum package located at ${(0, path_1.resolve)(extRoot)}?`,
178
178
  initial: true,
179
179
  });
180
180
  if (!verify)
181
181
  this.exit();
182
182
  }
183
183
  async ensureComposerInstallRan(extRoot) {
184
- if ((0, node_fs_1.existsSync)((0, node_path_1.resolve)(extRoot, 'vendor/flarum/core/composer.json')))
184
+ if ((0, fs_1.existsSync)((0, path_1.resolve)(extRoot, 'vendor/flarum/core/composer.json')))
185
185
  return;
186
186
  this.log("This command requires `composer install` to have been ran in your extension's root directory.");
187
187
  const composer = await this.genIO().getParam({
@@ -192,7 +192,7 @@ class BaseCommand extends core_1.Command {
192
192
  });
193
193
  if (composer) {
194
194
  cli_ux_1.default.action.start('Installing composer packages');
195
- (0, node_child_process_1.execSync)('composer install', { cwd: extRoot });
195
+ (0, child_process_1.execSync)('composer install', { cwd: extRoot });
196
196
  cli_ux_1.default.action.stop();
197
197
  }
198
198
  else {
@@ -206,7 +206,7 @@ class BaseCommand extends core_1.Command {
206
206
  */
207
207
  async confirmOverrideFiles(dir, pattern, confirmationMessage) {
208
208
  const paths = Array.isArray(pattern) ? pattern : [pattern];
209
- const files = await (0, globby_1.default)(paths.map((p) => (0, node_path_1.resolve)(dir, p)));
209
+ const files = await (0, globby_1.default)(paths.map((p) => (0, path_1.resolve)(dir, p)));
210
210
  const empty = files.length === 0 || (files.length === 1 && files[0] === '.git');
211
211
  if (empty)
212
212
  return false;
@@ -221,8 +221,8 @@ class BaseCommand extends core_1.Command {
221
221
  return true;
222
222
  }
223
223
  async deleteFiles(dir, pattern) {
224
- const pathsToDelete = await (0, globby_1.default)((0, node_path_1.resolve)(dir, pattern));
225
- pathsToDelete.forEach(node_fs_1.unlinkSync);
224
+ const pathsToDelete = await (0, globby_1.default)((0, path_1.resolve)(dir, pattern));
225
+ pathsToDelete.forEach(fs_1.unlinkSync);
226
226
  }
227
227
  }
228
228
  exports.default = BaseCommand;
@@ -1,26 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodePaths = void 0;
4
- const node_path_1 = require("node:path");
4
+ const path_1 = require("path");
5
5
  class NodePaths {
6
6
  constructor(paths) {
7
7
  this.paths = paths;
8
8
  }
9
9
  cwd(...path) {
10
- return (0, node_path_1.resolve)(process.cwd(), ...path);
10
+ return (0, path_1.resolve)(process.cwd(), ...path);
11
11
  }
12
12
  package(...path) {
13
- return (0, node_path_1.resolve)(this.paths.package, ...path);
13
+ return (0, path_1.resolve)(this.paths.package, ...path);
14
14
  }
15
15
  requestedDir(...path) {
16
16
  if (!this.paths.requestedDir)
17
17
  return null;
18
- return (0, node_path_1.resolve)(this.paths.requestedDir, ...path);
18
+ return (0, path_1.resolve)(this.paths.requestedDir, ...path);
19
19
  }
20
20
  monorepo(...path) {
21
21
  if (!this.paths.monorepo)
22
22
  return null;
23
- return (0, node_path_1.resolve)(this.paths.monorepo, ...path);
23
+ return (0, path_1.resolve)(this.paths.monorepo, ...path);
24
24
  }
25
25
  onMonorepoSub(packagePath, monorepoPath) {
26
26
  return new NodePaths(Object.assign(Object.assign({}, this.paths), { monorepo: monorepoPath !== null && monorepoPath !== void 0 ? monorepoPath : this.paths.package, package: packagePath }));
@@ -8,7 +8,7 @@ const module_1 = require("./module");
8
8
  const template_param_1 = require("./template-param");
9
9
  const cond_format_1 = require("boilersmith/utils/cond-format");
10
10
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
11
- const node_fs_1 = require("node:fs");
11
+ const fs_1 = require("fs");
12
12
  function auditStepFactory(dry, scaffoldDir, modules, templateParams, excludeScaffoldingFunc, moduleStatusCache) {
13
13
  let modulesEnabled;
14
14
  return {
@@ -24,7 +24,7 @@ function auditStepFactory(dry, scaffoldDir, modules, templateParams, excludeScaf
24
24
  io.info((0, cond_format_1.condFormat)(io.supportsAnsiColor, (m) => chalk_1.default.dim(chalk_1.default.green(m)), `✓ ${m.name}: ${m.shortDescription}`), true);
25
25
  }
26
26
  else if (m.updatable) {
27
- io.info((0, cond_format_1.condFormat)(io.supportsAnsiColor, (m) => chalk_1.default.dim(chalk_1.default.red(m)), `𐄂 ${m.name}: ${m.shortDescription} (disabled)`), true);
27
+ io.info((0, cond_format_1.condFormat)(io.supportsAnsiColor, (m) => chalk_1.default.dim(chalk_1.default.red(m)), `✕ ${m.name}: ${m.shortDescription} (disabled)`), true);
28
28
  }
29
29
  }
30
30
  for (const m of actionableModules) {
@@ -35,7 +35,7 @@ function auditStepFactory(dry, scaffoldDir, modules, templateParams, excludeScaf
35
35
  const filesWithChanges = fs
36
36
  .all()
37
37
  .filter((f) => f.state && f.state !== 'deleted')
38
- .filter((f) => { var _a; return !(0, node_fs_1.existsSync)(f.path) || (0, node_fs_1.readFileSync)(f.path, 'utf8').toString() !== ((_a = f.contents) === null || _a === void 0 ? void 0 : _a.toString()); });
38
+ .filter((f) => { var _a; return !(0, fs_1.existsSync)(f.path) || (0, fs_1.readFileSync)(f.path, 'utf8').toString() !== ((_a = f.contents) === null || _a === void 0 ? void 0 : _a.toString()); });
39
39
  if (filesWithChanges.length > 0) {
40
40
  io.error(`Module ${m.name} has ${filesWithChanges.length} changed files: ${filesWithChanges
41
41
  .map((f) => f.path.replace(paths.package() + '/', ''))
@@ -4,7 +4,7 @@ exports.applyModule = exports.setModuleValue = exports.currModulesEnabled = expo
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
6
6
  const mem_fs_editor_1 = require("mem-fs-editor");
7
- const node_path_1 = require("node:path");
7
+ const path_1 = require("path");
8
8
  const pick_deep_1 = (0, tslib_1.__importDefault)(require("pick-deep"));
9
9
  const read_tpl_1 = require("boilersmith/utils/read-tpl");
10
10
  const clone_and_fill_1 = require("boilersmith/utils/clone-and-fill");
@@ -92,6 +92,8 @@ excludeScaffolding = { files: [], configKeys: {} }, isInitial = false) {
92
92
  modules: modulesEnabled,
93
93
  };
94
94
  const tplDataFlat = Object.assign(Object.assign({}, (0, rename_keys_1.renameKeys)(tplData.modules, (k) => `modules.${k}`)), (0, rename_keys_1.renameKeys)(tplData.params, (k) => `params.${k}`));
95
+ // This is necessary because one layer of escaped backslashes is lost on template population.
96
+ tplData.params = Object.fromEntries(Object.entries(paramVals).map(([k, v]) => [k, typeof v === 'string' ? v.replace('\\', '\\\\') : v]));
95
97
  for (const file of module.filesToReplace) {
96
98
  const path = typeof file === 'string' ? file : file.path;
97
99
  const moduleDeps = typeof file === 'string' ? [] : (_a = file.moduleDeps) !== null && _a !== void 0 ? _a : [];
@@ -113,11 +115,15 @@ excludeScaffolding = { files: [], configKeys: {} }, isInitial = false) {
113
115
  })) {
114
116
  continue;
115
117
  }
116
- fsEditor.copyTpl((0, node_path_1.resolve)(scaffoldDir, path), copyTo, tplData);
118
+ let source = (0, read_tpl_1.readTpl)((0, path_1.resolve)(scaffoldDir, path), tplData);
119
+ if (fsEditor.exists(copyTo)) {
120
+ source = applyCustomizations(source, fsEditor.read(copyTo));
121
+ }
122
+ fsEditor.write(copyTo, source);
117
123
  }
118
124
  const jsonPaths = (0, clone_and_fill_1.cloneAndFill)(module.jsonToAugment, tplDataFlat);
119
125
  for (const jsonPath of Object.keys(jsonPaths)) {
120
- const scaffoldContents = (0, read_tpl_1.readTpl)((0, node_path_1.resolve)(scaffoldDir, jsonPath), tplData);
126
+ const scaffoldContents = (0, read_tpl_1.readTpl)((0, path_1.resolve)(scaffoldDir, jsonPath), tplData);
121
127
  const scaffoldContentsJson = JSON.parse(scaffoldContents);
122
128
  const excludeKeys = (0, clone_and_fill_1.cloneAndFill)((_b = excludeScaffolding.configKeys[jsonPath]) !== null && _b !== void 0 ? _b : [], tplDataFlat);
123
129
  const fieldsToAugment = jsonPaths[jsonPath].filter((key) => !excludeKeys.includes(key));
@@ -127,3 +133,21 @@ excludeScaffolding = { files: [], configKeys: {} }, isInitial = false) {
127
133
  return fs;
128
134
  }
129
135
  exports.applyModule = applyModule;
136
+ function applyCustomizations(source, curr) {
137
+ const commentStructures = [
138
+ ['//', '\n'],
139
+ ['/*', ' */'],
140
+ ['<!--', '-->'],
141
+ ['#', '\n'],
142
+ ];
143
+ commentStructures.forEach((x) => x);
144
+ return commentStructures.reduce((acc, [start, end]) => {
145
+ const CUSTOMIZATION_REGEX = new RegExp(`(${start}\\s*<CUSTOM-(?<id>.*)>\\s*${end})(?<contents>.*)(${start}\\s*</CUSTOM-\\k<id>>\\s*${end})`, 'gs');
146
+ const matches = curr.matchAll(CUSTOMIZATION_REGEX);
147
+ const customizations = Object.fromEntries([...matches]
148
+ .map((m) => m.groups)
149
+ .filter(Boolean)
150
+ .map((g) => [g === null || g === void 0 ? void 0 : g.id, g === null || g === void 0 ? void 0 : g.contents]));
151
+ return acc.replace(CUSTOMIZATION_REGEX, (_m, open, id, _c, close) => { var _a; return `${open}${(_a = customizations[id]) !== null && _a !== void 0 ? _a : ''}${close}`; });
152
+ }, source);
153
+ }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Scaffolder = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const globby_1 = (0, tslib_1.__importDefault)(require("globby"));
6
- const node_path_1 = require("node:path");
6
+ const path_1 = require("path");
7
7
  const json_leaf_paths_1 = require("boilersmith/utils/json-leaf-paths");
8
8
  const read_tpl_1 = require("boilersmith/utils/read-tpl");
9
9
  const init_step_factory_1 = require("./init-step-factory");
@@ -117,7 +117,7 @@ class Scaffolder {
117
117
  errors.push(`File "${path}" is owned by modules: "${fileModules}". However, it also has keys that are owned by modules: "${keyModules}".`);
118
118
  });
119
119
  // Ensure that all owned files exist in the filesystem.
120
- const scaffoldingFilePaths = new Set((await (0, globby_1.default)((0, node_path_1.resolve)(this.scaffoldDir, '**/*'), { dot: true })).map((p) => p.replace(`${this.scaffoldDir}/`, '')).filter((p) => p !== ''));
120
+ const scaffoldingFilePaths = new Set((await (0, globby_1.default)((0, path_1.resolve)(this.scaffoldDir, '**/*'), { dot: true })).map((p) => p.replace(`${this.scaffoldDir}/`, '')).filter((p) => p !== ''));
121
121
  moduleOwnedFiles
122
122
  .filter((path) => !scaffoldingFilePaths.has(path))
123
123
  .forEach((path) => {
@@ -164,7 +164,7 @@ class Scaffolder {
164
164
  if (errors.length > 0) {
165
165
  throw new Error(errors.join('\n'));
166
166
  }
167
- const contents = (0, read_tpl_1.readTpl)((0, node_path_1.resolve)(this.scaffoldDir, path), tplData);
167
+ const contents = (0, read_tpl_1.readTpl)((0, path_1.resolve)(this.scaffoldDir, path), tplData);
168
168
  let json;
169
169
  try {
170
170
  json = JSON.parse(contents);
@@ -196,7 +196,7 @@ class Scaffolder {
196
196
  }
197
197
  // Ensure that all files can be resolved with ejs using provided template variables.
198
198
  scaffoldingFilePaths.forEach((path) => {
199
- (0, read_tpl_1.readTpl)((0, node_path_1.resolve)(this.scaffoldDir, path), tplData);
199
+ (0, read_tpl_1.readTpl)((0, path_1.resolve)(this.scaffoldDir, path), tplData);
200
200
  });
201
201
  }
202
202
  }
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const pick_deep_1 = (0, tslib_1.__importDefault)(require("pick-deep"));
6
6
  const mem_fs_editor_1 = require("mem-fs-editor");
7
7
  const clone_and_fill_1 = require("../utils/clone-and-fill");
8
- const node_path_1 = require("node:path");
8
+ const path_1 = require("path");
9
9
  class BaseStubStep {
10
10
  constructor(stubDir, scaffolder) {
11
11
  this.composable = true;
@@ -27,7 +27,7 @@ class BaseStubStep {
27
27
  const newFileName = await this.getFileName(fs, paths, io);
28
28
  const newFilePath = paths.package(this.schema.root || this.defaultRoot, this.subdir, newFileName);
29
29
  const stub = (0, clone_and_fill_1.cloneAndFill)(this.schema.sourceFile, this.params);
30
- fsEditor.copyTpl((0, node_path_1.resolve)(this.stubDir, stub), newFilePath, this.params);
30
+ fsEditor.copyTpl((0, path_1.resolve)(this.stubDir, stub), newFilePath, this.params);
31
31
  return fs;
32
32
  }
33
33
  getExposed(_paths, _paramProvider) {
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readTpl = void 0;
4
4
  const ejs_1 = require("ejs");
5
- const node_fs_1 = require("node:fs");
5
+ const fs_1 = require("fs");
6
6
  function readTpl(path, data, options) {
7
- const template = (0, node_fs_1.readFileSync)(path, 'utf8');
7
+ const template = (0, fs_1.readFileSync)(path, 'utf8');
8
8
  return (0, ejs_1.render)(template, data, Object.assign(Object.assign({ filename: path }, options), { async: false }));
9
9
  }
10
10
  exports.readTpl = readTpl;
@@ -0,0 +1,15 @@
1
+ import { StepManager } from 'boilersmith/step-manager';
2
+ import BaseCommand from '../../base-command';
3
+ import { FlarumProviders } from '../../providers';
4
+ export default class Split extends BaseCommand {
5
+ static description: string;
6
+ static flags: {
7
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ };
9
+ static args: {
10
+ name: string;
11
+ description: string;
12
+ }[];
13
+ protected requireExistingExtension: boolean;
14
+ protected steps(stepManager: StepManager<FlarumProviders>): StepManager<FlarumProviders>;
15
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const base_command_1 = (0, tslib_1.__importDefault)(require("../../base-command"));
5
+ const core_1 = require("@oclif/core");
6
+ const split_1 = require("../../steps/monorepo/split");
7
+ class Split extends base_command_1.default {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.requireExistingExtension = false;
11
+ }
12
+ steps(stepManager) {
13
+ return stepManager.step(new split_1.MonorepoSplit(this.flags.force));
14
+ }
15
+ }
16
+ exports.default = Split;
17
+ Split.description = 'Split monorepo changes into subrepos.';
18
+ Split.flags = Object.assign({ force: core_1.Flags.boolean({ char: 'f', required: false }) }, base_command_1.default.flags);
19
+ Split.args = [...base_command_1.default.args];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PhpSubsystemProvider = exports.ParamTypeType = exports.ExpressionType = void 0;
4
- const node_child_process_1 = require("node:child_process");
4
+ const child_process_1 = require("child_process");
5
5
  var ExpressionType;
6
6
  (function (ExpressionType) {
7
7
  ExpressionType["SCALAR"] = "scalar";
@@ -24,7 +24,7 @@ class PhpSubsystemProvider {
24
24
  op: 'extender.add',
25
25
  params: extenderDef,
26
26
  });
27
- const res = (0, node_child_process_1.execSync)(`php ${this.phpPath}`, { input });
27
+ const res = (0, child_process_1.execSync)(`php ${this.phpPath}`, { input });
28
28
  if (!res) {
29
29
  throw new Error(`The PHP subsystem returned an invalid value: ${res}`);
30
30
  }
@@ -1,5 +1,5 @@
1
1
  import { Scaffolder } from 'boilersmith/scaffolding/scaffolder';
2
- export declare const EXTENSION_PARAMS: readonly ["packageName", "packageDescription", "packageNamespace", "authorName", "authorEmail", "extensionName", "licenseType", "mainGitBranch", "jsPackageManager", "licenseText", "packageNamespaceEscapedSlash", "extensionId", "year", "backendDirectory", "frontendDirectory"];
2
+ export declare const EXTENSION_PARAMS: readonly ["packageName", "packageDescription", "packageNamespace", "authorName", "authorEmail", "extensionName", "licenseType", "mainGitBranch", "jsPackageManager", "licenseText", "extensionId", "year", "backendDirectory", "frontendDirectory"];
3
3
  export declare type ExtensionParams = typeof EXTENSION_PARAMS[number];
4
4
  export declare const EXTENSION_MODULES: readonly ["core", "icon", "admin", "forum", "js", "jsCommon", "css", "locale", "gitConf", "githubActions", "prettier", "typescript", "bundlewatch", "backendTesting", "editorConfig", "styleci"];
5
5
  export declare type ExtensionModules = typeof EXTENSION_MODULES[number];
@@ -5,9 +5,9 @@ const tslib_1 = require("tslib");
5
5
  const scaffolder_1 = require("boilersmith/scaffolding/scaffolder");
6
6
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
7
7
  const mem_fs_editor_1 = require("mem-fs-editor");
8
- const node_child_process_1 = require("node:child_process");
9
- const node_fs_1 = require("node:fs");
10
- const node_path_1 = require("node:path");
8
+ const child_process_1 = require("child_process");
9
+ const fs_1 = require("fs");
10
+ const path_1 = require("path");
11
11
  const simple_git_1 = (0, tslib_1.__importDefault)(require("simple-git"));
12
12
  const simple_1 = (0, tslib_1.__importDefault)(require("spdx-license-list/simple"));
13
13
  const composer_1 = require("../utils/composer");
@@ -25,7 +25,6 @@ exports.EXTENSION_PARAMS = [
25
25
  'mainGitBranch',
26
26
  'jsPackageManager',
27
27
  'licenseText',
28
- 'packageNamespaceEscapedSlash',
29
28
  'extensionId',
30
29
  'year',
31
30
  'backendDirectory',
@@ -147,12 +146,6 @@ function paramNamesToDef(name) {
147
146
  uses: ['licenseType'],
148
147
  compute: async (_paths, licenseType) => (licenseType ? require(`spdx-license-list/licenses/${licenseType}`).licenseText : ''),
149
148
  };
150
- case 'packageNamespaceEscapedSlash':
151
- return {
152
- name,
153
- uses: ['packageNamespace'],
154
- compute: async (_paths, packageNamespace) => packageNamespace.replace('\\', '\\\\'),
155
- };
156
149
  case 'extensionId':
157
150
  return {
158
151
  name,
@@ -180,13 +173,13 @@ function paramNamesToDef(name) {
180
173
  var _a, _b;
181
174
  const cwd = (_a = paths.monorepo()) !== null && _a !== void 0 ? _a : paths.package();
182
175
  try {
183
- const remotes = (0, node_child_process_1.execSync)('git remote', { cwd, timeout: 2000 }).toString().split('\n');
176
+ const remotes = (0, child_process_1.execSync)('git remote', { cwd, timeout: 2000 }).toString().split('\n');
184
177
  if (remotes.includes('origin')) {
185
- return (0, node_child_process_1.execSync)("git remote show origin | grep 'HEAD branch' | cut -d' ' -f5", { cwd }).toString();
178
+ return (0, child_process_1.execSync)("git remote show origin | grep 'HEAD branch' | cut -d' ' -f5", { cwd, timeout: 2000 }).toString();
186
179
  }
187
180
  }
188
181
  catch (_c) { }
189
- return (_b = (await (0, simple_git_1.default)(cwd).getConfig('init.defaultBranch')).value) !== null && _b !== void 0 ? _b : 'main';
182
+ return (_b = (await (0, simple_git_1.default)(cwd, { timeout: { block: 2000 } }).getConfig('init.defaultBranch')).value) !== null && _b !== void 0 ? _b : 'main';
190
183
  },
191
184
  };
192
185
  case 'jsPackageManager':
@@ -195,7 +188,7 @@ function paramNamesToDef(name) {
195
188
  name,
196
189
  type: 'select',
197
190
  message: 'JS Package Manager',
198
- initial: 'yarn',
191
+ initial: 0,
199
192
  choices: [
200
193
  { title: 'Yarn', value: 'yarn' },
201
194
  { title: 'NPM', value: 'npm' },
@@ -262,7 +255,7 @@ function moduleNameToDef(name) {
262
255
  'license',
263
256
  'require.flarum/core',
264
257
  'authors',
265
- 'autoload.psr-4.${params.packageNamespaceEscapedSlash}\\',
258
+ 'autoload.psr-4.${params.packageNamespace}\\',
266
259
  'extra.flarum-extension.title',
267
260
  'extra.flarum-extension.category',
268
261
  'minimum-stability',
@@ -272,7 +265,7 @@ function moduleNameToDef(name) {
272
265
  needsTemplateParams: [
273
266
  'packageName',
274
267
  'packageNamespace',
275
- 'packageNamespaceEscapedSlash',
268
+ 'packageNamespace',
276
269
  'packageDescription',
277
270
  'extensionName',
278
271
  'licenseType',
@@ -312,9 +305,9 @@ function moduleNameToDef(name) {
312
305
  jsonToAugment: {},
313
306
  needsTemplateParams: [],
314
307
  inferEnabled: async (_fs, paths) => {
315
- if (!(0, node_fs_1.existsSync)(paths.package('js')))
308
+ if (!(0, fs_1.existsSync)(paths.package('js')))
316
309
  undefined;
317
- return (0, node_fs_1.existsSync)(paths.package('js/src/admin'));
310
+ return (0, fs_1.existsSync)(paths.package('js/src/admin'));
318
311
  },
319
312
  };
320
313
  case 'forum':
@@ -334,9 +327,9 @@ function moduleNameToDef(name) {
334
327
  jsonToAugment: {},
335
328
  needsTemplateParams: [],
336
329
  inferEnabled: async (_fs, paths) => {
337
- if (!(0, node_fs_1.existsSync)(paths.package('js')))
330
+ if (!(0, fs_1.existsSync)(paths.package('js')))
338
331
  undefined;
339
- return (0, node_fs_1.existsSync)(paths.package('js/src/forum'));
332
+ return (0, fs_1.existsSync)(paths.package('js/src/forum'));
340
333
  },
341
334
  };
342
335
  case 'js':
@@ -365,6 +358,7 @@ function moduleNameToDef(name) {
365
358
  'js/package.json': [
366
359
  'name',
367
360
  'private',
361
+ 'version',
368
362
  'devDependencies.flarum-webpack-config',
369
363
  'devDependencies.webpack',
370
364
  'devDependencies.webpack-cli',
@@ -375,7 +369,7 @@ function moduleNameToDef(name) {
375
369
  },
376
370
  needsTemplateParams: ['packageName', 'jsPackageManager'],
377
371
  inferEnabled: async (_fs, paths) => {
378
- return (0, node_fs_1.existsSync)(paths.package('js'));
372
+ return (0, fs_1.existsSync)(paths.package('js'));
379
373
  },
380
374
  };
381
375
  case 'jsCommon':
@@ -398,7 +392,7 @@ function moduleNameToDef(name) {
398
392
  jsonToAugment: {},
399
393
  needsTemplateParams: [],
400
394
  inferEnabled: async (_fs, paths) => {
401
- return (0, node_fs_1.existsSync)(paths.package('js/src/common'));
395
+ return (0, fs_1.existsSync)(paths.package('js/src/common'));
402
396
  },
403
397
  };
404
398
  case 'css':
@@ -417,7 +411,7 @@ function moduleNameToDef(name) {
417
411
  jsonToAugment: {},
418
412
  needsTemplateParams: [],
419
413
  inferEnabled: async (_fs, paths) => {
420
- return (0, node_fs_1.existsSync)(paths.package('less'));
414
+ return (0, fs_1.existsSync)(paths.package('less'));
421
415
  },
422
416
  };
423
417
  case 'locale':
@@ -433,7 +427,7 @@ function moduleNameToDef(name) {
433
427
  jsonToAugment: {},
434
428
  needsTemplateParams: [],
435
429
  inferEnabled: async (_fs, paths) => {
436
- return (0, node_fs_1.existsSync)(paths.package('locale'));
430
+ return (0, fs_1.existsSync)(paths.package('locale'));
437
431
  },
438
432
  };
439
433
  case 'gitConf':
@@ -448,7 +442,7 @@ function moduleNameToDef(name) {
448
442
  filesToReplace: [
449
443
  { path: 'gitignore', destPath: '.gitignore' },
450
444
  { path: 'js/gitignore', moduleDeps: ['js'], destPath: 'js/.gitignore' },
451
- '.gitattributes',
445
+ { path: '.gitattributes', monorepoPath: '.gitattributes' },
452
446
  ],
453
447
  jsonToAugment: {},
454
448
  needsTemplateParams: [],
@@ -498,10 +492,10 @@ function moduleNameToDef(name) {
498
492
  },
499
493
  needsTemplateParams: [],
500
494
  inferEnabled: async (_fs, paths) => {
501
- if (!(0, node_fs_1.existsSync)(paths.package('js/package.json'))) {
495
+ if (!(0, fs_1.existsSync)(paths.package('js/package.json'))) {
502
496
  return false;
503
497
  }
504
- return (0, node_fs_1.readFileSync)(paths.package('js/package.json')).includes('prettier');
498
+ return (0, fs_1.readFileSync)(paths.package('js/package.json')).includes('prettier');
505
499
  },
506
500
  };
507
501
  case 'typescript':
@@ -527,7 +521,7 @@ function moduleNameToDef(name) {
527
521
  },
528
522
  needsTemplateParams: [],
529
523
  inferEnabled: async (_fs, paths) => {
530
- return (0, node_fs_1.existsSync)(paths.package('js/tsconfig.json'));
524
+ return (0, fs_1.existsSync)(paths.package('js/tsconfig.json'));
531
525
  },
532
526
  };
533
527
  case 'bundlewatch':
@@ -542,7 +536,7 @@ function moduleNameToDef(name) {
542
536
  jsonToAugment: {},
543
537
  needsTemplateParams: [],
544
538
  inferEnabled: async (_fs, paths) => {
545
- return (0, node_fs_1.existsSync)(paths.package('js/.bundlewatch.config.json'));
539
+ return (0, fs_1.existsSync)(paths.package('js/.bundlewatch.config.json'));
546
540
  },
547
541
  };
548
542
  case 'backendTesting':
@@ -562,7 +556,7 @@ function moduleNameToDef(name) {
562
556
  ],
563
557
  jsonToAugment: {
564
558
  'composer.json': [
565
- 'autoload-dev.psr-4.${params.packageNamespaceEscapedSlash}\\Tests\\',
559
+ 'autoload-dev.psr-4.${params.packageNamespace}\\Tests\\',
566
560
  'scripts.test',
567
561
  'scripts.test:unit',
568
562
  'scripts.test:integration',
@@ -574,9 +568,9 @@ function moduleNameToDef(name) {
574
568
  'require-dev.flarum/testing',
575
569
  ],
576
570
  },
577
- needsTemplateParams: ['packageNamespaceEscapedSlash'],
571
+ needsTemplateParams: ['packageNamespace'],
578
572
  inferEnabled: async (_fs, paths) => {
579
- return (0, node_fs_1.existsSync)(paths.package('tests'));
573
+ return (0, fs_1.existsSync)(paths.package('tests'));
580
574
  },
581
575
  };
582
576
  case 'editorConfig':
@@ -637,7 +631,7 @@ function genExtScaffolder() {
637
631
  configKeys: (_f = (_e = (_d = json === null || json === void 0 ? void 0 : json.extra) === null || _d === void 0 ? void 0 : _d['flarum-cli']) === null || _e === void 0 ? void 0 : _e.excludeScaffoldingConfigKeys) !== null && _f !== void 0 ? _f : {},
638
632
  };
639
633
  };
640
- const scaffolder = new scaffolder_1.Scaffolder((0, node_path_1.resolve)(__dirname, '../../boilerplate/skeleton/extension'), moduleStatusCache, excludeScaffoldingFunc);
634
+ const scaffolder = new scaffolder_1.Scaffolder((0, path_1.resolve)(__dirname, '../../boilerplate/skeleton/extension'), moduleStatusCache, excludeScaffoldingFunc);
641
635
  for (const name of exports.EXTENSION_MODULES) {
642
636
  scaffolder.registerModule(moduleNameToDef(name));
643
637
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComposerInstall = void 0;
4
- const node_child_process_1 = require("node:child_process");
4
+ const child_process_1 = require("child_process");
5
5
  class ComposerInstall {
6
6
  constructor() {
7
7
  this.type = 'Run composer install/update';
@@ -9,7 +9,7 @@ class ComposerInstall {
9
9
  this.exposes = [];
10
10
  }
11
11
  async run(fs, paths, _paramProvider, _providers) {
12
- (0, node_child_process_1.execSync)('composer update', { cwd: paths.package('') });
12
+ (0, child_process_1.execSync)('composer update', { cwd: paths.package('') });
13
13
  return fs;
14
14
  }
15
15
  getExposed() {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NpmInstall = void 0;
4
- const node_child_process_1 = require("node:child_process");
4
+ const child_process_1 = require("child_process");
5
5
  class NpmInstall {
6
6
  constructor() {
7
7
  this.type = 'Run npm install';
@@ -9,7 +9,7 @@ class NpmInstall {
9
9
  this.exposes = [];
10
10
  }
11
11
  async run(fs, paths, _paramProvider, _providers) {
12
- (0, node_child_process_1.execSync)('npm install', { cwd: paths.package('js') });
12
+ (0, child_process_1.execSync)('npm install', { cwd: paths.package('js') });
13
13
  return fs;
14
14
  }
15
15
  getExposed() {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.YarnInstall = void 0;
4
- const node_child_process_1 = require("node:child_process");
4
+ const child_process_1 = require("child_process");
5
5
  class YarnInstall {
6
6
  constructor() {
7
7
  this.type = 'Run yarn install';
@@ -9,7 +9,7 @@ class YarnInstall {
9
9
  this.exposes = [];
10
10
  }
11
11
  async run(fs, paths, _paramProvider, _providers) {
12
- (0, node_child_process_1.execSync)('yarn install', { cwd: paths.package('js') });
12
+ (0, child_process_1.execSync)('yarn install', { cwd: paths.package('js') });
13
13
  return fs;
14
14
  }
15
15
  getExposed() {
@@ -3,35 +3,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MonorepoCreate = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  /* eslint-disable no-await-in-loop */
6
- const node_child_process_1 = require("node:child_process");
6
+ const child_process_1 = require("child_process");
7
7
  const monorepo_1 = require("../../utils/monorepo");
8
8
  const cond_format_1 = require("boilersmith/utils/cond-format");
9
9
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
10
- const node_fs_1 = require("node:fs");
11
- const node_path_1 = require("node:path");
12
- const node_os_1 = require("node:os");
10
+ const fs_1 = require("fs");
11
+ const path_1 = require("path");
12
+ const os_1 = require("os");
13
13
  const simple_git_1 = (0, tslib_1.__importDefault)(require("simple-git"));
14
14
  const mem_fs_editor_1 = require("mem-fs-editor");
15
15
  const commit_async_1 = require("boilersmith/utils/commit-async");
16
16
  const validation_1 = require("../../utils/validation");
17
- async function addGitPackage(cwd, path, remote) {
18
- const tmpDir = (0, node_fs_1.mkdtempSync)((0, node_path_1.resolve)((0, node_os_1.tmpdir)(), `${path.replace('/', '_')}-`));
19
- (0, node_child_process_1.execSync)(`git clone ${remote} ${tmpDir}`, { cwd });
20
- (0, node_child_process_1.execSync)(`git filter-repo --to-subdirectory-filter ${path}`, { cwd: tmpDir });
17
+ async function addGitPackage(cwd, path, remote, mainBranch = 'main') {
18
+ const tmpDir = (0, fs_1.mkdtempSync)((0, path_1.resolve)((0, os_1.tmpdir)(), `${path.replace('/', '_')}-`));
19
+ (0, child_process_1.execSync)(`git clone ${remote} ${tmpDir} --verbose --branch ${mainBranch} --single-branch`, { cwd });
20
+ (0, child_process_1.execSync)(`git filter-repo --to-subdirectory-filter ${path}`, { cwd: tmpDir });
21
+ if (mainBranch) {
22
+ await (0, simple_git_1.default)(tmpDir).checkout(mainBranch);
23
+ }
21
24
  await (0, simple_git_1.default)(tmpDir).branch(['REWRITE']);
22
25
  await (0, simple_git_1.default)(tmpDir).checkout('REWRITE');
23
26
  // Merge from remote
24
27
  const remoteName = path.replace('/', '_').replace('-', '_');
25
28
  await (0, simple_git_1.default)(cwd).addRemote(remoteName, tmpDir);
26
- (0, node_child_process_1.execSync)(`git fetch ${remoteName}`, { cwd });
27
- (0, node_child_process_1.execSync)(`git merge ${remoteName}/REWRITE --allow-unrelated-histories --no-edit`, { cwd });
29
+ (0, child_process_1.execSync)(`git fetch ${remoteName}`, { cwd });
30
+ (0, child_process_1.execSync)(`git merge ${remoteName}/REWRITE --allow-unrelated-histories --no-edit`, { cwd });
28
31
  await (0, simple_git_1.default)(cwd).removeRemote(remoteName);
29
- (0, node_fs_1.rmSync)(tmpDir, { recursive: true, force: true });
32
+ (0, fs_1.rmSync)(tmpDir, { recursive: true, force: true });
30
33
  }
31
34
  function makeRunCommitStep(cwd, fs, io, paths, providers) {
32
35
  return async function (packagePaths, step, message) {
33
36
  for (const path of packagePaths) {
34
- await step.run(fs, paths.onMonorepoSub((0, node_path_1.resolve)(cwd, path), cwd), io, providers);
37
+ await step.run(fs, paths.onMonorepoSub((0, path_1.resolve)(cwd, path), cwd), io, providers);
35
38
  }
36
39
  await (0, commit_async_1.commitAsync)(fs);
37
40
  await commitAll(cwd, message);
@@ -40,7 +43,7 @@ function makeRunCommitStep(cwd, fs, io, paths, providers) {
40
43
  async function getMonorepoConf(io, monorepoConfPath) {
41
44
  var _a;
42
45
  if (monorepoConfPath) {
43
- return JSON.parse((0, node_fs_1.readFileSync)(monorepoConfPath, 'utf8'));
46
+ return JSON.parse((0, fs_1.readFileSync)(monorepoConfPath, 'utf8'));
44
47
  }
45
48
  const packages = { extensions: [], composer: [], npm: [] };
46
49
  // eslint-disable-next-line no-constant-condition
@@ -119,56 +122,58 @@ class MonorepoCreate {
119
122
  }
120
123
  const conf = await getMonorepoConf(io, this.monorepoConfPath ? paths.cwd(this.monorepoConfPath) : undefined);
121
124
  const runCommitStep = makeRunCommitStep(target, fs, io, paths, providers);
122
- (0, node_fs_1.rmSync)(target, { recursive: true, force: true });
123
- (0, node_fs_1.mkdirSync)(target);
125
+ (0, fs_1.rmSync)(target, { recursive: true, force: true });
126
+ (0, fs_1.mkdirSync)(target);
124
127
  await (0, simple_git_1.default)(target).init();
125
128
  for (const lib of (_b = conf.packages.npm) !== null && _b !== void 0 ? _b : []) {
126
- await addGitPackage(target, (0, monorepo_1.npmPath)(lib.name), lib.gitRemote);
129
+ await addGitPackage(target, (0, monorepo_1.npmPath)(lib.name), lib.gitRemote, lib.mainBranch);
127
130
  }
128
131
  for (const lib of (_c = conf.packages.composer) !== null && _c !== void 0 ? _c : []) {
129
- await addGitPackage(target, (0, monorepo_1.composerPath)(lib.name), lib.gitRemote);
132
+ await addGitPackage(target, (0, monorepo_1.composerPath)(lib.name), lib.gitRemote, lib.mainBranch);
130
133
  }
131
134
  for (const ext of (_d = conf.packages.extensions) !== null && _d !== void 0 ? _d : []) {
132
- await addGitPackage(target, (0, monorepo_1.extensionPath)(ext.name), ext.gitRemote);
135
+ await addGitPackage(target, (0, monorepo_1.extensionPath)(ext.name), ext.gitRemote, ext.mainBranch);
133
136
  }
134
- if (conf.packages.core) {
135
- await addGitPackage(target, (0, monorepo_1.corePath)(conf.packages.core.name), conf.packages.core.gitRemote);
137
+ const corePkg = conf.packages.core;
138
+ if (corePkg) {
139
+ await addGitPackage(target, (0, monorepo_1.corePath)(corePkg.name), corePkg.gitRemote, corePkg.mainBranch);
136
140
  }
137
141
  const npmPaths = (_f = (_e = conf.packages.npm) === null || _e === void 0 ? void 0 : _e.map((lib) => (0, monorepo_1.npmPath)(lib.name))) !== null && _f !== void 0 ? _f : [];
138
142
  const composerPaths = (_h = (_g = conf.packages.composer) === null || _g === void 0 ? void 0 : _g.map((lib) => (0, monorepo_1.composerPath)(lib.name))) !== null && _h !== void 0 ? _h : [];
139
143
  const flarumPaths = (_k = (_j = conf.packages.extensions) === null || _j === void 0 ? void 0 : _j.map((ext) => (0, monorepo_1.extensionPath)(ext.name))) !== null && _k !== void 0 ? _k : [];
140
- if (conf.packages.core) {
141
- flarumPaths.push((0, monorepo_1.corePath)(conf.packages.core.name));
144
+ if (corePkg) {
145
+ flarumPaths.push((0, monorepo_1.corePath)(corePkg.name));
142
146
  }
143
147
  flarumPaths.forEach((path) => {
144
- (0, node_fs_1.rmSync)((0, node_path_1.resolve)(target, path, '.github'), { force: true, recursive: true });
148
+ (0, fs_1.rmSync)((0, path_1.resolve)(target, path, '.github'), { force: true, recursive: true });
145
149
  });
146
150
  [...npmPaths, ...composerPaths, ...flarumPaths].forEach((path) => {
147
- (0, node_fs_1.rmSync)((0, node_path_1.resolve)(target, path, '.styleci.yml'), { force: true });
151
+ (0, fs_1.rmSync)((0, path_1.resolve)(target, path, '.styleci.yml'), { force: true });
148
152
  });
149
153
  await commitAll(target, [
150
154
  'chore: remove centralizable repo config',
151
155
  '- Remove .github conf folder from Flarum packages',
152
156
  '- Remove styleci config from all packages',
153
157
  ]);
154
- (0, mem_fs_editor_1.create)(fs).writeJSON((0, node_path_1.resolve)(target, 'flarum-monorepo.json'), conf);
158
+ (0, mem_fs_editor_1.create)(fs).writeJSON((0, path_1.resolve)(target, 'flarum-monorepo.json'), conf);
155
159
  await (0, commit_async_1.commitAsync)(fs);
156
160
  await commitAll(target, 'chore: add monorepo config file');
157
161
  [...composerPaths, ...flarumPaths].forEach((path) => {
158
- const cwd = (0, node_path_1.resolve)(target, path);
159
- (0, node_child_process_1.execSync)('composer config repositories.0 path "../*"', { cwd });
160
- (0, node_child_process_1.execSync)('composer config minimum-stability dev', { cwd });
161
- (0, node_child_process_1.execSync)('composer config prefer-stable true', { cwd });
162
- const composerJsonPath = (0, node_path_1.resolve)(cwd, 'composer.json');
163
- const composerJson = (0, node_fs_1.readFileSync)(composerJsonPath);
164
- (0, node_fs_1.writeFileSync)(composerJsonPath, composerJson.toString().replace('"dev-master": "1.x-dev"', '"dev-main": "1.x-dev"'));
162
+ const cwd = (0, path_1.resolve)(target, path);
163
+ const relRepoPath = path.includes('/') ? '../../*/*' : './../*/*';
164
+ (0, child_process_1.execSync)(`composer config repositories.0 path "${relRepoPath}"`, { cwd });
165
+ (0, child_process_1.execSync)('composer config minimum-stability dev', { cwd });
166
+ (0, child_process_1.execSync)('composer config prefer-stable true', { cwd });
167
+ const composerJsonPath = (0, path_1.resolve)(cwd, 'composer.json');
168
+ const composerJson = (0, fs_1.readFileSync)(composerJsonPath);
169
+ (0, fs_1.writeFileSync)(composerJsonPath, composerJson.toString().replace('"dev-master": "1.x-dev"', '"dev-main": "1.x-dev"'));
165
170
  });
166
171
  [...composerPaths, ...flarumPaths].forEach((path) => {
167
- const cwd = (0, node_path_1.resolve)(target, path);
168
- (0, node_child_process_1.execSync)('composer install --dry-run --no-interaction --no-ansi --no-progress --no-scripts --no-autoloader', { cwd });
172
+ const cwd = (0, path_1.resolve)(target, path);
173
+ (0, child_process_1.execSync)('composer install --dry-run --no-interaction --no-ansi --no-progress --no-scripts --no-autoloader', { cwd });
169
174
  });
170
175
  await commitAll(target, 'chore: set up composer path repos');
171
- (0, mem_fs_editor_1.create)(fs).writeJSON((0, node_path_1.resolve)(target, 'flarum-monorepo.json'), conf);
176
+ (0, mem_fs_editor_1.create)(fs).writeJSON((0, path_1.resolve)(target, 'flarum-monorepo.json'), conf);
172
177
  await (0, commit_async_1.commitAsync)(fs);
173
178
  await commitAll(target, 'chore: add monorepo config file');
174
179
  await runCommitStep(flarumPaths, this.scaffolder.genAuditStep(false), 'chore: flarum-cli audit infra --fix');
@@ -0,0 +1,14 @@
1
+ import { IO } from 'boilersmith/io';
2
+ import { Paths } from 'boilersmith/paths';
3
+ import { Step } from 'boilersmith/step-manager';
4
+ import { Store } from 'mem-fs';
5
+ import { FlarumProviders } from '../../providers';
6
+ export declare class MonorepoSplit implements Step<FlarumProviders> {
7
+ type: string;
8
+ composable: boolean;
9
+ exposes: never[];
10
+ force?: boolean;
11
+ constructor(force: boolean);
12
+ run(fs: Store, paths: Paths, io: IO, _providers: FlarumProviders): Promise<Store>;
13
+ getExposed(): Record<string, unknown>;
14
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MonorepoSplit = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const child_process_1 = require("child_process");
6
+ const path_1 = require("path");
7
+ const simple_git_1 = (0, tslib_1.__importDefault)(require("simple-git"));
8
+ const monorepo_1 = require("../../utils/monorepo");
9
+ async function addRemote(cwd, name, remote) {
10
+ try {
11
+ await (0, simple_git_1.default)(cwd).addRemote(name, remote);
12
+ await (0, simple_git_1.default)(cwd).fetch(name);
13
+ }
14
+ catch (_a) {
15
+ // ignore, remote already exists.
16
+ }
17
+ }
18
+ async function splitAndPush(cwd, splitExecPath, splitPath, remoteName, remoteBranch, force = false) {
19
+ const currBranch = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { cwd }).toString().trim();
20
+ const sha1 = (0, child_process_1.execSync)(`${splitExecPath} --prefix=${splitPath}`, { cwd, stdio: ['pipe', 'pipe', 'ignore'] })
21
+ .toString()
22
+ .trim();
23
+ const branch = remoteBranch || 'main';
24
+ const pushArgs = `${remoteName} "${sha1}:refs/heads/${branch}"`;
25
+ if (force) {
26
+ (0, child_process_1.execSync)(`git push --force ${pushArgs}`, { cwd });
27
+ }
28
+ else {
29
+ const tmpBranch = `${remoteName}-tmp`;
30
+ (0, child_process_1.execSync)(`git switch -c ${tmpBranch} ${sha1}`, { cwd });
31
+ (0, child_process_1.execSync)(`git pull ${remoteName} ${branch} --rebase`, { cwd });
32
+ (0, child_process_1.execSync)(`git push ${pushArgs}`, { cwd });
33
+ (0, child_process_1.execSync)(`git switch ${currBranch}`, { cwd });
34
+ }
35
+ }
36
+ async function cleanupBranchAndRemote(cwd, name) {
37
+ await (0, simple_git_1.default)(cwd).removeRemote(name);
38
+ const tmpBranch = `${name}-tmp`;
39
+ (0, child_process_1.execSync)(`git branch -D ${tmpBranch}`, { cwd });
40
+ }
41
+ class MonorepoSplit {
42
+ constructor(force) {
43
+ this.type = 'Split monorepo changes to the respective cloned repos.';
44
+ this.composable = false;
45
+ this.exposes = [];
46
+ this.force = force;
47
+ }
48
+ async run(fs, paths, io, _providers) {
49
+ var _a, _b, _c, _d;
50
+ const platform = process.platform;
51
+ if (platform !== 'linux' && platform !== 'darwin') {
52
+ io.error(`Your platform, "${platform}", is not supported. Split can only be run on linux and mac`, true);
53
+ return fs;
54
+ }
55
+ if (this.force && !(await io.getParam({ type: 'confirm', name: 'confirm', initial: false, message: 'Are you sure you want to force split?' }))) {
56
+ io.error('Decided not to force push', true);
57
+ return fs;
58
+ }
59
+ const splitExec = (0, path_1.resolve)(__dirname, `../../../bin/splitsh-lite-${platform}`);
60
+ const target = (_a = paths.requestedDir()) !== null && _a !== void 0 ? _a : paths.package();
61
+ await (0, simple_git_1.default)(target).pull();
62
+ const conf = (0, monorepo_1.getMonorepoConf)(fs, paths);
63
+ const corePkg = conf.packages.core;
64
+ const clean = [];
65
+ // Add Remotes
66
+ for (const lib of (_b = conf.packages.npm) !== null && _b !== void 0 ? _b : []) {
67
+ await addRemote(target, lib.name, lib.gitRemote);
68
+ await splitAndPush(target, splitExec, (0, monorepo_1.npmPath)(lib.name), lib.name, lib.mainBranch, this.force);
69
+ clean.push(lib.name);
70
+ }
71
+ for (const lib of (_c = conf.packages.composer) !== null && _c !== void 0 ? _c : []) {
72
+ await addRemote(target, lib.name, lib.gitRemote);
73
+ await splitAndPush(target, splitExec, (0, monorepo_1.composerPath)(lib.name), lib.name, lib.mainBranch, this.force);
74
+ clean.push(lib.name);
75
+ }
76
+ for (const ext of (_d = conf.packages.extensions) !== null && _d !== void 0 ? _d : []) {
77
+ await addRemote(target, ext.name, ext.gitRemote);
78
+ await splitAndPush(target, splitExec, (0, monorepo_1.extensionPath)(ext.name), ext.name, ext.mainBranch, this.force);
79
+ clean.push(ext.name);
80
+ }
81
+ if (corePkg) {
82
+ await addRemote(target, corePkg.name, corePkg.gitRemote);
83
+ await splitAndPush(target, splitExec, (0, monorepo_1.corePath)(corePkg.name), corePkg.name, corePkg.mainBranch, this.force);
84
+ clean.push(corePkg.name);
85
+ }
86
+ for (const name of clean) {
87
+ await cleanupBranchAndRemote(target, name);
88
+ }
89
+ return fs;
90
+ }
91
+ getExposed() {
92
+ throw new Error('Method not implemented.');
93
+ }
94
+ }
95
+ exports.MonorepoSplit = MonorepoSplit;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GenerateMigrationStub = void 0;
4
- const node_fs_1 = require("node:fs");
4
+ const fs_1 = require("fs");
5
5
  const validation_1 = require("../../../utils/validation");
6
6
  const migration_1 = require("../../../utils/migration");
7
7
  const php_base_1 = require("../php-base");
@@ -36,7 +36,7 @@ class GenerateMigrationStub extends php_base_1.BasePhpStubStep {
36
36
  async getFileName(fs, paths, _paramProvider) {
37
37
  let persistedMigrations;
38
38
  try {
39
- persistedMigrations = (0, node_fs_1.readdirSync)(paths.package('migrations'));
39
+ persistedMigrations = (0, fs_1.readdirSync)(paths.package('migrations'));
40
40
  }
41
41
  catch (_a) {
42
42
  persistedMigrations = [];
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMonorepoConf = exports.corePath = exports.extensionPath = exports.composerPath = exports.npmPath = void 0;
4
4
  const mem_fs_editor_1 = require("mem-fs-editor");
5
5
  function npmPath(name) {
6
- return `packages/lib-${name}`;
6
+ return `js-packages/${name}`;
7
7
  }
8
8
  exports.npmPath = npmPath;
9
9
  function composerPath(name) {
10
- return `packages/lib-${name}`;
10
+ return `php-packages/${name}`;
11
11
  }
12
12
  exports.composerPath = composerPath;
13
13
  function extensionPath(name) {
14
- return `packages/ext-${name}`;
14
+ return `extensions/${name}`;
15
15
  }
16
16
  exports.extensionPath = extensionPath;
17
17
  function corePath(_name) {
18
- return 'packages/core';
18
+ return 'framework/core';
19
19
  }
20
20
  exports.corePath = corePath;
21
21
  function getMonorepoConf(fs, paths) {
@@ -1 +1 @@
1
- {"version":"2.0.0-beta.14","commands":{"infra":{"id":"infra","description":"Add/Update infrastructure to the latest scaffolding for some module in an extension. For example, you can use this to add/update TypeScript, backend testing, GitHub Actions, and other features.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"monorepo":{"name":"monorepo","type":"boolean","char":"m","allowNo":false},"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"module","description":"The name of the module to enable/update.","required":true,"options":["core","icon","admin","forum","js","jsCommon","css","locale","gitConf","githubActions","prettier","typescript","bundlewatch","backendTesting","editorConfig","styleci"]},{"name":"path","description":"Where should this command be executed?"}]},"init":{"id":"init","description":"Create a new Flarum extension","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"audit:infra":{"id":"audit:infra","description":"Check for outdated config files, infrastructure, setup, etc.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"fix":{"name":"fix","type":"boolean","char":"f","allowNo":false},"monorepo":{"name":"monorepo","type":"boolean","char":"m","allowNo":false},"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"monorepo:create":{"id":"monorepo:create","description":"Create a monorepo of Flarum extensions.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","required":false},"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"update:js-imports":{"id":"update:js-imports","description":"Updates JS imports from core to use proper namespaces","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:api-controller":{"id":"make:backend:api-controller","description":"Generate an API controller class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:api-serializer-attributes":{"id":"make:backend:api-serializer-attributes","description":"Generate an API serializer attributes extender","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:api-serializer":{"id":"make:backend:api-serializer","description":"Generate an API serializer class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:command":{"id":"make:backend:command","description":"Generate a console command class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:event-listener":{"id":"make:backend:event-listener","description":"Generate an event listener class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:handler":{"id":"make:backend:handler","description":"Generate a domain logic handler class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:integration-test":{"id":"make:backend:integration-test","description":"Generate an integration test class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:job":{"id":"make:backend:job","description":"Generate a job class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:migration":{"id":"make:backend:migration","description":"Generate a migration","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:model":{"id":"make:backend:model","description":"Generate a model class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:policy":{"id":"make:backend:policy","description":"Generate a policy class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:repository":{"id":"make:backend:repository","description":"Generate a repository class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:route":{"id":"make:backend:route","description":"Generate a routes extender","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:service-provider":{"id":"make:backend:service-provider","description":"Generate a service provider class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:validator":{"id":"make:backend:validator","description":"Generate a validator class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:component":{"id":"make:frontend:component","description":"Generate a frontend component","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:modal":{"id":"make:frontend:modal","description":"Generate a modal component","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:model":{"id":"make:frontend:model","description":"Generate a model class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]}}}
1
+ {"version":"2.0.0-beta.17","commands":{"infra":{"id":"infra","description":"Add/Update infrastructure to the latest scaffolding for some module in an extension. For example, you can use this to add/update TypeScript, backend testing, GitHub Actions, and other features.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"monorepo":{"name":"monorepo","type":"boolean","char":"m","allowNo":false},"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"module","description":"The name of the module to enable/update.","required":true,"options":["core","icon","admin","forum","js","jsCommon","css","locale","gitConf","githubActions","prettier","typescript","bundlewatch","backendTesting","editorConfig","styleci"]},{"name":"path","description":"Where should this command be executed?"}]},"init":{"id":"init","description":"Create a new Flarum extension","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"audit:infra":{"id":"audit:infra","description":"Check for outdated config files, infrastructure, setup, etc.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"fix":{"name":"fix","type":"boolean","char":"f","allowNo":false},"monorepo":{"name":"monorepo","type":"boolean","char":"m","allowNo":false},"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"monorepo:create":{"id":"monorepo:create","description":"Create a monorepo of Flarum extensions.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","required":false},"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"monorepo:split":{"id":"monorepo:split","description":"Split monorepo changes into subrepos.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","required":false,"allowNo":false},"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"update:js-imports":{"id":"update:js-imports","description":"Updates JS imports from core to use proper namespaces","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:api-controller":{"id":"make:backend:api-controller","description":"Generate an API controller class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:api-serializer-attributes":{"id":"make:backend:api-serializer-attributes","description":"Generate an API serializer attributes extender","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:api-serializer":{"id":"make:backend:api-serializer","description":"Generate an API serializer class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:command":{"id":"make:backend:command","description":"Generate a console command class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:event-listener":{"id":"make:backend:event-listener","description":"Generate an event listener class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:handler":{"id":"make:backend:handler","description":"Generate a domain logic handler class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:integration-test":{"id":"make:backend:integration-test","description":"Generate an integration test class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:job":{"id":"make:backend:job","description":"Generate a job class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:migration":{"id":"make:backend:migration","description":"Generate a migration","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:model":{"id":"make:backend:model","description":"Generate a model class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:policy":{"id":"make:backend:policy","description":"Generate a policy class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:repository":{"id":"make:backend:repository","description":"Generate a repository class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:route":{"id":"make:backend:route","description":"Generate a routes extender","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:service-provider":{"id":"make:backend:service-provider","description":"Generate a service provider class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:validator":{"id":"make:backend:validator","description":"Generate a validator class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:component":{"id":"make:frontend:component","description":"Generate a frontend component","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:modal":{"id":"make:frontend:modal","description":"Generate a modal component","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:model":{"id":"make:frontend:model","description":"Generate a model class","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{"no-interaction":{"name":"no-interaction","type":"boolean","char":"n","description":"Do not ask any interactive questions, assume defaults. When impossible, error.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flarum/cli",
3
3
  "description": "A CLI for developing Flarum extensions",
4
- "version": "2.0.0-beta.14",
4
+ "version": "2.0.0-beta.17",
5
5
  "author": "Flarum Team",
6
6
  "bin": {
7
7
  "fl": "bin/run",