@flarum/cli 2.0.0-beta.8 → 2.0.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 (133) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +181 -49
  3. package/bin/run +2 -1
  4. package/bin/splitsh-lite-darwin +0 -0
  5. package/bin/splitsh-lite-linux +0 -0
  6. package/boilerplate/skeleton/extension/.gitattributes +16 -14
  7. package/boilerplate/skeleton/extension/.github/workflows/backend.yml +2 -6
  8. package/boilerplate/skeleton/extension/.github/workflows/frontend.yml +4 -6
  9. package/boilerplate/skeleton/extension/LICENSE.md +1 -1
  10. package/boilerplate/skeleton/extension/README.md +1 -1
  11. package/boilerplate/skeleton/extension/composer.json +6 -4
  12. package/boilerplate/skeleton/extension/extend.php +2 -2
  13. package/boilerplate/skeleton/extension/js/admin.ts +2 -0
  14. package/boilerplate/skeleton/extension/js/forum.ts +2 -0
  15. package/boilerplate/skeleton/extension/js/package.json +5 -1
  16. package/boilerplate/skeleton/extension/js/src/admin/index.ts +5 -0
  17. package/boilerplate/skeleton/extension/js/src/common/index.ts +5 -0
  18. package/boilerplate/skeleton/extension/js/src/forum/index.ts +5 -0
  19. package/boilerplate/skeleton/extension/js/tsconfig.json +10 -2
  20. package/boilerplate/skeleton/extension/locale/en.yml +1 -1
  21. package/boilerplate/skeleton/extension/tests/phpunit.integration.xml +1 -0
  22. package/lib/base-command.d.ts +3 -1
  23. package/lib/base-command.js +44 -31
  24. package/lib/boilersmith/io.d.ts +28 -8
  25. package/lib/boilersmith/io.js +4 -2
  26. package/lib/boilersmith/paths.d.ts +2 -2
  27. package/lib/boilersmith/paths.js +7 -7
  28. package/lib/boilersmith/scaffolding/audit-step-factory.js +11 -11
  29. package/lib/boilersmith/scaffolding/infra-step-factory.js +2 -2
  30. package/lib/boilersmith/scaffolding/init-step-factory.js +5 -5
  31. package/lib/boilersmith/scaffolding/module.d.ts +28 -8
  32. package/lib/boilersmith/scaffolding/module.js +59 -17
  33. package/lib/boilersmith/scaffolding/scaffolder.d.ts +4 -1
  34. package/lib/boilersmith/scaffolding/scaffolder.js +32 -32
  35. package/lib/boilersmith/scaffolding/template-param.d.ts +1 -1
  36. package/lib/boilersmith/scaffolding/template-param.js +2 -2
  37. package/lib/boilersmith/step-manager.d.ts +0 -1
  38. package/lib/boilersmith/step-manager.js +10 -20
  39. package/lib/boilersmith/steps/stub-base.js +3 -3
  40. package/lib/boilersmith/utils/clone-and-fill.js +1 -1
  41. package/lib/boilersmith/utils/commit-async.d.ts +2 -0
  42. package/lib/boilersmith/utils/commit-async.js +15 -0
  43. package/lib/boilersmith/utils/read-tpl.js +2 -2
  44. package/lib/commands/audit/infra.d.ts +1 -1
  45. package/lib/commands/audit/infra.js +30 -8
  46. package/lib/commands/infra.d.ts +2 -2
  47. package/lib/commands/infra.js +18 -12
  48. package/lib/commands/init.d.ts +1 -1
  49. package/lib/commands/init.js +4 -2
  50. package/lib/commands/make/backend/api-controller.js +1 -2
  51. package/lib/commands/make/backend/api-serializer-attributes.js +1 -2
  52. package/lib/commands/make/backend/command.js +1 -2
  53. package/lib/commands/make/backend/event-listener.js +1 -2
  54. package/lib/commands/make/backend/handler.js +2 -5
  55. package/lib/commands/make/backend/integration-test.js +2 -4
  56. package/lib/commands/make/backend/migration.js +1 -2
  57. package/lib/commands/make/backend/model.js +1 -2
  58. package/lib/commands/make/backend/policy.js +1 -2
  59. package/lib/commands/make/backend/route.js +1 -2
  60. package/lib/commands/make/backend/service-provider.js +1 -2
  61. package/lib/commands/make/frontend/model.js +2 -5
  62. package/lib/commands/monorepo/create.d.ts +15 -0
  63. package/lib/commands/monorepo/create.js +20 -0
  64. package/lib/commands/monorepo/split.d.ts +15 -0
  65. package/lib/commands/monorepo/split.js +19 -0
  66. package/lib/commands/update/js-imports.js +1 -2
  67. package/lib/help.js +1 -1
  68. package/lib/providers/php-provider.js +2 -2
  69. package/lib/steps/gen-ext-scaffolder.d.ts +2 -2
  70. package/lib/steps/gen-ext-scaffolder.js +187 -53
  71. package/lib/steps/js/base.js +2 -4
  72. package/lib/steps/js/model.js +4 -4
  73. package/lib/steps/misc/composer.js +2 -2
  74. package/lib/steps/misc/git.d.ts +1 -1
  75. package/lib/steps/misc/git.js +2 -2
  76. package/lib/steps/misc/npm.d.ts +11 -0
  77. package/lib/steps/misc/npm.js +19 -0
  78. package/lib/steps/misc/yarn.js +2 -2
  79. package/lib/steps/monorepo/create.d.ts +17 -0
  80. package/lib/steps/monorepo/create.js +186 -0
  81. package/lib/steps/monorepo/split.d.ts +14 -0
  82. package/lib/steps/monorepo/split.js +99 -0
  83. package/lib/steps/stubs/backend/api-controller.d.ts +1 -1
  84. package/lib/steps/stubs/backend/api-controller.js +3 -0
  85. package/lib/steps/stubs/backend/api-serializer.d.ts +1 -1
  86. package/lib/steps/stubs/backend/api-serializer.js +3 -0
  87. package/lib/steps/stubs/backend/command.d.ts +0 -5
  88. package/lib/steps/stubs/backend/command.js +1 -0
  89. package/lib/steps/stubs/backend/event-listener.d.ts +1 -1
  90. package/lib/steps/stubs/backend/event-listener.js +2 -0
  91. package/lib/steps/stubs/backend/handler-command.d.ts +1 -1
  92. package/lib/steps/stubs/backend/handler-command.js +1 -0
  93. package/lib/steps/stubs/backend/handler.d.ts +1 -1
  94. package/lib/steps/stubs/backend/handler.js +4 -0
  95. package/lib/steps/stubs/backend/integration-test.d.ts +1 -1
  96. package/lib/steps/stubs/backend/integration-test.js +2 -0
  97. package/lib/steps/stubs/backend/job.d.ts +1 -1
  98. package/lib/steps/stubs/backend/job.js +1 -0
  99. package/lib/steps/stubs/backend/migration.js +6 -3
  100. package/lib/steps/stubs/backend/model.d.ts +1 -1
  101. package/lib/steps/stubs/backend/model.js +1 -0
  102. package/lib/steps/stubs/backend/policy.d.ts +1 -1
  103. package/lib/steps/stubs/backend/policy.js +2 -0
  104. package/lib/steps/stubs/backend/repository.d.ts +1 -1
  105. package/lib/steps/stubs/backend/repository.js +2 -0
  106. package/lib/steps/stubs/backend/service-provider.d.ts +1 -1
  107. package/lib/steps/stubs/backend/service-provider.js +1 -0
  108. package/lib/steps/stubs/backend/validator.d.ts +1 -1
  109. package/lib/steps/stubs/backend/validator.js +1 -0
  110. package/lib/steps/stubs/flarum-base.js +1 -1
  111. package/lib/steps/stubs/frontend/component.d.ts +0 -5
  112. package/lib/steps/stubs/frontend/component.js +1 -0
  113. package/lib/steps/stubs/frontend/modal.d.ts +0 -5
  114. package/lib/steps/stubs/frontend/modal.js +1 -0
  115. package/lib/steps/stubs/frontend/model.d.ts +0 -5
  116. package/lib/steps/stubs/frontend/model.js +1 -0
  117. package/lib/steps/stubs/js-base.js +8 -5
  118. package/lib/steps/stubs/php-base.js +10 -8
  119. package/lib/steps/update/js-imports.js +8 -2
  120. package/lib/utils/composer.d.ts +1 -0
  121. package/lib/utils/migration.js +3 -1
  122. package/lib/utils/monorepo.d.ts +24 -0
  123. package/lib/utils/monorepo.js +24 -0
  124. package/lib/utils/validation.d.ts +2 -0
  125. package/lib/utils/validation.js +6 -0
  126. package/oclif.manifest.json +1 -1
  127. package/package.json +11 -5
  128. package/php-subsystem/composer.json +9 -9
  129. package/php-subsystem/composer.lock +64 -71
  130. package/php-subsystem/vendor/composer/installed.json +54 -61
  131. package/php-subsystem/vendor/nikic/php-parser/README.md +55 -59
  132. package/php-subsystem/vendor/nikic/php-parser/composer.json +39 -39
  133. package/php-subsystem/vendor/nikic/php-parser/grammar/README.md +17 -20
