@squiz/component-cli-lib 1.2.1-alpha.98 → 1.2.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/.gitlab-ci.yml +29 -27
- package/CHANGELOG.md +80 -0
- package/jest.config.ts +3 -0
- package/lib/component-dev-folder-structures.spec.d.ts +1 -0
- package/lib/component-dev-folder-structures.spec.js +58 -0
- package/lib/component-dev-folder-structures.spec.js.map +1 -0
- package/lib/component-dev.d.ts +4 -1
- package/lib/component-dev.js +24 -18
- package/lib/component-dev.js.map +1 -1
- package/lib/component-dev.spec.js +28 -65
- package/lib/component-dev.spec.js.map +1 -1
- package/lib/integration-tests/__components__/big-package/manifest.json +3 -0
- package/lib/integration-tests/__components__/cmp-static-file-test/manifest.json +3 -0
- package/lib/integration-tests/__components__/invalid-manifest/manifest.json +3 -0
- package/lib/integration-tests/helper.d.ts +4 -0
- package/lib/integration-tests/helper.js +27 -6
- package/lib/integration-tests/helper.js.map +1 -1
- package/lib/integration-tests/service-deployment.spec.js +21 -1
- package/lib/integration-tests/service-deployment.spec.js.map +1 -1
- package/lib/integration-tests/upload-and-render-component.spec.js +38 -17
- package/lib/integration-tests/upload-and-render-component.spec.js.map +1 -1
- package/lib/upload-component-folder.d.ts +1 -1
- package/lib/upload-component-folder.js +10 -6
- package/lib/upload-component-folder.js.map +1 -1
- package/package.json +10 -10
- package/src/component-dev-folder-structures.spec.ts +69 -0
- package/src/component-dev.spec.ts +31 -83
- package/src/component-dev.ts +40 -18
- package/src/integration-tests/__components__/big-package/manifest.json +3 -0
- package/src/integration-tests/__components__/cmp-static-file-test/manifest.json +3 -1
- package/src/integration-tests/__components__/invalid-manifest/manifest.json +3 -0
- package/src/integration-tests/helper.ts +22 -1
- package/src/integration-tests/service-deployment.spec.ts +26 -2
- package/src/integration-tests/upload-and-render-component.spec.ts +78 -17
- package/src/upload-component-folder.ts +16 -7
- package/tsconfig.tsbuildinfo +1 -1
package/.gitlab-ci.yml
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
.rules:when-production:
|
|
4
|
+
rules:
|
|
5
|
+
- if: $CI_DEPLOY_TO_PROD && $CI_COMMIT_REF_NAME == $TARGET_BRANCH_PRODUCTION
|
|
6
|
+
when: on_success
|
|
7
|
+
|
|
3
8
|
.rules:when-uat:
|
|
4
9
|
rules:
|
|
5
|
-
- if: $CI_COMMIT_REF_NAME == $TARGET_BRANCH_UAT
|
|
10
|
+
- if: $CI_COMMIT_REF_NAME == $TARGET_BRANCH_UAT && $CI_DEPLOY_TO_PROD == null
|
|
6
11
|
when: on_success
|
|
7
|
-
- when: never
|
|
8
12
|
|
|
9
13
|
.rules:when-development:
|
|
10
14
|
rules:
|
|
11
|
-
- if: $CI_COMMIT_REF_NAME == $TARGET_BRANCH_DEVELOPMENT
|
|
15
|
+
- if: $CI_COMMIT_REF_NAME == $TARGET_BRANCH_DEVELOPMENT && $CI_DEPLOY_TO_PROD == null
|
|
12
16
|
when: on_success
|
|
13
|
-
- when: never
|
|
14
17
|
|
|
15
18
|
.rules:when-other-branch:
|
|
16
19
|
rules:
|
|
17
|
-
- if: $CI_COMMIT_REF_NAME != $TARGET_BRANCH_DEVELOPMENT && $CI_COMMIT_REF_NAME != $TARGET_BRANCH_UAT
|
|
20
|
+
- if: $CI_COMMIT_REF_NAME != $TARGET_BRANCH_DEVELOPMENT && $CI_COMMIT_REF_NAME != $TARGET_BRANCH_UAT && $CI_COMMIT_REF_NAME != $TARGET_BRANCH_PRODUCTION && $CI_DEPLOY_TO_PROD == null
|
|
18
21
|
when: on_success
|
|
19
|
-
- when: never
|
|
20
22
|
|
|
21
23
|
.get-service-urls:
|
|
22
24
|
stage: smoke-test-setup
|
|
@@ -57,14 +59,14 @@
|
|
|
57
59
|
reports:
|
|
58
60
|
dotenv: dot.env
|
|
59
61
|
|
|
60
|
-
smoke-test:
|
|
62
|
+
.smoke-test:
|
|
61
63
|
stage: smoke-test
|
|
62
64
|
tags:
|
|
63
65
|
- size/l
|
|
64
66
|
script:
|
|
65
67
|
- export
|
|
66
|
-
- npm
|
|
67
|
-
- npm run bootstrap
|
|
68
|
+
- npm ci
|
|
69
|
+
- npm run bootstrap -- --ci
|
|
68
70
|
- npm run clean
|
|
69
71
|
- npm run lint
|
|
70
72
|
- npm run format-code
|
|
@@ -77,13 +79,24 @@ smoke-test:
|
|
|
77
79
|
- runner_system_failure
|
|
78
80
|
- stuck_or_timeout_failure
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
smoke-test:development:
|
|
81
83
|
extends:
|
|
82
|
-
- .
|
|
83
|
-
- .
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
- .smoke-test
|
|
85
|
+
- .rules:when-development
|
|
86
|
+
|
|
87
|
+
smoke-test:uat:
|
|
88
|
+
extends:
|
|
89
|
+
- .smoke-test
|
|
90
|
+
- .rules:when-uat
|
|
91
|
+
|
|
92
|
+
# TODO: Do we need this running for feature branches?
|
|
93
|
+
# get-branch-service-urls:
|
|
94
|
+
# extends:
|
|
95
|
+
# - .rules:when-other-branch
|
|
96
|
+
# - .get-service-urls
|
|
97
|
+
# environment:
|
|
98
|
+
# name: non-production-development
|
|
99
|
+
# url: components.dev.dx.squiz.cloud
|
|
87
100
|
|
|
88
101
|
get-development-service-urls:
|
|
89
102
|
extends:
|
|
@@ -100,14 +113,3 @@ get-uat-service-urls:
|
|
|
100
113
|
environment:
|
|
101
114
|
name: non-production-development
|
|
102
115
|
url: components.dev.dx.squiz.cloud
|
|
103
|
-
|
|
104
|
-
get-production-service-urls:
|
|
105
|
-
extends:
|
|
106
|
-
- .get-service-urls
|
|
107
|
-
environment:
|
|
108
|
-
name: production
|
|
109
|
-
url: components.prod.dx.squiz.cloud
|
|
110
|
-
rules:
|
|
111
|
-
- if: $CI_DEPLOY_TO_PROD && $CI_COMMIT_REF_NAME == $TARGET_BRANCH_PRODUCTION
|
|
112
|
-
when: manual
|
|
113
|
-
- when: never
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,86 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.1](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1) (2022-09-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.2.1-alpha.107](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.107) (2022-09-21)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.2.1-alpha.106](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.106) (2022-09-02)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [1.2.1-alpha.105](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.105) (2022-08-26)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [1.2.1-alpha.104](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.104) (2022-08-23)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [1.2.1-alpha.103](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.103) (2022-08-23)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [1.2.1-alpha.102](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.102) (2022-08-23)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## [1.2.1-alpha.101](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.101) (2022-08-19)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## [1.2.1-alpha.100](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.100) (2022-08-18)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## [1.2.1-alpha.99](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.99) (2022-08-18)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @squiz/component-cli-lib
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
6
86
|
## [1.2.1-alpha.98](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.98) (2022-08-17)
|
|
7
87
|
|
|
8
88
|
**Note:** Version bump only for package @squiz/component-cli-lib
|
package/jest.config.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const supertest_1 = __importDefault(require("supertest"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
+
const render_runtime_lib_1 = require("@squiz/render-runtime-lib");
|
|
10
|
+
const component_dev_1 = require("./component-dev");
|
|
11
|
+
jest.setTimeout(20000);
|
|
12
|
+
describe('component-dev', () => {
|
|
13
|
+
describe('production style folder structure', () => {
|
|
14
|
+
let server;
|
|
15
|
+
let request;
|
|
16
|
+
beforeAll(async () => {
|
|
17
|
+
server = (0, component_dev_1.startDevelopmentRender)(render_runtime_lib_1.TestHelpers.getTestComponentFolder(), { port: 0 });
|
|
18
|
+
request = (0, supertest_1.default)(server);
|
|
19
|
+
});
|
|
20
|
+
afterAll(async () => {
|
|
21
|
+
server.close();
|
|
22
|
+
});
|
|
23
|
+
it('should find the component', async () => {
|
|
24
|
+
const response = await request.get(`/r/set/unit-test-components/test-component/1.0.0?something=hello`);
|
|
25
|
+
expect(response.text).toEqual('<h1>hello</h1>');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('local developer style folders', () => {
|
|
29
|
+
let version;
|
|
30
|
+
let componentName;
|
|
31
|
+
let fixtureDirectory;
|
|
32
|
+
let server;
|
|
33
|
+
let request;
|
|
34
|
+
beforeAll(async () => {
|
|
35
|
+
const { fixtureDirectory: createdFixtureDirectory, version: createdVersion, componentName: createdName, } = await render_runtime_lib_1.TestHelpers.ComponentFixture.setupFullComponentDirectory('<h1>Hello World</h1>');
|
|
36
|
+
version = createdVersion;
|
|
37
|
+
fixtureDirectory = createdFixtureDirectory;
|
|
38
|
+
componentName = createdName;
|
|
39
|
+
server = (0, component_dev_1.startDevelopmentRender)(fixtureDirectory, { port: 0 });
|
|
40
|
+
request = (0, supertest_1.default)(server);
|
|
41
|
+
});
|
|
42
|
+
afterAll(async () => {
|
|
43
|
+
server.close();
|
|
44
|
+
});
|
|
45
|
+
afterAll(async () => {
|
|
46
|
+
await promises_1.default.rm(path_1.default.join(fixtureDirectory, componentName), { force: true, recursive: true });
|
|
47
|
+
});
|
|
48
|
+
it('should handle recursing folders to find the component', async () => {
|
|
49
|
+
const response = await request.get(`/r/set/some-namespace/${componentName}/${version}/`);
|
|
50
|
+
expect(response.text).toEqual('<h1>Hello World</h1>');
|
|
51
|
+
});
|
|
52
|
+
it('should handle serving static files from single component directory', async () => {
|
|
53
|
+
const response = await request.get(`/s/some-namespace/${componentName}/${version}/static.txt`);
|
|
54
|
+
expect(response.text).toEqual('hello');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=component-dev-folder-structures.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-dev-folder-structures.spec.js","sourceRoot":"","sources":["../src/component-dev-folder-structures.spec.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,gDAAwB;AACxB,2DAA8B;AAE9B,kEAAwD;AACxD,mDAAyD;AAGzD,IAAI,CAAC,UAAU,CAAC,KAAM,CAAC,CAAC;AAExB,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;QACjD,IAAI,MAAc,CAAC;QACnB,IAAI,OAA4C,CAAC;QACjD,SAAS,CAAC,KAAK,IAAI,EAAE;YACnB,MAAM,GAAG,IAAA,sCAAsB,EAAC,gCAAW,CAAC,sBAAsB,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YACnF,OAA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G,CAAC,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7F,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;YACrE,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,yBAAyB,aAAa,IAAI,OAAO,GAAG,CAAC,CAAC;YACzF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oEAAoE,EAAE,KAAK,IAAI,EAAE;YAClF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,qBAAqB,aAAa,IAAI,OAAO,aAAa,CAAC,CAAC;YAC/F,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/lib/component-dev.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { LoggerOptions } from '@squiz/dx-logger-lib';
|
|
1
3
|
/**
|
|
2
4
|
* startDevelopmentRender starts a dev-mode render stack for any
|
|
3
5
|
* local directory. This should start an express server on a random unused port
|
|
@@ -10,4 +12,5 @@
|
|
|
10
12
|
export declare function startDevelopmentRender(componentPath: string, options: {
|
|
11
13
|
port: number;
|
|
12
14
|
previewFile?: string;
|
|
13
|
-
|
|
15
|
+
loggingFormat?: LoggerOptions['format'];
|
|
16
|
+
}): import("http").Server;
|
package/lib/component-dev.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.startDevelopmentRender = void 0;
|
|
|
7
7
|
const render_runtime_lib_1 = require("@squiz/render-runtime-lib");
|
|
8
8
|
const dx_logger_lib_1 = require("@squiz/dx-logger-lib");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const component_lib_1 = require("@squiz/component-lib");
|
|
10
11
|
/**
|
|
11
12
|
* startDevelopmentRender starts a dev-mode render stack for any
|
|
12
13
|
* local directory. This should start an express server on a random unused port
|
|
@@ -16,25 +17,30 @@ const path_1 = __importDefault(require("path"));
|
|
|
16
17
|
* @param {object} options - Additional configuration for the dev stack
|
|
17
18
|
* @returns a function to stop the render stack
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
-
const logger = (0, dx_logger_lib_1.getLogger)({ name: 'component-dev', format: 'human' });
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
function startDevelopmentRender(componentPath, options) {
|
|
21
|
+
const logger = (0, dx_logger_lib_1.getLogger)({ name: 'component-dev', format: options.loggingFormat || 'human' });
|
|
22
|
+
const rootUrl = `http://localhost:${options.port}`;
|
|
23
|
+
const dataMountPoint = path_1.default.resolve(process.cwd(), componentPath);
|
|
24
|
+
const componentRunnerService = new render_runtime_lib_1.ComponentRunnerServiceWithWorkers({
|
|
25
|
+
dataMountPoint,
|
|
26
|
+
shouldCacheResponses: false,
|
|
27
|
+
workerTimeout: 5000,
|
|
28
|
+
}, logger);
|
|
29
|
+
const webServer = (0, render_runtime_lib_1.setupRenderRuntimeServer)({
|
|
30
|
+
logger,
|
|
31
|
+
componentRunnerService,
|
|
32
|
+
componentSetService: new component_lib_1.ComponentSetServiceForLocalDev(logger),
|
|
33
|
+
componentFunctionService: new component_lib_1.ComponentFunctionService(rootUrl),
|
|
34
|
+
componentPreviewService: new render_runtime_lib_1.ComponentPreviewService(options.previewFile),
|
|
35
|
+
manifestService: new component_lib_1.ManifestServiceForDev(dataMountPoint, logger),
|
|
36
|
+
}, { rootUrl });
|
|
37
|
+
const server = webServer.listen(options.port, () => {
|
|
38
|
+
logger.info(`Component development webserver started on port ${options.port}`);
|
|
36
39
|
});
|
|
37
|
-
|
|
40
|
+
server.on('close', async () => {
|
|
41
|
+
await componentRunnerService.stop();
|
|
42
|
+
});
|
|
43
|
+
return server;
|
|
38
44
|
}
|
|
39
45
|
exports.startDevelopmentRender = startDevelopmentRender;
|
|
40
46
|
//# sourceMappingURL=component-dev.js.map
|
package/lib/component-dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-dev.js","sourceRoot":"","sources":["../src/component-dev.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"component-dev.js","sourceRoot":"","sources":["../src/component-dev.ts"],"names":[],"mappings":";;;;;;AAAA,kEAImC;AACnC,wDAAgE;AAChE,gDAAwB;AACxB,wDAAuH;AAEvH;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CACpC,aAAqB,EACrB,OAAwF;IAExF,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,EAAE,CAAC,CAAC;IAC9F,MAAM,OAAO,GAAG,oBAAoB,OAAO,CAAC,IAAI,EAAE,CAAC;IACnD,MAAM,cAAc,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;IAElE,MAAM,sBAAsB,GAAG,IAAI,sDAAiC,CAClE;QACE,cAAc;QACd,oBAAoB,EAAE,KAAK;QAC3B,aAAa,EAAE,IAAK;KACrB,EACD,MAAM,CACP,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,6CAAwB,EACxC;QACE,MAAM;QACN,sBAAsB;QACtB,mBAAmB,EAAE,IAAI,8CAA8B,CAAC,MAAM,CAAC;QAC/D,wBAAwB,EAAE,IAAI,wCAAwB,CAAC,OAAO,CAAC;QAC/D,uBAAuB,EAAE,IAAI,4CAAuB,CAAC,OAAO,CAAC,WAAW,CAAC;QACzE,eAAe,EAAE,IAAI,qCAAqB,CAAC,cAAc,EAAE,MAAM,CAAC;KACnE,EACD,EAAE,OAAO,EAAE,CACZ,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,IAAI,CAAC,mDAAmD,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;QAC5B,MAAM,sBAAsB,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AArCD,wDAqCC"}
|
|
@@ -3,87 +3,50 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
6
|
const render_runtime_lib_1 = require("@squiz/render-runtime-lib");
|
|
9
7
|
const component_dev_1 = require("./component-dev");
|
|
10
8
|
const supertest_1 = __importDefault(require("supertest"));
|
|
11
9
|
jest.setTimeout(20000);
|
|
12
10
|
describe('component-dev', () => {
|
|
13
|
-
describe('
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
doStopStack = await (0, component_dev_1.startDevelopmentRender)(path_1.default.join(__dirname, '../../../test-components'), { port: 0 });
|
|
17
|
-
});
|
|
18
|
-
afterAll(async () => {
|
|
19
|
-
await doStopStack();
|
|
20
|
-
});
|
|
21
|
-
it('should find the component', async () => {
|
|
22
|
-
const testServer = render_runtime_lib_1.TestHelpers.getTestServer();
|
|
23
|
-
const response = await testServer.get(`/r/set/test-component/1.0.0?something=hello`);
|
|
24
|
-
expect(response.text).toEqual('<h1>hello</h1>');
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
describe('local developer style folders', () => {
|
|
28
|
-
let doStopStack;
|
|
29
|
-
let version;
|
|
30
|
-
let componentName;
|
|
31
|
-
let fixtureDirectory;
|
|
11
|
+
describe('accessing local dev routes', () => {
|
|
12
|
+
let server;
|
|
13
|
+
let request;
|
|
32
14
|
beforeAll(async () => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
fixtureDirectory = ceratedFixtureDirectory;
|
|
36
|
-
componentName = createdName;
|
|
37
|
-
doStopStack = await (0, component_dev_1.startDevelopmentRender)(fixtureDirectory, { port: 0 });
|
|
15
|
+
server = (0, component_dev_1.startDevelopmentRender)(render_runtime_lib_1.TestHelpers.getTestComponentFolder(), { port: 0 });
|
|
16
|
+
request = (0, supertest_1.default)(server);
|
|
38
17
|
});
|
|
39
18
|
afterAll(async () => {
|
|
40
|
-
|
|
41
|
-
await promises_1.default.rm(path_1.default.join(fixtureDirectory, componentName), { force: true, recursive: true });
|
|
42
|
-
});
|
|
43
|
-
it('should handle recursing folders to find the component', async () => {
|
|
44
|
-
const testServer = render_runtime_lib_1.TestHelpers.getTestServer();
|
|
45
|
-
const response = await testServer.get(`/r/set/${componentName}/${version}/`);
|
|
46
|
-
expect(response.text).toEqual('<h1>Hello World</h1>');
|
|
47
|
-
});
|
|
48
|
-
it('should handle serving static files from single component directory', async () => {
|
|
49
|
-
const testServer = render_runtime_lib_1.TestHelpers.getTestServer();
|
|
50
|
-
const response = await testServer.get(`/s/${componentName}/${version}/static.txt`);
|
|
51
|
-
expect(response.text).toEqual('hello');
|
|
19
|
+
server.close();
|
|
52
20
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const url = `http://localhost:${port}`;
|
|
58
|
-
const request = (0, supertest_1.default)(url);
|
|
59
|
-
beforeAll(async () => {
|
|
60
|
-
const compDir = path_1.default.join(__dirname, '../', '../../test-components');
|
|
61
|
-
stopServer = await (0, component_dev_1.startDevelopmentRender)(compDir, {
|
|
62
|
-
port: port,
|
|
21
|
+
it('should fail validation when requesting a function with a missing entry file', async () => {
|
|
22
|
+
const response = await request.get('/r/set/unit-test-components/test-component/1.0.3/non-existent-entry-file?something=not-used');
|
|
23
|
+
expect(response.body).toEqual({
|
|
24
|
+
message: '"main\'s" entry file "missing-entry-file.js" is inaccessible',
|
|
63
25
|
});
|
|
64
|
-
|
|
65
|
-
afterAll(async () => {
|
|
66
|
-
await stopServer();
|
|
26
|
+
expect(response.statusCode).toEqual(500);
|
|
67
27
|
});
|
|
68
28
|
describe('definition routes', () => {
|
|
69
|
-
render_runtime_lib_1.
|
|
29
|
+
const server = (0, component_dev_1.startDevelopmentRender)(render_runtime_lib_1.TestHelpers.getTestComponentFolder(), { port: 0 });
|
|
30
|
+
const request = () => (0, supertest_1.default)(server);
|
|
31
|
+
render_runtime_lib_1.routeTests.definition(request, 'http://localhost:0');
|
|
32
|
+
afterAll(() => {
|
|
33
|
+
server.close();
|
|
34
|
+
});
|
|
70
35
|
});
|
|
71
36
|
describe('static routes', () => {
|
|
72
|
-
render_runtime_lib_1.
|
|
37
|
+
const server = (0, component_dev_1.startDevelopmentRender)(render_runtime_lib_1.TestHelpers.getTestComponentFolder(), { port: 0 });
|
|
38
|
+
const request = () => (0, supertest_1.default)(server);
|
|
39
|
+
render_runtime_lib_1.routeTests.static(request);
|
|
40
|
+
afterAll(() => {
|
|
41
|
+
server.close();
|
|
42
|
+
});
|
|
73
43
|
});
|
|
74
44
|
describe('render routes', () => {
|
|
75
|
-
render_runtime_lib_1.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// this is should 500 in prod and 404 locally
|
|
81
|
-
it('should fail validation if trying to render a component with an invalid schema', async () => {
|
|
82
|
-
const response = await request.get('/r/set/test-component/1.0.1?something=not-used');
|
|
83
|
-
expect(response.statusCode).toEqual(404);
|
|
84
|
-
expect(response.body).toEqual({
|
|
85
|
-
message: 'manifest could not be found',
|
|
86
|
-
});
|
|
45
|
+
const server = (0, component_dev_1.startDevelopmentRender)(render_runtime_lib_1.TestHelpers.getTestComponentFolder(), { port: 0 });
|
|
46
|
+
const request = () => (0, supertest_1.default)(server);
|
|
47
|
+
render_runtime_lib_1.routeTests.render(request, 'http://localhost:0');
|
|
48
|
+
afterAll(() => {
|
|
49
|
+
server.close();
|
|
87
50
|
});
|
|
88
51
|
});
|
|
89
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-dev.spec.js","sourceRoot":"","sources":["../src/component-dev.spec.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"component-dev.spec.js","sourceRoot":"","sources":["../src/component-dev.spec.ts"],"names":[],"mappings":";;;;;AAAA,kEAAoE;AACpE,mDAAyD;AACzD,0DAAkC;AAGlC,IAAI,CAAC,UAAU,CAAC,KAAM,CAAC,CAAC;AAExB,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAC1C,IAAI,MAAc,CAAC;QACnB,IAAI,OAA4C,CAAC;QACjD,SAAS,CAAC,KAAK,IAAI,EAAE;YACnB,MAAM,GAAG,IAAA,sCAAsB,EAAC,gCAAW,CAAC,sBAAsB,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YACnF,OAAO,GAAG,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,KAAK,IAAI,EAAE;YAClB,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6EAA6E,EAAE,KAAK,IAAI,EAAE;YAC3F,MAAM,QA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EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAC;YACxC,+BAAU,CAAC,MAAM,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;YACjD,QAAQ,CAAC,GAAG,EAAE;gBACZ,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComponentSetWebModel } from '@squiz/component-lib';
|
|
1
2
|
interface Config {
|
|
2
3
|
managementServiceUrl: string;
|
|
3
4
|
renderServiceUrl: string;
|
|
@@ -7,9 +8,12 @@ interface Config {
|
|
|
7
8
|
declare const configObj: Config;
|
|
8
9
|
export default configObj;
|
|
9
10
|
export declare const managementService: import("axios").AxiosInstance;
|
|
11
|
+
export declare const managementServiceRoot: import("axios").AxiosInstance;
|
|
10
12
|
export declare const renderService: import("axios").AxiosInstance;
|
|
11
13
|
export declare const ci_buildVersion: string;
|
|
12
14
|
export declare const ci_buildBranch: string;
|
|
13
15
|
export declare function getTestComponents(): string[];
|
|
14
16
|
export declare function createFile(filePath: string, sizeInMB: number): Promise<void>;
|
|
15
17
|
export declare function removeFile(filePath: string): void;
|
|
18
|
+
export declare function deleteComponentSet(webPath: string): Promise<void>;
|
|
19
|
+
export declare function addComponentSet(componentSet: ComponentSetWebModel): Promise<void>;
|
|
@@ -3,23 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.removeFile = exports.createFile = exports.getTestComponents = exports.ci_buildBranch = exports.ci_buildVersion = exports.renderService = exports.managementService = void 0;
|
|
6
|
+
exports.addComponentSet = exports.deleteComponentSet = exports.removeFile = exports.createFile = exports.getTestComponents = exports.ci_buildBranch = exports.ci_buildVersion = exports.renderService = exports.managementServiceRoot = exports.managementService = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
11
11
|
const crypto_1 = require("crypto");
|
|
12
|
-
const
|
|
12
|
+
const dx_common_lib_1 = require("@squiz/dx-common-lib");
|
|
13
13
|
const dotenv_1 = require("dotenv");
|
|
14
14
|
(0, dotenv_1.config)();
|
|
15
15
|
const configObj = {
|
|
16
|
-
managementServiceUrl: (0,
|
|
17
|
-
renderServiceUrl: (0,
|
|
18
|
-
ci_buildVersion: (0,
|
|
19
|
-
ci_buildBranch: (0,
|
|
16
|
+
managementServiceUrl: (0, dx_common_lib_1.parseEnvVarForVar)('COMPONENT_MANAGEMENT_SERVICE_URL').replace(/\/+$/, ''),
|
|
17
|
+
renderServiceUrl: (0, dx_common_lib_1.parseEnvVarForVar)('COMPONENT_RENDER_SERVICE_URL').replace(/\/+$/, ''),
|
|
18
|
+
ci_buildVersion: (0, dx_common_lib_1.parseEnvVarForVar)('CI_COMMIT_SHORT_SHA'),
|
|
19
|
+
ci_buildBranch: (0, dx_common_lib_1.parseEnvVarForVar)('CI_COMMIT_REF_NAME'),
|
|
20
20
|
};
|
|
21
21
|
exports.default = configObj;
|
|
22
22
|
exports.managementService = axios_1.default.create({
|
|
23
|
+
baseURL: configObj.managementServiceUrl + '/v1',
|
|
24
|
+
});
|
|
25
|
+
exports.managementServiceRoot = axios_1.default.create({
|
|
23
26
|
baseURL: configObj.managementServiceUrl,
|
|
24
27
|
});
|
|
25
28
|
exports.renderService = axios_1.default.create({
|
|
@@ -49,4 +52,22 @@ function removeFile(filePath) {
|
|
|
49
52
|
promises_1.default.unlink(filePath);
|
|
50
53
|
}
|
|
51
54
|
exports.removeFile = removeFile;
|
|
55
|
+
async function deleteComponentSet(webPath) {
|
|
56
|
+
try {
|
|
57
|
+
await exports.managementService.delete(`/component-set/${webPath}`);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
// no ops
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.deleteComponentSet = deleteComponentSet;
|
|
64
|
+
async function addComponentSet(componentSet) {
|
|
65
|
+
try {
|
|
66
|
+
await exports.managementService.post(`/component-set`, componentSet);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
//no ops
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.addComponentSet = addComponentSet;
|
|
52
73
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/integration-tests/helper.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AAExB,2DAA8B;AAC9B,mCAAqC;
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/integration-tests/helper.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AAExB,2DAA8B;AAC9B,mCAAqC;AAErC,wDAAyD;AACzD,mCAAgC;AAEhC,IAAA,eAAM,GAAE,CAAC;AAST,MAAM,SAAS,GAAW;IACxB,oBAAoB,EAAE,IAAA,iCAAiB,EAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAC/F,gBAAgB,EAAE,IAAA,iCAAiB,EAAC,8BAA8B,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IACvF,eAAe,EAAE,IAAA,iCAAiB,EAAC,qBAAqB,CAAC;IACzD,cAAc,EAAE,IAAA,iCAAiB,EAAC,oBAAoB,CAAC;CACxD,CAAC;AAEF,kBAAe,SAAS,C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HD,gCAGC;AAED,SAAgB,UAAU,CAAC,QAAgB;IACzC,kBAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC;AAFD,gCAEC;AAEM,KAAK,UAAU,kBAAkB,CAAC,OAAe;IACtD,IAAI;QACF,MAAM,yBAAiB,CAAC,MAAM,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAC;KAC7D;IAAC,OAAO,KAAK,EAAE;QACd,SAAS;KACV;AACH,CAAC;AAND,gDAMC;AAEM,KAAK,UAAU,eAAe,CAAC,YAAkC;IACtE,IAAI;QACF,MAAM,yBAAiB,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;KAC9D;IAAC,OAAO,KAAK,EAAE;QACd,QAAQ;KACT;AACH,CAAC;AAND,0CAMC"}
|
|
@@ -3,14 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const helper_1 = require("./helper");
|
|
4
4
|
describe('Verify latest services deployments', () => {
|
|
5
5
|
it('Should have latest Management API service', async () => {
|
|
6
|
-
const response = (await helper_1.
|
|
6
|
+
const response = (await helper_1.managementServiceRoot.get('/health')).data;
|
|
7
7
|
expect(response.buildVersion).toBe(helper_1.ci_buildVersion);
|
|
8
8
|
expect(response.buildBranch).toBe(helper_1.ci_buildBranch);
|
|
9
9
|
});
|
|
10
|
+
it('Should return 200 for Management API docs', async () => {
|
|
11
|
+
const req = await helper_1.managementService.get('/docs');
|
|
12
|
+
expect(req.status).toBe(200);
|
|
13
|
+
expect(req.headers['content-type']).toEqual('text/html; charset=utf-8');
|
|
14
|
+
});
|
|
15
|
+
it('Should return 200 for Management API docs.json', async () => {
|
|
16
|
+
const req = await helper_1.managementService.get('/docs.json');
|
|
17
|
+
expect(req.status).toBe(200);
|
|
18
|
+
expect(req.headers['content-type']).toEqual('application/json; charset=UTF-8');
|
|
19
|
+
});
|
|
10
20
|
it('Should have latest Render Runtime service', async () => {
|
|
11
21
|
const response = (await helper_1.renderService.get('/health')).data;
|
|
12
22
|
expect(response.buildVersion).toBe(helper_1.ci_buildVersion);
|
|
13
23
|
expect(response.buildBranch).toBe(helper_1.ci_buildBranch);
|
|
14
24
|
});
|
|
25
|
+
it('Should return 200 for Render Runtime API docs', async () => {
|
|
26
|
+
const req = await helper_1.renderService.get('/docs');
|
|
27
|
+
expect(req.status).toBe(200);
|
|
28
|
+
expect(req.headers['content-type']).toEqual('text/html; charset=utf-8');
|
|
29
|
+
});
|
|
30
|
+
it('Should return 200 for Render Runtime API docs.json', async () => {
|
|
31
|
+
const req = await helper_1.renderService.get('/docs.json');
|
|
32
|
+
expect(req.status).toBe(200);
|
|
33
|
+
expect(req.headers['content-type']).toEqual('application/json; charset=UTF-8');
|
|
34
|
+
});
|
|
15
35
|
});
|
|
16
36
|
//# sourceMappingURL=service-deployment.spec.js.map
|