@contrail/flexplm 1.6.1-alpha.6dd609b → 1.7.0-alpha.71b4d30
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/lib/cli/commands/{create.d.ts → config-file/create.d.ts} +0 -1
- package/lib/cli/commands/config-file/create.js +61 -0
- package/lib/cli/commands/config-file/create.spec.js +74 -0
- package/lib/cli/commands/config-file/index.d.ts +2 -0
- package/lib/cli/commands/config-file/index.js +47 -0
- package/lib/cli/commands/config-file/upload.d.ts +8 -0
- package/lib/cli/commands/config-file/upload.js +84 -0
- package/lib/cli/commands/config-file/upload.spec.js +51 -0
- package/lib/cli/commands/mapping-file/create.d.ts +4 -0
- package/lib/cli/commands/{create.js → mapping-file/create.js} +4 -20
- package/lib/cli/commands/mapping-file/create.spec.d.ts +1 -0
- package/lib/cli/commands/{create.spec.js → mapping-file/create.spec.js} +1 -1
- package/lib/cli/commands/mapping-file/index.d.ts +2 -0
- package/lib/cli/commands/mapping-file/index.js +57 -0
- package/lib/cli/commands/mapping-file/upload.d.ts +3 -0
- package/lib/cli/commands/mapping-file/upload.js +70 -0
- package/lib/cli/commands/shared/git.d.ts +6 -0
- package/lib/cli/commands/shared/git.js +100 -0
- package/lib/cli/commands/shared/prompts.d.ts +2 -0
- package/lib/cli/commands/shared/prompts.js +61 -0
- package/lib/cli/commands/shared/upload-base.d.ts +24 -0
- package/lib/cli/commands/shared/upload-base.js +138 -0
- package/lib/cli/commands/shared/upload-base.spec.d.ts +1 -0
- package/lib/cli/commands/shared/upload-base.spec.js +99 -0
- package/lib/cli/index.js +18 -36
- package/lib/cli/index.spec.js +111 -53
- package/lib/cli/template/config-template.json.template +5 -0
- package/lib/publish/base-process-publish-assortment.d.ts +0 -2
- package/lib/publish/base-process-publish-assortment.js +7 -62
- package/lib/publish/base-process-publish-assortment.spec.js +0 -212
- package/package.json +2 -2
- package/scripts/copy-template.js +16 -5
- package/lib/cli/commands/upload.d.ts +0 -17
- package/lib/cli/commands/upload.js +0 -228
- package/lib/cli/commands/upload.spec.js +0 -88
- /package/lib/cli/commands/{create.spec.d.ts → config-file/create.spec.d.ts} +0 -0
- /package/lib/cli/commands/{upload.spec.d.ts → config-file/upload.spec.d.ts} +0 -0
- /package/lib/cli/commands/{compile.d.ts → mapping-file/compile.d.ts} +0 -0
- /package/lib/cli/commands/{compile.js → mapping-file/compile.js} +0 -0
- /package/lib/cli/commands/{compile.spec.d.ts → mapping-file/compile.spec.d.ts} +0 -0
- /package/lib/cli/commands/{compile.spec.js → mapping-file/compile.spec.js} +0 -0
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
jest.mock('@contrail/sdk', () => ({
|
|
4
|
-
Entities: jest.fn(),
|
|
5
|
-
Files: jest.fn(),
|
|
6
|
-
login: jest.fn(),
|
|
7
|
-
}));
|
|
8
|
-
const upload_1 = require("./upload");
|
|
9
|
-
describe('UploadCommand.parseArgs', () => {
|
|
10
|
-
it('parses a bare file path', () => {
|
|
11
|
-
const opts = upload_1.UploadCommand.parseArgs(['mapping.ts']);
|
|
12
|
-
expect(opts).toEqual({
|
|
13
|
-
filePath: 'mapping.ts',
|
|
14
|
-
message: undefined,
|
|
15
|
-
branch: undefined,
|
|
16
|
-
skipGit: false,
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
it('parses -m commit message option', () => {
|
|
20
|
-
const opts = upload_1.UploadCommand.parseArgs(['mapping.ts', '-m', 'my message']);
|
|
21
|
-
expect(opts.message).toEqual('my message');
|
|
22
|
-
expect(opts.skipGit).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
it('parses -b branch option', () => {
|
|
25
|
-
const opts = upload_1.UploadCommand.parseArgs(['mapping.ts', '-b', 'feature/x']);
|
|
26
|
-
expect(opts.branch).toEqual('feature/x');
|
|
27
|
-
});
|
|
28
|
-
it('parses --skip-git flag', () => {
|
|
29
|
-
const opts = upload_1.UploadCommand.parseArgs(['mapping.ts', '--skip-git']);
|
|
30
|
-
expect(opts.skipGit).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
it('accepts the legacy --skipGit alias', () => {
|
|
33
|
-
const opts = upload_1.UploadCommand.parseArgs(['mapping.ts', '--skipGit']);
|
|
34
|
-
expect(opts.skipGit).toBe(true);
|
|
35
|
-
});
|
|
36
|
-
it('parses options before the file path', () => {
|
|
37
|
-
const opts = upload_1.UploadCommand.parseArgs(['-m', 'msg', '-b', 'br', 'mapping.ts']);
|
|
38
|
-
expect(opts).toEqual({
|
|
39
|
-
filePath: 'mapping.ts',
|
|
40
|
-
message: 'msg',
|
|
41
|
-
branch: 'br',
|
|
42
|
-
skipGit: false,
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
it('parses all options together', () => {
|
|
46
|
-
const opts = upload_1.UploadCommand.parseArgs(['mapping.ts', '-m', 'msg', '-b', 'br', '--skip-git']);
|
|
47
|
-
expect(opts).toEqual({
|
|
48
|
-
filePath: 'mapping.ts',
|
|
49
|
-
message: 'msg',
|
|
50
|
-
branch: 'br',
|
|
51
|
-
skipGit: true,
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
it('throws when -m is missing its value', () => {
|
|
55
|
-
expect(() => upload_1.UploadCommand.parseArgs(['mapping.ts', '-m'])).toThrow(/-m requires a commit message/);
|
|
56
|
-
});
|
|
57
|
-
it('throws when -b is missing its value', () => {
|
|
58
|
-
expect(() => upload_1.UploadCommand.parseArgs(['mapping.ts', '-b'])).toThrow(/-b requires a branch name/);
|
|
59
|
-
});
|
|
60
|
-
it('throws on unknown option', () => {
|
|
61
|
-
expect(() => upload_1.UploadCommand.parseArgs(['mapping.ts', '--bogus'])).toThrow(/Unknown option: --bogus/);
|
|
62
|
-
});
|
|
63
|
-
it('throws when an extra positional argument is supplied', () => {
|
|
64
|
-
expect(() => upload_1.UploadCommand.parseArgs(['mapping.ts', 'extra.ts'])).toThrow(/Unexpected argument: extra\.ts/);
|
|
65
|
-
});
|
|
66
|
-
it('throws when no file path is provided', () => {
|
|
67
|
-
expect(() => upload_1.UploadCommand.parseArgs([])).toThrow(/missing <path\.ts>/);
|
|
68
|
-
});
|
|
69
|
-
it('throws when only options are provided', () => {
|
|
70
|
-
expect(() => upload_1.UploadCommand.parseArgs(['--skip-git'])).toThrow(/missing <path\.ts>/);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
describe('UploadCommand.buildCommitMessage', () => {
|
|
74
|
-
it('appends fileId to the first line of a single-line message', () => {
|
|
75
|
-
expect(upload_1.UploadCommand.buildCommitMessage('initial commit', 'abc123')).toEqual('initial commit [fileId: abc123]');
|
|
76
|
-
});
|
|
77
|
-
it('only appends fileId to the first line of a multi-line message', () => {
|
|
78
|
-
const result = upload_1.UploadCommand.buildCommitMessage('header line\nbody line 1\nbody line 2', 'xyz');
|
|
79
|
-
expect(result).toEqual('header line [fileId: xyz]\nbody line 1\nbody line 2');
|
|
80
|
-
});
|
|
81
|
-
it('handles CRLF line endings', () => {
|
|
82
|
-
const result = upload_1.UploadCommand.buildCommitMessage('header\r\nbody', 'fid');
|
|
83
|
-
expect(result).toEqual('header [fileId: fid]\nbody');
|
|
84
|
-
});
|
|
85
|
-
it('handles an empty message', () => {
|
|
86
|
-
expect(upload_1.UploadCommand.buildCommitMessage('', 'fid')).toEqual(' [fileId: fid]');
|
|
87
|
-
});
|
|
88
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|