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

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 (113) hide show
  1. package/README.md +176 -43
  2. package/boilerplate/skeleton/extension/.gitattributes +1 -0
  3. package/boilerplate/skeleton/extension/.github/workflows/backend.yml +1 -1
  4. package/boilerplate/skeleton/extension/.github/workflows/frontend.yml +3 -1
  5. package/boilerplate/skeleton/extension/LICENSE.md +1 -1
  6. package/boilerplate/skeleton/extension/composer.json +4 -2
  7. package/boilerplate/skeleton/extension/extend.php +2 -2
  8. package/boilerplate/skeleton/extension/js/package.json +4 -1
  9. package/boilerplate/skeleton/extension/tests/phpunit.integration.xml +1 -0
  10. package/lib/base-command.d.ts +3 -1
  11. package/lib/base-command.js +27 -14
  12. package/lib/boilersmith/io.d.ts +28 -8
  13. package/lib/boilersmith/io.js +4 -2
  14. package/lib/boilersmith/paths.d.ts +2 -2
  15. package/lib/boilersmith/paths.js +2 -2
  16. package/lib/boilersmith/scaffolding/audit-step-factory.js +10 -10
  17. package/lib/boilersmith/scaffolding/infra-step-factory.js +2 -2
  18. package/lib/boilersmith/scaffolding/init-step-factory.js +5 -5
  19. package/lib/boilersmith/scaffolding/module.d.ts +19 -8
  20. package/lib/boilersmith/scaffolding/module.js +30 -17
  21. package/lib/boilersmith/scaffolding/scaffolder.d.ts +4 -1
  22. package/lib/boilersmith/scaffolding/scaffolder.js +29 -29
  23. package/lib/boilersmith/scaffolding/template-param.d.ts +1 -1
  24. package/lib/boilersmith/scaffolding/template-param.js +2 -2
  25. package/lib/boilersmith/step-manager.d.ts +0 -1
  26. package/lib/boilersmith/step-manager.js +10 -20
  27. package/lib/boilersmith/steps/stub-base.js +1 -1
  28. package/lib/boilersmith/utils/clone-and-fill.js +1 -1
  29. package/lib/boilersmith/utils/commit-async.d.ts +2 -0
  30. package/lib/boilersmith/utils/commit-async.js +15 -0
  31. package/lib/commands/audit/infra.d.ts +1 -1
  32. package/lib/commands/audit/infra.js +30 -8
  33. package/lib/commands/infra.d.ts +2 -2
  34. package/lib/commands/infra.js +18 -12
  35. package/lib/commands/init.d.ts +1 -1
  36. package/lib/commands/init.js +4 -2
  37. package/lib/commands/make/backend/api-controller.js +1 -2
  38. package/lib/commands/make/backend/api-serializer-attributes.js +1 -2
  39. package/lib/commands/make/backend/command.js +1 -2
  40. package/lib/commands/make/backend/event-listener.js +1 -2
  41. package/lib/commands/make/backend/handler.js +2 -5
  42. package/lib/commands/make/backend/integration-test.js +2 -4
  43. package/lib/commands/make/backend/migration.js +1 -2
  44. package/lib/commands/make/backend/model.js +1 -2
  45. package/lib/commands/make/backend/policy.js +1 -2
  46. package/lib/commands/make/backend/route.js +1 -2
  47. package/lib/commands/make/backend/service-provider.js +1 -2
  48. package/lib/commands/make/frontend/model.js +2 -5
  49. package/lib/commands/monorepo/create.d.ts +15 -0
  50. package/lib/commands/monorepo/create.js +20 -0
  51. package/lib/commands/update/js-imports.js +1 -2
  52. package/lib/help.js +1 -1
  53. package/lib/steps/gen-ext-scaffolder.d.ts +2 -2
  54. package/lib/steps/gen-ext-scaffolder.js +144 -46
  55. package/lib/steps/js/base.js +2 -4
  56. package/lib/steps/js/model.js +4 -4
  57. package/lib/steps/misc/git.d.ts +1 -1
  58. package/lib/steps/misc/git.js +2 -2
  59. package/lib/steps/misc/npm.d.ts +11 -0
  60. package/lib/steps/misc/npm.js +19 -0
  61. package/lib/steps/monorepo/create.d.ts +17 -0
  62. package/lib/steps/monorepo/create.js +181 -0
  63. package/lib/steps/stubs/backend/api-controller.d.ts +1 -1
  64. package/lib/steps/stubs/backend/api-controller.js +3 -0
  65. package/lib/steps/stubs/backend/api-serializer.d.ts +1 -1
  66. package/lib/steps/stubs/backend/api-serializer.js +3 -0
  67. package/lib/steps/stubs/backend/command.d.ts +0 -5
  68. package/lib/steps/stubs/backend/command.js +1 -0
  69. package/lib/steps/stubs/backend/event-listener.d.ts +1 -1
  70. package/lib/steps/stubs/backend/event-listener.js +2 -0
  71. package/lib/steps/stubs/backend/handler-command.d.ts +1 -1
  72. package/lib/steps/stubs/backend/handler-command.js +1 -0
  73. package/lib/steps/stubs/backend/handler.d.ts +1 -1
  74. package/lib/steps/stubs/backend/handler.js +4 -0
  75. package/lib/steps/stubs/backend/integration-test.d.ts +1 -1
  76. package/lib/steps/stubs/backend/integration-test.js +2 -0
  77. package/lib/steps/stubs/backend/job.d.ts +1 -1
  78. package/lib/steps/stubs/backend/job.js +1 -0
  79. package/lib/steps/stubs/backend/migration.js +4 -1
  80. package/lib/steps/stubs/backend/model.d.ts +1 -1
  81. package/lib/steps/stubs/backend/model.js +1 -0
  82. package/lib/steps/stubs/backend/policy.d.ts +1 -1
  83. package/lib/steps/stubs/backend/policy.js +2 -0
  84. package/lib/steps/stubs/backend/repository.d.ts +1 -1
  85. package/lib/steps/stubs/backend/repository.js +2 -0
  86. package/lib/steps/stubs/backend/service-provider.d.ts +1 -1
  87. package/lib/steps/stubs/backend/service-provider.js +1 -0
  88. package/lib/steps/stubs/backend/validator.d.ts +1 -1
  89. package/lib/steps/stubs/backend/validator.js +1 -0
  90. package/lib/steps/stubs/flarum-base.js +1 -1
  91. package/lib/steps/stubs/frontend/component.d.ts +0 -5
  92. package/lib/steps/stubs/frontend/component.js +1 -0
  93. package/lib/steps/stubs/frontend/modal.d.ts +0 -5
  94. package/lib/steps/stubs/frontend/modal.js +1 -0
  95. package/lib/steps/stubs/frontend/model.d.ts +0 -5
  96. package/lib/steps/stubs/frontend/model.js +1 -0
  97. package/lib/steps/stubs/js-base.js +8 -5
  98. package/lib/steps/stubs/php-base.js +10 -8
  99. package/lib/steps/update/js-imports.js +8 -2
  100. package/lib/utils/composer.d.ts +1 -0
  101. package/lib/utils/migration.js +3 -1
  102. package/lib/utils/monorepo.d.ts +24 -0
  103. package/lib/utils/monorepo.js +24 -0
  104. package/lib/utils/validation.d.ts +2 -0
  105. package/lib/utils/validation.js +6 -0
  106. package/oclif.manifest.json +1 -1
  107. package/package.json +10 -5
  108. package/php-subsystem/composer.json +9 -9
  109. package/php-subsystem/composer.lock +64 -71
  110. package/php-subsystem/vendor/composer/installed.json +54 -61
  111. package/php-subsystem/vendor/nikic/php-parser/README.md +55 -59
  112. package/php-subsystem/vendor/nikic/php-parser/composer.json +39 -39
  113. package/php-subsystem/vendor/nikic/php-parser/grammar/README.md +17 -20
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MonorepoCreate = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /* eslint-disable no-await-in-loop */
6
+ const node_child_process_1 = require("node:child_process");
7
+ const monorepo_1 = require("../../utils/monorepo");
8
+ const cond_format_1 = require("boilersmith/utils/cond-format");
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");
13
+ const simple_git_1 = (0, tslib_1.__importDefault)(require("simple-git"));
14
+ const mem_fs_editor_1 = require("mem-fs-editor");
15
+ const commit_async_1 = require("boilersmith/utils/commit-async");
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 });
21
+ await (0, simple_git_1.default)(tmpDir).branch(['REWRITE']);
22
+ await (0, simple_git_1.default)(tmpDir).checkout('REWRITE');
23
+ // Merge from remote
24
+ const remoteName = path.replace('/', '_').replace('-', '_');
25
+ 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 });
28
+ await (0, simple_git_1.default)(cwd).removeRemote(remoteName);
29
+ (0, node_fs_1.rmSync)(tmpDir, { recursive: true, force: true });
30
+ }
31
+ function makeRunCommitStep(cwd, fs, io, paths, providers) {
32
+ return async function (packagePaths, step, message) {
33
+ for (const path of packagePaths) {
34
+ await step.run(fs, paths.onMonorepoSub((0, node_path_1.resolve)(cwd, path), cwd), io, providers);
35
+ }
36
+ await (0, commit_async_1.commitAsync)(fs);
37
+ await commitAll(cwd, message);
38
+ };
39
+ }
40
+ async function getMonorepoConf(io, monorepoConfPath) {
41
+ var _a;
42
+ if (monorepoConfPath) {
43
+ return JSON.parse((0, node_fs_1.readFileSync)(monorepoConfPath, 'utf8'));
44
+ }
45
+ const packages = { extensions: [], composer: [], npm: [] };
46
+ // eslint-disable-next-line no-constant-condition
47
+ while (true) {
48
+ const confirm = await io.getParam({
49
+ name: 'confirm',
50
+ type: 'confirm',
51
+ initial: true,
52
+ message: 'Add another package to monorepo?',
53
+ }, true);
54
+ if (!confirm)
55
+ break;
56
+ const packageType = (await io.getParam({
57
+ name: 'packageType',
58
+ message: 'Package Type',
59
+ type: 'select',
60
+ choices: [
61
+ { title: 'Flarum Extension', value: 'extensions' },
62
+ { title: 'Composer PHP Package', value: 'composer' },
63
+ { title: 'NPM JS/TS Package', value: 'npm' },
64
+ { title: 'Flarum Core', value: 'core' },
65
+ ],
66
+ validate: (value) => value !== 'core' || !packages.core || 'A core package has already been specified.',
67
+ }, true));
68
+ const packageName = await io.getParam({
69
+ name: 'name',
70
+ message: 'Package Name (used to generate subdirectory path)',
71
+ type: 'text',
72
+ validate: validation_1.Validator.fileName,
73
+ }, true);
74
+ const gitRemote = await io.getParam({
75
+ name: 'remote',
76
+ message: 'Git remote (e.g. git@github.com:flarum/core.git)',
77
+ type: 'text',
78
+ validate: validation_1.Validator.gitRepo,
79
+ }, true);
80
+ const packageInfo = {
81
+ name: packageName,
82
+ gitRemote,
83
+ };
84
+ if (packageType === 'core') {
85
+ packages.core = packageInfo;
86
+ }
87
+ else {
88
+ const typePackages = (_a = packages[packageType]) !== null && _a !== void 0 ? _a : [];
89
+ typePackages.push(packageInfo);
90
+ packages[packageType] = typePackages;
91
+ }
92
+ }
93
+ return { packages };
94
+ }
95
+ async function commitAll(cwd, message) {
96
+ await (0, simple_git_1.default)(cwd).add('.');
97
+ await (0, simple_git_1.default)(cwd).commit(message);
98
+ }
99
+ class MonorepoCreate {
100
+ constructor(scaffolder, monorepoConfPath) {
101
+ this.type = 'Create a monorepo of Flarum extensions';
102
+ this.composable = false;
103
+ this.exposes = [];
104
+ this.scaffolder = scaffolder;
105
+ this.monorepoConfPath = monorepoConfPath;
106
+ }
107
+ async run(fs, paths, io, providers) {
108
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
109
+ const target = (_a = paths.requestedDir()) !== null && _a !== void 0 ? _a : paths.package('flarum_monorepo');
110
+ const confirmTarget = await io.getParam({
111
+ name: 'confirmTarget',
112
+ message: `Create monorepo in directory: "${(0, cond_format_1.condFormat)(io.supportsAnsiColor, chalk_1.default.dim, target)}" (will be overwritten)?`,
113
+ type: 'confirm',
114
+ initial: true,
115
+ });
116
+ if (!confirmTarget) {
117
+ io.error('Target not confirmed', true);
118
+ return fs;
119
+ }
120
+ const conf = await getMonorepoConf(io, this.monorepoConfPath ? paths.cwd(this.monorepoConfPath) : undefined);
121
+ 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);
124
+ await (0, simple_git_1.default)(target).init();
125
+ 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);
127
+ }
128
+ 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);
130
+ }
131
+ 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);
133
+ }
134
+ if (conf.packages.core) {
135
+ await addGitPackage(target, (0, monorepo_1.corePath)(conf.packages.core.name), conf.packages.core.gitRemote);
136
+ }
137
+ 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
+ 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
+ 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));
142
+ }
143
+ flarumPaths.forEach((path) => {
144
+ (0, node_fs_1.rmSync)((0, node_path_1.resolve)(target, path, '.github'), { force: true, recursive: true });
145
+ });
146
+ [...npmPaths, ...composerPaths, ...flarumPaths].forEach((path) => {
147
+ (0, node_fs_1.rmSync)((0, node_path_1.resolve)(target, path, '.styleci.yml'), { force: true });
148
+ });
149
+ await commitAll(target, [
150
+ 'chore: remove centralizable repo config',
151
+ '- Remove .github conf folder from Flarum packages',
152
+ '- Remove styleci config from all packages',
153
+ ]);
154
+ (0, mem_fs_editor_1.create)(fs).writeJSON((0, node_path_1.resolve)(target, 'flarum-monorepo.json'), conf);
155
+ await (0, commit_async_1.commitAsync)(fs);
156
+ await commitAll(target, 'chore: add monorepo config file');
157
+ [...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"'));
165
+ });
166
+ [...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 });
169
+ });
170
+ 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);
172
+ await (0, commit_async_1.commitAsync)(fs);
173
+ await commitAll(target, 'chore: add monorepo config file');
174
+ await runCommitStep(flarumPaths, this.scaffolder.genAuditStep(false), 'chore: flarum-cli audit infra --fix');
175
+ return fs;
176
+ }
177
+ getExposed() {
178
+ return {};
179
+ }
180
+ }
181
+ exports.MonorepoCreate = MonorepoCreate;
@@ -17,7 +17,7 @@ export declare class GenerateApiControllerStub extends BasePhpStubStep {
17
17
  } | {
18
18
  name: string;
19
19
  type: string;
20
- message?: undefined;
20
+ message: string;
21
21
  validate?: undefined;
22
22
  choices?: undefined;
23
23
  optional?: undefined;
@@ -24,6 +24,7 @@ class GenerateApiControllerStub 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: 'classType',
@@ -43,6 +44,7 @@ class GenerateApiControllerStub extends php_base_1.BasePhpStubStep {
43
44
  {
44
45
  name: 'serializerClassName',
45
46
  type: 'text',
47
+ message: 'Serializer class name',
46
48
  },
47
49
  {
48
50
  name: 'handlerCommandClass',
@@ -54,6 +56,7 @@ class GenerateApiControllerStub extends php_base_1.BasePhpStubStep {
54
56
  {
55
57
  name: 'handlerCommandClassName',
56
58
  type: 'text',
59
+ message: 'Handler command class name',
57
60
  },
58
61
  ],
59
62
  };
@@ -19,7 +19,7 @@ export declare class GenerateApiSerializerStub extends BasePhpStubStep {
19
19
  } | {
20
20
  name: string;
21
21
  type: string;
22
- message?: undefined;
22
+ message: string;
23
23
  validate?: undefined;
24
24
  })[];
25
25
  };