@@ -13,7 +13,7 @@ export declare class GenerateJobStub extends BasePhpStubStep {
13
13
  } | {
14
14
  name: string;
15
15
  type: string;
16
- message?: undefined;
16
+ message: string;
17
17
  validate?: undefined;
18
18
  })[];
19
19
  };
@@ -20,6 +20,7 @@ class GenerateJobStub extends php_base_1.BasePhpStubStep {
20
20
  {
21
21
  name: 'classNamespace',
22
22
  type: 'text',
23
+ message: 'Class Namespace',
23
24
  },
24
25
  ],
25
26
  };
@@ -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,12 +36,15 @@ 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 = [];
43
43
  }
44
- const memMigrations = fs.all().map(f => f.path).filter(p => p.startsWith(paths.package('migrations')));
44
+ const memMigrations = fs
45
+ .all()
46
+ .map((f) => f.path)
47
+ .filter((p) => p.startsWith(paths.package('migrations')));
45
48
  return (0, migration_1.getNextMigrationName)([...persistedMigrations, ...memMigrations], this.params.name) + '.php';
46
49
  }
47
50
  }
@@ -19,7 +19,7 @@ export declare class GenerateModelStub extends BasePhpStubStep {
19
19
  } | {
20
20
  name: string;
21
21
  type: string;
22
- message?: undefined;
22
+ message: string;
23
23
  validate?: undefined;
24
24
  optional?: undefined;
25
25
  } | {
@@ -23,6 +23,7 @@ class GenerateModelStub extends php_base_1.BasePhpStubStep {
23
23
  {
24
24
  name: 'classNamespace',
25
25
  type: 'text',
26
+ message: 'Class Namespace',
26
27
  },
27
28
  {
28
29
  name: 'tableName',
@@ -15,7 +15,7 @@ export declare class GeneratePolicyStub extends BasePhpStubStep {
15
15
  } | {
16
16
  name: string;
17
17
  type: string;
18
- message?: undefined;
18
+ message: string;
19
19
  validate?: undefined;
20
20
  })[];
21
21
  };
@@ -24,6 +24,7 @@ class GeneratePolicyStub extends php_base_1.BasePhpStubStep {
24
24
  {
25
25
  name: 'classNamespace',
26
26
  type: 'text',
27
+ message: 'Class Namespace',
27
28
  },
28
29
  {
29
30
  name: 'modelClass',
@@ -34,6 +35,7 @@ class GeneratePolicyStub extends php_base_1.BasePhpStubStep {
34
35
  {
35
36
  name: 'modelClassName',
36
37
  type: 'text',
38
+ message: 'Class Namespace',
37
39
  },
38
40
  ],
39
41
  };
@@ -15,7 +15,7 @@ export declare class GenerateRepositoryStub extends BasePhpStubStep {
15
15
  } | {
16
16
  name: string;
17
17
  type: string;
18
- message?: undefined;
18
+ message: string;
19
19
  validate?: undefined;
20
20
  })[];
21
21
  };
