@tramvai/cli 2.73.1 → 2.74.0
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/bin/platform-debug.js +4 -8
- package/lib/cli/bin-init.js +0 -4
- package/lib/cli/bin-init.js.map +1 -1
- package/lib/cli/runCLI.js +5 -1
- package/lib/cli/runCLI.js.map +1 -1
- package/lib/commands/add/add.js +16 -4
- package/lib/commands/add/add.js.map +1 -1
- package/lib/commands/add/checkPackageValidator.js +2 -4
- package/lib/commands/add/checkPackageValidator.js.map +1 -1
- package/lib/commands/update/dependantLibs.js +6 -6
- package/lib/commands/update/dependantLibs.js.map +1 -1
- package/lib/commands/update/update.js +29 -7
- package/lib/commands/update/update.js.map +1 -1
- package/lib/commands/update/updatePackageJson.js +37 -31
- package/lib/commands/update/updatePackageJson.js.map +1 -1
- package/lib/library/babel/index.js +3 -1
- package/lib/library/babel/index.js.map +1 -1
- package/lib/models/command.js +1 -1
- package/lib/models/command.js.map +1 -1
- package/lib/models/logger.js +1 -1
- package/lib/models/logger.js.map +1 -1
- package/lib/models/task.js +1 -1
- package/lib/models/task.js.map +1 -1
- package/lib/utils/commands/dependencies/getLatestPackageVersion.d.ts +1 -1
- package/lib/utils/commands/dependencies/getLatestPackageVersion.js +11 -3
- package/lib/utils/commands/dependencies/getLatestPackageVersion.js.map +1 -1
- package/lib/utils/commands/dependencies/packageHasVersion.js +3 -18
- package/lib/utils/commands/dependencies/packageHasVersion.js.map +1 -1
- package/package.json +7 -4
- package/src/cli/bin-init.ts +0 -4
- package/src/cli/runCLI.ts +7 -1
- package/src/commands/add/add.ts +17 -4
- package/src/commands/add/checkPackageValidator.ts +2 -5
- package/src/commands/update/dependantLibs.ts +5 -5
- package/src/commands/update/update.ts +34 -8
- package/src/commands/update/updatePackageJson.spec.ts +14 -20
- package/src/commands/update/updatePackageJson.ts +45 -41
- package/src/library/babel/index.ts +3 -1
- package/src/models/command.ts +1 -1
- package/src/models/logger.ts +1 -1
- package/src/models/task.ts +1 -1
- package/src/utils/commands/dependencies/getLatestPackageVersion.ts +12 -3
- package/src/utils/commands/dependencies/packageHasVersion.ts +3 -22
- package/lib/utils/commands/dependencies/deduplicate.d.ts +0 -2
- package/lib/utils/commands/dependencies/deduplicate.js +0 -20
- package/lib/utils/commands/dependencies/deduplicate.js.map +0 -1
- package/lib/utils/commands/dependencies/getPackageInfo.d.ts +0 -1
- package/lib/utils/commands/dependencies/getPackageInfo.js +0 -13
- package/lib/utils/commands/dependencies/getPackageInfo.js.map +0 -1
- package/lib/utils/commands/dependencies/installDependencies.d.ts +0 -2
- package/lib/utils/commands/dependencies/installDependencies.js +0 -20
- package/lib/utils/commands/dependencies/installDependencies.js.map +0 -1
- package/lib/utils/commands/dependencies/installDependency.d.ts +0 -6
- package/lib/utils/commands/dependencies/installDependency.js +0 -20
- package/lib/utils/commands/dependencies/installDependency.js.map +0 -1
- package/src/utils/commands/dependencies/deduplicate.ts +0 -16
- package/src/utils/commands/dependencies/getPackageInfo.ts +0 -10
- package/src/utils/commands/dependencies/installDependencies.ts +0 -16
- package/src/utils/commands/dependencies/installDependency.ts +0 -19
package/src/commands/add/add.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Context } from '../../models/context';
|
|
2
2
|
import type { CommandResult } from '../../models/command';
|
|
3
|
-
import { installDependency } from '../../utils/commands/dependencies/installDependency';
|
|
4
|
-
import { deduplicate } from '../../utils/commands/dependencies/deduplicate';
|
|
5
3
|
import { migrate } from '../../utils/commands/dependencies/migrate';
|
|
6
4
|
import { findTramvaiVersion } from '../../utils/commands/dependencies/findTramvaiVersion';
|
|
7
5
|
import { checkVersions } from '../../utils/commands/dependencies/checkVersions';
|
|
@@ -14,9 +12,24 @@ export type Params = {
|
|
|
14
12
|
export default async (context: Context, { packageName, dev }: Params): Promise<CommandResult> => {
|
|
15
13
|
const version = await findTramvaiVersion();
|
|
16
14
|
|
|
17
|
-
await
|
|
15
|
+
await context.packageManager.install({
|
|
16
|
+
name: packageName,
|
|
17
|
+
version,
|
|
18
|
+
devDependency: dev,
|
|
19
|
+
stdio: 'inherit',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (context.packageManager.name !== 'npm') {
|
|
23
|
+
// npm dedupe is extremely slow in most cases
|
|
24
|
+
// so execute it only for yarn
|
|
25
|
+
context.logger.event({
|
|
26
|
+
type: 'info',
|
|
27
|
+
event: 'dedupe',
|
|
28
|
+
message: 'Deduplicate dependencies',
|
|
29
|
+
});
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
await context.packageManager.dedupe({ stdio: 'inherit' });
|
|
32
|
+
}
|
|
20
33
|
|
|
21
34
|
await migrate(context);
|
|
22
35
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import childProcess from 'child_process';
|
|
1
|
+
import latestVersion from 'latest-version';
|
|
3
2
|
import type { Params } from './add';
|
|
4
3
|
|
|
5
|
-
const exec = util.promisify(childProcess.exec);
|
|
6
|
-
|
|
7
4
|
export const checkPackage = async (_, { packageName }: Params) => {
|
|
8
5
|
try {
|
|
9
|
-
await
|
|
6
|
+
await latestVersion(packageName);
|
|
10
7
|
} catch (e) {
|
|
11
8
|
throw new Error(`Package ${packageName} does not exists`);
|
|
12
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import getLatestPackageVersion from 'latest-version';
|
|
2
|
+
import getPackageInfo from 'package-json';
|
|
3
3
|
|
|
4
4
|
// map of packages that is not in unified versioning
|
|
5
5
|
// but we still want to update it
|
|
@@ -34,9 +34,9 @@ export const getLibPackageVersion = async (
|
|
|
34
34
|
return getLatestPackageVersion(name);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const { dependencies } = await getPackageInfo(unifiedModule, { version: unifiedVersion });
|
|
38
38
|
|
|
39
|
-
if (!
|
|
39
|
+
if (!dependencies[name]) {
|
|
40
40
|
console.warn(
|
|
41
41
|
`⚠️ cannot resolve proper version for the "${name}" package.
|
|
42
42
|
You have to update this package by yourself.`
|
|
@@ -45,5 +45,5 @@ You have to update this package by yourself.`
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
return
|
|
48
|
+
return dependencies[name];
|
|
49
49
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Context } from '../../models/context';
|
|
2
2
|
import type { CommandResult } from '../../models/command';
|
|
3
|
-
import { installDependencies } from '../../utils/commands/dependencies/installDependencies';
|
|
4
3
|
import { getLatestPackageVersion } from '../../utils/commands/dependencies/getLatestPackageVersion';
|
|
5
|
-
import { deduplicate } from '../../utils/commands/dependencies/deduplicate';
|
|
6
4
|
import { migrate } from '../../utils/commands/dependencies/migrate';
|
|
7
5
|
import { updatePackageJson } from './updatePackageJson';
|
|
8
6
|
import { checkVersions } from '../../utils/commands/dependencies/checkVersions';
|
|
@@ -15,21 +13,49 @@ export default async (
|
|
|
15
13
|
context: Context,
|
|
16
14
|
{ to: version = 'latest' }: Params
|
|
17
15
|
): Promise<CommandResult> => {
|
|
18
|
-
const versionNumber =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const versionNumber = await getLatestPackageVersion('@tramvai/core', version);
|
|
17
|
+
|
|
18
|
+
context.logger.event({
|
|
19
|
+
type: 'info',
|
|
20
|
+
event: 'resolving-version',
|
|
21
|
+
message: `Tramvai version resolved to ${versionNumber}`,
|
|
22
|
+
});
|
|
22
23
|
|
|
23
24
|
await updatePackageJson(versionNumber);
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
context.logger.event({
|
|
27
|
+
type: 'info',
|
|
28
|
+
event: 'install',
|
|
29
|
+
message: 'Installing dependencies',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
await context.packageManager.install({ stdio: 'inherit' });
|
|
33
|
+
|
|
34
|
+
if (context.packageManager.name !== 'npm') {
|
|
35
|
+
// npm dedupe is extremely slow in most cases
|
|
36
|
+
// so execute it only for yarn
|
|
37
|
+
context.logger.event({
|
|
38
|
+
type: 'info',
|
|
39
|
+
event: 'dedupe',
|
|
40
|
+
message: 'Deduplicate dependencies',
|
|
41
|
+
});
|
|
26
42
|
|
|
27
|
-
|
|
43
|
+
await context.packageManager.dedupe({ stdio: 'inherit' });
|
|
44
|
+
}
|
|
28
45
|
|
|
29
46
|
await migrate(context);
|
|
30
47
|
|
|
31
48
|
await checkVersions(context);
|
|
32
49
|
|
|
50
|
+
if (context.packageManager.name === 'npm') {
|
|
51
|
+
context.logger.event({
|
|
52
|
+
type: 'warning',
|
|
53
|
+
event: 'dedupe',
|
|
54
|
+
message:
|
|
55
|
+
'To make sure the node_modules tree is optimized you can additionaly run `npm dedupe` command',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
33
59
|
return Promise.resolve({
|
|
34
60
|
status: 'ok',
|
|
35
61
|
});
|
|
@@ -10,23 +10,17 @@ const mockPackageInfoDependencies = jest.fn<Record<string, string | undefined>,
|
|
|
10
10
|
jest.mock('../../utils/commands/dependencies/packageHasVersion', () => ({
|
|
11
11
|
packageHasVersion: () => true,
|
|
12
12
|
}));
|
|
13
|
-
jest.mock('
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
13
|
+
jest.mock('latest-version', () => (dep: string) => {
|
|
14
|
+
if (dep.startsWith('@tramvai')) {
|
|
15
|
+
return LATEST_TRAMVAI_VERSION;
|
|
16
|
+
}
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}));
|
|
18
|
+
return LATEST_LIB_VERSION;
|
|
19
|
+
});
|
|
22
20
|
|
|
23
|
-
jest.mock('
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return mockPackageInfoDependencies(packageName);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
}));
|
|
21
|
+
jest.mock('package-json', () => (packageName: string) => {
|
|
22
|
+
return { dependencies: mockPackageInfoDependencies(packageName) };
|
|
23
|
+
});
|
|
30
24
|
|
|
31
25
|
jest.mock('fs', () => ({
|
|
32
26
|
readFileSync: () => JSON.stringify(mockPackageJson),
|
|
@@ -54,18 +48,18 @@ it('should update tramvai deps to latest versions', async () => {
|
|
|
54
48
|
},
|
|
55
49
|
};
|
|
56
50
|
|
|
57
|
-
mockPackageInfoDependencies.mockImplementation((dep) => {
|
|
51
|
+
mockPackageInfoDependencies.mockImplementation((dep: string) => {
|
|
58
52
|
switch (dep) {
|
|
59
|
-
case '@tramvai/core
|
|
53
|
+
case '@tramvai/core':
|
|
60
54
|
return { '@tinkoff/dippy': '0.7.44', '@tinkoff/utils': '^2.1.0' };
|
|
61
|
-
case '@tramvai/module-common
|
|
55
|
+
case '@tramvai/module-common':
|
|
62
56
|
return {
|
|
63
57
|
'@tinkoff/error': '0.6.1',
|
|
64
58
|
'@tinkoff/url': '0.4.1',
|
|
65
59
|
};
|
|
66
|
-
case '@tramvai/cli
|
|
60
|
+
case '@tramvai/cli':
|
|
67
61
|
return {};
|
|
68
|
-
case '@tramvai/module-router
|
|
62
|
+
case '@tramvai/module-router':
|
|
69
63
|
return {
|
|
70
64
|
'@tinkoff/router': '0.4.3',
|
|
71
65
|
'@tinkoff/url': '0.4.1',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { parse, minVersion } from 'semver';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import pMap from 'p-map';
|
|
4
|
+
import type { Ora } from 'ora';
|
|
5
|
+
import ora from 'ora';
|
|
4
6
|
import { packageHasVersion } from '../../utils/commands/dependencies/packageHasVersion';
|
|
5
7
|
import { getLibPackageVersion, isDependantLib } from './dependantLibs';
|
|
6
8
|
|
|
@@ -10,47 +12,45 @@ const isUnifiedVersion = (name: string) => {
|
|
|
10
12
|
|
|
11
13
|
const getVersionFromDep = (dep: string) => parse(dep)?.version || minVersion(dep)?.version;
|
|
12
14
|
|
|
13
|
-
const updateEntry = async (
|
|
14
|
-
deps: Record<string, any>,
|
|
15
|
-
dep: string,
|
|
16
|
-
{ currentVersion, version }: { currentVersion: string; version: string }
|
|
17
|
-
) => {
|
|
18
|
-
let nextVersion: string | undefined;
|
|
19
|
-
|
|
20
|
-
if (isUnifiedVersion(dep) && getVersionFromDep(deps[dep]) === currentVersion) {
|
|
21
|
-
nextVersion = version;
|
|
22
|
-
} else if (isDependantLib(dep)) {
|
|
23
|
-
const libVersion = await getLibPackageVersion(dep, version);
|
|
24
|
-
nextVersion = libVersion;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (nextVersion) {
|
|
28
|
-
const depHasVersion = await packageHasVersion(dep, nextVersion);
|
|
29
|
-
|
|
30
|
-
if (depHasVersion) {
|
|
31
|
-
console.log(`- ${dep}@${nextVersion}`);
|
|
32
|
-
// eslint-disable-next-line no-param-reassign
|
|
33
|
-
deps[dep] = nextVersion;
|
|
34
|
-
} else {
|
|
35
|
-
console.warn(
|
|
36
|
-
`⚠️ cannot update ${dep} to ${nextVersion} version, this version does not exist.
|
|
37
|
-
Maybe this package was removed or renamed.
|
|
38
|
-
Wait migrations, then manually update or remove dependency from package.json, if necessary.`
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
15
|
const updateDependencies = (
|
|
45
16
|
dependencies: Record<string, string> = {},
|
|
46
17
|
targetVersion: string,
|
|
47
|
-
currentVersion: string
|
|
18
|
+
currentVersion: string,
|
|
19
|
+
spinner: Ora
|
|
48
20
|
) => {
|
|
49
21
|
return pMap<string, void>(
|
|
50
22
|
Object.keys(dependencies),
|
|
51
23
|
async (dep) => {
|
|
52
|
-
|
|
53
|
-
|
|
24
|
+
let nextVersion: string | undefined;
|
|
25
|
+
|
|
26
|
+
if (isUnifiedVersion(dep) && getVersionFromDep(dependencies[dep]) === currentVersion) {
|
|
27
|
+
nextVersion = targetVersion;
|
|
28
|
+
} else if (isDependantLib(dep)) {
|
|
29
|
+
const libVersion = await getLibPackageVersion(dep, targetVersion);
|
|
30
|
+
nextVersion = libVersion;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (nextVersion) {
|
|
34
|
+
const depHasVersion = await packageHasVersion(dep, nextVersion);
|
|
35
|
+
|
|
36
|
+
// clear the spinner to be able to log info that should be preserved in the output
|
|
37
|
+
// the idea borrowed from [here](https://github.com/sindresorhus/ora/issues/120)
|
|
38
|
+
spinner.clear();
|
|
39
|
+
|
|
40
|
+
if (depHasVersion) {
|
|
41
|
+
console.log(`- ${dep}@${nextVersion}`);
|
|
42
|
+
// eslint-disable-next-line no-param-reassign
|
|
43
|
+
dependencies[dep] = nextVersion;
|
|
44
|
+
} else {
|
|
45
|
+
console.warn(
|
|
46
|
+
`⚠️ cannot update ${dep} to ${nextVersion} version, this version does not exist.
|
|
47
|
+
Maybe this package was removed or renamed.
|
|
48
|
+
Wait migrations, then manually update or remove dependency from package.json, if necessary.`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// start the spinner back with the initial text
|
|
53
|
+
spinner.start(spinner.text);
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
{
|
|
@@ -60,8 +60,6 @@ const updateDependencies = (
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export const updatePackageJson = async (version: string) => {
|
|
63
|
-
console.log(`Update package.json to ${version} version`);
|
|
64
|
-
|
|
65
63
|
const file = fs.readFileSync('package.json');
|
|
66
64
|
const content = JSON.parse(file.toString());
|
|
67
65
|
const currentVersion = getVersionFromDep(content.dependencies['@tramvai/core']);
|
|
@@ -72,12 +70,18 @@ export const updatePackageJson = async (version: string) => {
|
|
|
72
70
|
|
|
73
71
|
if (currentVersion === version) {
|
|
74
72
|
console.error('The installed version is equal to the current version, no update is required.');
|
|
75
|
-
|
|
73
|
+
return;
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
await updateDependencies(content.devDependencies, version, currentVersion);
|
|
80
|
-
await updateDependencies(content.peerDependencies, version, currentVersion);
|
|
76
|
+
const spinner = ora(`Updating package.json versions`).start();
|
|
81
77
|
|
|
82
|
-
|
|
78
|
+
try {
|
|
79
|
+
await updateDependencies(content.dependencies, version, currentVersion, spinner);
|
|
80
|
+
await updateDependencies(content.devDependencies, version, currentVersion, spinner);
|
|
81
|
+
await updateDependencies(content.peerDependencies, version, currentVersion, spinner);
|
|
82
|
+
|
|
83
|
+
fs.writeFileSync('package.json', JSON.stringify(content, null, 2));
|
|
84
|
+
} finally {
|
|
85
|
+
spinner.stop();
|
|
86
|
+
}
|
|
83
87
|
};
|
|
@@ -84,7 +84,9 @@ export const babelConfigFactory = ({
|
|
|
84
84
|
{
|
|
85
85
|
modules,
|
|
86
86
|
useBuiltIns: 'entry',
|
|
87
|
-
|
|
87
|
+
// from core-js version depends what polyfills will be included with `useBuiltIns: 'entry'` option
|
|
88
|
+
// this logic is here - https://github.com/zloirock/core-js/blob/master/packages/core-js-compat/src/modules-by-versions.mjs
|
|
89
|
+
corejs: require('core-js/package.json').version,
|
|
88
90
|
loose: true,
|
|
89
91
|
targets,
|
|
90
92
|
browserslistEnv: resultTarget,
|
package/src/models/command.ts
CHANGED
package/src/models/logger.ts
CHANGED
|
@@ -11,7 +11,7 @@ export class Logger {
|
|
|
11
11
|
console.error(event.type, event.event, event.message, event.payload);
|
|
12
12
|
} else if (event.type === 'warning') {
|
|
13
13
|
console.warn(event.type, event.event, event.message, event.payload);
|
|
14
|
-
} else if (process.env.DEBUG_MODE === 'true') {
|
|
14
|
+
} else if (event.type === 'info' || process.env.DEBUG_MODE === 'true') {
|
|
15
15
|
console.log(event.type, event.event, event.message, event.payload);
|
|
16
16
|
}
|
|
17
17
|
}
|
package/src/models/task.ts
CHANGED
|
@@ -34,7 +34,7 @@ export abstract class Task {
|
|
|
34
34
|
parameters: { arguments?: string[]; options?: Record<string, any> } = {}
|
|
35
35
|
): Promise<TaskResult> {
|
|
36
36
|
this.context.logger.event({
|
|
37
|
-
type: '
|
|
37
|
+
type: 'debug',
|
|
38
38
|
event: `RUN:TASK:${this.name}`,
|
|
39
39
|
message: JSON.stringify(parameters),
|
|
40
40
|
});
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ora from 'ora';
|
|
2
|
+
import latestVersion from 'latest-version';
|
|
2
3
|
|
|
3
|
-
export const getLatestPackageVersion = async (packageName: string,
|
|
4
|
-
|
|
4
|
+
export const getLatestPackageVersion = async (packageName: string, version = 'latest') => {
|
|
5
|
+
const spinner = ora(`Resolving the highest version satifying to ${version}`).start();
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
const result = await latestVersion(packageName, { version });
|
|
9
|
+
|
|
10
|
+
return result;
|
|
11
|
+
} finally {
|
|
12
|
+
spinner.stop();
|
|
13
|
+
}
|
|
5
14
|
};
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import childProcess from 'child_process';
|
|
3
|
-
import ora from 'ora';
|
|
4
|
-
|
|
5
|
-
const exec = util.promisify(childProcess.exec);
|
|
6
|
-
|
|
7
|
-
const addPaddingToString = (text: string) =>
|
|
8
|
-
text
|
|
9
|
-
.split('\n')
|
|
10
|
-
.map((line) => ` ${line}`)
|
|
11
|
-
.join('\n');
|
|
1
|
+
import latestVersion from 'latest-version';
|
|
12
2
|
|
|
13
3
|
export const packageHasVersion = async (packageName: string, version: string): Promise<boolean> => {
|
|
14
|
-
const spinner = ora(`Checking is ${packageName} package has ${version} version`).start();
|
|
15
|
-
|
|
16
4
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
spinner.stop();
|
|
20
|
-
return hasVersion;
|
|
5
|
+
await latestVersion(packageName, { version });
|
|
6
|
+
return true;
|
|
21
7
|
} catch (e) {
|
|
22
|
-
spinner.stop();
|
|
23
|
-
// TODO: replace with logger from di
|
|
24
|
-
console.log(`Checking failed with error:\n`);
|
|
25
|
-
console.log(`${addPaddingToString(e.message)}`);
|
|
26
|
-
console.log(`${addPaddingToString(e.stack.replace(e.message, ''))}\n`);
|
|
27
8
|
return false;
|
|
28
9
|
}
|
|
29
10
|
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deduplicate = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
6
|
-
const deduplicate = (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
-
const spinner = (0, ora_1.default)('Deduplicate dependencies in a lock file').start();
|
|
8
|
-
try {
|
|
9
|
-
yield context.packageManager.dedupe();
|
|
10
|
-
spinner.stop();
|
|
11
|
-
console.log('Deduplication completed');
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
spinner.stop();
|
|
15
|
-
console.error('Deduplication error:');
|
|
16
|
-
throw e;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.deduplicate = deduplicate;
|
|
20
|
-
//# sourceMappingURL=deduplicate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deduplicate.js","sourceRoot":"","sources":["../../../../src/utils/commands/dependencies/deduplicate.ts"],"names":[],"mappings":";;;;AAAA,sDAAsB;AAGf,MAAM,WAAW,GAAG,CAAO,OAAgB,EAAE,EAAE;IACpD,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC,yCAAyC,CAAC,CAAC,KAAK,EAAE,CAAC;IAEvE,IAAI;QACF,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;KACxC;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACtC,MAAM,CAAC,CAAC;KACT;AACH,CAAC,CAAA,CAAC;AAZW,QAAA,WAAW,eAYtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getPackageInfo: (packageName: string, field?: string) => Promise<any>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPackageInfo = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const util_1 = tslib_1.__importDefault(require("util"));
|
|
6
|
-
const child_process_1 = tslib_1.__importDefault(require("child_process"));
|
|
7
|
-
const exec = util_1.default.promisify(child_process_1.default.exec);
|
|
8
|
-
const getPackageInfo = (packageName, field) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
-
const { stdout } = yield exec(`npm view ${packageName} --json ${field !== null && field !== void 0 ? field : ''}`);
|
|
10
|
-
return JSON.parse(stdout);
|
|
11
|
-
});
|
|
12
|
-
exports.getPackageInfo = getPackageInfo;
|
|
13
|
-
//# sourceMappingURL=getPackageInfo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageInfo.js","sourceRoot":"","sources":["../../../../src/utils/commands/dependencies/getPackageInfo.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,0EAAyC;AAEzC,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,uBAAY,CAAC,IAAI,CAAC,CAAC;AAExC,MAAM,cAAc,GAAG,CAAO,WAAmB,EAAE,KAAc,EAAE,EAAE;IAC1E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,YAAY,WAAW,WAAW,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,EAAE,CAAC,CAAC;IAE/E,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC,CAAA,CAAC;AAJW,QAAA,cAAc,kBAIzB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.installDependencies = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
6
|
-
const installDependencies = (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
-
const spinner = (0, ora_1.default)('Install dependencies...').start();
|
|
8
|
-
try {
|
|
9
|
-
yield context.packageManager.install();
|
|
10
|
-
spinner.stop();
|
|
11
|
-
console.log('Dependencies installed');
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
spinner.stop();
|
|
15
|
-
console.error('Error installing dependencies:');
|
|
16
|
-
throw e;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.installDependencies = installDependencies;
|
|
20
|
-
//# sourceMappingURL=installDependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"installDependencies.js","sourceRoot":"","sources":["../../../../src/utils/commands/dependencies/installDependencies.ts"],"names":[],"mappings":";;;;AAAA,sDAAsB;AAGf,MAAM,mBAAmB,GAAG,CAAO,OAAgB,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC,yBAAyB,CAAC,CAAC,KAAK,EAAE,CAAC;IAEvD,IAAI;QACF,MAAM,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QACvC,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;KACvC;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAChD,MAAM,CAAC,CAAC;KACT;AACH,CAAC,CAAA,CAAC;AAZW,QAAA,mBAAmB,uBAY9B"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.installDependency = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
6
|
-
const installDependency = ({ name, version, devDependency }, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
-
const spinner = (0, ora_1.default)(`Install ${name}@${version}`).start();
|
|
8
|
-
try {
|
|
9
|
-
yield context.packageManager.install({ name, version, devDependency });
|
|
10
|
-
spinner.stop();
|
|
11
|
-
console.log(`${name}@${version} installed`);
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
spinner.stop();
|
|
15
|
-
console.error(`Error installing ${name}@${version}: `, e);
|
|
16
|
-
throw e;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.installDependency = installDependency;
|
|
20
|
-
//# sourceMappingURL=installDependency.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"installDependency.js","sourceRoot":"","sources":["../../../../src/utils/commands/dependencies/installDependency.ts"],"names":[],"mappings":";;;;AAAA,sDAAsB;AAGf,MAAM,iBAAiB,GAAG,CAC/B,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAA8D,EAC5F,OAAgB,EAChB,EAAE;IACF,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC,WAAW,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IAE1D,IAAI;QACF,MAAM,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,OAAO,YAAY,CAAC,CAAC;KAC7C;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,IAAI,IAAI,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1D,MAAM,CAAC,CAAC;KACT;AACH,CAAC,CAAA,CAAC;AAfW,QAAA,iBAAiB,qBAe5B"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import ora from 'ora';
|
|
2
|
-
import type { Context } from '../../../models/context';
|
|
3
|
-
|
|
4
|
-
export const deduplicate = async (context: Context) => {
|
|
5
|
-
const spinner = ora('Deduplicate dependencies in a lock file').start();
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
await context.packageManager.dedupe();
|
|
9
|
-
spinner.stop();
|
|
10
|
-
console.log('Deduplication completed');
|
|
11
|
-
} catch (e) {
|
|
12
|
-
spinner.stop();
|
|
13
|
-
console.error('Deduplication error:');
|
|
14
|
-
throw e;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import util from 'util';
|
|
2
|
-
import childProcess from 'child_process';
|
|
3
|
-
|
|
4
|
-
const exec = util.promisify(childProcess.exec);
|
|
5
|
-
|
|
6
|
-
export const getPackageInfo = async (packageName: string, field?: string) => {
|
|
7
|
-
const { stdout } = await exec(`npm view ${packageName} --json ${field ?? ''}`);
|
|
8
|
-
|
|
9
|
-
return JSON.parse(stdout);
|
|
10
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import ora from 'ora';
|
|
2
|
-
import type { Context } from '../../../models/context';
|
|
3
|
-
|
|
4
|
-
export const installDependencies = async (context: Context) => {
|
|
5
|
-
const spinner = ora('Install dependencies...').start();
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
await context.packageManager.install();
|
|
9
|
-
spinner.stop();
|
|
10
|
-
console.log('Dependencies installed');
|
|
11
|
-
} catch (e) {
|
|
12
|
-
spinner.stop();
|
|
13
|
-
console.error('Error installing dependencies:');
|
|
14
|
-
throw e;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import ora from 'ora';
|
|
2
|
-
import type { Context } from '../../../models/context';
|
|
3
|
-
|
|
4
|
-
export const installDependency = async (
|
|
5
|
-
{ name, version, devDependency }: { name: string; version: string; devDependency?: boolean },
|
|
6
|
-
context: Context
|
|
7
|
-
) => {
|
|
8
|
-
const spinner = ora(`Install ${name}@${version}`).start();
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
await context.packageManager.install({ name, version, devDependency });
|
|
12
|
-
spinner.stop();
|
|
13
|
-
console.log(`${name}@${version} installed`);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
spinner.stop();
|
|
16
|
-
console.error(`Error installing ${name}@${version}: `, e);
|
|
17
|
-
throw e;
|
|
18
|
-
}
|
|
19
|
-
};
|