@squiz/component-cli-lib 1.2.1-alpha.106 → 1.2.1-alpha.17
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/CHANGELOG.md +0 -730
- package/jest.config.ts +3 -8
- package/lib/index.d.ts +1 -2
- package/lib/index.js +79 -5
- package/lib/index.js.map +1 -1
- package/lib/{component-dev.spec.d.ts → test.d.ts} +0 -0
- package/lib/test.js +12 -0
- package/lib/test.js.map +1 -0
- package/lib/utils/zipDirectory.d.ts +1 -0
- package/lib/utils/zipDirectory.js +32 -0
- package/lib/utils/zipDirectory.js.map +1 -0
- package/package.json +16 -22
- package/src/index.ts +90 -2
- package/src/test.ts +9 -0
- package/src/utils/zipDirectory.ts +31 -0
- package/tsconfig.json +1 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/.gitlab-ci.yml +0 -118
- package/jest.integration.config.ts +0 -17
- package/lib/component-dev.d.ts +0 -13
- package/lib/component-dev.js +0 -40
- package/lib/component-dev.js.map +0 -1
- package/lib/component-dev.spec.js +0 -91
- package/lib/component-dev.spec.js.map +0 -1
- package/lib/integration-tests/__components__/big-package/manifest.json +0 -32
- package/lib/integration-tests/__components__/cmp-static-file-test/manifest.json +0 -36
- package/lib/integration-tests/__components__/invalid-manifest/manifest.json +0 -24
- package/lib/integration-tests/helper.d.ts +0 -18
- package/lib/integration-tests/helper.js +0 -70
- package/lib/integration-tests/helper.js.map +0 -1
- package/lib/integration-tests/service-deployment.spec.d.ts +0 -1
- package/lib/integration-tests/service-deployment.spec.js +0 -16
- package/lib/integration-tests/service-deployment.spec.js.map +0 -1
- package/lib/integration-tests/test-setup.d.ts +0 -0
- package/lib/integration-tests/test-setup.js +0 -3
- package/lib/integration-tests/test-setup.js.map +0 -1
- package/lib/integration-tests/upload-and-render-component.spec.d.ts +0 -1
- package/lib/integration-tests/upload-and-render-component.spec.js +0 -136
- package/lib/integration-tests/upload-and-render-component.spec.js.map +0 -1
- package/lib/upload-component-folder.d.ts +0 -3
- package/lib/upload-component-folder.js +0 -128
- package/lib/upload-component-folder.js.map +0 -1
- package/src/component-dev.spec.ts +0 -111
- package/src/component-dev.ts +0 -34
- package/src/integration-tests/__components__/big-package/manifest.json +0 -33
- package/src/integration-tests/__components__/big-package/render-json.js +0 -5
- package/src/integration-tests/__components__/cmp-static-file-test/main.js +0 -10
- package/src/integration-tests/__components__/cmp-static-file-test/manifest.json +0 -40
- package/src/integration-tests/__components__/cmp-static-file-test/public/static-library-file.js +0 -1
- package/src/integration-tests/__components__/invalid-manifest/main.js +0 -7
- package/src/integration-tests/__components__/invalid-manifest/manifest.json +0 -26
- package/src/integration-tests/__components__/invalid-upload/main.js +0 -7
- package/src/integration-tests/helper.ts +0 -75
- package/src/integration-tests/service-deployment.spec.ts +0 -21
- package/src/integration-tests/test-setup.ts +0 -1
- package/src/integration-tests/upload-and-render-component.spec.ts +0 -141
- package/src/upload-component-folder.ts +0 -137
package/.gitlab-ci.yml
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
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
|
-
- when: never
|
|
8
|
-
|
|
9
|
-
.rules:when-uat:
|
|
10
|
-
rules:
|
|
11
|
-
- if: $CI_COMMIT_REF_NAME == $TARGET_BRANCH_UAT && $CI_DEPLOY_TO_PROD == null
|
|
12
|
-
when: on_success
|
|
13
|
-
- when: never
|
|
14
|
-
|
|
15
|
-
.rules:when-development:
|
|
16
|
-
rules:
|
|
17
|
-
- if: $CI_COMMIT_REF_NAME == $TARGET_BRANCH_DEVELOPMENT && $CI_DEPLOY_TO_PROD == null
|
|
18
|
-
when: on_success
|
|
19
|
-
- when: never
|
|
20
|
-
|
|
21
|
-
.rules:when-other-branch:
|
|
22
|
-
rules:
|
|
23
|
-
- 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
|
|
24
|
-
when: on_success
|
|
25
|
-
- when: never
|
|
26
|
-
|
|
27
|
-
.get-service-urls:
|
|
28
|
-
stage: smoke-test-setup
|
|
29
|
-
image:
|
|
30
|
-
name: amazon/aws-cli
|
|
31
|
-
tags:
|
|
32
|
-
- access/aws-dx-nonprod
|
|
33
|
-
script:
|
|
34
|
-
- export
|
|
35
|
-
- echo "Configuring service URLs"
|
|
36
|
-
- |2
|
|
37
|
-
echo -n "Getting 'COMPONENT_MANAGEMENT_SERVICE_URL' from CloudFormation stack: 'dx-${DEPLOYMENT_LABEL}-cmp' output: 'managementServiceURL'... "
|
|
38
|
-
COMPONENT_MANAGEMENT_SERVICE_URL="$(aws --region $AWS_REGION cloudformation describe-stacks --stack-name dx-${DEPLOYMENT_LABEL}-cmp --max-items 1 --query "Stacks[].Outputs[?contains(OutputKey,'managementServiceURL')].OutputValue" --output text)"
|
|
39
|
-
[[ $COMPONENT_MANAGEMENT_SERVICE_URL ]] || {
|
|
40
|
-
echo "✘";
|
|
41
|
-
echo "COMPONENT_MANAGEMENT_SERVICE_URL is empty or unset";
|
|
42
|
-
exit 1;
|
|
43
|
-
}
|
|
44
|
-
echo "✔︎"
|
|
45
|
-
- |2
|
|
46
|
-
echo -n "Getting 'COMPONENT_RENDER_SERVICE_URL' from CloudFormation stack: 'dx-${DEPLOYMENT_LABEL}-cmp' output: 'renderServiceURL'... "
|
|
47
|
-
COMPONENT_RENDER_SERVICE_URL=$(aws --region $AWS_REGION cloudformation describe-stacks --stack-name dx-${DEPLOYMENT_LABEL}-cmp --max-items 1 --query "Stacks[].Outputs[?contains(OutputKey,'renderServiceURL')].OutputValue" --output text)
|
|
48
|
-
[[ $COMPONENT_RENDER_SERVICE_URL ]] || {
|
|
49
|
-
echo "✘";
|
|
50
|
-
echo "COMPONENT_RENDER_SERVICE_URL is empty or unset";
|
|
51
|
-
exit 1;
|
|
52
|
-
}
|
|
53
|
-
echo "✔︎"
|
|
54
|
-
- echo "COMPONENT_MANAGEMENT_SERVICE_URL=${COMPONENT_MANAGEMENT_SERVICE_URL}" >> dot.env
|
|
55
|
-
- echo "COMPONENT_RENDER_SERVICE_URL=${COMPONENT_RENDER_SERVICE_URL}" >> dot.env
|
|
56
|
-
- >2
|
|
57
|
-
echo "COMPONENT_MANAGEMENT_SERVICE_URL now has value: '${COMPONENT_MANAGEMENT_SERVICE_URL}'
|
|
58
|
-
and will be inherited by other jobs via \"dotenv\" artifact"
|
|
59
|
-
- >2
|
|
60
|
-
echo "COMPONENT_RENDER_SERVICE_URL now has value: '${COMPONENT_RENDER_SERVICE_URL}'
|
|
61
|
-
and will be inherited by other jobs via \"dotenv\" artifact"
|
|
62
|
-
artifacts:
|
|
63
|
-
reports:
|
|
64
|
-
dotenv: dot.env
|
|
65
|
-
|
|
66
|
-
smoke-test:
|
|
67
|
-
stage: smoke-test
|
|
68
|
-
tags:
|
|
69
|
-
- size/l
|
|
70
|
-
script:
|
|
71
|
-
- export
|
|
72
|
-
- npm ci
|
|
73
|
-
- npm run bootstrap -- --ci
|
|
74
|
-
- npm run clean
|
|
75
|
-
- npm run lint
|
|
76
|
-
- npm run format-code
|
|
77
|
-
- npm run compile
|
|
78
|
-
- cd packages/component-cli-lib
|
|
79
|
-
- npm run test:integration
|
|
80
|
-
retry:
|
|
81
|
-
max: 2
|
|
82
|
-
when:
|
|
83
|
-
- runner_system_failure
|
|
84
|
-
- stuck_or_timeout_failure
|
|
85
|
-
|
|
86
|
-
get-branch-service-urls:
|
|
87
|
-
extends:
|
|
88
|
-
- .rules:when-other-branch
|
|
89
|
-
- .get-service-urls
|
|
90
|
-
environment:
|
|
91
|
-
name: non-production-development
|
|
92
|
-
url: components.dev.dx.squiz.cloud
|
|
93
|
-
|
|
94
|
-
get-development-service-urls:
|
|
95
|
-
extends:
|
|
96
|
-
- .rules:when-development
|
|
97
|
-
- .get-service-urls
|
|
98
|
-
environment:
|
|
99
|
-
name: non-production-development
|
|
100
|
-
url: components.dev.dx.squiz.cloud
|
|
101
|
-
|
|
102
|
-
get-uat-service-urls:
|
|
103
|
-
extends:
|
|
104
|
-
- .rules:when-uat
|
|
105
|
-
- .get-service-urls
|
|
106
|
-
environment:
|
|
107
|
-
name: non-production-development
|
|
108
|
-
url: components.dev.dx.squiz.cloud
|
|
109
|
-
|
|
110
|
-
get-production-service-urls:
|
|
111
|
-
extends:
|
|
112
|
-
- .rules:when-production
|
|
113
|
-
- .get-service-urls
|
|
114
|
-
environment:
|
|
115
|
-
name: production
|
|
116
|
-
url: components.prod.dx.squiz.cloud
|
|
117
|
-
tags:
|
|
118
|
-
- access/aws-dx-prod
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Config } from 'jest';
|
|
2
|
-
|
|
3
|
-
// Sync object
|
|
4
|
-
const config: Config = {
|
|
5
|
-
preset: 'ts-jest',
|
|
6
|
-
testEnvironment: 'node',
|
|
7
|
-
testRegex: '/integration-tests/.*\\.spec\\.ts$',
|
|
8
|
-
setupFiles: ['./src/integration-tests/test-setup.ts'],
|
|
9
|
-
detectOpenHandles: true,
|
|
10
|
-
|
|
11
|
-
globals: {
|
|
12
|
-
BUILD_VERSION: 'undefined',
|
|
13
|
-
BUILD_BRANCH: 'undefined',
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default config;
|
package/lib/component-dev.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* startDevelopmentRender starts a dev-mode render stack for any
|
|
3
|
-
* local directory. This should start an express server on a random unused port
|
|
4
|
-
* which can be accessed for viewing the component in development.
|
|
5
|
-
*
|
|
6
|
-
* @param {string} componentPath - The directory with the component to be rendered
|
|
7
|
-
* @param {object} options - Additional configuration for the dev stack
|
|
8
|
-
* @returns a function to stop the render stack
|
|
9
|
-
*/
|
|
10
|
-
export declare function startDevelopmentRender(componentPath: string, options: {
|
|
11
|
-
port: number;
|
|
12
|
-
previewFile?: string;
|
|
13
|
-
}): Promise<() => Promise<void>>;
|
package/lib/component-dev.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
exports.startDevelopmentRender = void 0;
|
|
7
|
-
const render_runtime_lib_1 = require("@squiz/render-runtime-lib");
|
|
8
|
-
const dx_logger_lib_1 = require("@squiz/dx-logger-lib");
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
/**
|
|
11
|
-
* startDevelopmentRender starts a dev-mode render stack for any
|
|
12
|
-
* local directory. This should start an express server on a random unused port
|
|
13
|
-
* which can be accessed for viewing the component in development.
|
|
14
|
-
*
|
|
15
|
-
* @param {string} componentPath - The directory with the component to be rendered
|
|
16
|
-
* @param {object} options - Additional configuration for the dev stack
|
|
17
|
-
* @returns a function to stop the render stack
|
|
18
|
-
*/
|
|
19
|
-
async function startDevelopmentRender(componentPath, options) {
|
|
20
|
-
const logger = (0, dx_logger_lib_1.getLogger)({ name: 'component-dev', format: 'human' });
|
|
21
|
-
await (0, render_runtime_lib_1.startRenderStack)({
|
|
22
|
-
logger: logger,
|
|
23
|
-
webserver: {
|
|
24
|
-
port: options.port,
|
|
25
|
-
rootUrl: `http://localhost:${options.port}`,
|
|
26
|
-
shouldRunMigrations: false,
|
|
27
|
-
},
|
|
28
|
-
componentRunner: {
|
|
29
|
-
// Considering the component path will be passed in from CLI
|
|
30
|
-
// We need to generate the path from the calling directory
|
|
31
|
-
dataMountPoint: path_1.default.resolve(process.cwd(), componentPath),
|
|
32
|
-
localDevMode: true,
|
|
33
|
-
previewFile: options.previewFile,
|
|
34
|
-
workerTimeout: 20000,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
return () => (0, render_runtime_lib_1.stopRenderStack)();
|
|
38
|
-
}
|
|
39
|
-
exports.startDevelopmentRender = startDevelopmentRender;
|
|
40
|
-
//# sourceMappingURL=component-dev.js.map
|
package/lib/component-dev.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-dev.js","sourceRoot":"","sources":["../src/component-dev.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA8E;AAC9E,wDAAiD;AACjD,gDAAwB;AAExB;;;;;;;;GAQG;AACI,KAAK,UAAU,sBAAsB,CAAC,aAAqB,EAAE,OAA+C;IACjH,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACrE,MAAM,IAAA,qCAAgB,EAAC;QACrB,MAAM,EAAE,MAAM;QACd,SAAS,EAAE;YACT,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,oBAAoB,OAAO,CAAC,IAAI,EAAE;YAC3C,mBAAmB,EAAE,KAAK;SAC3B;QACD,eAAe,EAAE;YACf,4DAA4D;YAC5D,0DAA0D;YAC1D,cAAc,EAAE,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC;YAC1D,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,aAAa,EAAE,KAAM;SACtB;KACF,CAAC,CAAC;IAEH,OAAO,GAAG,EAAE,CAAC,IAAA,oCAAe,GAAE,CAAC;AACjC,CAAC;AApBD,wDAoBC"}
|
|
@@ -1,91 +0,0 @@
|
|
|
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 path_1 = __importDefault(require("path"));
|
|
7
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
-
const render_runtime_lib_1 = require("@squiz/render-runtime-lib");
|
|
9
|
-
const component_dev_1 = require("./component-dev");
|
|
10
|
-
const supertest_1 = __importDefault(require("supertest"));
|
|
11
|
-
jest.setTimeout(20000);
|
|
12
|
-
describe('component-dev', () => {
|
|
13
|
-
describe('production style folder structure', () => {
|
|
14
|
-
let doStopStack;
|
|
15
|
-
beforeAll(async () => {
|
|
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;
|
|
32
|
-
beforeAll(async () => {
|
|
33
|
-
const { fixtureDirectory: ceratedFixtureDirectory, version: createdVersion, componentName: createdName, } = await render_runtime_lib_1.TestHelpers.ComponentFixture.setupFullComponentDirectory('<h1>Hello World</h1>');
|
|
34
|
-
version = createdVersion;
|
|
35
|
-
fixtureDirectory = ceratedFixtureDirectory;
|
|
36
|
-
componentName = createdName;
|
|
37
|
-
doStopStack = await (0, component_dev_1.startDevelopmentRender)(fixtureDirectory, { port: 0 });
|
|
38
|
-
});
|
|
39
|
-
afterAll(async () => {
|
|
40
|
-
await doStopStack();
|
|
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');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('accessing local dev routes', () => {
|
|
55
|
-
let stopServer;
|
|
56
|
-
const port = 3006;
|
|
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,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
afterAll(async () => {
|
|
66
|
-
await stopServer();
|
|
67
|
-
});
|
|
68
|
-
describe('definition routes', () => {
|
|
69
|
-
render_runtime_lib_1.routeTests.definition(url, url);
|
|
70
|
-
});
|
|
71
|
-
describe('static routes', () => {
|
|
72
|
-
render_runtime_lib_1.routeTests.static(url);
|
|
73
|
-
});
|
|
74
|
-
describe('render routes', () => {
|
|
75
|
-
render_runtime_lib_1.routeTests.render(url, url);
|
|
76
|
-
});
|
|
77
|
-
describe('GET /r/set/test-component/1.0.1', () => {
|
|
78
|
-
//
|
|
79
|
-
// this scenario is different to the 'production' tests
|
|
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
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
//# sourceMappingURL=component-dev.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-dev.spec.js","sourceRoot":"","sources":["../src/component-dev.spec.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,2DAA8B;AAE9B,kEAAoE;AACpE,mDAAyD;AACzD,0DAAkC;AAElC,IAAI,CAAC,UAAU,CAAC,KAAM,CAAC,CAAC;AAExB,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;QACjD,IAAI,WAA+D,CAAC;QAEpE,SAAS,CAAC,KAAK,IAAI,EAAE;YACnB,WAAW,GAAG,MAAM,IAAA,sCAAsB,EAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5G,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,KAAK,IAAI,EAAE;YAClB,MAAM,WAAW,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;YACzC,MAAM,UAAU,GAAG,gCAAW,CAAC,aAAa,EAAE,CAAC;YAC/C,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;YACrF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;QAC7C,IAAI,WAA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+EAA+E,EAAE,KAAK,IAAI,EAAE;gBAC7F,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;gBAErF,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACzC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;oBAC5B,OAAO,EAAE,6BAA6B;iBACvC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://localhost:3000/schemas/v1.json#",
|
|
3
|
-
"name": "big-package",
|
|
4
|
-
"version": "1.0.2",
|
|
5
|
-
"main-function": "render-json",
|
|
6
|
-
"functions": [
|
|
7
|
-
{
|
|
8
|
-
"name": "render-json",
|
|
9
|
-
"entry": "render-json.js",
|
|
10
|
-
"input": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"properties": {
|
|
13
|
-
"something": {
|
|
14
|
-
"type": "string"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"required": ["something"]
|
|
18
|
-
},
|
|
19
|
-
"output": {
|
|
20
|
-
"response-type": "json",
|
|
21
|
-
"definition": {
|
|
22
|
-
"properties": {
|
|
23
|
-
"my-prop": {
|
|
24
|
-
"type": "string"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"required": ["my-prop"]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://localhost:3000/schemas/v1.json#",
|
|
3
|
-
"name": "cmp-static-file-test",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"main-function": "main",
|
|
6
|
-
"functions": [
|
|
7
|
-
{
|
|
8
|
-
"entry": "main.js",
|
|
9
|
-
"name": "main",
|
|
10
|
-
"input": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"properties": {
|
|
13
|
-
"something": {
|
|
14
|
-
"type": "string"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"required": ["something"]
|
|
18
|
-
},
|
|
19
|
-
"output": {
|
|
20
|
-
"response-type": "html",
|
|
21
|
-
"static-files": [
|
|
22
|
-
{
|
|
23
|
-
"location": "header",
|
|
24
|
-
"file": {
|
|
25
|
-
"filepath": "static-library-file.js",
|
|
26
|
-
"type": "js"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"static-files": {
|
|
34
|
-
"location-root": "public"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://localhost:3000/schemas/v1.json#",
|
|
3
|
-
"name": "invalid-manifes@t",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"main-function": "main",
|
|
6
|
-
"functions": [
|
|
7
|
-
{
|
|
8
|
-
"entry": "main.js",
|
|
9
|
-
"name": "main",
|
|
10
|
-
"input": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"properties": {
|
|
13
|
-
"something": {
|
|
14
|
-
"type": "string"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"required": ["something"]
|
|
18
|
-
},
|
|
19
|
-
"output": {
|
|
20
|
-
"response-type": "html"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ComponentSetWebModel } from '@squiz/component-lib';
|
|
2
|
-
interface Config {
|
|
3
|
-
managementServiceUrl: string;
|
|
4
|
-
renderServiceUrl: string;
|
|
5
|
-
ci_buildVersion: string;
|
|
6
|
-
ci_buildBranch: string;
|
|
7
|
-
}
|
|
8
|
-
declare const configObj: Config;
|
|
9
|
-
export default configObj;
|
|
10
|
-
export declare const managementService: import("axios").AxiosInstance;
|
|
11
|
-
export declare const renderService: import("axios").AxiosInstance;
|
|
12
|
-
export declare const ci_buildVersion: string;
|
|
13
|
-
export declare const ci_buildBranch: string;
|
|
14
|
-
export declare function getTestComponents(): string[];
|
|
15
|
-
export declare function createFile(filePath: string, sizeInMB: number): Promise<void>;
|
|
16
|
-
export declare function removeFile(filePath: string): void;
|
|
17
|
-
export declare function deleteComponentSet(webPath: string): Promise<void>;
|
|
18
|
-
export declare function addComponentSet(componentSet: ComponentSetWebModel): Promise<void>;
|
|
@@ -1,70 +0,0 @@
|
|
|
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
|
-
exports.addComponentSet = exports.deleteComponentSet = exports.removeFile = exports.createFile = exports.getTestComponents = exports.ci_buildBranch = exports.ci_buildVersion = exports.renderService = exports.managementService = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
11
|
-
const crypto_1 = require("crypto");
|
|
12
|
-
const dx_common_lib_1 = require("@squiz/dx-common-lib");
|
|
13
|
-
const dotenv_1 = require("dotenv");
|
|
14
|
-
(0, dotenv_1.config)();
|
|
15
|
-
const configObj = {
|
|
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
|
-
};
|
|
21
|
-
exports.default = configObj;
|
|
22
|
-
exports.managementService = axios_1.default.create({
|
|
23
|
-
baseURL: configObj.managementServiceUrl,
|
|
24
|
-
});
|
|
25
|
-
exports.renderService = axios_1.default.create({
|
|
26
|
-
baseURL: configObj.renderServiceUrl,
|
|
27
|
-
});
|
|
28
|
-
exports.ci_buildVersion = configObj.ci_buildVersion;
|
|
29
|
-
exports.ci_buildBranch = configObj.ci_buildBranch;
|
|
30
|
-
function getTestComponents() {
|
|
31
|
-
const componets = [];
|
|
32
|
-
const componentsDir = path_1.default.join(__dirname, '/__components__/');
|
|
33
|
-
const files = fs_1.default.readdirSync(componentsDir);
|
|
34
|
-
for (const file of files) {
|
|
35
|
-
const stat = fs_1.default.statSync(path_1.default.join(componentsDir, file));
|
|
36
|
-
if (stat.isDirectory() && file.substring(0, 4) === 'cmp-') {
|
|
37
|
-
componets.push(file);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return componets;
|
|
41
|
-
}
|
|
42
|
-
exports.getTestComponents = getTestComponents;
|
|
43
|
-
async function createFile(filePath, sizeInMB) {
|
|
44
|
-
const content = (0, crypto_1.randomBytes)(sizeInMB * 1000000);
|
|
45
|
-
await promises_1.default.writeFile(`${filePath}`, content);
|
|
46
|
-
}
|
|
47
|
-
exports.createFile = createFile;
|
|
48
|
-
function removeFile(filePath) {
|
|
49
|
-
promises_1.default.unlink(filePath);
|
|
50
|
-
}
|
|
51
|
-
exports.removeFile = removeFile;
|
|
52
|
-
async function deleteComponentSet(webPath) {
|
|
53
|
-
try {
|
|
54
|
-
await exports.managementService.delete(`/component-set/${webPath}`);
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
// no ops
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.deleteComponentSet = deleteComponentSet;
|
|
61
|
-
async function addComponentSet(componentSet) {
|
|
62
|
-
try {
|
|
63
|
-
await exports.managementService.post(`/component-set`, componentSet);
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
//no ops
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.addComponentSet = addComponentSet;
|
|
70
|
-
//# sourceMappingURL=helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAC;AAEZ,QAAA,iBAAiB,GAAG,eAAK,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,SAAS,CAAC,oBAAoB;CACxC,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,eAAK,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,SAAS,CAAC,gBAAgB;CACpC,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC;AAC5C,QAAA,cAAc,GAAG,SAAS,CAAC,cAAc,CAAC;AAEvD,SAAgB,iBAAiB;IAC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,QAAQ;KACT;AACH,CAAC;AAND,0CAMC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const helper_1 = require("./helper");
|
|
4
|
-
describe('Verify latest services deployments', () => {
|
|
5
|
-
it('Should have latest Management API service', async () => {
|
|
6
|
-
const response = (await helper_1.managementService.get('/health')).data;
|
|
7
|
-
expect(response.buildVersion).toBe(helper_1.ci_buildVersion);
|
|
8
|
-
expect(response.buildBranch).toBe(helper_1.ci_buildBranch);
|
|
9
|
-
});
|
|
10
|
-
it('Should have latest Render Runtime service', async () => {
|
|
11
|
-
const response = (await helper_1.renderService.get('/health')).data;
|
|
12
|
-
expect(response.buildVersion).toBe(helper_1.ci_buildVersion);
|
|
13
|
-
expect(response.buildBranch).toBe(helper_1.ci_buildBranch);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=service-deployment.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-deployment.spec.js","sourceRoot":"","sources":["../../src/integration-tests/service-deployment.spec.ts"],"names":[],"mappings":";;AAAA,qCAA6F;AAQ7F,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAClD,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,QAAQ,GAAe,CAAC,MAAM,0BAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3E,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,wBAAe,CAAC,CAAC;QACpD,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,uBAAc,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,QAAQ,GAAe,CAAC,MAAM,sBAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QACvE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,wBAAe,CAAC,CAAC;QACpD,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,uBAAc,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-setup.js","sourceRoot":"","sources":["../../src/integration-tests/test-setup.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,UAAU,CAAC,KAAM,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|