@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,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WatchCompiler = void 0;
|
|
4
|
+
const errors_1 = require("../ui/errors");
|
|
5
|
+
const get_value_or_default_1 = require("./helpers/get-value-or-default");
|
|
6
|
+
const tsconfig_paths_hook_1 = require("./hooks/tsconfig-paths.hook");
|
|
7
|
+
class WatchCompiler {
|
|
8
|
+
constructor(pluginsLoader, tsConfigProvider, typescriptLoader) {
|
|
9
|
+
this.pluginsLoader = pluginsLoader;
|
|
10
|
+
this.tsConfigProvider = tsConfigProvider;
|
|
11
|
+
this.typescriptLoader = typescriptLoader;
|
|
12
|
+
}
|
|
13
|
+
run(configuration, configFilename, appName, tsCompilerOptions, onSuccess) {
|
|
14
|
+
const tsBin = this.typescriptLoader.load();
|
|
15
|
+
const configPath = tsBin.findConfigFile(process.cwd(), tsBin.sys.fileExists, configFilename);
|
|
16
|
+
if (!configPath) {
|
|
17
|
+
throw new Error(errors_1.CLI_ERRORS.MISSING_TYPESCRIPT(configFilename));
|
|
18
|
+
}
|
|
19
|
+
const { projectReferences } = this.tsConfigProvider.getByConfigFilename(configFilename);
|
|
20
|
+
const createProgram = tsBin.createEmitAndSemanticDiagnosticsBuilderProgram;
|
|
21
|
+
const origDiagnosticReporter = tsBin.createDiagnosticReporter(tsBin.sys, true);
|
|
22
|
+
const origWatchStatusReporter = tsBin.createWatchStatusReporter(tsBin.sys, true);
|
|
23
|
+
const host = tsBin.createWatchCompilerHost(configPath, tsCompilerOptions, tsBin.sys, createProgram, this.createDiagnosticReporter(origDiagnosticReporter), this.createWatchStatusChanged(origWatchStatusReporter, onSuccess));
|
|
24
|
+
const pluginsConfig = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.plugins', appName);
|
|
25
|
+
const plugins = this.pluginsLoader.load(pluginsConfig);
|
|
26
|
+
const origCreateProgram = host.createProgram;
|
|
27
|
+
host.createProgram = (rootNames, options,
|
|
28
|
+
// tslint:disable-next-line:no-shadowed-variable
|
|
29
|
+
host, oldProgram) => {
|
|
30
|
+
const tsconfigPathsPlugin = options ? (0, tsconfig_paths_hook_1.tsconfigPathsBeforeHookFactory)(options) : null;
|
|
31
|
+
const program = origCreateProgram(rootNames, options, host, oldProgram, undefined, projectReferences);
|
|
32
|
+
const origProgramEmit = program.emit;
|
|
33
|
+
program.emit = (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) => {
|
|
34
|
+
let transforms = customTransformers;
|
|
35
|
+
transforms = typeof transforms !== 'object' ? {} : transforms;
|
|
36
|
+
const before = plugins.beforeHooks.map((hook) => hook(program.getProgram()));
|
|
37
|
+
const after = plugins.afterHooks.map((hook) => hook(program.getProgram()));
|
|
38
|
+
const afterDeclarations = plugins.afterDeclarationsHooks.map((hook) => hook(program.getProgram()));
|
|
39
|
+
if (tsconfigPathsPlugin) {
|
|
40
|
+
before.unshift(tsconfigPathsPlugin);
|
|
41
|
+
}
|
|
42
|
+
transforms.before = before.concat(transforms.before || []);
|
|
43
|
+
transforms.after = after.concat(transforms.after || []);
|
|
44
|
+
transforms.afterDeclarations = afterDeclarations.concat(transforms.afterDeclarations || []);
|
|
45
|
+
return origProgramEmit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, transforms);
|
|
46
|
+
};
|
|
47
|
+
return program;
|
|
48
|
+
};
|
|
49
|
+
tsBin.createWatchProgram(host);
|
|
50
|
+
}
|
|
51
|
+
createDiagnosticReporter(diagnosticReporter) {
|
|
52
|
+
return function (diagnostic, ...args) {
|
|
53
|
+
return diagnosticReporter.call(this, diagnostic, ...args);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
createWatchStatusChanged(watchStatusReporter, onSuccess) {
|
|
57
|
+
return function (diagnostic, ...args) {
|
|
58
|
+
const messageText = diagnostic && diagnostic.messageText;
|
|
59
|
+
const noErrorsMessage = '0 errors';
|
|
60
|
+
if (messageText &&
|
|
61
|
+
messageText.includes &&
|
|
62
|
+
messageText.includes(noErrorsMessage) &&
|
|
63
|
+
onSuccess) {
|
|
64
|
+
onSuccess();
|
|
65
|
+
}
|
|
66
|
+
return watchStatusReporter.call(this, diagnostic, ...args);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.WatchCompiler = WatchCompiler;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Configuration } from '../configuration';
|
|
2
|
+
import { AssetsManager } from './assets-manager';
|
|
3
|
+
import { PluginsLoader } from './plugins-loader';
|
|
4
|
+
import webpack = require('webpack');
|
|
5
|
+
export declare class WebpackCompiler {
|
|
6
|
+
private readonly pluginsLoader;
|
|
7
|
+
constructor(pluginsLoader: PluginsLoader);
|
|
8
|
+
run(configuration: Required<Configuration>, webpackConfigFactoryOrConfig: (config: webpack.Configuration, webpackRef: typeof webpack) => webpack.Configuration, tsConfigPath: string, appName: string, isDebugEnabled: boolean | undefined, watchMode: boolean | undefined, assetsManager: AssetsManager, onSuccess?: () => void): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebpackCompiler = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const ui_1 = require("../ui");
|
|
7
|
+
const webpack_defaults_1 = require("./defaults/webpack-defaults");
|
|
8
|
+
const get_value_or_default_1 = require("./helpers/get-value-or-default");
|
|
9
|
+
const webpack = require("webpack");
|
|
10
|
+
class WebpackCompiler {
|
|
11
|
+
constructor(pluginsLoader) {
|
|
12
|
+
this.pluginsLoader = pluginsLoader;
|
|
13
|
+
}
|
|
14
|
+
run(configuration, webpackConfigFactoryOrConfig, tsConfigPath, appName, isDebugEnabled = false, watchMode = false, assetsManager, onSuccess) {
|
|
15
|
+
const cwd = process.cwd();
|
|
16
|
+
const configPath = (0, path_1.join)(cwd, tsConfigPath);
|
|
17
|
+
if (!(0, fs_1.existsSync)(configPath)) {
|
|
18
|
+
throw new Error(`Could not find TypeScript configuration file "${tsConfigPath}".`);
|
|
19
|
+
}
|
|
20
|
+
const pluginsConfig = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.plugins', appName);
|
|
21
|
+
const plugins = this.pluginsLoader.load(pluginsConfig);
|
|
22
|
+
const relativeRootPath = (0, path_1.dirname)((0, path_1.relative)(cwd, configPath));
|
|
23
|
+
const sourceRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName);
|
|
24
|
+
const pathToSource = (0, path_1.normalize)(sourceRoot).indexOf((0, path_1.normalize)(relativeRootPath)) >= 0
|
|
25
|
+
? (0, path_1.join)(cwd, sourceRoot)
|
|
26
|
+
: (0, path_1.join)(cwd, relativeRootPath, sourceRoot);
|
|
27
|
+
const entryFile = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'entryFile', appName);
|
|
28
|
+
const entryFileRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'root', appName) || '';
|
|
29
|
+
const defaultOptions = (0, webpack_defaults_1.webpackDefaultsFactory)(pathToSource, entryFileRoot, entryFile, isDebugEnabled, tsConfigPath, plugins);
|
|
30
|
+
const projectWebpackOptions = typeof webpackConfigFactoryOrConfig !== 'function'
|
|
31
|
+
? webpackConfigFactoryOrConfig
|
|
32
|
+
: webpackConfigFactoryOrConfig(defaultOptions, webpack);
|
|
33
|
+
const webpackConfiguration = Object.assign(Object.assign(Object.assign({}, defaultOptions), { mode: watchMode ? 'development' : defaultOptions.mode }), projectWebpackOptions);
|
|
34
|
+
const compiler = webpack(webpackConfiguration);
|
|
35
|
+
const afterCallback = (err, stats) => {
|
|
36
|
+
if (err && stats === undefined) {
|
|
37
|
+
// Could not complete the compilation
|
|
38
|
+
// The error caught is most likely thrown by underlying tasks
|
|
39
|
+
console.log(err);
|
|
40
|
+
return process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
const statsOutput = stats.toString({
|
|
43
|
+
chunks: false,
|
|
44
|
+
colors: true,
|
|
45
|
+
modules: false,
|
|
46
|
+
assets: false,
|
|
47
|
+
});
|
|
48
|
+
if (!err && !stats.hasErrors()) {
|
|
49
|
+
if (!onSuccess) {
|
|
50
|
+
assetsManager.closeWatchers();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
onSuccess();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (!watchMode && !webpackConfiguration.watch) {
|
|
57
|
+
console.log(statsOutput);
|
|
58
|
+
return process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
console.log(statsOutput);
|
|
61
|
+
};
|
|
62
|
+
if (watchMode || webpackConfiguration.watch) {
|
|
63
|
+
compiler.hooks.watchRun.tapAsync('Rebuild info', (params, callback) => {
|
|
64
|
+
console.log(`\n${ui_1.INFO_PREFIX} Webpack is building your sources...\n`);
|
|
65
|
+
callback();
|
|
66
|
+
});
|
|
67
|
+
compiler.watch(webpackConfiguration.watchOptions || {}, afterCallback);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
compiler.run(afterCallback);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.WebpackCompiler = WebpackCompiler;
|
|
@@ -0,0 +1,26 @@
|
|
|
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.WorkspaceUtils = void 0;
|
|
13
|
+
const rimraf = require("rimraf");
|
|
14
|
+
const get_value_or_default_1 = require("./helpers/get-value-or-default");
|
|
15
|
+
class WorkspaceUtils {
|
|
16
|
+
deleteOutDirIfEnabled(configuration, appName, dirPath) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const isDeleteEnabled = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.deleteOutDir', appName);
|
|
19
|
+
if (!isDeleteEnabled) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
yield new Promise((resolve, reject) => rimraf(dirPath, (err) => (err ? reject(err) : resolve())));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.WorkspaceUtils = WorkspaceUtils;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare type Asset = 'string' | AssetEntry;
|
|
2
|
+
export interface AssetEntry {
|
|
3
|
+
glob: string;
|
|
4
|
+
include?: string;
|
|
5
|
+
flat?: boolean;
|
|
6
|
+
exclude?: string;
|
|
7
|
+
outDir?: string;
|
|
8
|
+
watchAssets?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ActionOnFile {
|
|
11
|
+
action: 'change' | 'unlink';
|
|
12
|
+
item: AssetEntry;
|
|
13
|
+
path: string;
|
|
14
|
+
sourceRoot: string;
|
|
15
|
+
watchAssetsMode: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface CompilerOptions {
|
|
18
|
+
tsConfigPath?: string;
|
|
19
|
+
webpack?: boolean;
|
|
20
|
+
webpackConfigPath?: string;
|
|
21
|
+
plugins?: string[] | PluginOptions[];
|
|
22
|
+
assets?: string[];
|
|
23
|
+
deleteOutDir?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface PluginOptions {
|
|
26
|
+
name: string;
|
|
27
|
+
options: Record<string, any>[];
|
|
28
|
+
}
|
|
29
|
+
interface GenerateOptions {
|
|
30
|
+
spec?: boolean | Record<string, boolean>;
|
|
31
|
+
}
|
|
32
|
+
export interface ProjectConfiguration {
|
|
33
|
+
type?: string;
|
|
34
|
+
root?: string;
|
|
35
|
+
entryFile?: string;
|
|
36
|
+
sourceRoot?: string;
|
|
37
|
+
compilerOptions?: CompilerOptions;
|
|
38
|
+
}
|
|
39
|
+
export interface Configuration {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
language?: string;
|
|
42
|
+
collection?: string;
|
|
43
|
+
sourceRoot?: string;
|
|
44
|
+
entryFile?: string;
|
|
45
|
+
monorepo?: boolean;
|
|
46
|
+
compilerOptions?: CompilerOptions;
|
|
47
|
+
generateOptions?: GenerateOptions;
|
|
48
|
+
projects?: {
|
|
49
|
+
[key: string]: ProjectConfiguration;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Configuration } from './configuration';
|
|
2
|
+
export declare const defaultConfiguration: Required<Configuration>;
|
|
3
|
+
export declare const defaultOutDir = "dist";
|
|
4
|
+
export declare const defaultGitIgnore = "# compiled output\ndist/\nnode_modules/\n\n# Logs\nlogs/\n*.log\nnpm-debug.log*\npnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# OS\n.DS_Store\n\n# Tests\ncoverage\n.nyc_output\n\n# IDEs and editors\n.idea\n.project\n.classpath\n.c9/\n*.launch\n.settings/\n*.sublime-workspace\n\n# IDE - VSCode\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultGitIgnore = exports.defaultOutDir = exports.defaultConfiguration = void 0;
|
|
4
|
+
const schematics_1 = require("../schematics");
|
|
5
|
+
exports.defaultConfiguration = {
|
|
6
|
+
language: 'ts',
|
|
7
|
+
sourceRoot: 'src',
|
|
8
|
+
collection: schematics_1.Collection.GADMIN_GENERATOR,
|
|
9
|
+
entryFile: 'main',
|
|
10
|
+
projects: {},
|
|
11
|
+
monorepo: false,
|
|
12
|
+
compilerOptions: {
|
|
13
|
+
tsConfigPath: 'tsconfig.build.json',
|
|
14
|
+
webpack: false,
|
|
15
|
+
webpackConfigPath: 'webpack.config.js',
|
|
16
|
+
plugins: [],
|
|
17
|
+
assets: [],
|
|
18
|
+
},
|
|
19
|
+
generateOptions: {},
|
|
20
|
+
};
|
|
21
|
+
exports.defaultOutDir = 'dist';
|
|
22
|
+
exports.defaultGitIgnore = `# compiled output
|
|
23
|
+
dist/
|
|
24
|
+
node_modules/
|
|
25
|
+
|
|
26
|
+
# Logs
|
|
27
|
+
logs/
|
|
28
|
+
*.log
|
|
29
|
+
npm-debug.log*
|
|
30
|
+
pnpm-debug.log*
|
|
31
|
+
yarn-debug.log*
|
|
32
|
+
yarn-error.log*
|
|
33
|
+
lerna-debug.log*
|
|
34
|
+
|
|
35
|
+
# OS
|
|
36
|
+
.DS_Store
|
|
37
|
+
|
|
38
|
+
# Tests
|
|
39
|
+
coverage
|
|
40
|
+
.nyc_output
|
|
41
|
+
|
|
42
|
+
# IDEs and editors
|
|
43
|
+
.idea
|
|
44
|
+
.project
|
|
45
|
+
.classpath
|
|
46
|
+
.c9/
|
|
47
|
+
*.launch
|
|
48
|
+
.settings/
|
|
49
|
+
*.sublime-workspace
|
|
50
|
+
|
|
51
|
+
# IDE - VSCode
|
|
52
|
+
.vscode/*
|
|
53
|
+
!.vscode/settings.json
|
|
54
|
+
!.vscode/tasks.json
|
|
55
|
+
!.vscode/launch.json
|
|
56
|
+
!.vscode/extensions.json`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Reader } from '../readers';
|
|
2
|
+
import { Configuration } from './configuration';
|
|
3
|
+
import { ConfigurationLoader } from './configuration.loader';
|
|
4
|
+
export declare class GadminConfigurationLoader implements ConfigurationLoader {
|
|
5
|
+
private readonly reader;
|
|
6
|
+
constructor(reader: Reader);
|
|
7
|
+
load(name?: string): Promise<Required<Configuration>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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.GadminConfigurationLoader = void 0;
|
|
13
|
+
const defaults_1 = require("./defaults");
|
|
14
|
+
class GadminConfigurationLoader {
|
|
15
|
+
constructor(reader) {
|
|
16
|
+
this.reader = reader;
|
|
17
|
+
}
|
|
18
|
+
load(name) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const content = name
|
|
21
|
+
? yield this.reader.read(name)
|
|
22
|
+
: yield this.reader.readAnyOf([
|
|
23
|
+
'.gadmincli.json',
|
|
24
|
+
'.gadmin-cli.json',
|
|
25
|
+
'gadmin-cli.json',
|
|
26
|
+
'gadmin.json',
|
|
27
|
+
]);
|
|
28
|
+
if (!content) {
|
|
29
|
+
return defaults_1.defaultConfiguration;
|
|
30
|
+
}
|
|
31
|
+
const fileConfig = JSON.parse(content);
|
|
32
|
+
if (fileConfig.compilerOptions) {
|
|
33
|
+
return Object.assign(Object.assign(Object.assign({}, defaults_1.defaultConfiguration), fileConfig), { compilerOptions: Object.assign(Object.assign({}, defaults_1.defaultConfiguration.compilerOptions), fileConfig.compilerOptions) });
|
|
34
|
+
}
|
|
35
|
+
return Object.assign(Object.assign({}, defaults_1.defaultConfiguration), fileConfig);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.GadminConfigurationLoader = GadminConfigurationLoader;
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./configuration.loader"), exports);
|
|
18
|
+
__exportStar(require("./gadmin-configuration.loader"), exports);
|
|
19
|
+
__exportStar(require("./configuration"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './nest.dependency-manager';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./nest.dependency-manager"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractPackageManager } from '../package-managers';
|
|
2
|
+
export declare class NestDependencyManager {
|
|
3
|
+
private packageManager;
|
|
4
|
+
constructor(packageManager: AbstractPackageManager);
|
|
5
|
+
read(): Promise<string[]>;
|
|
6
|
+
update(force: boolean, tag?: string): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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.NestDependencyManager = void 0;
|
|
13
|
+
const ora = require("ora");
|
|
14
|
+
const ui_1 = require("../ui");
|
|
15
|
+
class NestDependencyManager {
|
|
16
|
+
constructor(packageManager) {
|
|
17
|
+
this.packageManager = packageManager;
|
|
18
|
+
}
|
|
19
|
+
read() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const production = yield this.packageManager.getProduction();
|
|
22
|
+
return production
|
|
23
|
+
.filter((dependency) => dependency.name.indexOf('@nestjs') > -1)
|
|
24
|
+
.map((dependency) => dependency.name);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
update(force, tag = 'latest') {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const spinner = ora({
|
|
30
|
+
spinner: {
|
|
31
|
+
interval: 120,
|
|
32
|
+
frames: ['▹▹▹▹▹', '▸▹▹▹▹', '▹▸▹▹▹', '▹▹▸▹▹', '▹▹▹▸▹', '▹▹▹▹▸'],
|
|
33
|
+
},
|
|
34
|
+
text: ui_1.MESSAGES.PACKAGE_MANAGER_UPDATE_IN_PROGRESS,
|
|
35
|
+
});
|
|
36
|
+
spinner.start();
|
|
37
|
+
const dependencies = yield this.read();
|
|
38
|
+
if (force) {
|
|
39
|
+
yield this.packageManager.upgradeProduction(dependencies, tag);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
yield this.packageManager.updateProduction(dependencies);
|
|
43
|
+
}
|
|
44
|
+
spinner.succeed();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.NestDependencyManager = NestDependencyManager;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AbstractRunner } from '../runners/abstract.runner';
|
|
2
|
+
import { PackageManagerCommands } from './package-manager-commands';
|
|
3
|
+
import { ProjectDependency } from './project.dependency';
|
|
4
|
+
export declare abstract class AbstractPackageManager {
|
|
5
|
+
protected runner: AbstractRunner;
|
|
6
|
+
constructor(runner: AbstractRunner);
|
|
7
|
+
install(directory: string, packageManager: string): Promise<void>;
|
|
8
|
+
version(): Promise<string>;
|
|
9
|
+
addProduction(dependencies: string[], tag: string): Promise<boolean>;
|
|
10
|
+
addDevelopment(dependencies: string[], tag: string): Promise<void>;
|
|
11
|
+
private add;
|
|
12
|
+
getProduction(): Promise<ProjectDependency[]>;
|
|
13
|
+
getDevelopment(): Promise<ProjectDependency[]>;
|
|
14
|
+
private readPackageJson;
|
|
15
|
+
updateProduction(dependencies: string[]): Promise<void>;
|
|
16
|
+
updateDevelopment(dependencies: string[]): Promise<void>;
|
|
17
|
+
private update;
|
|
18
|
+
upgradeProduction(dependencies: string[], tag: string): Promise<void>;
|
|
19
|
+
upgradeDevelopment(dependencies: string[], tag: string): Promise<void>;
|
|
20
|
+
deleteProduction(dependencies: string[]): Promise<void>;
|
|
21
|
+
deleteDevelopment(dependencies: string[]): Promise<void>;
|
|
22
|
+
delete(commandArguments: string): Promise<void>;
|
|
23
|
+
abstract get name(): string;
|
|
24
|
+
abstract get cli(): PackageManagerCommands;
|
|
25
|
+
}
|