@flarum/cli 3.0.11 → 3.0.12
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.
- package/README.md +1 -1
- package/bin/libgit2.1.5.dylib +0 -0
- package/bin/splitsh-lite-darwin-arm64 +0 -0
- package/boilerplate/skeleton/extension/js/package.json +1 -1
- package/boilerplate/skeleton/extension/phpstan.neon +0 -1
- package/boilerplate/skeleton/extension/tests/phpunit.integration.xml +1 -0
- package/boilerplate/skeleton/extension/tests/phpunit.unit.xml +2 -1
- package/lib/commands/monorepo/split.js +1 -1
- package/lib/steps/monorepo/split.d.ts +2 -1
- package/lib/steps/monorepo/split.js +20 -5
- package/lib/steps/upgrade/twopointoh/backend/phpunit-xml.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/phpunit-xml.js +33 -0
- package/lib/steps/upgrade/twopointoh/backend/phpunit.js +21 -16
- package/lib/steps/upgrade/twopointoh/base.js +50 -13
- package/lib/steps/upgrade/twopointoh/dependencies.js +10 -5
- package/lib/steps/upgrade/twopointoh/step-failures.d.ts +24 -0
- package/lib/steps/upgrade/twopointoh/step-failures.js +48 -0
- package/lib/utils/ast.js +3 -9
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ $ npm install -g @flarum/cli
|
|
|
49
49
|
$ flarum-cli COMMAND
|
|
50
50
|
running command...
|
|
51
51
|
$ flarum-cli (-v|--version|version)
|
|
52
|
-
@flarum/cli/3.0.
|
|
52
|
+
@flarum/cli/3.0.12 darwin-arm64 node-v26.6.0
|
|
53
53
|
$ flarum-cli --help [COMMAND]
|
|
54
54
|
USAGE
|
|
55
55
|
$ flarum-cli COMMAND
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<phpunit
|
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
-
xsi:noNamespaceSchemaLocation="
|
|
4
|
+
xsi:noNamespaceSchemaLocation="../vendor/phpunit/phpunit/phpunit.xsd"
|
|
5
5
|
backupGlobals="false"
|
|
6
6
|
cacheDirectory=".phpunit.cache"
|
|
7
7
|
backupStaticProperties="false"
|
|
8
8
|
colors="true"
|
|
9
|
+
displayDetailsOnTestsThatTriggerWarnings="true"
|
|
9
10
|
processIsolation="false"
|
|
10
11
|
stopOnFailure="false"
|
|
11
12
|
>
|
|
@@ -10,7 +10,7 @@ class Split extends base_command_1.default {
|
|
|
10
10
|
this.requireExistingExtension = false;
|
|
11
11
|
}
|
|
12
12
|
steps(stepManager) {
|
|
13
|
-
return stepManager.step(new split_1.MonorepoSplit(this.flags.force));
|
|
13
|
+
return stepManager.step(new split_1.MonorepoSplit(this.flags.force, this.flags['no-interaction']));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.default = Split;
|
|
@@ -8,7 +8,8 @@ export declare class MonorepoSplit implements Step<FlarumProviders> {
|
|
|
8
8
|
composable: boolean;
|
|
9
9
|
exposes: never[];
|
|
10
10
|
force?: boolean;
|
|
11
|
-
|
|
11
|
+
noInteraction?: boolean;
|
|
12
|
+
constructor(force: boolean, noInteraction?: boolean);
|
|
12
13
|
run(fs: Store, paths: Paths, io: IO, _providers: FlarumProviders): Promise<Store>;
|
|
13
14
|
getExposed(): Record<string, unknown>;
|
|
14
15
|
}
|
|
@@ -43,28 +43,43 @@ async function splitAndPush(cwd, splitExecPath, splitPath, remoteName, remoteBra
|
|
|
43
43
|
}
|
|
44
44
|
async function cleanupBranchAndRemote(cwd, name) {
|
|
45
45
|
await (0, simple_git_1.default)(cwd).removeRemote(name);
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
try {
|
|
47
|
+
const tmpBranch = `${name}-tmp`;
|
|
48
|
+
(0, child_process_1.execSync)(`git branch -D ${tmpBranch}`, { cwd, stdio: 'ignore' });
|
|
49
|
+
}
|
|
50
|
+
catch (_a) {
|
|
51
|
+
// A forced split pushes the split sha straight to the remote, so it never
|
|
52
|
+
// creates the temp branch this deletes.
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
class MonorepoSplit {
|
|
50
|
-
constructor(force) {
|
|
56
|
+
constructor(force, noInteraction = false) {
|
|
51
57
|
this.type = 'Split monorepo changes to the respective cloned repos.';
|
|
52
58
|
this.composable = false;
|
|
53
59
|
this.exposes = [];
|
|
54
60
|
this.force = force;
|
|
61
|
+
this.noInteraction = noInteraction;
|
|
55
62
|
}
|
|
56
63
|
async run(fs, paths, io, _providers) {
|
|
57
64
|
var _a, _b, _c, _d;
|
|
58
65
|
const platform = process.platform;
|
|
66
|
+
const arch = process.arch;
|
|
59
67
|
if (platform !== 'linux' && platform !== 'darwin') {
|
|
60
68
|
io.error(`Your platform, "${platform}", is not supported. Split can only be run on linux and mac`, true);
|
|
61
69
|
return fs;
|
|
62
70
|
}
|
|
63
|
-
if (this.force &&
|
|
71
|
+
if (this.force &&
|
|
72
|
+
!this.noInteraction &&
|
|
73
|
+
!(await io.getParam({ type: 'confirm', name: 'confirm', initial: false, message: 'Are you sure you want to force split?' }))) {
|
|
64
74
|
io.error('Decided not to force push', true);
|
|
65
75
|
return fs;
|
|
66
76
|
}
|
|
67
|
-
|
|
77
|
+
// Select the appropriate binary based on platform and architecture
|
|
78
|
+
let splitExec;
|
|
79
|
+
splitExec =
|
|
80
|
+
platform === 'darwin' && arch === 'arm64'
|
|
81
|
+
? (0, path_1.resolve)(__dirname, `../../../bin/splitsh-lite-darwin-arm64`)
|
|
82
|
+
: (0, path_1.resolve)(__dirname, `../../../bin/splitsh-lite-${platform}`);
|
|
68
83
|
const target = (_a = paths.requestedDir()) !== null && _a !== void 0 ? _a : paths.package();
|
|
69
84
|
await (0, simple_git_1.default)(target).pull();
|
|
70
85
|
const conf = (0, monorepo_1.getMonorepoConf)(fs, paths);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a PHPUnit 9-era config to the shape the CLI scaffolds for 2.x
|
|
3
|
+
* extensions: schema resolved from the vendored phpunit, the attributes
|
|
4
|
+
* PHPUnit 10 removed dropped or renamed, coverage's include list moved to
|
|
5
|
+
* <source>, the Mockery listener block removed, and warning details enabled
|
|
6
|
+
* so flarum/testing's query guard is visible in the output.
|
|
7
|
+
*/
|
|
8
|
+
export declare function modernizePhpunitXml(file: string, code: string): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modernizePhpunitXml = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Convert a PHPUnit 9-era config to the shape the CLI scaffolds for 2.x
|
|
6
|
+
* extensions: schema resolved from the vendored phpunit, the attributes
|
|
7
|
+
* PHPUnit 10 removed dropped or renamed, coverage's include list moved to
|
|
8
|
+
* <source>, the Mockery listener block removed, and warning details enabled
|
|
9
|
+
* so flarum/testing's query guard is visible in the output.
|
|
10
|
+
*/
|
|
11
|
+
function modernizePhpunitXml(file, code) {
|
|
12
|
+
// The schema path is relative to the config file's own directory.
|
|
13
|
+
const prefix = '../'.repeat(file.split('/').length - 1);
|
|
14
|
+
let updated = code.replace(/xsi:noNamespaceSchemaLocation="[^"]*"/, `xsi:noNamespaceSchemaLocation="${prefix}vendor/phpunit/phpunit/phpunit.xsd"`);
|
|
15
|
+
// Attributes removed in PHPUnit 10.
|
|
16
|
+
updated = updated.replace(/[\t ]*(?:convert(?:Deprecations|Errors|Notices|Warnings)ToExceptions|forceCoversAnnotation|verbose|printerClass)="[^"]*"\r?\n/g, '');
|
|
17
|
+
updated = updated.replace(/backupStaticAttributes=/g, 'backupStaticProperties=');
|
|
18
|
+
// New settings, inserted next to their neighbours in the scaffolded order.
|
|
19
|
+
if (!updated.includes('cacheDirectory=')) {
|
|
20
|
+
updated = updated.replace(/(\n([\t ]*)backupGlobals="[^"]*")/, '$1\n$2cacheDirectory=".phpunit.cache"');
|
|
21
|
+
}
|
|
22
|
+
if (!updated.includes('displayDetailsOnTestsThatTriggerWarnings=')) {
|
|
23
|
+
updated = updated.replace(/(\n([\t ]*)colors="[^"]*")/, '$1\n$2displayDetailsOnTestsThatTriggerWarnings="true"');
|
|
24
|
+
}
|
|
25
|
+
// The include list lives in <source> now; coverage configuration as it
|
|
26
|
+
// existed in 9.x is gone.
|
|
27
|
+
updated = updated.replace(/<coverage[^>]*>/, '<source>').replace(/<\/coverage>/, '</source>');
|
|
28
|
+
// Test listeners were removed in PHPUnit 10 (Mockery integration works
|
|
29
|
+
// without one).
|
|
30
|
+
updated = updated.replace(/[\t ]*<listeners>[\S\s]*?<\/listeners>\r?\n?/, '');
|
|
31
|
+
return updated;
|
|
32
|
+
}
|
|
33
|
+
exports.modernizePhpunitXml = modernizePhpunitXml;
|
|
@@ -3,29 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const base_1 = require("../base");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const phpunit_xml_1 = require("./phpunit-xml");
|
|
6
7
|
class PhpUnit extends base_1.BaseUpgradeStep {
|
|
7
8
|
constructor() {
|
|
8
9
|
super(...arguments);
|
|
9
10
|
this.type = 'PHPUnit 9 to 11 changes';
|
|
10
11
|
}
|
|
11
12
|
replacements(file) {
|
|
12
|
-
if (
|
|
13
|
-
return [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
if (file.endsWith('.php')) {
|
|
14
|
+
return [
|
|
15
|
+
(_file, code) => ({
|
|
16
|
+
updated: this.php.run('upgrade.2-0.phpunit', { file, code }).code,
|
|
17
|
+
}),
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
// The XML rewrite previously sat behind the .php guard above (making it
|
|
21
|
+
// unreachable) and used String.replace with regex syntax in a string
|
|
22
|
+
// (matching nothing) — every upgraded extension kept its 9.3-era config.
|
|
23
|
+
if (/(^|\/)phpunit(\.[\w-]+)?\.xml$/.test(file)) {
|
|
24
|
+
return [
|
|
25
|
+
(xmlFile, code) => ({
|
|
26
|
+
updated: (0, phpunit_xml_1.modernizePhpunitXml)(xmlFile, code),
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
return [];
|
|
26
31
|
}
|
|
27
32
|
targets() {
|
|
28
|
-
return ['tests/**/*'];
|
|
33
|
+
return ['tests/**/*', 'phpunit.xml', 'phpunit.*.xml'];
|
|
29
34
|
}
|
|
30
35
|
gitCommit() {
|
|
31
36
|
return {
|
|
@@ -39,7 +44,7 @@ class PhpUnit extends base_1.BaseUpgradeStep {
|
|
|
39
44
|
'https://github.com/sebastianbergmann/phpunit/blob/10.5/DEPRECATIONS.md',
|
|
40
45
|
'https://github.com/sebastianbergmann/phpunit/blob/11.3.0/DEPRECATIONS.md',
|
|
41
46
|
];
|
|
42
|
-
const dbLink = '
|
|
47
|
+
const dbLink = 'https://docs.flarum.org/2.x/extend/testing#model-factories';
|
|
43
48
|
return `Flarum 2.0 uses PHPUnit 11. The tool has applied the most significant changes, but you might still run into other deprecations.
|
|
44
49
|
Please refer to the following links for more information:
|
|
45
50
|
${links.map((link) => chalk_1.default.underline(link)).join('\n ')}
|
|
@@ -12,6 +12,7 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
|
12
12
|
const string_1 = tslib_1.__importDefault(require("string"));
|
|
13
13
|
const simple_git_1 = tslib_1.__importDefault(require("simple-git"));
|
|
14
14
|
const types_1 = require("@babel/types");
|
|
15
|
+
const step_failures_1 = require("./step-failures");
|
|
15
16
|
class BaseUpgradeStep {
|
|
16
17
|
getExposed(_paths, _paramProvider) {
|
|
17
18
|
return (0, pick_deep_1.default)(this.params, this.exposes);
|
|
@@ -70,6 +71,7 @@ class BaseUpgradeStep {
|
|
|
70
71
|
this.command.log('\u001B[A => ' + chalk_1.default.bold(' WORKING' + filledDots));
|
|
71
72
|
dots = (dots + 1) % 4;
|
|
72
73
|
};
|
|
74
|
+
const failures = new step_failures_1.StepFailures();
|
|
73
75
|
const targets = this.targets();
|
|
74
76
|
for (const target of targets) {
|
|
75
77
|
progress();
|
|
@@ -84,8 +86,15 @@ class BaseUpgradeStep {
|
|
|
84
86
|
continue;
|
|
85
87
|
}
|
|
86
88
|
const code = fsEditor.read(file);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
// Same as the transform pass below: a file this step can't read
|
|
90
|
+
// shouldn't stop it from reporting on the others.
|
|
91
|
+
try {
|
|
92
|
+
const advanced = this.advancedContent(file, code);
|
|
93
|
+
this.before(file, code, advanced);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
failures.record((0, string_1.default)(file.replace(paths.package(), '')).stripLeft('/').stripLeft('\\').toString(), error);
|
|
97
|
+
}
|
|
89
98
|
progress();
|
|
90
99
|
}
|
|
91
100
|
}
|
|
@@ -97,10 +106,20 @@ class BaseUpgradeStep {
|
|
|
97
106
|
continue;
|
|
98
107
|
}
|
|
99
108
|
const code = fsEditor.read(file);
|
|
100
|
-
const advanced = this.advancedContent(file, code);
|
|
101
109
|
const relativeTarget = (0, string_1.default)(file.replace(paths.package(), '')).stripLeft('/').stripLeft('\\').toString();
|
|
102
|
-
|
|
103
|
-
|
|
110
|
+
let result;
|
|
111
|
+
// One file the step can't handle shouldn't decide the fate of the
|
|
112
|
+
// rest: note it and carry on, so the author is told about every
|
|
113
|
+
// problem this step found rather than the first one.
|
|
114
|
+
try {
|
|
115
|
+
const advanced = this.advancedContent(file, code);
|
|
116
|
+
// eslint-disable-next-line no-await-in-loop
|
|
117
|
+
result = await this.applyReplacements(relativeTarget, code, advanced);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
failures.record(relativeTarget, error);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
104
123
|
if (result.newPath && result.newPath !== file) {
|
|
105
124
|
fsEditor.move(file, result.newPath);
|
|
106
125
|
newFiles.push(result.newPath);
|
|
@@ -137,7 +156,22 @@ class BaseUpgradeStep {
|
|
|
137
156
|
// await applyOn(newFiles);
|
|
138
157
|
// }
|
|
139
158
|
}
|
|
140
|
-
const
|
|
159
|
+
const dir = (_c = paths.requestedDir()) !== null && _c !== void 0 ? _c : paths.cwd();
|
|
160
|
+
if (failures.any()) {
|
|
161
|
+
// Leave the step all-or-nothing. Its partial writes are already on disk,
|
|
162
|
+
// and the run refuses to start with a dirty tree, so keeping them would
|
|
163
|
+
// block the re-run this step is asking the author to do.
|
|
164
|
+
await (0, simple_git_1.default)(dir).checkout(['--', '.']);
|
|
165
|
+
this.command.log('\u001B[A => ' + chalk_1.default.bgRed.bold(' FAILED '));
|
|
166
|
+
this.command.log('');
|
|
167
|
+
this.command.log(failures.report());
|
|
168
|
+
this.command.log('');
|
|
169
|
+
const files = failures.count() === 1 ? 'file' : 'files';
|
|
170
|
+
this.command.error(`${failures.count()} ${files} could not be upgraded by this step, so it made no changes.\n` +
|
|
171
|
+
' Fix the problems above and run the command again — steps that already\n' +
|
|
172
|
+
' completed are skipped, so it will resume from here.', { code: 'FL_ERR' });
|
|
173
|
+
}
|
|
174
|
+
const changesMade = await (0, simple_git_1.default)(dir)
|
|
141
175
|
.diffSummary()
|
|
142
176
|
.then((summary) => summary.files.length > 0);
|
|
143
177
|
if (changesMade) {
|
|
@@ -181,8 +215,7 @@ class BaseUpgradeStep {
|
|
|
181
215
|
advanced = (0, ast_1.parseCode)(code);
|
|
182
216
|
}
|
|
183
217
|
catch (error) {
|
|
184
|
-
|
|
185
|
-
throw error;
|
|
218
|
+
throw new Error(`The transformed code could not be parsed back: ${error.message}`);
|
|
186
219
|
}
|
|
187
220
|
(_b = result.imports) === null || _b === void 0 ? void 0 : _b.forEach((imp) => {
|
|
188
221
|
this.ensureImport(file, advanced, imp);
|
|
@@ -235,12 +268,17 @@ class BaseUpgradeStep {
|
|
|
235
268
|
try {
|
|
236
269
|
return JSON.parse(code);
|
|
237
270
|
}
|
|
238
|
-
catch (
|
|
239
|
-
|
|
271
|
+
catch (error) {
|
|
272
|
+
throw new Error(`Not valid JSON: ${error.message}`);
|
|
240
273
|
}
|
|
241
274
|
}
|
|
242
275
|
if (['js', 'ts', 'jsx', 'tsx'].includes(lang || '')) {
|
|
243
|
-
|
|
276
|
+
try {
|
|
277
|
+
return (0, ast_1.parseCode)(code);
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
throw new Error(`Could not parse: ${error.message}`);
|
|
281
|
+
}
|
|
244
282
|
}
|
|
245
283
|
return null;
|
|
246
284
|
}
|
|
@@ -261,8 +299,7 @@ class BaseUpgradeStep {
|
|
|
261
299
|
return (0, ast_1.generateCode)(updated, false);
|
|
262
300
|
}
|
|
263
301
|
catch (error) {
|
|
264
|
-
|
|
265
|
-
throw error;
|
|
302
|
+
throw new Error(`Could not generate code from the transformed syntax tree: ${error.message}`);
|
|
266
303
|
}
|
|
267
304
|
}
|
|
268
305
|
return code;
|
|
@@ -52,7 +52,7 @@ class Dependencies extends base_1.BaseUpgradeStep {
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
if (key === 'flarum/core') {
|
|
55
|
-
composer.require[key] = '^2.0.0
|
|
55
|
+
composer.require[key] = '^2.0.0';
|
|
56
56
|
}
|
|
57
57
|
else if (key.startsWith('flarum/') && value !== '*') {
|
|
58
58
|
composer.require[key] = '*';
|
|
@@ -67,15 +67,20 @@ class Dependencies extends base_1.BaseUpgradeStep {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
if (['flarum/core', 'flarum/testing', 'flarum/phpstan'].includes(key)) {
|
|
70
|
-
composer['require-dev'][key] = '^2.0.0
|
|
70
|
+
composer['require-dev'][key] = '^2.0.0';
|
|
71
71
|
}
|
|
72
72
|
else if (key.startsWith('flarum/') && value.startsWith('^1')) {
|
|
73
73
|
composer['require-dev'][key] = '*';
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
if (composer.require.php) {
|
|
77
|
-
composer.require.php = '^8.
|
|
77
|
+
composer.require.php = '^8.3';
|
|
78
78
|
}
|
|
79
|
+
// 2.0 constraints resolve to prereleases while the line is in RC, so the
|
|
80
|
+
// extension has to accept them — with stable preferred wherever one
|
|
81
|
+
// exists, so only Flarum itself comes from the beta channel.
|
|
82
|
+
composer['minimum-stability'] = 'beta';
|
|
83
|
+
composer['prefer-stable'] = true;
|
|
79
84
|
if (composer.require['fof/extend']) {
|
|
80
85
|
composer.require['fof/extend'] = '^2.0.0';
|
|
81
86
|
}
|
|
@@ -91,8 +96,8 @@ class Dependencies extends base_1.BaseUpgradeStep {
|
|
|
91
96
|
'flarum-webpack-config': '^3.0.0',
|
|
92
97
|
'flarum-tsconfig': '^2.0.0',
|
|
93
98
|
'@flarum/jest-config': '^2.0.0',
|
|
94
|
-
|
|
95
|
-
'webpack-cli':
|
|
99
|
+
webpack: '^5.65.0',
|
|
100
|
+
'webpack-cli': '^4.9.1',
|
|
96
101
|
};
|
|
97
102
|
const dependencies = advanced.dependencies || advanced.devDependencies;
|
|
98
103
|
for (const [key] of Object.entries(dependencies)) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files a single upgrade step could not transform.
|
|
3
|
+
*
|
|
4
|
+
* A step runs over every matching file in an extension, and any one of them
|
|
5
|
+
* can defeat it — a parser that doesn't recognise some syntax, a transformer
|
|
6
|
+
* meeting a shape it wasn't written for. Collecting those instead of throwing
|
|
7
|
+
* at the first means the author is told about all of them at once, and fixes
|
|
8
|
+
* them in one pass rather than rediscovering them one re-run at a time.
|
|
9
|
+
*/
|
|
10
|
+
export declare class StepFailures {
|
|
11
|
+
private failures;
|
|
12
|
+
record(file: string, error: unknown): void;
|
|
13
|
+
any(): boolean;
|
|
14
|
+
count(): number;
|
|
15
|
+
/**
|
|
16
|
+
* The failures, formatted for the author: which file, and why.
|
|
17
|
+
*/
|
|
18
|
+
report(): string;
|
|
19
|
+
/**
|
|
20
|
+
* The message alone. A stack trace is about our internals, not about the
|
|
21
|
+
* code being upgraded, so it isn't what the author needs to see.
|
|
22
|
+
*/
|
|
23
|
+
private static reasonFor;
|
|
24
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StepFailures = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
/**
|
|
7
|
+
* The files a single upgrade step could not transform.
|
|
8
|
+
*
|
|
9
|
+
* A step runs over every matching file in an extension, and any one of them
|
|
10
|
+
* can defeat it — a parser that doesn't recognise some syntax, a transformer
|
|
11
|
+
* meeting a shape it wasn't written for. Collecting those instead of throwing
|
|
12
|
+
* at the first means the author is told about all of them at once, and fixes
|
|
13
|
+
* them in one pass rather than rediscovering them one re-run at a time.
|
|
14
|
+
*/
|
|
15
|
+
class StepFailures {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.failures = [];
|
|
18
|
+
}
|
|
19
|
+
record(file, error) {
|
|
20
|
+
this.failures.push({ file, reason: StepFailures.reasonFor(error) });
|
|
21
|
+
}
|
|
22
|
+
any() {
|
|
23
|
+
return this.failures.length > 0;
|
|
24
|
+
}
|
|
25
|
+
count() {
|
|
26
|
+
return this.failures.length;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The failures, formatted for the author: which file, and why.
|
|
30
|
+
*/
|
|
31
|
+
report() {
|
|
32
|
+
return this.failures.map(({ file, reason }) => ` ${chalk_1.default.bold(file)}\n ${reason}`).join('\n\n');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The message alone. A stack trace is about our internals, not about the
|
|
36
|
+
* code being upgraded, so it isn't what the author needs to see.
|
|
37
|
+
*/
|
|
38
|
+
static reasonFor(error) {
|
|
39
|
+
if (error instanceof Error) {
|
|
40
|
+
return error.message;
|
|
41
|
+
}
|
|
42
|
+
if (typeof error === 'string') {
|
|
43
|
+
return error;
|
|
44
|
+
}
|
|
45
|
+
return JSON.stringify(error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.StepFailures = StepFailures;
|
package/lib/utils/ast.js
CHANGED
|
@@ -10,15 +10,9 @@ const prettierrc_json_1 = tslib_1.__importDefault(require("@flarum/prettier-conf
|
|
|
10
10
|
// import generate from '@babel/generator';
|
|
11
11
|
const recast = tslib_1.__importStar(require("recast"));
|
|
12
12
|
function parseCode(code) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
console.log(code);
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
13
|
+
return recast.parse(code, {
|
|
14
|
+
parser: require('recast/parsers/babel-ts'),
|
|
15
|
+
});
|
|
22
16
|
}
|
|
23
17
|
exports.parseCode = parseCode;
|
|
24
18
|
async function generateCode(ast, extenders = false) {
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"3.0.11","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","frontendTesting","backendTesting","phpstan","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?"}]},"flarum:change":{"id":"flarum:change","description":"Related Flarum version information.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"flarum:info":{"id":"flarum:info","description":"Related Flarum version information.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"make:locale":{"id":"make:locale","description":"Generate new locale key value pair.","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":"key","description":"The nested key of the locale (e.g. `forum.custom_modal.title`).","required":false},{"name":"value","description":"The value of the locale.","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:model":{"id":"make: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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:notification":{"id":"make:notification","description":"Generate a new notification","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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:post-type":{"id":"make:post-type","description":"Generate a new post type","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":"className","description":"The name of the class to generate","required":false},{"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?"}]},"upgrade:2.0":{"id":"upgrade:2.0","description":"Upgrade an extension to Flarum 2.0","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},"step":{"name":"step","type":"option","description":"Optionally specify a specific step to run","required":false},"force-steps":{"name":"force-steps","type":"boolean","description":"Force run steps even if already ran","required":false,"allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:api-resource":{"id":"make:backend:api-resource","description":"Generate an API resource 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:controller":{"id":"make:backend:controller","description":"Generate a 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":"className","description":"The name of the class to generate","required":false},{"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:filter":{"id":"make:backend:filter","description":"Generate a filter 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":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:mail-driver":{"id":"make:backend:mail-driver","description":"Generate a mail driver 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:middleware":{"id":"make:backend:middleware","description":"Generate a middleware","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":"name","description":"The name of the migration","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:notification-blueprint":{"id":"make:backend:notification-blueprint","description":"Generate a notification blueprint 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:notification-driver":{"id":"make:backend:notification-driver","description":"Generate a notification driver 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":"className","description":"The name of the class to generate","required":false},{"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:post-type":{"id":"make:backend:post-type","description":"Generate a new backend post type 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":"className","description":"The name of the class to generate","required":false},{"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:search-driver":{"id":"make:backend:search-driver","description":"Generate a search driver","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":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"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":"frontend","description":"The frontend name","required":false},{"name":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:forum-page":{"id":"make:frontend:forum-page","description":"Generate a forum page 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":"className","description":"The name of the class to generate","required":false},{"name":"routeName","description":"Route name (unique)","required":false},{"name":"routePath","description":"Route path","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:gambit":{"id":"make:frontend:gambit","description":"Generate a frontend gambit 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: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":"frontend","description":"The frontend name","required":false},{"name":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:notification":{"id":"make:frontend:notification","description":"Generate a frontend notification 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:post-type":{"id":"make:frontend:post-type","description":"Generate a frontend post type 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]}}}
|
|
1
|
+
{"version":"3.0.12","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","frontendTesting","backendTesting","phpstan","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?"}]},"flarum:change":{"id":"flarum:change","description":"Related Flarum version information.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"flarum:info":{"id":"flarum:info","description":"Related Flarum version information.","pluginName":"@flarum/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"make:locale":{"id":"make:locale","description":"Generate new locale key value pair.","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":"key","description":"The nested key of the locale (e.g. `forum.custom_modal.title`).","required":false},{"name":"value","description":"The value of the locale.","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:model":{"id":"make: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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:notification":{"id":"make:notification","description":"Generate a new notification","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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:post-type":{"id":"make:post-type","description":"Generate a new post type","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":"className","description":"The name of the class to generate","required":false},{"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?"}]},"upgrade:2.0":{"id":"upgrade:2.0","description":"Upgrade an extension to Flarum 2.0","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},"step":{"name":"step","type":"option","description":"Optionally specify a specific step to run","required":false},"force-steps":{"name":"force-steps","type":"boolean","description":"Force run steps even if already ran","required":false,"allowNo":false}},"args":[{"name":"path","description":"Where should this command be executed?"}]},"make:backend:api-resource":{"id":"make:backend:api-resource","description":"Generate an API resource 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:controller":{"id":"make:backend:controller","description":"Generate a 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":"className","description":"The name of the class to generate","required":false},{"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:filter":{"id":"make:backend:filter","description":"Generate a filter 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":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:mail-driver":{"id":"make:backend:mail-driver","description":"Generate a mail driver 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:middleware":{"id":"make:backend:middleware","description":"Generate a middleware","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":"name","description":"The name of the migration","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:notification-blueprint":{"id":"make:backend:notification-blueprint","description":"Generate a notification blueprint 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:backend:notification-driver":{"id":"make:backend:notification-driver","description":"Generate a notification driver 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":"className","description":"The name of the class to generate","required":false},{"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:post-type":{"id":"make:backend:post-type","description":"Generate a new backend post type 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":"className","description":"The name of the class to generate","required":false},{"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:search-driver":{"id":"make:backend:search-driver","description":"Generate a search driver","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":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"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":"frontend","description":"The frontend name","required":false},{"name":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:forum-page":{"id":"make:frontend:forum-page","description":"Generate a forum page 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":"className","description":"The name of the class to generate","required":false},{"name":"routeName","description":"Route name (unique)","required":false},{"name":"routePath","description":"Route path","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:gambit":{"id":"make:frontend:gambit","description":"Generate a frontend gambit 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: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":"frontend","description":"The frontend name","required":false},{"name":"className","description":"The name of the class to generate","required":false},{"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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:notification":{"id":"make:frontend:notification","description":"Generate a frontend notification 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]},"make:frontend:post-type":{"id":"make:frontend:post-type","description":"Generate a frontend post type 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":"className","description":"The name of the class to generate","required":false},{"name":"path","description":"Where should this command be executed?"}]}}}
|