@tramvai/test-integration 4.37.0 → 4.38.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/lib/app/buildCli.d.ts +15 -0
- package/lib/app/buildCli.es.js +55 -0
- package/lib/app/buildCli.js +64 -0
- package/lib/app/types.d.ts +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.es.js +1 -0
- package/lib/index.js +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Writable } from 'stream';
|
|
3
|
+
import type { PromiseType } from 'utility-types';
|
|
4
|
+
import type { BuildOptions } from './types';
|
|
5
|
+
export interface BuildCliOptions extends Omit<BuildOptions, 'config' | 'target'> {
|
|
6
|
+
logger?: Pick<typeof console, 'log' | 'error'>;
|
|
7
|
+
}
|
|
8
|
+
export declare const buildCli: (targetOrConfig: BuildOptions['target'] | BuildOptions['config'], { env, logger, ...cliOptions }?: BuildCliOptions) => Promise<{
|
|
9
|
+
stdout: Writable;
|
|
10
|
+
stderr: Writable;
|
|
11
|
+
getBuildStats: import("@tramvai/cli/lib/typings/build/Builder").GetBuildStats;
|
|
12
|
+
builder?: import("@tramvai/cli/lib/typings/build/Builder").Builder<any> | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export type BuildCliResult = PromiseType<ReturnType<typeof buildCli>>;
|
|
15
|
+
//# sourceMappingURL=buildCli.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import mergeDeep from '@tinkoff/utils/object/mergeDeep';
|
|
2
|
+
import { Writable } from 'stream';
|
|
3
|
+
import envCi from 'env-ci';
|
|
4
|
+
import { build } from '@tramvai/cli';
|
|
5
|
+
|
|
6
|
+
const ciInfo = envCi();
|
|
7
|
+
const buildCli = async (targetOrConfig, { env, logger = console, ...cliOptions } = {}) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const stdout = new Writable({
|
|
10
|
+
write(chunk, encoding, callback) {
|
|
11
|
+
logger.log(`[@tramvai/cli] log:`, chunk.toString());
|
|
12
|
+
callback();
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
const stderr = new Writable({
|
|
16
|
+
write(chunk, encoding, callback) {
|
|
17
|
+
logger.error(`[@tramvai/cli] error:`, chunk.toString());
|
|
18
|
+
callback();
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const cliResult = await build({
|
|
22
|
+
stdout,
|
|
23
|
+
stderr,
|
|
24
|
+
// build cache made tests unstable in CI, because of cache writing process are async,
|
|
25
|
+
// and there is no way to wait this process (`idleTimeoutForInitialStore: 0` helps sometimes, but no guarantees)
|
|
26
|
+
fileCache: !ciInfo.isCi,
|
|
27
|
+
// faster builds with debug flag, sm still will be disabled by default
|
|
28
|
+
sourceMap: (_a = cliOptions.sourceMap) !== null && _a !== void 0 ? _a : false,
|
|
29
|
+
...(typeof targetOrConfig === 'string'
|
|
30
|
+
? { target: targetOrConfig }
|
|
31
|
+
: {
|
|
32
|
+
config: mergeDeep({
|
|
33
|
+
// faster builds
|
|
34
|
+
sourceMap: false,
|
|
35
|
+
// faster builds
|
|
36
|
+
experiments: {
|
|
37
|
+
transpilation: {
|
|
38
|
+
loader: 'swc',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}, targetOrConfig),
|
|
42
|
+
}),
|
|
43
|
+
env: {
|
|
44
|
+
...env,
|
|
45
|
+
},
|
|
46
|
+
...cliOptions,
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
...cliResult,
|
|
50
|
+
stdout,
|
|
51
|
+
stderr,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { buildCli };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var mergeDeep = require('@tinkoff/utils/object/mergeDeep');
|
|
6
|
+
var stream = require('stream');
|
|
7
|
+
var envCi = require('env-ci');
|
|
8
|
+
var cli = require('@tramvai/cli');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var mergeDeep__default = /*#__PURE__*/_interopDefaultLegacy(mergeDeep);
|
|
13
|
+
var envCi__default = /*#__PURE__*/_interopDefaultLegacy(envCi);
|
|
14
|
+
|
|
15
|
+
const ciInfo = envCi__default["default"]();
|
|
16
|
+
const buildCli = async (targetOrConfig, { env, logger = console, ...cliOptions } = {}) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const stdout = new stream.Writable({
|
|
19
|
+
write(chunk, encoding, callback) {
|
|
20
|
+
logger.log(`[@tramvai/cli] log:`, chunk.toString());
|
|
21
|
+
callback();
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const stderr = new stream.Writable({
|
|
25
|
+
write(chunk, encoding, callback) {
|
|
26
|
+
logger.error(`[@tramvai/cli] error:`, chunk.toString());
|
|
27
|
+
callback();
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const cliResult = await cli.build({
|
|
31
|
+
stdout,
|
|
32
|
+
stderr,
|
|
33
|
+
// build cache made tests unstable in CI, because of cache writing process are async,
|
|
34
|
+
// and there is no way to wait this process (`idleTimeoutForInitialStore: 0` helps sometimes, but no guarantees)
|
|
35
|
+
fileCache: !ciInfo.isCi,
|
|
36
|
+
// faster builds with debug flag, sm still will be disabled by default
|
|
37
|
+
sourceMap: (_a = cliOptions.sourceMap) !== null && _a !== void 0 ? _a : false,
|
|
38
|
+
...(typeof targetOrConfig === 'string'
|
|
39
|
+
? { target: targetOrConfig }
|
|
40
|
+
: {
|
|
41
|
+
config: mergeDeep__default["default"]({
|
|
42
|
+
// faster builds
|
|
43
|
+
sourceMap: false,
|
|
44
|
+
// faster builds
|
|
45
|
+
experiments: {
|
|
46
|
+
transpilation: {
|
|
47
|
+
loader: 'swc',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}, targetOrConfig),
|
|
51
|
+
}),
|
|
52
|
+
env: {
|
|
53
|
+
...env,
|
|
54
|
+
},
|
|
55
|
+
...cliOptions,
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
...cliResult,
|
|
59
|
+
stdout,
|
|
60
|
+
stderr,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
exports.buildCli = buildCli;
|
package/lib/app/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { start } from '@tramvai/cli';
|
|
1
|
+
import type { start, build } from '@tramvai/cli';
|
|
2
2
|
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
|
|
3
3
|
export type StartOptions = UnionToIntersection<Parameters<typeof start>[0]>;
|
|
4
|
+
export type BuildOptions = UnionToIntersection<Parameters<typeof build>[0]>;
|
|
4
5
|
export {};
|
|
5
6
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/index.d.ts
CHANGED
package/lib/index.es.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var startCli = require('./app/startCli.js');
|
|
6
|
+
var buildCli = require('./app/buildCli.js');
|
|
6
7
|
var sleep = require('./helpers/sleep.js');
|
|
7
8
|
var utils = require('./app/utils.js');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
exports.startCli = startCli.startCli;
|
|
13
|
+
exports.buildCli = buildCli.buildCli;
|
|
12
14
|
exports.sleep = sleep.sleep;
|
|
13
15
|
exports.getServerDomain = utils.getServerDomain;
|
|
14
16
|
exports.getServerUrl = utils.getServerUrl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/test-integration",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.38.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@tinkoff/mocker": "4.0.1",
|
|
24
|
-
"@tramvai/test-helpers": "4.
|
|
24
|
+
"@tramvai/test-helpers": "4.38.0",
|
|
25
25
|
"env-ci": "^5.0.2",
|
|
26
26
|
"utility-types": "^3.10.0",
|
|
27
27
|
"wait-on": "^5.3.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@tinkoff/utils": "^2.1.2",
|
|
31
|
-
"@tramvai/cli": "4.
|
|
31
|
+
"@tramvai/cli": "4.38.0",
|
|
32
32
|
"tslib": "^2.4.0"
|
|
33
33
|
},
|
|
34
34
|
"license": "Apache-2.0",
|