@@ -24,6 +24,7 @@ class GenerateRepositoryStub extends php_base_1.BasePhpStubStep {
24
24
  {
25
25
  name: 'classNamespace',
26
26
  type: 'text',
27
+ message: 'Class Namespace',
27
28
  },
28
29
  {
29
30
  name: 'modelClass',
@@ -34,6 +35,7 @@ class GenerateRepositoryStub extends php_base_1.BasePhpStubStep {
34
35
  {
35
36
  name: 'modelClassName',
36
37
  type: 'text',
38
+ message: 'Class Namespace',
37
39
  },
38
40
  ],
39
41
  };
@@ -13,7 +13,7 @@ export declare class GenerateServiceProviderStub extends BasePhpStubStep {
13
13
  } | {
14
14
  name: string;
15
15
  type: string;
16
- message?: undefined;
16
+ message: string;
17
17
  validate?: undefined;
18
18
  })[];
19
19
  };
@@ -20,6 +20,7 @@ class GenerateServiceProviderStub extends php_base_1.BasePhpStubStep {
20
20
  {
21
21
  name: 'classNamespace',
22
22
  type: 'text',
23
+ message: 'Class Namespace',
23
24
  },
24
25
  ],
25
26
  };
@@ -13,7 +13,7 @@ export declare class GenerateValidatorStub extends BasePhpStubStep {
13
13
  } | {
14
14
  name: string;
15
15
  type: string;
16
- message?: undefined;
16
+ message: string;
17
17
  validate?: undefined;
18
18
  })[];
