@gadmin2n/cli 0.0.73
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/.circleci/config.yml +62 -0
- package/.claude/settings.local.json +7 -0
- package/.github/ISSUE_TEMPLATE/Bug_report.yml +106 -0
- package/.github/ISSUE_TEMPLATE/Feature_request.yml +52 -0
- package/.github/ISSUE_TEMPLATE/Regression.yml +78 -0
- package/.github/ISSUE_TEMPLATE/config.yml +7 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +41 -0
- package/LICENSE +24 -0
- package/README.md +56 -0
- package/actions/abstract.action.d.ts +4 -0
- package/actions/abstract.action.js +6 -0
- package/actions/add.action.d.ts +12 -0
- package/actions/add.action.js +129 -0
- package/actions/build.action.d.ts +27 -0
- package/actions/build.action.js +108 -0
- package/actions/generate.action.d.ts +5 -0
- package/actions/generate.action.js +95 -0
- package/actions/index.d.ts +8 -0
- package/actions/index.js +24 -0
- package/actions/info.action.d.ts +28 -0
- package/actions/info.action.js +129 -0
- package/actions/new.action.d.ts +7 -0
- package/actions/new.action.js +294 -0
- package/actions/prisma.action.d.ts +5 -0
- package/actions/prisma.action.js +153 -0
- package/actions/start.action.d.ts +9 -0
- package/actions/start.action.js +115 -0
- package/actions/update.action.d.ts +5 -0
- package/actions/update.action.js +26 -0
- package/bin/gadmin.d.ts +2 -0
- package/bin/gadmin.js +25 -0
- package/commands/abstract.command.d.ts +7 -0
- package/commands/abstract.command.js +9 -0
- package/commands/add.command.d.ts +5 -0
- package/commands/add.command.js +43 -0
- package/commands/build.command.d.ts +5 -0
- package/commands/build.command.js +50 -0
- package/commands/command.input.d.ts +25 -0
- package/commands/command.input.js +28 -0
- package/commands/command.loader.d.ts +5 -0
- package/commands/command.loader.js +33 -0
- package/commands/generate.command.d.ts +7 -0
- package/commands/generate.command.js +105 -0
- package/commands/index.d.ts +2 -0
- package/commands/index.js +18 -0
- package/commands/info.command.d.ts +5 -0
- package/commands/info.command.js +25 -0
- package/commands/new.command.d.ts +5 -0
- package/commands/new.command.js +52 -0
- package/commands/start.command.d.ts +5 -0
- package/commands/start.command.js +64 -0
- package/commands/update.command.d.ts +5 -0
- package/commands/update.command.js +30 -0
- package/lib/compiler/assets-manager.d.ts +15 -0
- package/lib/compiler/assets-manager.js +103 -0
- package/lib/compiler/compiler.d.ts +12 -0
- package/lib/compiler/compiler.js +60 -0
- package/lib/compiler/defaults/webpack-defaults.d.ts +3 -0
- package/lib/compiler/defaults/webpack-defaults.js +95 -0
- package/lib/compiler/helpers/append-extension.d.ts +1 -0
- package/lib/compiler/helpers/append-extension.js +8 -0
- package/lib/compiler/helpers/copy-path-resolve.d.ts +7 -0
- package/lib/compiler/helpers/copy-path-resolve.js +26 -0
- package/lib/compiler/helpers/get-value-or-default.d.ts +4 -0
- package/lib/compiler/helpers/get-value-or-default.js +67 -0
- package/lib/compiler/helpers/tsconfig-provider.d.ts +11 -0
- package/lib/compiler/helpers/tsconfig-provider.js +22 -0
- package/lib/compiler/hooks/tsconfig-paths.hook.d.ts +2 -0
- package/lib/compiler/hooks/tsconfig-paths.hook.js +70 -0
- package/lib/compiler/plugins-loader.d.ts +21 -0
- package/lib/compiler/plugins-loader.js +54 -0
- package/lib/compiler/typescript-loader.d.ts +6 -0
- package/lib/compiler/typescript-loader.js +31 -0
- package/lib/compiler/watch-compiler.d.ts +14 -0
- package/lib/compiler/watch-compiler.js +70 -0
- package/lib/compiler/webpack-compiler.d.ts +9 -0
- package/lib/compiler/webpack-compiler.js +74 -0
- package/lib/compiler/workspace-utils.d.ts +4 -0
- package/lib/compiler/workspace-utils.js +26 -0
- package/lib/configuration/configuration.d.ts +52 -0
- package/lib/configuration/configuration.js +2 -0
- package/lib/configuration/configuration.loader.d.ts +4 -0
- package/lib/configuration/configuration.loader.js +2 -0
- package/lib/configuration/defaults.d.ts +4 -0
- package/lib/configuration/defaults.js +56 -0
- package/lib/configuration/gadmin-configuration.loader.d.ts +8 -0
- package/lib/configuration/gadmin-configuration.loader.js +39 -0
- package/lib/configuration/index.d.ts +3 -0
- package/lib/configuration/index.js +19 -0
- package/lib/dependency-managers/index.d.ts +1 -0
- package/lib/dependency-managers/index.js +17 -0
- package/lib/dependency-managers/nest.dependency-manager.d.ts +7 -0
- package/lib/dependency-managers/nest.dependency-manager.js +48 -0
- package/lib/package-managers/abstract.package-manager.d.ts +25 -0
- package/lib/package-managers/abstract.package-manager.js +185 -0
- package/lib/package-managers/index.d.ts +8 -0
- package/lib/package-managers/index.js +24 -0
- package/lib/package-managers/npm.package-manager.d.ts +7 -0
- package/lib/package-managers/npm.package-manager.js +26 -0
- package/lib/package-managers/package-manager-commands.d.ts +9 -0
- package/lib/package-managers/package-manager-commands.js +2 -0
- package/lib/package-managers/package-manager.d.ts +5 -0
- package/lib/package-managers/package-manager.factory.d.ts +6 -0
- package/lib/package-managers/package-manager.factory.js +54 -0
- package/lib/package-managers/package-manager.js +9 -0
- package/lib/package-managers/pnpm.package-manager.d.ts +7 -0
- package/lib/package-managers/pnpm.package-manager.js +27 -0
- package/lib/package-managers/project.dependency.d.ts +4 -0
- package/lib/package-managers/project.dependency.js +2 -0
- package/lib/package-managers/yarn.package-manager.d.ts +7 -0
- package/lib/package-managers/yarn.package-manager.js +26 -0
- package/lib/questions/questions.d.ts +2 -0
- package/lib/questions/questions.js +23 -0
- package/lib/readers/file-system.reader.d.ts +8 -0
- package/lib/readers/file-system.reader.js +61 -0
- package/lib/readers/index.d.ts +2 -0
- package/lib/readers/index.js +18 -0
- package/lib/readers/reader.d.ts +5 -0
- package/lib/readers/reader.js +2 -0
- package/lib/runners/abstract.runner.d.ts +11 -0
- package/lib/runners/abstract.runner.js +55 -0
- package/lib/runners/git.runner.d.ts +4 -0
- package/lib/runners/git.runner.js +10 -0
- package/lib/runners/index.d.ts +3 -0
- package/lib/runners/index.js +19 -0
- package/lib/runners/npm.runner.d.ts +4 -0
- package/lib/runners/npm.runner.js +10 -0
- package/lib/runners/pnpm.runner.d.ts +4 -0
- package/lib/runners/pnpm.runner.js +10 -0
- package/lib/runners/runner.d.ts +6 -0
- package/lib/runners/runner.factory.d.ts +8 -0
- package/lib/runners/runner.factory.js +26 -0
- package/lib/runners/runner.js +10 -0
- package/lib/runners/schematic.runner.d.ts +6 -0
- package/lib/runners/schematic.runner.js +21 -0
- package/lib/runners/yarn.runner.d.ts +4 -0
- package/lib/runners/yarn.runner.js +10 -0
- package/lib/schematics/abstract.collection.d.ts +10 -0
- package/lib/schematics/abstract.collection.js +34 -0
- package/lib/schematics/collection.d.ts +3 -0
- package/lib/schematics/collection.factory.d.ts +5 -0
- package/lib/schematics/collection.factory.js +18 -0
- package/lib/schematics/collection.js +7 -0
- package/lib/schematics/custom.collection.d.ts +3 -0
- package/lib/schematics/custom.collection.js +7 -0
- package/lib/schematics/gadmin.collection.d.ts +16 -0
- package/lib/schematics/gadmin.collection.js +142 -0
- package/lib/schematics/index.d.ts +4 -0
- package/lib/schematics/index.js +20 -0
- package/lib/schematics/schematic.option.d.ts +8 -0
- package/lib/schematics/schematic.option.js +44 -0
- package/lib/ui/banner.d.ts +1 -0
- package/lib/ui/banner.js +11 -0
- package/lib/ui/emojis.d.ts +19 -0
- package/lib/ui/emojis.js +23 -0
- package/lib/ui/errors.d.ts +4 -0
- package/lib/ui/errors.js +8 -0
- package/lib/ui/index.d.ts +5 -0
- package/lib/ui/index.js +21 -0
- package/lib/ui/messages.d.ts +26 -0
- package/lib/ui/messages.js +34 -0
- package/lib/ui/prefixes.d.ts +2 -0
- package/lib/ui/prefixes.js +6 -0
- package/lib/utils/formatting.d.ts +8 -0
- package/lib/utils/formatting.js +19 -0
- package/lib/utils/is-error.d.ts +1 -0
- package/lib/utils/is-error.js +11 -0
- package/lib/utils/load-configuration.d.ts +2 -0
- package/lib/utils/load-configuration.js +21 -0
- package/lib/utils/local-binaries.d.ts +3 -0
- package/lib/utils/local-binaries.js +16 -0
- package/lib/utils/project-utils.d.ts +8 -0
- package/lib/utils/project-utils.js +69 -0
- package/lib/utils/remaining-flags.d.ts +2 -0
- package/lib/utils/remaining-flags.js +37 -0
- package/lib/utils/tree-kill.d.ts +1 -0
- package/lib/utils/tree-kill.js +66 -0
- package/package.json +105 -0
- package/test/lib/compiler/hooks/__snapshots__/tsconfig-paths.hook.spec.ts.snap +68 -0
- package/test/lib/compiler/hooks/fixtures/aliased-imports/src/bar.tsx +1 -0
- package/test/lib/compiler/hooks/fixtures/aliased-imports/src/baz.js +1 -0
- package/test/lib/compiler/hooks/fixtures/aliased-imports/src/qux.jsx +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AddCommand = void 0;
|
|
13
|
+
const remaining_flags_1 = require("../lib/utils/remaining-flags");
|
|
14
|
+
const abstract_command_1 = require("./abstract.command");
|
|
15
|
+
class AddCommand extends abstract_command_1.AbstractCommand {
|
|
16
|
+
load(program) {
|
|
17
|
+
program
|
|
18
|
+
.command('add <library>')
|
|
19
|
+
.allowUnknownOption()
|
|
20
|
+
.description('Adds support for an external library to your project.')
|
|
21
|
+
.option('-d, --dry-run', 'Report actions that would be performed without writing out results.')
|
|
22
|
+
.option('-p, --project [project]', 'Project in which to generate files.')
|
|
23
|
+
.usage('<library> [options] [library-specific-options]')
|
|
24
|
+
.action((library, command) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const options = [];
|
|
26
|
+
options.push({ name: 'dry-run', value: !!command.dryRun });
|
|
27
|
+
options.push({
|
|
28
|
+
name: 'project',
|
|
29
|
+
value: command.project,
|
|
30
|
+
});
|
|
31
|
+
const inputs = [];
|
|
32
|
+
inputs.push({ name: 'library', value: library });
|
|
33
|
+
const flags = (0, remaining_flags_1.getRemainingFlags)(program);
|
|
34
|
+
try {
|
|
35
|
+
yield this.action.handle(inputs, options, flags);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.AddCommand = AddCommand;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BuildCommand = void 0;
|
|
13
|
+
const abstract_command_1 = require("./abstract.command");
|
|
14
|
+
class BuildCommand extends abstract_command_1.AbstractCommand {
|
|
15
|
+
load(program) {
|
|
16
|
+
program
|
|
17
|
+
.command('build [app]')
|
|
18
|
+
.option('-c, --config [path]', 'Path to gadmin-cli configuration file.')
|
|
19
|
+
.option('-p, --path [path]', 'Path to tsconfig file.')
|
|
20
|
+
.option('-w, --watch', 'Run in watch mode (live-reload).')
|
|
21
|
+
.option('--watchAssets', 'Watch non-ts (e.g., .graphql) files mode.')
|
|
22
|
+
.option('--webpack', 'Use webpack for compilation.')
|
|
23
|
+
.option('--webpackPath [path]', 'Path to webpack configuration.')
|
|
24
|
+
.option('--tsc', 'Use tsc for compilation.')
|
|
25
|
+
.description('Build Gadmin application.')
|
|
26
|
+
.action((app, command) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const options = [];
|
|
28
|
+
options.push({
|
|
29
|
+
name: 'config',
|
|
30
|
+
value: command.config,
|
|
31
|
+
});
|
|
32
|
+
const isWebpackEnabled = command.tsc ? false : command.webpack;
|
|
33
|
+
options.push({ name: 'webpack', value: isWebpackEnabled });
|
|
34
|
+
options.push({ name: 'watch', value: !!command.watch });
|
|
35
|
+
options.push({ name: 'watchAssets', value: !!command.watchAssets });
|
|
36
|
+
options.push({
|
|
37
|
+
name: 'path',
|
|
38
|
+
value: command.path,
|
|
39
|
+
});
|
|
40
|
+
options.push({
|
|
41
|
+
name: 'webpackPath',
|
|
42
|
+
value: command.webpackPath,
|
|
43
|
+
});
|
|
44
|
+
const inputs = [];
|
|
45
|
+
inputs.push({ name: 'app', value: app });
|
|
46
|
+
yield this.action.handle(inputs, options);
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.BuildCommand = BuildCommand;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface Input {
|
|
2
|
+
name: string;
|
|
3
|
+
value: boolean | string;
|
|
4
|
+
options?: any;
|
|
5
|
+
}
|
|
6
|
+
export declare enum Template {
|
|
7
|
+
GameAngle = "gadmin2-game-angle-demo",
|
|
8
|
+
Customize = "customize"
|
|
9
|
+
}
|
|
10
|
+
export declare enum TransferProtocol {
|
|
11
|
+
Restful = "restful",
|
|
12
|
+
GraphQL = "graphQL"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ServerFramework {
|
|
15
|
+
Nest = "nest",
|
|
16
|
+
Iris = "iris"
|
|
17
|
+
}
|
|
18
|
+
export declare enum UiFramework {
|
|
19
|
+
Tea = "tea",
|
|
20
|
+
Antd = "antd"
|
|
21
|
+
}
|
|
22
|
+
export declare enum WithWeb {
|
|
23
|
+
Yes = "yes",
|
|
24
|
+
No = "no"
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WithWeb = exports.UiFramework = exports.ServerFramework = exports.TransferProtocol = exports.Template = void 0;
|
|
4
|
+
var Template;
|
|
5
|
+
(function (Template) {
|
|
6
|
+
Template["GameAngle"] = "gadmin2-game-angle-demo";
|
|
7
|
+
Template["Customize"] = "customize";
|
|
8
|
+
})(Template = exports.Template || (exports.Template = {}));
|
|
9
|
+
var TransferProtocol;
|
|
10
|
+
(function (TransferProtocol) {
|
|
11
|
+
TransferProtocol["Restful"] = "restful";
|
|
12
|
+
TransferProtocol["GraphQL"] = "graphQL";
|
|
13
|
+
})(TransferProtocol = exports.TransferProtocol || (exports.TransferProtocol = {}));
|
|
14
|
+
var ServerFramework;
|
|
15
|
+
(function (ServerFramework) {
|
|
16
|
+
ServerFramework["Nest"] = "nest";
|
|
17
|
+
ServerFramework["Iris"] = "iris";
|
|
18
|
+
})(ServerFramework = exports.ServerFramework || (exports.ServerFramework = {}));
|
|
19
|
+
var UiFramework;
|
|
20
|
+
(function (UiFramework) {
|
|
21
|
+
UiFramework["Tea"] = "tea";
|
|
22
|
+
UiFramework["Antd"] = "antd";
|
|
23
|
+
})(UiFramework = exports.UiFramework || (exports.UiFramework = {}));
|
|
24
|
+
var WithWeb;
|
|
25
|
+
(function (WithWeb) {
|
|
26
|
+
WithWeb["Yes"] = "yes";
|
|
27
|
+
WithWeb["No"] = "no";
|
|
28
|
+
})(WithWeb = exports.WithWeb || (exports.WithWeb = {}));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandLoader = void 0;
|
|
4
|
+
const chalk = require("chalk");
|
|
5
|
+
const actions_1 = require("../actions");
|
|
6
|
+
const ui_1 = require("../lib/ui");
|
|
7
|
+
const add_command_1 = require("./add.command");
|
|
8
|
+
const build_command_1 = require("./build.command");
|
|
9
|
+
const generate_command_1 = require("./generate.command");
|
|
10
|
+
const info_command_1 = require("./info.command");
|
|
11
|
+
const new_command_1 = require("./new.command");
|
|
12
|
+
const start_command_1 = require("./start.command");
|
|
13
|
+
const update_command_1 = require("./update.command");
|
|
14
|
+
class CommandLoader {
|
|
15
|
+
static load(program) {
|
|
16
|
+
new new_command_1.NewCommand(new actions_1.NewAction()).load(program);
|
|
17
|
+
new build_command_1.BuildCommand(new actions_1.BuildAction()).load(program);
|
|
18
|
+
new start_command_1.StartCommand(new actions_1.StartAction()).load(program);
|
|
19
|
+
new info_command_1.InfoCommand(new actions_1.InfoAction()).load(program);
|
|
20
|
+
new update_command_1.UpdateCommand(new actions_1.UpdateAction()).load(program);
|
|
21
|
+
new add_command_1.AddCommand(new actions_1.AddAction()).load(program);
|
|
22
|
+
new generate_command_1.GenerateCommand(new actions_1.GenerateAction()).load(program);
|
|
23
|
+
this.handleInvalidCommand(program);
|
|
24
|
+
}
|
|
25
|
+
static handleInvalidCommand(program) {
|
|
26
|
+
program.on('command:*', () => {
|
|
27
|
+
console.error(`\n${ui_1.ERROR_PREFIX} Invalid command: ${chalk.red('%s')}`, program.args.join(' '));
|
|
28
|
+
console.log(`See ${chalk.red('--help')} for a list of available commands.\n`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.CommandLoader = CommandLoader;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommanderStatic } from 'commander';
|
|
2
|
+
import { AbstractCommand } from './abstract.command';
|
|
3
|
+
export declare class GenerateCommand extends AbstractCommand {
|
|
4
|
+
load(program: CommanderStatic): void;
|
|
5
|
+
private buildDescription;
|
|
6
|
+
private buildSchematicsListAsTable;
|
|
7
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GenerateCommand = void 0;
|
|
13
|
+
const chalk = require("chalk");
|
|
14
|
+
const Table = require("cli-table3");
|
|
15
|
+
const gadmin_collection_1 = require("../lib/schematics/gadmin.collection");
|
|
16
|
+
const abstract_command_1 = require("./abstract.command");
|
|
17
|
+
class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
18
|
+
load(program) {
|
|
19
|
+
program
|
|
20
|
+
.command('generate <schematic> [name] [path]')
|
|
21
|
+
.alias('g')
|
|
22
|
+
.description(this.buildDescription())
|
|
23
|
+
.option('-d, --dry-run', 'Report actions that would be taken without writing out results.')
|
|
24
|
+
.option('-p, --project [project]', 'Project in which to generate files.')
|
|
25
|
+
.option('--flat', 'Enforce flat structure of generated element.', () => true)
|
|
26
|
+
.option('--no-flat', 'Enforce that directories are generated.', () => false)
|
|
27
|
+
.option('--spec', 'Enforce spec files generation.', () => {
|
|
28
|
+
return { value: true, passedAsInput: true };
|
|
29
|
+
}, true)
|
|
30
|
+
.option('--skip-import', 'Skip importing', () => true, false)
|
|
31
|
+
.option('--no-spec', 'Disable spec files generation.', () => {
|
|
32
|
+
return { value: false, passedAsInput: true };
|
|
33
|
+
})
|
|
34
|
+
.option('-c, --collection [collectionName]', 'Schematics collection to use.')
|
|
35
|
+
.action((schematic, name, path, command) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const options = [];
|
|
37
|
+
options.push({ name: 'dry-run', value: !!command.dryRun });
|
|
38
|
+
if (command.flat !== undefined) {
|
|
39
|
+
options.push({ name: 'flat', value: command.flat });
|
|
40
|
+
}
|
|
41
|
+
options.push({
|
|
42
|
+
name: 'spec',
|
|
43
|
+
value: typeof command.spec === 'boolean'
|
|
44
|
+
? command.spec
|
|
45
|
+
: command.spec.value,
|
|
46
|
+
options: {
|
|
47
|
+
passedAsInput: typeof command.spec === 'boolean'
|
|
48
|
+
? false
|
|
49
|
+
: command.spec.passedAsInput,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
options.push({
|
|
53
|
+
name: 'collection',
|
|
54
|
+
value: command.collection,
|
|
55
|
+
});
|
|
56
|
+
options.push({
|
|
57
|
+
name: 'project',
|
|
58
|
+
value: command.project,
|
|
59
|
+
});
|
|
60
|
+
options.push({
|
|
61
|
+
name: 'skipImport',
|
|
62
|
+
value: command.skipImport,
|
|
63
|
+
options: {
|
|
64
|
+
keepInputNameFormat: true,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const inputs = [];
|
|
68
|
+
inputs.push({ name: 'schematic', value: schematic });
|
|
69
|
+
inputs.push({ name: 'name', value: name });
|
|
70
|
+
inputs.push({ name: 'path', value: path });
|
|
71
|
+
yield this.action.handle(inputs, options);
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
buildDescription() {
|
|
75
|
+
return ('Generate a Gadmin element.\n' +
|
|
76
|
+
` Schematics available on ${chalk.bold('@gadmin2n/schematics')} collection:\n` +
|
|
77
|
+
this.buildSchematicsListAsTable());
|
|
78
|
+
}
|
|
79
|
+
buildSchematicsListAsTable() {
|
|
80
|
+
const leftMargin = ' ';
|
|
81
|
+
const tableConfig = {
|
|
82
|
+
head: ['name', 'alias', 'type', 'description'],
|
|
83
|
+
chars: {
|
|
84
|
+
'left': leftMargin.concat('│'),
|
|
85
|
+
'top-left': leftMargin.concat('┌'),
|
|
86
|
+
'bottom-left': leftMargin.concat('└'),
|
|
87
|
+
'mid': '',
|
|
88
|
+
'left-mid': '',
|
|
89
|
+
'mid-mid': '',
|
|
90
|
+
'right-mid': '',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
const table = new Table(tableConfig);
|
|
94
|
+
for (const schematic of gadmin_collection_1.GadminCollection.getSchematics()) {
|
|
95
|
+
table.push([
|
|
96
|
+
chalk.green(schematic.name),
|
|
97
|
+
chalk.cyan(schematic.alias),
|
|
98
|
+
schematic.type,
|
|
99
|
+
schematic.description,
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
return table.toString();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.GenerateCommand = GenerateCommand;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./command.loader"), exports);
|
|
18
|
+
__exportStar(require("./command.input"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InfoCommand = void 0;
|
|
13
|
+
const abstract_command_1 = require("./abstract.command");
|
|
14
|
+
class InfoCommand extends abstract_command_1.AbstractCommand {
|
|
15
|
+
load(program) {
|
|
16
|
+
program
|
|
17
|
+
.command('info')
|
|
18
|
+
.alias('i')
|
|
19
|
+
.description('Display Gadmin project details.')
|
|
20
|
+
.action(() => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
yield this.action.handle();
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.InfoCommand = InfoCommand;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.NewCommand = void 0;
|
|
13
|
+
const schematics_1 = require("../lib/schematics");
|
|
14
|
+
const abstract_command_1 = require("./abstract.command");
|
|
15
|
+
class NewCommand extends abstract_command_1.AbstractCommand {
|
|
16
|
+
load(program) {
|
|
17
|
+
program
|
|
18
|
+
.command('new [name]')
|
|
19
|
+
.alias('n')
|
|
20
|
+
.description('Generate Gadmin application.')
|
|
21
|
+
.option('--directory [directory]', 'Specify the destination directory')
|
|
22
|
+
.option('-d, --dry-run', 'Report actions that would be performed without writing out results.', false)
|
|
23
|
+
.option('-g, --skip-git', 'Skip git repository initialization.', false)
|
|
24
|
+
.option('-w, --with-web', 'Need generate frontend web pages.')
|
|
25
|
+
.option('-s, --skip-install', 'Skip package installation.', false)
|
|
26
|
+
.option('-p, --package-manager [package-manager]', 'Specify package manager.')
|
|
27
|
+
.option('-c, --collection [collectionName]', 'Schematics collection to use', schematics_1.Collection.GADMIN_GENERATOR)
|
|
28
|
+
.option('--strict', 'Enables strict mode in TypeScript.', false)
|
|
29
|
+
.action((name, command) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const options = [];
|
|
31
|
+
options.push({ name: 'directory', value: command.directory });
|
|
32
|
+
options.push({ name: 'template', value: undefined });
|
|
33
|
+
options.push({ name: 'dry-run', value: command.dryRun });
|
|
34
|
+
options.push({ name: 'skip-git', value: command.skipGit });
|
|
35
|
+
options.push({ name: 'skip-install', value: command.skipInstall });
|
|
36
|
+
options.push({ name: 'strict', value: command.strict });
|
|
37
|
+
options.push({
|
|
38
|
+
name: 'package-manager',
|
|
39
|
+
value: command.packageManager,
|
|
40
|
+
});
|
|
41
|
+
options.push({ name: 'collection', value: command.collection });
|
|
42
|
+
options.push({ name: 'transfer-protocol', value: 'restful' });
|
|
43
|
+
options.push({ name: 'server-framework', value: undefined });
|
|
44
|
+
options.push({ name: 'with-web', value: command.withWeb });
|
|
45
|
+
options.push({ name: 'ui-framework', value: 'antd' });
|
|
46
|
+
const inputs = [];
|
|
47
|
+
inputs.push({ name: 'name', value: name });
|
|
48
|
+
yield this.action.handle(inputs, options);
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.NewCommand = NewCommand;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StartCommand = void 0;
|
|
13
|
+
const abstract_command_1 = require("./abstract.command");
|
|
14
|
+
class StartCommand extends abstract_command_1.AbstractCommand {
|
|
15
|
+
load(program) {
|
|
16
|
+
program
|
|
17
|
+
.command('start [app]')
|
|
18
|
+
.option('-c, --config [path]', 'Path to gadmin-cli configuration file.')
|
|
19
|
+
.option('-p, --path [path]', 'Path to tsconfig file.')
|
|
20
|
+
.option('-w, --watch', 'Run in watch mode (live-reload).')
|
|
21
|
+
.option('--watchAssets', 'Watch non-ts (e.g., .graphql) files mode.')
|
|
22
|
+
.option('-d, --debug [hostport] ', 'Run in debug mode (with --inspect flag).')
|
|
23
|
+
.option('--webpack', 'Use webpack for compilation.')
|
|
24
|
+
.option('--webpackPath [path]', 'Path to webpack configuration.')
|
|
25
|
+
.option('--tsc', 'Use tsc for compilation.')
|
|
26
|
+
.option('-e, --exec [binary]', 'Binary to run (default: "node").')
|
|
27
|
+
.option('--preserveWatchOutput', 'Use "preserveWatchOutput" option when tsc watch mode.')
|
|
28
|
+
.description('Run Gadmin application.')
|
|
29
|
+
.action((app, command) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const options = [];
|
|
31
|
+
options.push({
|
|
32
|
+
name: 'config',
|
|
33
|
+
value: command.config,
|
|
34
|
+
});
|
|
35
|
+
const isWebpackEnabled = command.tsc ? false : command.webpack;
|
|
36
|
+
options.push({ name: 'webpack', value: isWebpackEnabled });
|
|
37
|
+
options.push({ name: 'debug', value: command.debug });
|
|
38
|
+
options.push({ name: 'watch', value: !!command.watch });
|
|
39
|
+
options.push({ name: 'watchAssets', value: !!command.watchAssets });
|
|
40
|
+
options.push({
|
|
41
|
+
name: 'path',
|
|
42
|
+
value: command.path,
|
|
43
|
+
});
|
|
44
|
+
options.push({
|
|
45
|
+
name: 'webpackPath',
|
|
46
|
+
value: command.webpackPath,
|
|
47
|
+
});
|
|
48
|
+
options.push({
|
|
49
|
+
name: 'exec',
|
|
50
|
+
value: command.exec,
|
|
51
|
+
});
|
|
52
|
+
options.push({
|
|
53
|
+
name: 'preserveWatchOutput',
|
|
54
|
+
value: !!command.preserveWatchOutput &&
|
|
55
|
+
!!command.watch &&
|
|
56
|
+
!isWebpackEnabled,
|
|
57
|
+
});
|
|
58
|
+
const inputs = [];
|
|
59
|
+
inputs.push({ name: 'app', value: app });
|
|
60
|
+
yield this.action.handle(inputs, options);
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.StartCommand = StartCommand;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateCommand = void 0;
|
|
13
|
+
const abstract_command_1 = require("./abstract.command");
|
|
14
|
+
class UpdateCommand extends abstract_command_1.AbstractCommand {
|
|
15
|
+
load(program) {
|
|
16
|
+
program
|
|
17
|
+
.command('update')
|
|
18
|
+
.alias('u')
|
|
19
|
+
.description('Update Gadmin dependencies.')
|
|
20
|
+
.option('-f, --force', 'Remove and re-install dependencies (instead of update).')
|
|
21
|
+
.option('-t, --tag <tag>', 'Upgrade to tagged packages (latest | beta | rc | next tag).')
|
|
22
|
+
.action((command) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const options = [];
|
|
24
|
+
options.push({ name: 'force', value: !!command.force });
|
|
25
|
+
options.push({ name: 'tag', value: command.tag });
|
|
26
|
+
yield this.action.handle([], options);
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.UpdateCommand = UpdateCommand;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Configuration } from '../configuration';
|
|
2
|
+
export declare class AssetsManager {
|
|
3
|
+
private watchAssetsKeyValue;
|
|
4
|
+
private watchers;
|
|
5
|
+
private actionInProgress;
|
|
6
|
+
/**
|
|
7
|
+
* Using on `nest build` to close file watch or the build process will not end
|
|
8
|
+
* Interval like process
|
|
9
|
+
* If no action has been taken recently close watchers
|
|
10
|
+
* If action has been taken recently flag and try again
|
|
11
|
+
*/
|
|
12
|
+
closeWatchers(): void;
|
|
13
|
+
copyAssets(configuration: Required<Configuration>, appName: string, outDir: string, watchAssetsMode: boolean): void;
|
|
14
|
+
private actionOnFile;
|
|
15
|
+
}
|