@depup/nestjs__cli 11.0.16-depup.1
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/LICENSE +24 -0
- package/README.md +42 -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 +113 -0
- package/actions/build.action.d.ts +22 -0
- package/actions/build.action.js +145 -0
- package/actions/generate.action.d.ts +5 -0
- package/actions/generate.action.js +97 -0
- package/actions/index.d.ts +7 -0
- package/actions/index.js +23 -0
- package/actions/info.action.d.ts +35 -0
- package/actions/info.action.js +181 -0
- package/actions/new.action.d.ts +7 -0
- package/actions/new.action.js +186 -0
- package/actions/start.action.d.ts +10 -0
- package/actions/start.action.js +122 -0
- package/bin/nest.d.ts +2 -0
- package/bin/nest.js +25 -0
- package/changes.json +54 -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 +36 -0
- package/commands/build.command.d.ts +5 -0
- package/commands/build.command.js +74 -0
- package/commands/command.input.d.ts +5 -0
- package/commands/command.input.js +2 -0
- package/commands/command.loader.d.ts +5 -0
- package/commands/command.loader.js +31 -0
- package/commands/generate.command.d.ts +9 -0
- package/commands/generate.command.js +107 -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 +16 -0
- package/commands/new.command.d.ts +5 -0
- package/commands/new.command.js +61 -0
- package/commands/start.command.d.ts +5 -0
- package/commands/start.command.js +104 -0
- package/lib/compiler/assets-manager.d.ts +15 -0
- package/lib/compiler/assets-manager.js +129 -0
- package/lib/compiler/base-compiler.d.ts +9 -0
- package/lib/compiler/base-compiler.js +26 -0
- package/lib/compiler/compiler.d.ts +12 -0
- package/lib/compiler/compiler.js +61 -0
- package/lib/compiler/defaults/swc-defaults.d.ts +61 -0
- package/lib/compiler/defaults/swc-defaults.js +57 -0
- package/lib/compiler/defaults/webpack-defaults.d.ts +3 -0
- package/lib/compiler/defaults/webpack-defaults.js +104 -0
- package/lib/compiler/helpers/append-extension.d.ts +1 -0
- package/lib/compiler/helpers/append-extension.js +7 -0
- package/lib/compiler/helpers/copy-path-resolve.d.ts +7 -0
- package/lib/compiler/helpers/copy-path-resolve.js +25 -0
- package/lib/compiler/helpers/delete-out-dir.d.ts +2 -0
- package/lib/compiler/helpers/delete-out-dir.js +12 -0
- package/lib/compiler/helpers/get-builder.d.ts +21 -0
- package/lib/compiler/helpers/get-builder.js +19 -0
- package/lib/compiler/helpers/get-tsc-config.path.d.ts +10 -0
- package/lib/compiler/helpers/get-tsc-config.path.js +24 -0
- package/lib/compiler/helpers/get-value-or-default.d.ts +4 -0
- package/lib/compiler/helpers/get-value-or-default.js +66 -0
- package/lib/compiler/helpers/get-webpack-config-path.d.ts +10 -0
- package/lib/compiler/helpers/get-webpack-config-path.js +23 -0
- package/lib/compiler/helpers/manual-restart.d.ts +2 -0
- package/lib/compiler/helpers/manual-restart.js +17 -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 +76 -0
- package/lib/compiler/interfaces/readonly-visitor.interface.d.ts +10 -0
- package/lib/compiler/interfaces/readonly-visitor.interface.js +2 -0
- package/lib/compiler/plugins/plugin-metadata-generator.d.ts +58 -0
- package/lib/compiler/plugins/plugin-metadata-generator.js +84 -0
- package/lib/compiler/plugins/plugin-metadata-printer.d.ts +17 -0
- package/lib/compiler/plugins/plugin-metadata-printer.js +51 -0
- package/lib/compiler/plugins/plugins-loader.d.ts +30 -0
- package/lib/compiler/plugins/plugins-loader.js +70 -0
- package/lib/compiler/swc/constants.d.ts +9 -0
- package/lib/compiler/swc/constants.js +13 -0
- package/lib/compiler/swc/forked-type-checker.d.ts +1 -0
- package/lib/compiler/swc/forked-type-checker.js +63 -0
- package/lib/compiler/swc/swc-compiler.d.ts +25 -0
- package/lib/compiler/swc/swc-compiler.js +231 -0
- package/lib/compiler/swc/type-checker-host.d.ts +14 -0
- package/lib/compiler/swc/type-checker-host.js +90 -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 +22 -0
- package/lib/compiler/watch-compiler.js +89 -0
- package/lib/compiler/webpack-compiler.d.ts +21 -0
- package/lib/compiler/webpack-compiler.js +99 -0
- package/lib/configuration/configuration.d.ts +91 -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 +6 -0
- package/lib/configuration/defaults.js +86 -0
- package/lib/configuration/index.d.ts +3 -0
- package/lib/configuration/index.js +19 -0
- package/lib/configuration/nest-configuration.loader.d.ts +8 -0
- package/lib/configuration/nest-configuration.loader.js +61 -0
- package/lib/package-managers/abstract.package-manager.d.ts +25 -0
- package/lib/package-managers/abstract.package-manager.js +151 -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 +41 -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 +9 -0
- package/lib/questions/questions.js +27 -0
- package/lib/readers/file-system.reader.d.ts +8 -0
- package/lib/readers/file-system.reader.js +46 -0
- package/lib/readers/index.d.ts +2 -0
- package/lib/readers/index.js +18 -0
- package/lib/readers/reader.d.ts +10 -0
- package/lib/readers/reader.js +11 -0
- package/lib/runners/abstract.runner.d.ts +11 -0
- package/lib/runners/abstract.runner.js +47 -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 +12 -0
- package/lib/schematics/abstract.collection.js +23 -0
- package/lib/schematics/collection.d.ts +3 -0
- package/lib/schematics/collection.factory.d.ts +5 -0
- package/lib/schematics/collection.factory.js +19 -0
- package/lib/schematics/collection.js +7 -0
- package/lib/schematics/custom.collection.d.ts +10 -0
- package/lib/schematics/custom.collection.js +33 -0
- package/lib/schematics/index.d.ts +4 -0
- package/lib/schematics/index.js +20 -0
- package/lib/schematics/nest.collection.d.ts +15 -0
- package/lib/schematics/nest.collection.js +126 -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 +12 -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 +24 -0
- package/lib/ui/messages.js +32 -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 +18 -0
- package/lib/utils/get-default-tsconfig-path.d.ts +1 -0
- package/lib/utils/get-default-tsconfig-path.js +12 -0
- package/lib/utils/gracefully-exit-on-prompt-error.d.ts +1 -0
- package/lib/utils/gracefully-exit-on-prompt-error.js +11 -0
- package/lib/utils/is-module-available.d.ts +1 -0
- package/lib/utils/is-module-available.js +12 -0
- package/lib/utils/load-configuration.d.ts +2 -0
- package/lib/utils/load-configuration.js +9 -0
- package/lib/utils/local-binaries.d.ts +3 -0
- package/lib/utils/local-binaries.js +15 -0
- package/lib/utils/os-info.utils.d.ts +1 -0
- package/lib/utils/os-info.utils.js +23 -0
- package/lib/utils/project-utils.d.ts +11 -0
- package/lib/utils/project-utils.js +83 -0
- package/lib/utils/remaining-flags.d.ts +2 -0
- package/lib/utils/remaining-flags.js +36 -0
- package/lib/utils/tree-kill.d.ts +1 -0
- package/lib/utils/tree-kill.js +68 -0
- package/lib/utils/type-assertions.d.ts +1 -0
- package/lib/utils/type-assertions.js +8 -0
- package/package.json +161 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export 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
|
+
export interface SwcBuilderOptions {
|
|
18
|
+
swcrcPath?: string;
|
|
19
|
+
outDir?: string;
|
|
20
|
+
filenames?: string[];
|
|
21
|
+
sync?: boolean;
|
|
22
|
+
extensions?: string[];
|
|
23
|
+
copyFiles?: boolean;
|
|
24
|
+
includeDotfiles?: boolean;
|
|
25
|
+
quiet?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface WebpackBuilderOptions {
|
|
28
|
+
configPath?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface TscBuilderOptions {
|
|
31
|
+
configPath?: string;
|
|
32
|
+
}
|
|
33
|
+
export type BuilderVariant = 'tsc' | 'swc' | 'webpack';
|
|
34
|
+
export type Builder = BuilderVariant | {
|
|
35
|
+
type: 'webpack';
|
|
36
|
+
options?: WebpackBuilderOptions;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'swc';
|
|
39
|
+
options?: SwcBuilderOptions;
|
|
40
|
+
} | {
|
|
41
|
+
type: 'tsc';
|
|
42
|
+
options?: TscBuilderOptions;
|
|
43
|
+
};
|
|
44
|
+
export interface CompilerOptions {
|
|
45
|
+
tsConfigPath?: string;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Use `builder` instead.
|
|
48
|
+
*/
|
|
49
|
+
webpack?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Use `builder.options.configPath` instead.
|
|
52
|
+
*/
|
|
53
|
+
webpackConfigPath?: string;
|
|
54
|
+
plugins?: string[] | PluginOptions[];
|
|
55
|
+
assets?: string[];
|
|
56
|
+
deleteOutDir?: boolean;
|
|
57
|
+
manualRestart?: boolean;
|
|
58
|
+
builder?: Builder;
|
|
59
|
+
}
|
|
60
|
+
export interface PluginOptions {
|
|
61
|
+
name: string;
|
|
62
|
+
options: Record<string, any>[];
|
|
63
|
+
}
|
|
64
|
+
export interface GenerateOptions {
|
|
65
|
+
spec?: boolean | Record<string, boolean>;
|
|
66
|
+
flat?: boolean;
|
|
67
|
+
specFileSuffix?: string;
|
|
68
|
+
baseDir?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface ProjectConfiguration {
|
|
71
|
+
type?: string;
|
|
72
|
+
root?: string;
|
|
73
|
+
entryFile?: string;
|
|
74
|
+
exec?: string;
|
|
75
|
+
sourceRoot?: string;
|
|
76
|
+
compilerOptions?: CompilerOptions;
|
|
77
|
+
}
|
|
78
|
+
export interface Configuration {
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
language?: string;
|
|
81
|
+
collection?: string;
|
|
82
|
+
sourceRoot?: string;
|
|
83
|
+
entryFile?: string;
|
|
84
|
+
exec?: string;
|
|
85
|
+
monorepo?: boolean;
|
|
86
|
+
compilerOptions?: CompilerOptions;
|
|
87
|
+
generateOptions?: GenerateOptions;
|
|
88
|
+
projects?: {
|
|
89
|
+
[key: string]: ProjectConfiguration;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Configuration } from './configuration';
|
|
2
|
+
export declare const defaultConfiguration: Required<Configuration>;
|
|
3
|
+
export declare const defaultTsconfigFilename: string;
|
|
4
|
+
export declare const defaultWebpackConfigFilename = "webpack.config.js";
|
|
5
|
+
export declare const defaultOutDir = "dist";
|
|
6
|
+
export declare const defaultGitIgnore = "# compiled output\n/dist\n/node_modules\n/build\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\n/coverage\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\n\n# dotenv environment variable files\n.env\n.env.development.local\n.env.test.local\n.env.production.local\n.env.local\n\n# temp directory\n.temp\n.tmp\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultGitIgnore = exports.defaultOutDir = exports.defaultWebpackConfigFilename = exports.defaultTsconfigFilename = exports.defaultConfiguration = void 0;
|
|
4
|
+
const get_default_tsconfig_path_1 = require("../utils/get-default-tsconfig-path");
|
|
5
|
+
exports.defaultConfiguration = {
|
|
6
|
+
language: 'ts',
|
|
7
|
+
sourceRoot: 'src',
|
|
8
|
+
collection: '@nestjs/schematics',
|
|
9
|
+
entryFile: 'main',
|
|
10
|
+
exec: 'node',
|
|
11
|
+
projects: {},
|
|
12
|
+
monorepo: false,
|
|
13
|
+
compilerOptions: {
|
|
14
|
+
builder: {
|
|
15
|
+
type: 'tsc',
|
|
16
|
+
options: {
|
|
17
|
+
configPath: (0, get_default_tsconfig_path_1.getDefaultTsconfigPath)(),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
webpack: false,
|
|
21
|
+
plugins: [],
|
|
22
|
+
assets: [],
|
|
23
|
+
manualRestart: false,
|
|
24
|
+
},
|
|
25
|
+
generateOptions: {},
|
|
26
|
+
};
|
|
27
|
+
exports.defaultTsconfigFilename = (0, get_default_tsconfig_path_1.getDefaultTsconfigPath)();
|
|
28
|
+
exports.defaultWebpackConfigFilename = 'webpack.config.js';
|
|
29
|
+
exports.defaultOutDir = 'dist';
|
|
30
|
+
exports.defaultGitIgnore = `# compiled output
|
|
31
|
+
/dist
|
|
32
|
+
/node_modules
|
|
33
|
+
/build
|
|
34
|
+
|
|
35
|
+
# Logs
|
|
36
|
+
logs
|
|
37
|
+
*.log
|
|
38
|
+
npm-debug.log*
|
|
39
|
+
pnpm-debug.log*
|
|
40
|
+
yarn-debug.log*
|
|
41
|
+
yarn-error.log*
|
|
42
|
+
lerna-debug.log*
|
|
43
|
+
|
|
44
|
+
# OS
|
|
45
|
+
.DS_Store
|
|
46
|
+
|
|
47
|
+
# Tests
|
|
48
|
+
/coverage
|
|
49
|
+
/.nyc_output
|
|
50
|
+
|
|
51
|
+
# IDEs and editors
|
|
52
|
+
/.idea
|
|
53
|
+
.project
|
|
54
|
+
.classpath
|
|
55
|
+
.c9/
|
|
56
|
+
*.launch
|
|
57
|
+
.settings/
|
|
58
|
+
*.sublime-workspace
|
|
59
|
+
|
|
60
|
+
# IDE - VSCode
|
|
61
|
+
.vscode/*
|
|
62
|
+
!.vscode/settings.json
|
|
63
|
+
!.vscode/tasks.json
|
|
64
|
+
!.vscode/launch.json
|
|
65
|
+
!.vscode/extensions.json
|
|
66
|
+
|
|
67
|
+
# dotenv environment variable files
|
|
68
|
+
.env
|
|
69
|
+
.env.development.local
|
|
70
|
+
.env.test.local
|
|
71
|
+
.env.production.local
|
|
72
|
+
.env.local
|
|
73
|
+
|
|
74
|
+
# temp directory
|
|
75
|
+
.temp
|
|
76
|
+
.tmp
|
|
77
|
+
|
|
78
|
+
# Runtime data
|
|
79
|
+
pids
|
|
80
|
+
*.pid
|
|
81
|
+
*.seed
|
|
82
|
+
*.pid.lock
|
|
83
|
+
|
|
84
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
85
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
86
|
+
`;
|
|
@@ -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("./nest-configuration.loader"), exports);
|
|
19
|
+
__exportStar(require("./configuration"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Reader } from '../readers';
|
|
2
|
+
import { Configuration } from './configuration';
|
|
3
|
+
import { ConfigurationLoader } from './configuration.loader';
|
|
4
|
+
export declare class NestConfigurationLoader implements ConfigurationLoader {
|
|
5
|
+
private readonly reader;
|
|
6
|
+
constructor(reader: Reader);
|
|
7
|
+
load(name?: string): Required<Configuration>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NestConfigurationLoader = void 0;
|
|
4
|
+
const readers_1 = require("../readers");
|
|
5
|
+
const defaults_1 = require("./defaults");
|
|
6
|
+
/**
|
|
7
|
+
* A cache table that maps some reader (by its name along with the config path)
|
|
8
|
+
* to a loaded configuration.
|
|
9
|
+
* This was added because several commands relies on the app's config in order
|
|
10
|
+
* to generate some dynanmic content prior running the command itself.
|
|
11
|
+
*/
|
|
12
|
+
const loadedConfigsCache = new Map();
|
|
13
|
+
class NestConfigurationLoader {
|
|
14
|
+
constructor(reader) {
|
|
15
|
+
this.reader = reader;
|
|
16
|
+
}
|
|
17
|
+
load(name) {
|
|
18
|
+
const cacheEntryKey = `${this.reader.constructor.name}:${name}`;
|
|
19
|
+
const cachedConfig = loadedConfigsCache.get(cacheEntryKey);
|
|
20
|
+
if (cachedConfig) {
|
|
21
|
+
return cachedConfig;
|
|
22
|
+
}
|
|
23
|
+
let loadedConfig;
|
|
24
|
+
const contentOrError = name
|
|
25
|
+
? this.reader.read(name)
|
|
26
|
+
: this.reader.readAnyOf([
|
|
27
|
+
'nest-cli.json',
|
|
28
|
+
'.nest-cli.json',
|
|
29
|
+
]);
|
|
30
|
+
if (contentOrError) {
|
|
31
|
+
const isMissingPermissionsError = contentOrError instanceof readers_1.ReaderFileLackPermissionsError;
|
|
32
|
+
if (isMissingPermissionsError) {
|
|
33
|
+
console.error(contentOrError.message);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
const fileConfig = JSON.parse(contentOrError);
|
|
37
|
+
if (fileConfig.compilerOptions) {
|
|
38
|
+
loadedConfig = {
|
|
39
|
+
...defaults_1.defaultConfiguration,
|
|
40
|
+
...fileConfig,
|
|
41
|
+
compilerOptions: {
|
|
42
|
+
...defaults_1.defaultConfiguration.compilerOptions,
|
|
43
|
+
...fileConfig.compilerOptions,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
loadedConfig = {
|
|
49
|
+
...defaults_1.defaultConfiguration,
|
|
50
|
+
...fileConfig,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
loadedConfig = defaults_1.defaultConfiguration;
|
|
56
|
+
}
|
|
57
|
+
loadedConfigsCache.set(cacheEntryKey, loadedConfig);
|
|
58
|
+
return loadedConfig;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.NestConfigurationLoader = NestConfigurationLoader;
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractPackageManager = void 0;
|
|
4
|
+
const ansis_1 = require("ansis");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const ora = require("ora");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const ui_1 = require("../ui");
|
|
9
|
+
const formatting_1 = require("../utils/formatting");
|
|
10
|
+
class AbstractPackageManager {
|
|
11
|
+
constructor(runner) {
|
|
12
|
+
this.runner = runner;
|
|
13
|
+
}
|
|
14
|
+
async install(directory, packageManager) {
|
|
15
|
+
const spinner = ora({
|
|
16
|
+
spinner: {
|
|
17
|
+
interval: 120,
|
|
18
|
+
frames: ['▹▹▹▹▹', '▸▹▹▹▹', '▹▸▹▹▹', '▹▹▸▹▹', '▹▹▹▸▹', '▹▹▹▹▸'],
|
|
19
|
+
},
|
|
20
|
+
text: ui_1.MESSAGES.PACKAGE_MANAGER_INSTALLATION_IN_PROGRESS,
|
|
21
|
+
});
|
|
22
|
+
spinner.start();
|
|
23
|
+
try {
|
|
24
|
+
const commandArgs = `${this.cli.install} ${this.cli.silentFlag}`;
|
|
25
|
+
const collect = true;
|
|
26
|
+
const normalizedDirectory = (0, formatting_1.normalizeToKebabOrSnakeCase)(directory);
|
|
27
|
+
await this.runner.run(commandArgs, collect, (0, path_1.join)(process.cwd(), normalizedDirectory));
|
|
28
|
+
spinner.succeed();
|
|
29
|
+
console.info();
|
|
30
|
+
console.info(ui_1.MESSAGES.PACKAGE_MANAGER_INSTALLATION_SUCCEED(directory));
|
|
31
|
+
console.info(ui_1.MESSAGES.GET_STARTED_INFORMATION);
|
|
32
|
+
console.info();
|
|
33
|
+
console.info((0, ansis_1.gray)(ui_1.MESSAGES.CHANGE_DIR_COMMAND(directory)));
|
|
34
|
+
console.info((0, ansis_1.gray)(ui_1.MESSAGES.START_COMMAND(packageManager)));
|
|
35
|
+
console.info();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
spinner.fail();
|
|
39
|
+
const commandArgs = this.cli.install;
|
|
40
|
+
const commandToRun = this.runner.rawFullCommand(commandArgs);
|
|
41
|
+
console.error((0, ansis_1.red)(ui_1.MESSAGES.PACKAGE_MANAGER_INSTALLATION_FAILED((0, ansis_1.bold)(commandToRun))));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async version() {
|
|
45
|
+
const commandArguments = '--version';
|
|
46
|
+
const collect = true;
|
|
47
|
+
return this.runner.run(commandArguments, collect);
|
|
48
|
+
}
|
|
49
|
+
async addProduction(dependencies, tag) {
|
|
50
|
+
const command = [this.cli.add, this.cli.saveFlag]
|
|
51
|
+
.filter((i) => i)
|
|
52
|
+
.join(' ');
|
|
53
|
+
const args = dependencies
|
|
54
|
+
.map((dependency) => `${dependency}@${tag}`)
|
|
55
|
+
.join(' ');
|
|
56
|
+
const spinner = ora({
|
|
57
|
+
spinner: {
|
|
58
|
+
interval: 120,
|
|
59
|
+
frames: ['▹▹▹▹▹', '▸▹▹▹▹', '▹▸▹▹▹', '▹▹▸▹▹', '▹▹▹▸▹', '▹▹▹▹▸'],
|
|
60
|
+
},
|
|
61
|
+
text: ui_1.MESSAGES.PACKAGE_MANAGER_PRODUCTION_INSTALLATION_IN_PROGRESS,
|
|
62
|
+
});
|
|
63
|
+
spinner.start();
|
|
64
|
+
try {
|
|
65
|
+
await this.add(`${command} ${args}`);
|
|
66
|
+
spinner.succeed();
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
spinner.fail();
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async addDevelopment(dependencies, tag) {
|
|
75
|
+
const command = `${this.cli.add} ${this.cli.saveDevFlag}`;
|
|
76
|
+
const args = dependencies
|
|
77
|
+
.map((dependency) => `${dependency}@${tag}`)
|
|
78
|
+
.join(' ');
|
|
79
|
+
await this.add(`${command} ${args}`);
|
|
80
|
+
}
|
|
81
|
+
async add(commandArguments) {
|
|
82
|
+
const collect = true;
|
|
83
|
+
await this.runner.run(commandArguments, collect);
|
|
84
|
+
}
|
|
85
|
+
async getProduction() {
|
|
86
|
+
const packageJsonContent = await this.readPackageJson();
|
|
87
|
+
const packageJsonDependencies = packageJsonContent.dependencies;
|
|
88
|
+
const dependencies = [];
|
|
89
|
+
for (const [name, version] of Object.entries(packageJsonDependencies)) {
|
|
90
|
+
dependencies.push({ name, version });
|
|
91
|
+
}
|
|
92
|
+
return dependencies;
|
|
93
|
+
}
|
|
94
|
+
async getDevelopment() {
|
|
95
|
+
const packageJsonContent = await this.readPackageJson();
|
|
96
|
+
const packageJsonDevDependencies = packageJsonContent.devDependencies;
|
|
97
|
+
const dependencies = [];
|
|
98
|
+
for (const [name, version] of Object.entries(packageJsonDevDependencies)) {
|
|
99
|
+
dependencies.push({ name, version });
|
|
100
|
+
}
|
|
101
|
+
return dependencies;
|
|
102
|
+
}
|
|
103
|
+
async readPackageJson() {
|
|
104
|
+
return new Promise((resolve, reject) => {
|
|
105
|
+
(0, fs_1.readFile)((0, path_1.join)(process.cwd(), 'package.json'), (error, buffer) => {
|
|
106
|
+
if (error !== undefined && error !== null) {
|
|
107
|
+
reject(error);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
resolve(JSON.parse(buffer.toString()));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async updateProduction(dependencies) {
|
|
116
|
+
const commandArguments = `${this.cli.update} ${dependencies.join(' ')}`;
|
|
117
|
+
await this.update(commandArguments);
|
|
118
|
+
}
|
|
119
|
+
async updateDevelopment(dependencies) {
|
|
120
|
+
const commandArguments = `${this.cli.update} ${dependencies.join(' ')}`;
|
|
121
|
+
await this.update(commandArguments);
|
|
122
|
+
}
|
|
123
|
+
async update(commandArguments) {
|
|
124
|
+
const collect = true;
|
|
125
|
+
await this.runner.run(commandArguments, collect);
|
|
126
|
+
}
|
|
127
|
+
async upgradeProduction(dependencies, tag) {
|
|
128
|
+
await this.deleteProduction(dependencies);
|
|
129
|
+
await this.addProduction(dependencies, tag);
|
|
130
|
+
}
|
|
131
|
+
async upgradeDevelopment(dependencies, tag) {
|
|
132
|
+
await this.deleteDevelopment(dependencies);
|
|
133
|
+
await this.addDevelopment(dependencies, tag);
|
|
134
|
+
}
|
|
135
|
+
async deleteProduction(dependencies) {
|
|
136
|
+
const command = [this.cli.remove, this.cli.saveFlag]
|
|
137
|
+
.filter((i) => i)
|
|
138
|
+
.join(' ');
|
|
139
|
+
const args = dependencies.join(' ');
|
|
140
|
+
await this.delete(`${command} ${args}`);
|
|
141
|
+
}
|
|
142
|
+
async deleteDevelopment(dependencies) {
|
|
143
|
+
const commandArguments = `${this.cli.remove} ${this.cli.saveDevFlag} ${dependencies.join(' ')}`;
|
|
144
|
+
await this.delete(commandArguments);
|
|
145
|
+
}
|
|
146
|
+
async delete(commandArguments) {
|
|
147
|
+
const collect = true;
|
|
148
|
+
await this.runner.run(commandArguments, collect);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.AbstractPackageManager = AbstractPackageManager;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './package-manager';
|
|
2
|
+
export * from './package-manager.factory';
|
|
3
|
+
export * from './abstract.package-manager';
|
|
4
|
+
export * from './npm.package-manager';
|
|
5
|
+
export * from './yarn.package-manager';
|
|
6
|
+
export * from './pnpm.package-manager';
|
|
7
|
+
export * from './project.dependency';
|
|
8
|
+
export * from './package-manager-commands';
|
|
@@ -0,0 +1,24 @@
|
|
|
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("./package-manager"), exports);
|
|
18
|
+
__exportStar(require("./package-manager.factory"), exports);
|
|
19
|
+
__exportStar(require("./abstract.package-manager"), exports);
|
|
20
|
+
__exportStar(require("./npm.package-manager"), exports);
|
|
21
|
+
__exportStar(require("./yarn.package-manager"), exports);
|
|
22
|
+
__exportStar(require("./pnpm.package-manager"), exports);
|
|
23
|
+
__exportStar(require("./project.dependency"), exports);
|
|
24
|
+
__exportStar(require("./package-manager-commands"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractPackageManager } from './abstract.package-manager';
|
|
2
|
+
import { PackageManagerCommands } from './package-manager-commands';
|
|
3
|
+
export declare class NpmPackageManager extends AbstractPackageManager {
|
|
4
|
+
constructor();
|
|
5
|
+
get name(): string;
|
|
6
|
+
get cli(): PackageManagerCommands;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NpmPackageManager = void 0;
|
|
4
|
+
const runners_1 = require("../runners");
|
|
5
|
+
const abstract_package_manager_1 = require("./abstract.package-manager");
|
|
6
|
+
const package_manager_1 = require("./package-manager");
|
|
7
|
+
class NpmPackageManager extends abstract_package_manager_1.AbstractPackageManager {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(runners_1.RunnerFactory.create(runners_1.Runner.NPM));
|
|
10
|
+
}
|
|
11
|
+
get name() {
|
|
12
|
+
return package_manager_1.PackageManager.NPM.toUpperCase();
|
|
13
|
+
}
|
|
14
|
+
get cli() {
|
|
15
|
+
return {
|
|
16
|
+
install: 'install',
|
|
17
|
+
add: 'install',
|
|
18
|
+
update: 'update',
|
|
19
|
+
remove: 'uninstall',
|
|
20
|
+
saveFlag: '--save',
|
|
21
|
+
saveDevFlag: '--save-dev',
|
|
22
|
+
silentFlag: '--silent',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.NpmPackageManager = NpmPackageManager;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractPackageManager } from './abstract.package-manager';
|
|
2
|
+
import { PackageManager } from './package-manager';
|
|
3
|
+
export declare class PackageManagerFactory {
|
|
4
|
+
static create(name: PackageManager | string): AbstractPackageManager;
|
|
5
|
+
static find(): Promise<AbstractPackageManager>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackageManagerFactory = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const npm_package_manager_1 = require("./npm.package-manager");
|
|
6
|
+
const package_manager_1 = require("./package-manager");
|
|
7
|
+
const yarn_package_manager_1 = require("./yarn.package-manager");
|
|
8
|
+
const pnpm_package_manager_1 = require("./pnpm.package-manager");
|
|
9
|
+
class PackageManagerFactory {
|
|
10
|
+
static create(name) {
|
|
11
|
+
switch (name) {
|
|
12
|
+
case package_manager_1.PackageManager.NPM:
|
|
13
|
+
return new npm_package_manager_1.NpmPackageManager();
|
|
14
|
+
case package_manager_1.PackageManager.YARN:
|
|
15
|
+
return new yarn_package_manager_1.YarnPackageManager();
|
|
16
|
+
case package_manager_1.PackageManager.PNPM:
|
|
17
|
+
return new pnpm_package_manager_1.PnpmPackageManager();
|
|
18
|
+
default:
|
|
19
|
+
throw new Error(`Package manager ${name} is not managed.`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static async find() {
|
|
23
|
+
const DEFAULT_PACKAGE_MANAGER = package_manager_1.PackageManager.NPM;
|
|
24
|
+
try {
|
|
25
|
+
const files = await fs.promises.readdir(process.cwd());
|
|
26
|
+
const hasYarnLockFile = files.includes('yarn.lock');
|
|
27
|
+
if (hasYarnLockFile) {
|
|
28
|
+
return this.create(package_manager_1.PackageManager.YARN);
|
|
29
|
+
}
|
|
30
|
+
const hasPnpmLockFile = files.includes('pnpm-lock.yaml');
|
|
31
|
+
if (hasPnpmLockFile) {
|
|
32
|
+
return this.create(package_manager_1.PackageManager.PNPM);
|
|
33
|
+
}
|
|
34
|
+
return this.create(DEFAULT_PACKAGE_MANAGER);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return this.create(DEFAULT_PACKAGE_MANAGER);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.PackageManagerFactory = PackageManagerFactory;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackageManager = void 0;
|
|
4
|
+
var PackageManager;
|
|
5
|
+
(function (PackageManager) {
|
|
6
|
+
PackageManager["NPM"] = "npm";
|
|
7
|
+
PackageManager["YARN"] = "yarn";
|
|
8
|
+
PackageManager["PNPM"] = "pnpm";
|
|
9
|
+
})(PackageManager || (exports.PackageManager = PackageManager = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractPackageManager } from './abstract.package-manager';
|
|
2
|
+
import { PackageManagerCommands } from './package-manager-commands';
|
|
3
|
+
export declare class PnpmPackageManager extends AbstractPackageManager {
|
|
4
|
+
constructor();
|
|
5
|
+
get name(): string;
|
|
6
|
+
get cli(): PackageManagerCommands;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PnpmPackageManager = void 0;
|
|
4
|
+
const runners_1 = require("../runners");
|
|
5
|
+
const abstract_package_manager_1 = require("./abstract.package-manager");
|
|
6
|
+
const package_manager_1 = require("./package-manager");
|
|
7
|
+
class PnpmPackageManager extends abstract_package_manager_1.AbstractPackageManager {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(runners_1.RunnerFactory.create(runners_1.Runner.PNPM));
|
|
10
|
+
}
|
|
11
|
+
get name() {
|
|
12
|
+
return package_manager_1.PackageManager.PNPM.toUpperCase();
|
|
13
|
+
}
|
|
14
|
+
// As of PNPM v5.3, all commands are shared with NPM v6.14.5. See: https://pnpm.js.org/en/pnpm-vs-npm
|
|
15
|
+
get cli() {
|
|
16
|
+
return {
|
|
17
|
+
install: 'install --strict-peer-dependencies=false',
|
|
18
|
+
add: 'install --strict-peer-dependencies=false',
|
|
19
|
+
update: 'update',
|
|
20
|
+
remove: 'uninstall',
|
|
21
|
+
saveFlag: '--save',
|
|
22
|
+
saveDevFlag: '--save-dev',
|
|
23
|
+
silentFlag: '--reporter=silent',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.PnpmPackageManager = PnpmPackageManager;
|