19
19
  };
@@ -20,6 +20,7 @@ class GenerateValidatorStub extends php_base_1.BasePhpStubStep {
20
20
  {
21
21
  name: 'classNamespace',
22
22
  type: 'text',
23
+ message: 'Class Namespace',
23
24
  },
24
25
  ],
25
26
  };
@@ -4,7 +4,7 @@ exports.FlarumBaseStubStep = void 0;
4
4
  const stub_base_1 = require("boilersmith/steps/stub-base");
5
5
  class FlarumBaseStubStep extends stub_base_1.BaseStubStep {
6
6
  async precompileParams(fs, paths, io) {
7
- return Object.assign(Object.assign({}, await super.precompileParams(fs, paths, io)), { extensionId: this.scaffolder.templateParamVal('extensionId', fs, paths, io) });
7
+ return Object.assign(Object.assign({}, (await super.precompileParams(fs, paths, io))), { extensionId: await this.scaffolder.templateParamVal('extensionId', fs, paths, io) });
8
8
  }
9
9
  }
10
10
  exports.FlarumBaseStubStep = FlarumBaseStubStep;
@@ -16,11 +16,6 @@ export declare class GenerateComponentStub extends BaseJsStubStep {
16
16
  type: string;
17
17
  message: string;
18
18
  validate: typeof Validator.className;
19
- } | {
20
- name: string;
21
- type: string;
22
- message?: undefined;
23
- validate?: undefined;
24
19
  })[];
25
20
  };
26
21
  }
@@ -26,6 +26,7 @@ class GenerateComponentStub extends js_base_1.BaseJsStubStep {
26
26
  {
27
27
  name: 'classNamespace',
28
28
  type: 'text',
29
+ message: 'Class Namespace',
29
30
  },
30
31
  ],
31
32
  };
@@ -16,11 +16,6 @@ export declare class GenerateModalStub extends BaseJsStubStep {
16
16
  type: string;
17
17
  message: string;
18
18
  validate: typeof Validator.className;
19
- } | {
20
- name: string;
21
- type: string;
22
- message?: undefined;
23
- validate?: undefined;
24
19
  })[];
25
20
  };
26
21
  }
@@ -26,6 +26,7 @@ class GenerateModalStub extends js_base_1.BaseJsStubStep {
26
26
  {
27
27
  name: 'classNamespace',
28
28
  type: 'text',
29
+ message: 'Class Namespace',
29
30
  },
30
31
  ],
31
32
  };