@@ -26,6 +26,7 @@ class GenerateApiSerializerStub extends php_base_1.BasePhpStubStep {
26
26
  {
27
27
  name: 'classNamespace',
28
28
  type: 'text',
29
+ message: 'Class Namespace',
29
30
  },
30
31
  {
31
32
  name: 'modelClass',
@@ -36,10 +37,12 @@ class GenerateApiSerializerStub extends php_base_1.BasePhpStubStep {
36
37
  {
37
38
  name: 'modelClassName',
38
39
  type: 'text',
40
+ message: 'Model class name',
39
41
  },
40
42
  {
41
43
  name: 'modelType',
42
44
  type: 'text',
45
+ message: 'Model type',
43
46
  },
44
47
  ],
45
48
  };
@@ -12,11 +12,6 @@ export declare class GenerateCommandStub extends BasePhpStubStep {
12
12
  type: string;
13
13
  message: string;
14
14
  validate: typeof Validator.className;
15
- } | {
16
- name: string;
17
- type: string;
18
- message?: undefined;
19
- validate?: undefined;
20
15
  } | {
21
16
  name: string;
22
17
  type: string;
@@ -24,6 +24,7 @@ class GenerateCommandStub 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: 'commandName',
@@ -15,7 +15,7 @@ export declare class GenerateEventListenerStub 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 GenerateEventListenerStub 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: 'eventClass',
@@ -34,6 +35,7 @@ class GenerateEventListenerStub extends php_base_1.BasePhpStubStep {
34
35
  {
35
36
  name: 'eventClassName',
36
37
  type: 'text',
38
+ message: 'Event Class Name',
37
39
  },
38
40
  ],
39
41
  };
@@ -16,7 +16,7 @@ export declare class GenerateHandlerCommandStub extends BasePhpStubStep {
16
16
  } | {
17
17
  name: string;
18
18
  type: string;
19
- message?: undefined;
19
+ message: string;
20
20
  validate?: undefined;
21
21
  choices?: undefined;
22
22
  } | {
@@ -24,6 +24,7 @@ class GenerateHandlerCommandStub 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: 'classType',
@@ -17,7 +17,7 @@ export declare class GenerateHandlerStub extends BasePhpStubStep {
17
17
  } | {
18
18
  name: string;
19
19
  type: string;
20
- message?: undefined;
20
+ message: string;
21
21
  validate?: undefined;
22
22
  optional?: undefined;
23
23
  } | {
@@ -26,6 +26,7 @@ class GenerateHandlerStub extends php_base_1.BasePhpStubStep {
26
26
  {
27
27
  name: 'classNamespace',
28
28
  type: 'text',
29
+ message: 'Class Namespace',
29
30
  },
30
31
  {
31
32
  name: 'handlerCommandClass',
@@ -36,6 +37,7 @@ class GenerateHandlerStub extends php_base_1.BasePhpStubStep {
36
37
  {
37
38
  name: 'handlerCommandClassName',
38
39
  type: 'text',
40
+ message: 'Handler command class name',
39
41
  },
40
42
  {
41
43
  name: 'repositoryClass',
@@ -46,6 +48,7 @@ class GenerateHandlerStub extends php_base_1.BasePhpStubStep {
46
48
  {
47
49
  name: 'repositoryClassName',
48
50
  type: 'text',
51
+ message: 'Repository Class Name',
49
52
  },
50
53
  {
51
54
  name: 'validatorClass',
@@ -56,6 +59,7 @@ class GenerateHandlerStub extends php_base_1.BasePhpStubStep {
56
59
  {
57
60
  name: 'validatorClassName',
58
61
  type: 'text',
62
+ message: 'Validator Class Name',
59
63
  },
60
64
  ],
61
65
  };
@@ -16,7 +16,7 @@ export declare class GenerateIntegrationTestStub extends BasePhpStubStep {
16
16
  } | {
17
17
  name: string;
18
18
  type: string;
19
- message?: undefined;
19
+ message: string;
20
20
  validate?: undefined;
21
21
  })[];
22
22
  };
@@ -23,10 +23,12 @@ class GenerateIntegrationTestStub 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: 'extensionId',
29
30
  type: 'text',
31
+ message: 'Extension Id',
30
32
  },
31
33
  ],
32
34
  };
@@ -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
  };
@@ -41,7 +41,10 @@ class GenerateMigrationStub extends php_base_1.BasePhpStubStep {
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: 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;