@flarum/cli 2.0.0-beta.12 → 2.0.0-beta.15
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 +176 -43
- package/bin/run +2 -1
- package/bin/splitsh-lite-darwin +0 -0
- package/bin/splitsh-lite-linux +0 -0
- package/boilerplate/skeleton/extension/.gitattributes +1 -0
- package/boilerplate/skeleton/extension/.github/workflows/backend.yml +1 -1
- package/boilerplate/skeleton/extension/.github/workflows/frontend.yml +3 -1
- package/boilerplate/skeleton/extension/LICENSE.md +1 -1
- package/boilerplate/skeleton/extension/composer.json +4 -2
- package/boilerplate/skeleton/extension/js/package.json +4 -1
- package/boilerplate/skeleton/extension/tests/phpunit.integration.xml +1 -0
- package/lib/base-command.d.ts +3 -1
- package/lib/base-command.js +44 -31
- package/lib/boilersmith/io.d.ts +28 -8
- package/lib/boilersmith/io.js +4 -2
- package/lib/boilersmith/paths.d.ts +2 -2
- package/lib/boilersmith/paths.js +7 -7
- package/lib/boilersmith/scaffolding/audit-step-factory.js +11 -11
- package/lib/boilersmith/scaffolding/infra-step-factory.js +2 -2
- package/lib/boilersmith/scaffolding/init-step-factory.js +5 -5
- package/lib/boilersmith/scaffolding/module.d.ts +19 -8
- package/lib/boilersmith/scaffolding/module.js +32 -19
- package/lib/boilersmith/scaffolding/scaffolder.d.ts +4 -1
- package/lib/boilersmith/scaffolding/scaffolder.js +32 -32
- package/lib/boilersmith/scaffolding/template-param.d.ts +1 -1
- package/lib/boilersmith/scaffolding/template-param.js +2 -2
- package/lib/boilersmith/step-manager.d.ts +0 -1
- package/lib/boilersmith/step-manager.js +10 -20
- package/lib/boilersmith/steps/stub-base.js +3 -3
- package/lib/boilersmith/utils/clone-and-fill.js +1 -1
- package/lib/boilersmith/utils/commit-async.d.ts +2 -0
- package/lib/boilersmith/utils/commit-async.js +15 -0
- package/lib/boilersmith/utils/read-tpl.js +2 -2
- package/lib/commands/audit/infra.d.ts +1 -1
- package/lib/commands/audit/infra.js +30 -8
- package/lib/commands/infra.d.ts +2 -2
- package/lib/commands/infra.js +18 -12
- package/lib/commands/init.d.ts +1 -1
- package/lib/commands/init.js +4 -2
- package/lib/commands/make/backend/api-controller.js +1 -2
- package/lib/commands/make/backend/api-serializer-attributes.js +1 -2
- package/lib/commands/make/backend/command.js +1 -2
- package/lib/commands/make/backend/event-listener.js +1 -2
- package/lib/commands/make/backend/handler.js +2 -5
- package/lib/commands/make/backend/integration-test.js +2 -4
- package/lib/commands/make/backend/migration.js +1 -2
- package/lib/commands/make/backend/model.js +1 -2
- package/lib/commands/make/backend/policy.js +1 -2
- package/lib/commands/make/backend/route.js +1 -2
- package/lib/commands/make/backend/service-provider.js +1 -2
- package/lib/commands/make/frontend/model.js +2 -5
- package/lib/commands/monorepo/create.d.ts +15 -0
- package/lib/commands/monorepo/create.js +20 -0
- package/lib/commands/monorepo/split.d.ts +15 -0
- package/lib/commands/monorepo/split.js +19 -0
- package/lib/commands/update/js-imports.js +1 -2
- package/lib/help.js +1 -1
- package/lib/providers/php-provider.js +2 -2
- package/lib/steps/gen-ext-scaffolder.d.ts +1 -1
- package/lib/steps/gen-ext-scaffolder.js +109 -53
- package/lib/steps/js/base.js +2 -4
- package/lib/steps/js/model.js +4 -4
- package/lib/steps/misc/composer.js +2 -2
- package/lib/steps/misc/git.d.ts +1 -1
- package/lib/steps/misc/git.js +2 -2
- package/lib/steps/misc/npm.d.ts +11 -0
- package/lib/steps/misc/npm.js +19 -0
- package/lib/steps/misc/yarn.js +2 -2
- package/lib/steps/monorepo/create.d.ts +17 -0
- package/lib/steps/monorepo/create.js +186 -0
- package/lib/steps/monorepo/split.d.ts +12 -0
- package/lib/steps/monorepo/split.js +75 -0
- package/lib/steps/stubs/backend/api-controller.d.ts +1 -1
- package/lib/steps/stubs/backend/api-controller.js +3 -0
- package/lib/steps/stubs/backend/api-serializer.d.ts +1 -1
- package/lib/steps/stubs/backend/api-serializer.js +3 -0
- package/lib/steps/stubs/backend/command.d.ts +0 -5
- package/lib/steps/stubs/backend/command.js +1 -0
- package/lib/steps/stubs/backend/event-listener.d.ts +1 -1
- package/lib/steps/stubs/backend/event-listener.js +2 -0
- package/lib/steps/stubs/backend/handler-command.d.ts +1 -1
- package/lib/steps/stubs/backend/handler-command.js +1 -0
- package/lib/steps/stubs/backend/handler.d.ts +1 -1
- package/lib/steps/stubs/backend/handler.js +4 -0
- package/lib/steps/stubs/backend/integration-test.d.ts +1 -1
- package/lib/steps/stubs/backend/integration-test.js +2 -0
- package/lib/steps/stubs/backend/job.d.ts +1 -1
- package/lib/steps/stubs/backend/job.js +1 -0
- package/lib/steps/stubs/backend/migration.js +6 -3
- package/lib/steps/stubs/backend/model.d.ts +1 -1
- package/lib/steps/stubs/backend/model.js +1 -0
- package/lib/steps/stubs/backend/policy.d.ts +1 -1
- package/lib/steps/stubs/backend/policy.js +2 -0
- package/lib/steps/stubs/backend/repository.d.ts +1 -1
- package/lib/steps/stubs/backend/repository.js +2 -0
- package/lib/steps/stubs/backend/service-provider.d.ts +1 -1
- package/lib/steps/stubs/backend/service-provider.js +1 -0
- package/lib/steps/stubs/backend/validator.d.ts +1 -1
- package/lib/steps/stubs/backend/validator.js +1 -0
- package/lib/steps/stubs/flarum-base.js +1 -1
- package/lib/steps/stubs/frontend/component.d.ts +0 -5
- package/lib/steps/stubs/frontend/component.js +1 -0
- package/lib/steps/stubs/frontend/modal.d.ts +0 -5
- package/lib/steps/stubs/frontend/modal.js +1 -0
- package/lib/steps/stubs/frontend/model.d.ts +0 -5
- package/lib/steps/stubs/frontend/model.js +1 -0
- package/lib/steps/stubs/js-base.js +8 -5
- package/lib/steps/stubs/php-base.js +10 -8
- package/lib/steps/update/js-imports.js +8 -2
- package/lib/utils/composer.d.ts +1 -0
- package/lib/utils/migration.js +3 -1
- package/lib/utils/monorepo.d.ts +24 -0
- package/lib/utils/monorepo.js +24 -0
- package/lib/utils/validation.d.ts +2 -0
- package/lib/utils/validation.js +6 -0
- package/oclif.manifest.json +1 -1
- package/package.json +10 -5
- package/php-subsystem/composer.json +9 -9
- package/php-subsystem/composer.lock +64 -71
- package/php-subsystem/vendor/composer/installed.json +54 -61
- package/php-subsystem/vendor/nikic/php-parser/README.md +55 -59
- package/php-subsystem/vendor/nikic/php-parser/composer.json +39 -39
- package/php-subsystem/vendor/nikic/php-parser/grammar/README.md +17 -20
|
@@ -0,0 +1,186 @@
|
|
|
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 child_process_1 = require("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 fs_1 = require("fs");
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const os_1 = require("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, mainBranch = 'main') {
|
|
18
|
+
const tmpDir = (0, fs_1.mkdtempSync)((0, path_1.resolve)((0, os_1.tmpdir)(), `${path.replace('/', '_')}-`));
|
|
19
|
+
(0, child_process_1.execSync)(`git clone ${remote} ${tmpDir} --verbose --branch ${mainBranch} --single-branch`, { cwd });
|
|
20
|
+
(0, child_process_1.execSync)(`git filter-repo --to-subdirectory-filter ${path}`, { cwd: tmpDir });
|
|
21
|
+
if (mainBranch) {
|
|
22
|
+
await (0, simple_git_1.default)(tmpDir).checkout(mainBranch);
|
|
23
|
+
}
|
|
24
|
+
await (0, simple_git_1.default)(tmpDir).branch(['REWRITE']);
|
|
25
|
+
await (0, simple_git_1.default)(tmpDir).checkout('REWRITE');
|
|
26
|
+
// Merge from remote
|
|
27
|
+
const remoteName = path.replace('/', '_').replace('-', '_');
|
|
28
|
+
await (0, simple_git_1.default)(cwd).addRemote(remoteName, tmpDir);
|
|
29
|
+
(0, child_process_1.execSync)(`git fetch ${remoteName}`, { cwd });
|
|
30
|
+
(0, child_process_1.execSync)(`git merge ${remoteName}/REWRITE --allow-unrelated-histories --no-edit`, { cwd });
|
|
31
|
+
await (0, simple_git_1.default)(cwd).removeRemote(remoteName);
|
|
32
|
+
(0, fs_1.rmSync)(tmpDir, { recursive: true, force: true });
|
|
33
|
+
}
|
|
34
|
+
function makeRunCommitStep(cwd, fs, io, paths, providers) {
|
|
35
|
+
return async function (packagePaths, step, message) {
|
|
36
|
+
for (const path of packagePaths) {
|
|
37
|
+
await step.run(fs, paths.onMonorepoSub((0, path_1.resolve)(cwd, path), cwd), io, providers);
|
|
38
|
+
}
|
|
39
|
+
await (0, commit_async_1.commitAsync)(fs);
|
|
40
|
+
await commitAll(cwd, message);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async function getMonorepoConf(io, monorepoConfPath) {
|
|
44
|
+
var _a;
|
|
45
|
+
if (monorepoConfPath) {
|
|
46
|
+
return JSON.parse((0, fs_1.readFileSync)(monorepoConfPath, 'utf8'));
|
|
47
|
+
}
|
|
48
|
+
const packages = { extensions: [], composer: [], npm: [] };
|
|
49
|
+
// eslint-disable-next-line no-constant-condition
|
|
50
|
+
while (true) {
|
|
51
|
+
const confirm = await io.getParam({
|
|
52
|
+
name: 'confirm',
|
|
53
|
+
type: 'confirm',
|
|
54
|
+
initial: true,
|
|
55
|
+
message: 'Add another package to monorepo?',
|
|
56
|
+
}, true);
|
|
57
|
+
if (!confirm)
|
|
58
|
+
break;
|
|
59
|
+
const packageType = (await io.getParam({
|
|
60
|
+
name: 'packageType',
|
|
61
|
+
message: 'Package Type',
|
|
62
|
+
type: 'select',
|
|
63
|
+
choices: [
|
|
64
|
+
{ title: 'Flarum Extension', value: 'extensions' },
|
|
65
|
+
{ title: 'Composer PHP Package', value: 'composer' },
|
|
66
|
+
{ title: 'NPM JS/TS Package', value: 'npm' },
|
|
67
|
+
{ title: 'Flarum Core', value: 'core' },
|
|
68
|
+
],
|
|
69
|
+
validate: (value) => value !== 'core' || !packages.core || 'A core package has already been specified.',
|
|
70
|
+
}, true));
|
|
71
|
+
const packageName = await io.getParam({
|
|
72
|
+
name: 'name',
|
|
73
|
+
message: 'Package Name (used to generate subdirectory path)',
|
|
74
|
+
type: 'text',
|
|
75
|
+
validate: validation_1.Validator.fileName,
|
|
76
|
+
}, true);
|
|
77
|
+
const gitRemote = await io.getParam({
|
|
78
|
+
name: 'remote',
|
|
79
|
+
message: 'Git remote (e.g. git@github.com:flarum/core.git)',
|
|
80
|
+
type: 'text',
|
|
81
|
+
validate: validation_1.Validator.gitRepo,
|
|
82
|
+
}, true);
|
|
83
|
+
const packageInfo = {
|
|
84
|
+
name: packageName,
|
|
85
|
+
gitRemote,
|
|
86
|
+
};
|
|
87
|
+
if (packageType === 'core') {
|
|
88
|
+
packages.core = packageInfo;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const typePackages = (_a = packages[packageType]) !== null && _a !== void 0 ? _a : [];
|
|
92
|
+
typePackages.push(packageInfo);
|
|
93
|
+
packages[packageType] = typePackages;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return { packages };
|
|
97
|
+
}
|
|
98
|
+
async function commitAll(cwd, message) {
|
|
99
|
+
await (0, simple_git_1.default)(cwd).add('.');
|
|
100
|
+
await (0, simple_git_1.default)(cwd).commit(message);
|
|
101
|
+
}
|
|
102
|
+
class MonorepoCreate {
|
|
103
|
+
constructor(scaffolder, monorepoConfPath) {
|
|
104
|
+
this.type = 'Create a monorepo of Flarum extensions';
|
|
105
|
+
this.composable = false;
|
|
106
|
+
this.exposes = [];
|
|
107
|
+
this.scaffolder = scaffolder;
|
|
108
|
+
this.monorepoConfPath = monorepoConfPath;
|
|
109
|
+
}
|
|
110
|
+
async run(fs, paths, io, providers) {
|
|
111
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
112
|
+
const target = (_a = paths.requestedDir()) !== null && _a !== void 0 ? _a : paths.package('flarum_monorepo');
|
|
113
|
+
const confirmTarget = await io.getParam({
|
|
114
|
+
name: 'confirmTarget',
|
|
115
|
+
message: `Create monorepo in directory: "${(0, cond_format_1.condFormat)(io.supportsAnsiColor, chalk_1.default.dim, target)}" (will be overwritten)?`,
|
|
116
|
+
type: 'confirm',
|
|
117
|
+
initial: true,
|
|
118
|
+
});
|
|
119
|
+
if (!confirmTarget) {
|
|
120
|
+
io.error('Target not confirmed', true);
|
|
121
|
+
return fs;
|
|
122
|
+
}
|
|
123
|
+
const conf = await getMonorepoConf(io, this.monorepoConfPath ? paths.cwd(this.monorepoConfPath) : undefined);
|
|
124
|
+
const runCommitStep = makeRunCommitStep(target, fs, io, paths, providers);
|
|
125
|
+
(0, fs_1.rmSync)(target, { recursive: true, force: true });
|
|
126
|
+
(0, fs_1.mkdirSync)(target);
|
|
127
|
+
await (0, simple_git_1.default)(target).init();
|
|
128
|
+
for (const lib of (_b = conf.packages.npm) !== null && _b !== void 0 ? _b : []) {
|
|
129
|
+
await addGitPackage(target, (0, monorepo_1.npmPath)(lib.name), lib.gitRemote, lib.mainBranch);
|
|
130
|
+
}
|
|
131
|
+
for (const lib of (_c = conf.packages.composer) !== null && _c !== void 0 ? _c : []) {
|
|
132
|
+
await addGitPackage(target, (0, monorepo_1.composerPath)(lib.name), lib.gitRemote, lib.mainBranch);
|
|
133
|
+
}
|
|
134
|
+
for (const ext of (_d = conf.packages.extensions) !== null && _d !== void 0 ? _d : []) {
|
|
135
|
+
await addGitPackage(target, (0, monorepo_1.extensionPath)(ext.name), ext.gitRemote, ext.mainBranch);
|
|
136
|
+
}
|
|
137
|
+
const corePkg = conf.packages.core;
|
|
138
|
+
if (corePkg) {
|
|
139
|
+
await addGitPackage(target, (0, monorepo_1.corePath)(corePkg.name), corePkg.gitRemote, corePkg.mainBranch);
|
|
140
|
+
}
|
|
141
|
+
const npmPaths = (_f = (_e = conf.packages.npm) === null || _e === void 0 ? void 0 : _e.map((lib) => (0, monorepo_1.npmPath)(lib.name))) !== null && _f !== void 0 ? _f : [];
|
|
142
|
+
const composerPaths = (_h = (_g = conf.packages.composer) === null || _g === void 0 ? void 0 : _g.map((lib) => (0, monorepo_1.composerPath)(lib.name))) !== null && _h !== void 0 ? _h : [];
|
|
143
|
+
const flarumPaths = (_k = (_j = conf.packages.extensions) === null || _j === void 0 ? void 0 : _j.map((ext) => (0, monorepo_1.extensionPath)(ext.name))) !== null && _k !== void 0 ? _k : [];
|
|
144
|
+
if (corePkg) {
|
|
145
|
+
flarumPaths.push((0, monorepo_1.corePath)(corePkg.name));
|
|
146
|
+
}
|
|
147
|
+
flarumPaths.forEach((path) => {
|
|
148
|
+
(0, fs_1.rmSync)((0, path_1.resolve)(target, path, '.github'), { force: true, recursive: true });
|
|
149
|
+
});
|
|
150
|
+
[...npmPaths, ...composerPaths, ...flarumPaths].forEach((path) => {
|
|
151
|
+
(0, fs_1.rmSync)((0, path_1.resolve)(target, path, '.styleci.yml'), { force: true });
|
|
152
|
+
});
|
|
153
|
+
await commitAll(target, [
|
|
154
|
+
'chore: remove centralizable repo config',
|
|
155
|
+
'- Remove .github conf folder from Flarum packages',
|
|
156
|
+
'- Remove styleci config from all packages',
|
|
157
|
+
]);
|
|
158
|
+
(0, mem_fs_editor_1.create)(fs).writeJSON((0, path_1.resolve)(target, 'flarum-monorepo.json'), conf);
|
|
159
|
+
await (0, commit_async_1.commitAsync)(fs);
|
|
160
|
+
await commitAll(target, 'chore: add monorepo config file');
|
|
161
|
+
[...composerPaths, ...flarumPaths].forEach((path) => {
|
|
162
|
+
const cwd = (0, path_1.resolve)(target, path);
|
|
163
|
+
const relRepoPath = path.includes('/') ? '../../*/*' : './../*/*';
|
|
164
|
+
(0, child_process_1.execSync)(`composer config repositories.0 path "${relRepoPath}"`, { cwd });
|
|
165
|
+
(0, child_process_1.execSync)('composer config minimum-stability dev', { cwd });
|
|
166
|
+
(0, child_process_1.execSync)('composer config prefer-stable true', { cwd });
|
|
167
|
+
const composerJsonPath = (0, path_1.resolve)(cwd, 'composer.json');
|
|
168
|
+
const composerJson = (0, fs_1.readFileSync)(composerJsonPath);
|
|
169
|
+
(0, fs_1.writeFileSync)(composerJsonPath, composerJson.toString().replace('"dev-master": "1.x-dev"', '"dev-main": "1.x-dev"'));
|
|
170
|
+
});
|
|
171
|
+
[...composerPaths, ...flarumPaths].forEach((path) => {
|
|
172
|
+
const cwd = (0, path_1.resolve)(target, path);
|
|
173
|
+
(0, child_process_1.execSync)('composer install --dry-run --no-interaction --no-ansi --no-progress --no-scripts --no-autoloader', { cwd });
|
|
174
|
+
});
|
|
175
|
+
await commitAll(target, 'chore: set up composer path repos');
|
|
176
|
+
(0, mem_fs_editor_1.create)(fs).writeJSON((0, path_1.resolve)(target, 'flarum-monorepo.json'), conf);
|
|
177
|
+
await (0, commit_async_1.commitAsync)(fs);
|
|
178
|
+
await commitAll(target, 'chore: add monorepo config file');
|
|
179
|
+
await runCommitStep(flarumPaths, this.scaffolder.genAuditStep(false), 'chore: flarum-cli audit infra --fix');
|
|
180
|
+
return fs;
|
|
181
|
+
}
|
|
182
|
+
getExposed() {
|
|
183
|
+
return {};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.MonorepoCreate = MonorepoCreate;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IO } from 'boilersmith/io';
|
|
2
|
+
import { Paths } from 'boilersmith/paths';
|
|
3
|
+
import { Step } from 'boilersmith/step-manager';
|
|
4
|
+
import { Store } from 'mem-fs';
|
|
5
|
+
import { FlarumProviders } from '../../providers';
|
|
6
|
+
export declare class MonorepoSplit implements Step<FlarumProviders> {
|
|
7
|
+
type: string;
|
|
8
|
+
composable: boolean;
|
|
9
|
+
exposes: never[];
|
|
10
|
+
run(fs: Store, paths: Paths, io: IO, _providers: FlarumProviders): Promise<Store>;
|
|
11
|
+
getExposed(): Record<string, unknown>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MonorepoSplit = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const simple_git_1 = (0, tslib_1.__importDefault)(require("simple-git"));
|
|
8
|
+
const monorepo_1 = require("../../utils/monorepo");
|
|
9
|
+
async function addRemote(cwd, name, remote) {
|
|
10
|
+
try {
|
|
11
|
+
await (0, simple_git_1.default)(cwd).addRemote(name, remote);
|
|
12
|
+
}
|
|
13
|
+
catch (_a) {
|
|
14
|
+
// ignore, remote already exists.
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function splitAndPush(cwd, splitExecPath, splitPath, remoteName, remoteBranch) {
|
|
18
|
+
const sha1 = (0, child_process_1.execSync)(`${splitExecPath} --prefix=${splitPath}`, { cwd, stdio: ['pipe', 'pipe', 'ignore'] })
|
|
19
|
+
.toString()
|
|
20
|
+
.trim();
|
|
21
|
+
(0, child_process_1.execSync)(`git push ${remoteName} "${sha1}:refs/heads/${remoteBranch || 'main'}"`, { cwd });
|
|
22
|
+
}
|
|
23
|
+
async function removeRemote(cwd, name) {
|
|
24
|
+
await (0, simple_git_1.default)(cwd).removeRemote(name);
|
|
25
|
+
}
|
|
26
|
+
class MonorepoSplit {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.type = 'Split monorepo changes to the respective cloned repos.';
|
|
29
|
+
this.composable = false;
|
|
30
|
+
this.exposes = [];
|
|
31
|
+
}
|
|
32
|
+
async run(fs, paths, io, _providers) {
|
|
33
|
+
var _a, _b, _c, _d;
|
|
34
|
+
const platform = process.platform;
|
|
35
|
+
if (platform !== 'linux' && platform !== 'darwin') {
|
|
36
|
+
io.error(`Your platform, "${platform}", is not supported. Split can only be run on linux and mac`, true);
|
|
37
|
+
return fs;
|
|
38
|
+
}
|
|
39
|
+
const splitExec = (0, path_1.resolve)(__dirname, `../../../bin/splitsh-lite-${platform}`);
|
|
40
|
+
const target = (_a = paths.requestedDir()) !== null && _a !== void 0 ? _a : paths.package();
|
|
41
|
+
await (0, simple_git_1.default)(target).pull();
|
|
42
|
+
const conf = (0, monorepo_1.getMonorepoConf)(fs, paths);
|
|
43
|
+
const corePkg = conf.packages.core;
|
|
44
|
+
// Add Remotes
|
|
45
|
+
for (const lib of (_b = conf.packages.npm) !== null && _b !== void 0 ? _b : []) {
|
|
46
|
+
await addRemote(target, lib.name, lib.gitRemote);
|
|
47
|
+
await splitAndPush(target, splitExec, (0, monorepo_1.npmPath)(lib.name), lib.name, lib.mainBranch).finally(() => {
|
|
48
|
+
return removeRemote(target, lib.name);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
for (const lib of (_c = conf.packages.composer) !== null && _c !== void 0 ? _c : []) {
|
|
52
|
+
await addRemote(target, lib.name, lib.gitRemote);
|
|
53
|
+
await splitAndPush(target, splitExec, (0, monorepo_1.composerPath)(lib.name), lib.name, lib.mainBranch).finally(() => {
|
|
54
|
+
return removeRemote(target, lib.name);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
for (const ext of (_d = conf.packages.extensions) !== null && _d !== void 0 ? _d : []) {
|
|
58
|
+
await addRemote(target, ext.name, ext.gitRemote);
|
|
59
|
+
await splitAndPush(target, splitExec, (0, monorepo_1.extensionPath)(ext.name), ext.name, ext.mainBranch).finally(() => {
|
|
60
|
+
return removeRemote(target, ext.name);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (corePkg) {
|
|
64
|
+
await addRemote(target, corePkg.name, corePkg.gitRemote);
|
|
65
|
+
await splitAndPush(target, splitExec, (0, monorepo_1.corePath)(corePkg.name), corePkg.name, corePkg.mainBranch).finally(() => {
|
|
66
|
+
return removeRemote(target, corePkg.name);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return fs;
|
|
70
|
+
}
|
|
71
|
+
getExposed() {
|
|
72
|
+
throw new Error('Method not implemented.');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.MonorepoSplit = MonorepoSplit;
|
|
@@ -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
|
};
|
|
@@ -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 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
|
};
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GenerateMigrationStub = void 0;
|
|
4
|
-
const
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
5
|
const validation_1 = require("../../../utils/validation");
|
|
6
6
|
const migration_1 = require("../../../utils/migration");
|
|
7
7
|
const php_base_1 = require("../php-base");
|
|
@@ -36,12 +36,15 @@ class GenerateMigrationStub extends php_base_1.BasePhpStubStep {
|
|
|
36
36
|
async getFileName(fs, paths, _paramProvider) {
|
|
37
37
|
let persistedMigrations;
|
|
38
38
|
try {
|
|
39
|
-
persistedMigrations = (0,
|
|
39
|
+
persistedMigrations = (0, fs_1.readdirSync)(paths.package('migrations'));
|
|
40
40
|
}
|
|
41
41
|
catch (_a) {
|
|
42
42
|
persistedMigrations = [];
|
|
43
43
|
}
|
|
44
|
-
const memMigrations = fs
|
|
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
|
}
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|
|
@@ -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;
|