@@ -19,11 +19,6 @@ export declare class GenerateModelStub extends BaseJsStubStep {
19
19
  type: string;
20
20
  message: string;
21
21
  validate: typeof Validator.className;
22
- } | {
23
- name: string;
24
- type: string;
25
- message?: undefined;
26
- validate?: undefined;
27
22
  })[];
28
23
  };
29
24
  protected compileParams(fs: Store, paths: Paths, io: IO): Promise<Record<string, unknown>>;
@@ -27,6 +27,7 @@ class GenerateModelStub extends js_base_1.BaseJsStubStep {
27
27
  {
28
28
  name: 'classNamespace',
29
29
  type: 'text',
30
+ message: 'Class Namespace',
30
31
  },
31
32
  ],
32
33
  };
@@ -16,16 +16,19 @@ class BaseJsStubStep extends flarum_base_1.FlarumBaseStubStep {
16
16
  }
17
17
  async precompileParams(fs, paths, io) {
18
18
  const params = await super.precompileParams(fs, paths, io);
19
- const paramDefs = this.schema.params.filter(param => !this.implicitParams.includes(param.name));
20
- this.subdir = this.schema.forceRecommendedSubdir || paths.requestedDir() === null ? this.schema.recommendedSubdir : paths.requestedDir().slice(`${paths.package('js/src')}/`.length);
21
- params.frontend = await io.getParam(paramDefs.find(param => param.name === 'frontend'));
22
- params.className = await io.getParam(paramDefs.find(param => param.name === 'className'));
19
+ const paramDefs = this.schema.params.filter((param) => !this.implicitParams.includes(param.name));
20
+ this.subdir =
21
+ this.schema.forceRecommendedSubdir || paths.requestedDir() === null
22
+ ? this.schema.recommendedSubdir
23
+ : paths.requestedDir().slice(`${paths.package('js/src')}/`.length);
24
+ params.frontend = await io.getParam(paramDefs.find((param) => param.name === 'frontend'));
25
+ params.className = await io.getParam(paramDefs.find((param) => param.name === 'className'));
23
26
  this.subdir = (0, clone_and_fill_1.cloneAndFill)(this.subdir, params);
24
27
  params.classNamespace = `${this.subdir}/${params.className}`;
25
28
  return params;
26
29
  }
27
30
  async getFileName(_fs, _paths, io) {
28
- return await io.getParam({ name: 'className', type: 'text' }) + '.js';
31
+ return (await io.getParam({ name: 'className', message: 'File name', type: 'text' })) + '.js';
29
32
  }
30
33
  }
31
34
  exports.BaseJsStubStep = BaseJsStubStep;
@@ -15,35 +15,37 @@ class BasePhpStubStep extends flarum_base_1.FlarumBaseStubStep {
15
15
  return [...super.implicitParams, 'classNamespace'];
16
16
  }
17
17
  async precompileParams(fs, paths, io) {
18
- const params = Object.assign(Object.assign({}, await super.precompileParams(fs, paths, io)), { classNamespace: this.stubNamespace(await this.scaffolder.templateParamVal('packageNamespace', fs, paths, io), paths) });
19
- let paramDefs = this.schema.params.filter(param => !this.implicitParams.includes(param.name));
18
+ const params = Object.assign(Object.assign({}, (await super.precompileParams(fs, paths, io))), { classNamespace: this.stubNamespace(await this.scaffolder.templateParamVal('packageNamespace', fs, paths, io), paths) });
19
+ let paramDefs = this.schema.params.filter((param) => !this.implicitParams.includes(param.name));
20
20
  const classParams = [...this.phpClassParams];
21
- const classNameParam = paramDefs.find(param => param.name === 'className');
21
+ const classNameParam = paramDefs.find((param) => param.name === 'className');
22
22
  if (classNameParam) {
23
23
  params.className = await io.getParam(classNameParam);
24
24
  params.class = `${params.classNamespace}\\${params.className}`;
25
- paramDefs = paramDefs.filter(param => param.name !== 'class' && param.name !== 'className');
25
+ paramDefs = paramDefs.filter((param) => param.name !== 'class' && param.name !== 'className');
26
26
  }
27
27
  else {
28
28
  classParams.push('class');
29
29
  }
30
30
  for (const classParam of classParams) {
31
- const paramDef = this.schema.params.find(param => param.name === classParam);
31
+ const paramDef = this.schema.params.find((param) => param.name === classParam);
32
32
  if (!paramDef) {
33
33
  continue;
34
34
  }
35
35
  // eslint-disable-next-line no-await-in-loop
36
36
  params[classParam] = await io.getParam(paramDef);
37
37
  params[`${classParam}Name`] = params[classParam].split('\\').pop();
38
- paramDefs = paramDefs.filter(param => param.name !== classParam && param.name !== `${classParam}Name`);
38
+ paramDefs = paramDefs.filter((param) => param.name !== classParam && param.name !== `${classParam}Name`);
39
39
  }
40
40
  return params;
41
41
  }
