@squiz/component-cli-lib 1.2.1-alpha.100

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.
Files changed (50) hide show
  1. package/.gitlab-ci.yml +113 -0
  2. package/CHANGELOG.md +690 -0
  3. package/jest.config.ts +16 -0
  4. package/jest.integration.config.ts +17 -0
  5. package/lib/component-dev.d.ts +13 -0
  6. package/lib/component-dev.js +40 -0
  7. package/lib/component-dev.js.map +1 -0
  8. package/lib/component-dev.spec.d.ts +1 -0
  9. package/lib/component-dev.spec.js +91 -0
  10. package/lib/component-dev.spec.js.map +1 -0
  11. package/lib/index.d.ts +2 -0
  12. package/lib/index.js +8 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/integration-tests/__components__/big-package/manifest.json +32 -0
  15. package/lib/integration-tests/__components__/cmp-static-file-test/manifest.json +36 -0
  16. package/lib/integration-tests/__components__/invalid-manifest/manifest.json +24 -0
  17. package/lib/integration-tests/helper.d.ts +18 -0
  18. package/lib/integration-tests/helper.js +70 -0
  19. package/lib/integration-tests/helper.js.map +1 -0
  20. package/lib/integration-tests/service-deployment.spec.d.ts +1 -0
  21. package/lib/integration-tests/service-deployment.spec.js +16 -0
  22. package/lib/integration-tests/service-deployment.spec.js.map +1 -0
  23. package/lib/integration-tests/test-setup.d.ts +0 -0
  24. package/lib/integration-tests/test-setup.js +3 -0
  25. package/lib/integration-tests/test-setup.js.map +1 -0
  26. package/lib/integration-tests/upload-and-render-component.spec.d.ts +1 -0
  27. package/lib/integration-tests/upload-and-render-component.spec.js +135 -0
  28. package/lib/integration-tests/upload-and-render-component.spec.js.map +1 -0
  29. package/lib/upload-component-folder.d.ts +3 -0
  30. package/lib/upload-component-folder.js +127 -0
  31. package/lib/upload-component-folder.js.map +1 -0
  32. package/package.json +41 -0
  33. package/src/component-dev.spec.ts +111 -0
  34. package/src/component-dev.ts +34 -0
  35. package/src/index.ts +2 -0
  36. package/src/integration-tests/__components__/big-package/manifest.json +33 -0
  37. package/src/integration-tests/__components__/big-package/render-json.js +5 -0
  38. package/src/integration-tests/__components__/cmp-static-file-test/main.js +10 -0
  39. package/src/integration-tests/__components__/cmp-static-file-test/manifest.json +40 -0
  40. package/src/integration-tests/__components__/cmp-static-file-test/public/static-library-file.js +1 -0
  41. package/src/integration-tests/__components__/invalid-manifest/main.js +7 -0
  42. package/src/integration-tests/__components__/invalid-manifest/manifest.json +26 -0
  43. package/src/integration-tests/__components__/invalid-upload/main.js +7 -0
  44. package/src/integration-tests/helper.ts +74 -0
  45. package/src/integration-tests/service-deployment.spec.ts +21 -0
  46. package/src/integration-tests/test-setup.ts +1 -0
  47. package/src/integration-tests/upload-and-render-component.spec.ts +137 -0
  48. package/src/upload-component-folder.ts +136 -0
  49. package/tsconfig.json +21 -0
  50. package/tsconfig.tsbuildinfo +1 -0
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,113 @@
1
+ ---
2
+ # uat target branch only.
3
+ .rules:when-uat:
4
+ rules:
5
+ - if: $CI_COMMIT_REF_NAME == $TARGET_BRANCH_UAT
6
+ when: on_success
7
+ - when: never
8
+
9
+ .rules:when-development:
10
+ rules:
11
+ - if: $CI_COMMIT_REF_NAME == $TARGET_BRANCH_DEVELOPMENT
12
+ when: on_success
13
+ - when: never
14
+
15
+ .rules:when-other-branch:
16
+ rules:
17
+ - if: $CI_COMMIT_REF_NAME != $TARGET_BRANCH_DEVELOPMENT && $CI_COMMIT_REF_NAME != $TARGET_BRANCH_UAT
18
+ when: on_success
19
+ - when: never
20
+
21
+ .get-service-urls:
22
+ stage: smoke-test-setup
23
+ image:
24
+ name: amazon/aws-cli
25
+ tags:
26
+ - access/aws-dx-nonprod
27
+ script:
28
+ - export
29
+ - echo "Configuring service URLs"
30
+ - |2
31
+ echo -n "Getting 'COMPONENT_MANAGEMENT_SERVICE_URL' from CloudFormation stack: 'dx-${DEPLOYMENT_LABEL}-cmp' output: 'managementServiceURL'... "
32
+ 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)"
33
+ [[ $COMPONENT_MANAGEMENT_SERVICE_URL ]] || {
34
+ echo "✘";
35
+ echo "COMPONENT_MANAGEMENT_SERVICE_URL is empty or unset";
36
+ exit 1;
37
+ }
38
+ echo "✔︎"
39
+ - |2
40
+ echo -n "Getting 'COMPONENT_RENDER_SERVICE_URL' from CloudFormation stack: 'dx-${DEPLOYMENT_LABEL}-cmp' output: 'renderServiceURL'... "
41
+ 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)
42
+ [[ $COMPONENT_RENDER_SERVICE_URL ]] || {
43
+ echo "✘";
44
+ echo "COMPONENT_RENDER_SERVICE_URL is empty or unset";
45
+ exit 1;
46
+ }
47
+ echo "✔︎"
48
+ - echo "COMPONENT_MANAGEMENT_SERVICE_URL=${COMPONENT_MANAGEMENT_SERVICE_URL}" >> dot.env
49
+ - echo "COMPONENT_RENDER_SERVICE_URL=${COMPONENT_RENDER_SERVICE_URL}" >> dot.env
50
+ - >2
51
+ echo "COMPONENT_MANAGEMENT_SERVICE_URL now has value: '${COMPONENT_MANAGEMENT_SERVICE_URL}'
52
+ and will be inherited by other jobs via \"dotenv\" artifact"
53
+ - >2
54
+ echo "COMPONENT_RENDER_SERVICE_URL now has value: '${COMPONENT_RENDER_SERVICE_URL}'
55
+ and will be inherited by other jobs via \"dotenv\" artifact"
56
+ artifacts:
57
+ reports:
58
+ dotenv: dot.env
59
+
60
+ smoke-test:
61
+ stage: smoke-test
62
+ tags:
63
+ - size/l
64
+ script:
65
+ - export
66
+ - npm i
67
+ - npm run bootstrap
68
+ - npm run clean
69
+ - npm run lint
70
+ - npm run format-code
71
+ - npm run compile
72
+ - cd packages/component-cli-lib
73
+ - npm run test:integration
74
+ retry:
75
+ max: 2
76
+ when:
77
+ - runner_system_failure
78
+ - stuck_or_timeout_failure
79
+
80
+ get-branch-service-urls:
81
+ extends:
82
+ - .rules:when-other-branch
83
+ - .get-service-urls
84
+ environment:
85
+ name: non-production-development
86
+ url: components.dev.dx.squiz.cloud
87
+
88
+ get-development-service-urls:
89
+ extends:
90
+ - .rules:when-development
91
+ - .get-service-urls
92
+ environment:
93
+ name: non-production-development
94
+ url: components.dev.dx.squiz.cloud
95
+
96
+ get-uat-service-urls:
97
+ extends:
98
+ - .rules:when-uat
99
+ - .get-service-urls
100
+ environment:
101
+ name: non-production-development
102
+ 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