42
42
  async getFileName(_fs, _paths, io) {
43
- return await io.getParam({ name: 'className', type: 'text' }) + '.php';
43
+ return (await io.getParam({ name: 'className', message: 'Class Name', type: 'text' })) + '.php';
44
44
  }
45
45
  stubNamespace(packageNamespace, paths) {
46
- const subdir = this.schema.forceRecommendedSubdir || paths.requestedDir() === null ? this.schema.recommendedSubdir.replace('\\', '.').replace('/', '.') : paths.requestedDir().slice(`${paths.package((this.schema.root || this.defaultRoot).replace('./', ''))}/`.length);
46
+ const subdir = this.schema.forceRecommendedSubdir || paths.requestedDir() === null
47
+ ? this.schema.recommendedSubdir.replace('\\', '.').replace('/', '.')
48
+ : paths.requestedDir().slice(`${paths.package((this.schema.root || this.defaultRoot).replace('./', ''))}/`.length);
47
49
  this.subdir = subdir.replace('.', '/');
48
50
  let namespace = packageNamespace;
49
51
  if (this.schema.root === './tests') {
@@ -18,7 +18,10 @@ class UpdateJSImports {
18
18
  const importMap = {};
19
19
  const jsSrcDir = paths.package('vendor/flarum/core/js/src');
20
20
  const vendorRegex = new RegExp(`${jsSrcDir}/.*(js|jsx|ts|tsx)`);
21
- const fsVendorFilePaths = fs.all().map(file => file.path).filter(path => path && vendorRegex.test(path));
21
+ const fsVendorFilePaths = fs
22
+ .all()
23
+ .map((file) => file.path)
24
+ .filter((path) => path && vendorRegex.test(path));
22
25
  const persistedVendorFilePaths = globby_1.default.sync(`${jsSrcDir}/**/*.{js,jsx,ts,tsx}`);
23
26
  for (const currPath of [...fsVendorFilePaths, ...persistedVendorFilePaths]) {
24
27
  const withNamespace = currPath.slice(jsSrcDir.length + 1).replace(/\.(js|jsx|ts|tsx)$/, '');
@@ -26,7 +29,10 @@ class UpdateJSImports {
26
29
  importMap[`flarum/${noNamespace}`] = `flarum/${withNamespace}`;
27
30
  }
28
31
  const srcRegex = new RegExp(`${paths.package('js/src')}/.*(js|jsx|ts|tsx)`);
29
- const fsSrcFilePaths = fs.all().map(file => file.path).filter(path => path && srcRegex.test(path));
32
+ const fsSrcFilePaths = fs
33
+ .all()
34
+ .map((file) => file.path)
35
+ .filter((path) => path && srcRegex.test(path));
30
36
  const persistedSrcFilePaths = globby_1.default.sync(paths.package('js/src/**/*.{js,jsx,ts,tsx}'));
31
37
  for (const match of [...fsSrcFilePaths, ...persistedSrcFilePaths]) {
32
38
  let fileCounted = false;
@@ -47,6 +47,7 @@ export declare type ComposerJsonSchema = {
47
47
  extra?: {
48
48
  'flarum-cli'?: {
49
49
  excludeScaffolding?: string[];
50
+ excludeScaffoldingConfigKeys: Record<string, string[]>;
50
51
  mainGitBranch?: string;
51
52
  modules?: Record<ExtensionModules, boolean>;
52
53
  };
@@ -10,7 +10,9 @@ function getNextMigrationName(currNames, name) {
10
10
  if (!match)
11
11
  continue;
12
12
  const now = new Date();
13
- if (Number.parseInt(match[1], 10) === now.getFullYear() && Number.parseInt(match[2], 10) === now.getMonth() + 1 && Number.parseInt(match[3], 10) === now.getDate()) {
13
+ if (Number.parseInt(match[1], 10) === now.getFullYear() &&
14
+ Number.parseInt(match[2], 10) === now.getMonth() + 1 &&
15
+ Number.parseInt(match[3], 10) === now.getDate()) {
14
16
  number = Number.parseInt(match[4], 10) + 1;
15
17
  break;
16
18
  }
@@ -0,0 +1,24 @@
1
+ import { Store } from 'mem-fs';
2
+ import { Paths } from 'boilersmith/paths';
3
+ export declare function npmPath(name: string): string;
4
+ export declare function composerPath(name: string): string;
5
+ export declare function extensionPath(name: string): string;
6
+ export declare function corePath(_name: string): string;
7
+ declare type PackageInfo = {
8
+ name: string;
9
+ gitRemote: string;
10
+ /**
11
+ * Defaults to `main`.
12
+ */
13
+ mainBranch?: string;
14
+ };
15
+ export declare type FlarumMonorepoJsonSchema = {
16
+ packages: {
17
+ core?: PackageInfo;
18
+ extensions: PackageInfo[];
19
+ composer?: PackageInfo[];
20
+ npm?: PackageInfo[];
21
+ };
22
+ };
23
+ export declare function getMonorepoConf(fs: Store, paths: Paths): FlarumMonorepoJsonSchema;
24
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMonorepoConf = exports.corePath = exports.extensionPath = exports.composerPath = exports.npmPath = void 0;
4
+ const mem_fs_editor_1 = require("mem-fs-editor");
5
+ function npmPath(name) {
6
+ return `js-packages/${name}`;
7
+ }
8
+ exports.npmPath = npmPath;
9
+ function composerPath(name) {
10
+ return `php-packages/${name}`;
11
+ }
12
+ exports.composerPath = composerPath;
13
+ function extensionPath(name) {
14
+ return `extensions/${name}`;
15
+ }
16
+ exports.extensionPath = extensionPath;
17
+ function corePath(_name) {
18
+ return 'framework/core';
19
+ }
20
+ exports.corePath = corePath;
21
+ function getMonorepoConf(fs, paths) {
22
+ return (0, mem_fs_editor_1.create)(fs).readJSON(paths.package('flarum-monorepo.json'));
23
+ }
24
+ exports.getMonorepoConf = getMonorepoConf;
@@ -8,5 +8,7 @@ export declare class Validator {
8
8
  static migrationName(s: string): ValidatorFunc;
9
9
  static tableName(s: string): ValidatorFunc;
10
10
  static modelType(s: string): ValidatorFunc;
11
+ static fileName(s: string): ValidatorFunc;
12
+ static gitRepo(s: string): ValidatorFunc;
11
13
  }
12
14
  export {};
@@ -26,5 +26,11 @@ class Validator {
26
26
  static modelType(s) {
27
27
  return /^[\w-]+$/.test(s.trim()) || 'Field is required; alphanumerical characters, dashes, and underscores only!';
28
28
  }
29
+ static fileName(s) {
30
+ return /^[\w-]+$/.test(s.trim()) || 'Field is required; alphanumerical characters, dashes, and underscores only!';
31
+ }
32
+ static gitRepo(s) {
33
+ return /^((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w./:@~-]+)(\.git)(\/)?$/.test(s.trim()) || 'Invalid git repo URL.';
34
+ }
29
35
  }
30
36
  exports.Validator = Validator;
@@ -1 +1 @@
1
- {"version":"2.0.0-beta.8","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","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?"}]},"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","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,16 +1,18 @@
1
1
  {
2
2
  "name": "@flarum/cli",
3
3
  "description": "A CLI for developing Flarum extensions",
4
- "version": "2.0.0-beta.8",
4
+ "version": "2.0.0",
5
5
  "author": "Flarum Team",
6
6
  "bin": {
7
7
  "fl": "bin/run",
8
+ "fl1": "bin/run",
8
9
  "flarum-cli": "bin/run"
9
10
  },
10
11
  "bugs": "https://github.com/flarum/cli/issues",
11
12
  "devDependencies": {
12
13
  "@babel/core": "^7.0.0",
13
14
  "@babel/preset-env": "^7.14.2",
15
+ "@flarum/prettier-config": "^1.0.0",
14
16
  "@oclif/dev-cli": "^1.26.0",
15
17
  "@oclif/test": "^1.2.8",
16
18
  "@types/chai": "^4.2.20",
@@ -30,11 +32,13 @@
30
32
  "eslint": "^7.32.0",
31
33
  "eslint-config-oclif": "^4.0.0",
32
34
  "eslint-config-oclif-typescript": "1.0.2",
35
+ "eslint-config-prettier": "^8.3.0",
33
36
  "eslint-import-resolver-babel-module": "^5.3.1",
34
37
  "eslint-import-resolver-typescript": "^2.5.0",
35
38
  "eslint-plugin-import": "^2.25.3",
36
39
  "jest": "^27.4.5",
37
40
  "jest-extended": "^1.2.0",
41
+ "prettier": "^2.5.1",
38
42
  "ts-jest": "^27.1.2",
39
43
  "ts-node": "^8.10.2",
40
44
  "tsconfig-paths": "^3.12.0",
@@ -81,20 +85,23 @@
81
85
  },
82
86
  "audit": {
83
87
  "description": "Checks for potential errors / updatable parts of a Flarum extension."
88
+ },
89
+ "update": {
90
+ "description": "Helper commands to update extensions for new versions of Flarum Core."
84
91
  }
85
92
  },
86
93
  "plugins": [
87
94
  "@oclif/plugin-help",
88
- "@oclif/plugin-plugins",
89
95
  "@oclif/plugin-version"
90
96
  ]
91
97
  },
92
98
  "repository": "flarum/cli",
99
+ "prettier": "@flarum/prettier-config",
93
100
  "scripts": {
94
101
  "oclif-dev": "node -r tsconfig-paths/register node_modules/.bin/oclif-dev",
95
- "format": "eslint . --ext .ts --config .eslintrc --fix",
102
+ "format": "eslint . --ext .ts --config .eslintrc --fix && prettier --write .",
96
103
  "postpack": "rm -f oclif.manifest.json",
97
- "posttest": "eslint . --ext .ts --config .eslintrc && tsc --build --dry",
104
+ "posttest": "prettier --check . && eslint . --ext .ts --config .eslintrc && tsc --build --dry",
98
105
  "prepack": "rm -rf lib && tsc --project tsconfig.build.json && yarn oclif-dev manifest && yarn oclif-dev readme",
99
106
  "test": "jest",
100
107
  "version": "yarn oclif-dev readme && git add README.md"
@@ -104,7 +111,6 @@
104
111
  "@oclif/core": "^1.0.11",
105
112
  "@oclif/errors": "^1.3.5",
106
113
  "@oclif/plugin-help": "^5",
107
- "@oclif/plugin-plugins": "^2.0.11",
108
114
  "@oclif/plugin-version": "^1",
109
115
  "chalk": "^2.4.2",
110
116
  "cli-ux": "^6.0.6",
@@ -1,12 +1,12 @@
1
1
  {
2
- "name": "flarum/cli-php-util",
3
- "type": "library",
4
- "require": {
5
- "nikic/php-parser": "^4.10"
6
- },
7
- "autoload": {
8
- "psr-4": {
9
- "Flarum\\CliPhpSubsystem\\": "src/"
10
- }
2
+ "name": "flarum/cli-php-util",
3
+ "type": "library",
4
+ "require": {
5
+ "nikic/php-parser": "^4.10"
6
+ },
7
+ "autoload": {
8
+ "psr-4": {
9
+ "Flarum\\CliPhpSubsystem\\": "src/"
11
10
  }
11
+ }
12
12
  }