@aws-cdk-testing/cli-integ 0.0.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.
Files changed (257) hide show
  1. package/.eslintrc.js +9 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +16 -0
  4. package/README.md +205 -0
  5. package/bin/apply-patches +22 -0
  6. package/bin/download-and-run-old-tests +52 -0
  7. package/bin/query-github +2 -0
  8. package/bin/query-github.d.ts +1 -0
  9. package/bin/query-github.js +54 -0
  10. package/bin/query-github.ts +56 -0
  11. package/bin/run-suite +2 -0
  12. package/bin/run-suite.d.ts +1 -0
  13. package/bin/run-suite.js +131 -0
  14. package/bin/run-suite.ts +140 -0
  15. package/bin/stage-distribution +2 -0
  16. package/bin/stage-distribution.d.ts +1 -0
  17. package/bin/stage-distribution.js +217 -0
  18. package/bin/stage-distribution.ts +267 -0
  19. package/bin/test-root +2 -0
  20. package/bin/test-root.d.ts +1 -0
  21. package/bin/test-root.js +6 -0
  22. package/bin/test-root.ts +3 -0
  23. package/entrypoints/test-cli-regression-against-current-code.sh +11 -0
  24. package/entrypoints/test-cli-regression-against-latest-release.sh +11 -0
  25. package/entrypoints/test-cli-regression.bash +83 -0
  26. package/entrypoints/test.sh +12 -0
  27. package/lib/aws.d.ts +51 -0
  28. package/lib/aws.js +206 -0
  29. package/lib/aws.ts +263 -0
  30. package/lib/corking.d.ts +12 -0
  31. package/lib/corking.js +35 -0
  32. package/lib/corking.ts +33 -0
  33. package/lib/eventually.d.ts +20 -0
  34. package/lib/eventually.js +34 -0
  35. package/lib/eventually.ts +42 -0
  36. package/lib/files.d.ts +15 -0
  37. package/lib/files.js +80 -0
  38. package/lib/files.ts +80 -0
  39. package/lib/github.d.ts +4 -0
  40. package/lib/github.js +43 -0
  41. package/lib/github.ts +43 -0
  42. package/lib/index.d.ts +13 -0
  43. package/lib/index.js +30 -0
  44. package/lib/index.ts +13 -0
  45. package/lib/integ-test.d.ts +10 -0
  46. package/lib/integ-test.js +70 -0
  47. package/lib/integ-test.ts +81 -0
  48. package/lib/lists.d.ts +1 -0
  49. package/lib/lists.js +11 -0
  50. package/lib/lists.ts +9 -0
  51. package/lib/memoize.d.ts +6 -0
  52. package/lib/memoize.js +18 -0
  53. package/lib/memoize.ts +14 -0
  54. package/lib/npm.d.ts +8 -0
  55. package/lib/npm.js +38 -0
  56. package/lib/npm.ts +41 -0
  57. package/lib/package-sources/release-source.d.ts +23 -0
  58. package/lib/package-sources/release-source.js +71 -0
  59. package/lib/package-sources/release-source.ts +81 -0
  60. package/lib/package-sources/repo-source.d.ts +30 -0
  61. package/lib/package-sources/repo-source.js +97 -0
  62. package/lib/package-sources/repo-source.ts +111 -0
  63. package/lib/package-sources/repo-tools/npm +2 -0
  64. package/lib/package-sources/repo-tools/npm.d.ts +1 -0
  65. package/lib/package-sources/repo-tools/npm.js +43 -0
  66. package/lib/package-sources/repo-tools/npm.ts +48 -0
  67. package/lib/package-sources/source.d.ts +28 -0
  68. package/lib/package-sources/source.js +3 -0
  69. package/lib/package-sources/source.ts +35 -0
  70. package/lib/package-sources/subprocess.d.ts +3 -0
  71. package/lib/package-sources/subprocess.js +17 -0
  72. package/lib/package-sources/subprocess.ts +15 -0
  73. package/lib/resource-pool.d.ts +50 -0
  74. package/lib/resource-pool.js +117 -0
  75. package/lib/resource-pool.ts +140 -0
  76. package/lib/resources.d.ts +1 -0
  77. package/lib/resources.js +6 -0
  78. package/lib/resources.ts +4 -0
  79. package/lib/shell.d.ts +56 -0
  80. package/lib/shell.js +123 -0
  81. package/lib/shell.ts +168 -0
  82. package/lib/staging/codeartifact.d.ts +44 -0
  83. package/lib/staging/codeartifact.js +281 -0
  84. package/lib/staging/codeartifact.ts +387 -0
  85. package/lib/staging/maven.d.ts +5 -0
  86. package/lib/staging/maven.js +91 -0
  87. package/lib/staging/maven.ts +95 -0
  88. package/lib/staging/npm.d.ts +4 -0
  89. package/lib/staging/npm.js +55 -0
  90. package/lib/staging/npm.ts +62 -0
  91. package/lib/staging/nuget.d.ts +4 -0
  92. package/lib/staging/nuget.js +69 -0
  93. package/lib/staging/nuget.ts +75 -0
  94. package/lib/staging/parallel-shell.d.ts +5 -0
  95. package/lib/staging/parallel-shell.js +45 -0
  96. package/lib/staging/parallel-shell.ts +51 -0
  97. package/lib/staging/pypi.d.ts +4 -0
  98. package/lib/staging/pypi.js +48 -0
  99. package/lib/staging/pypi.ts +50 -0
  100. package/lib/staging/usage-dir.d.ts +31 -0
  101. package/lib/staging/usage-dir.js +87 -0
  102. package/lib/staging/usage-dir.ts +99 -0
  103. package/lib/with-aws.d.ts +14 -0
  104. package/lib/with-aws.js +60 -0
  105. package/lib/with-aws.ts +67 -0
  106. package/lib/with-cdk-app.d.ts +210 -0
  107. package/lib/with-cdk-app.js +539 -0
  108. package/lib/with-cdk-app.ts +742 -0
  109. package/lib/with-cli-lib.d.ts +17 -0
  110. package/lib/with-cli-lib.js +123 -0
  111. package/lib/with-cli-lib.ts +134 -0
  112. package/lib/with-packages.d.ts +5 -0
  113. package/lib/with-packages.js +13 -0
  114. package/lib/with-packages.ts +15 -0
  115. package/lib/with-sam.d.ts +33 -0
  116. package/lib/with-sam.js +258 -0
  117. package/lib/with-sam.ts +288 -0
  118. package/lib/with-temporary-directory.d.ts +5 -0
  119. package/lib/with-temporary-directory.js +31 -0
  120. package/lib/with-temporary-directory.ts +35 -0
  121. package/lib/with-timeout.d.ts +19 -0
  122. package/lib/with-timeout.js +34 -0
  123. package/lib/with-timeout.ts +33 -0
  124. package/lib/xpmutex.d.ts +43 -0
  125. package/lib/xpmutex.js +207 -0
  126. package/lib/xpmutex.ts +218 -0
  127. package/package.json +111 -0
  128. package/resources/bootstrap-templates/session-tags.all-roles-deny-all.yaml +703 -0
  129. package/resources/bootstrap-templates/session-tags.deploy-role-deny-sqs.yaml +700 -0
  130. package/resources/cdk-apps/app/app.js +926 -0
  131. package/resources/cdk-apps/app/appsync.hotswap.graphql +3 -0
  132. package/resources/cdk-apps/app/cdk.json +7 -0
  133. package/resources/cdk-apps/app/docker/Dockerfile +2 -0
  134. package/resources/cdk-apps/app/docker/Dockerfile.Custom +2 -0
  135. package/resources/cdk-apps/app/lambda/index.js +4 -0
  136. package/resources/cdk-apps/app/lambda/response.json +3 -0
  137. package/resources/cdk-apps/app/nested-stack.js +65 -0
  138. package/resources/cdk-apps/cfn-include-app/cdk.json +4 -0
  139. package/resources/cdk-apps/cfn-include-app/cfn-include-app.js +21 -0
  140. package/resources/cdk-apps/cfn-include-app/example-template.json +13 -0
  141. package/resources/cdk-apps/rollback-test-app/app.js +110 -0
  142. package/resources/cdk-apps/rollback-test-app/cdk.json +7 -0
  143. package/resources/cdk-apps/sam_cdk_integ_app/bin/test-app.js +11 -0
  144. package/resources/cdk-apps/sam_cdk_integ_app/cdk.json +6 -0
  145. package/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +19 -0
  146. package/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +134 -0
  147. package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/.no-packagejson-validator +0 -0
  148. package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/Dockerfile +9 -0
  149. package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/app.js +22 -0
  150. package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/package.json +18 -0
  151. package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/go.mod +5 -0
  152. package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/go.sum +17 -0
  153. package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/main.go +17 -0
  154. package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/.no-packagejson-validator +0 -0
  155. package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/app.ts +16 -0
  156. package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/package-lock.json +12 -0
  157. package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/package.json +5 -0
  158. package/resources/cdk-apps/sam_cdk_integ_app/src/python/Function/app.py +15 -0
  159. package/resources/cdk-apps/sam_cdk_integ_app/src/python/Function/requirements.txt +1 -0
  160. package/resources/cdk-apps/sam_cdk_integ_app/src/python/Layer/layer_version_dependency.py +5 -0
  161. package/resources/cdk-apps/sam_cdk_integ_app/src/python/Layer/requirements.txt +1 -0
  162. package/resources/cdk-apps/sam_cdk_integ_app/src/rest-api-definition.yaml +12 -0
  163. package/resources/cdk-apps/simple-app/app.js +26 -0
  164. package/resources/cdk-apps/simple-app/cdk.json +7 -0
  165. package/resources/cli-regression-patches/v1.119.0/NOTES.md +5 -0
  166. package/resources/cli-regression-patches/v1.119.0/cli.integtest.js +659 -0
  167. package/resources/cli-regression-patches/v1.130.0/NOTES.md +12 -0
  168. package/resources/cli-regression-patches/v1.130.0/app/app.js +378 -0
  169. package/resources/cli-regression-patches/v1.130.0/bootstrapping.integtest.js +220 -0
  170. package/resources/cli-regression-patches/v1.44.0/NOTES.md +18 -0
  171. package/resources/cli-regression-patches/v1.44.0/bootstrapping.integtest.js +126 -0
  172. package/resources/cli-regression-patches/v1.44.0/test.sh +26 -0
  173. package/resources/cli-regression-patches/v1.61.1/NOTES.md +2 -0
  174. package/resources/cli-regression-patches/v1.61.1/skip-tests.txt +16 -0
  175. package/resources/cli-regression-patches/v1.62.0/NOTES.md +2 -0
  176. package/resources/cli-regression-patches/v1.62.0/aws-helpers.js +245 -0
  177. package/resources/cli-regression-patches/v1.63.0/NOTES.md +1 -0
  178. package/resources/cli-regression-patches/v1.63.0/skip-tests.txt +7 -0
  179. package/resources/cli-regression-patches/v1.64.0/NOTES.md +3 -0
  180. package/resources/cli-regression-patches/v1.64.0/cdk-helpers.js +325 -0
  181. package/resources/cli-regression-patches/v1.64.0/cli.integtest.js +599 -0
  182. package/resources/cli-regression-patches/v1.64.1/NOTES.md +3 -0
  183. package/resources/cli-regression-patches/v1.64.1/cdk-helpers.js +324 -0
  184. package/resources/cli-regression-patches/v1.64.1/cli.integtest.js +599 -0
  185. package/resources/cli-regression-patches/v1.67.0/NOTES.md +2 -0
  186. package/resources/cli-regression-patches/v1.67.0/cdk-helpers.js +331 -0
  187. package/resources/cli-regression-patches/v2.130.0/NOTES.md +1 -0
  188. package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +19 -0
  189. package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +134 -0
  190. package/resources/cli-regression-patches/v2.130.0/skip-tests.txt +5 -0
  191. package/resources/cli-regression-patches/v2.132.0/NOTES.md +1 -0
  192. package/resources/cli-regression-patches/v2.132.0/skip-tests.txt +4 -0
  193. package/resources/cli-regression-patches/v2.142.0/NOTES.md +1 -0
  194. package/resources/cli-regression-patches/v2.142.0/skip-tests.txt +4 -0
  195. package/resources/cli-regression-patches/v2.160.0/skip-tests.txt +2 -0
  196. package/resources/cli-regression-patches/v2.161.0/NOTES.md +1 -0
  197. package/resources/cli-regression-patches/v2.161.0/skip-tests.txt +5 -0
  198. package/resources/cli-regression-patches/v2.166.0/NOTES.md +1 -0
  199. package/resources/cli-regression-patches/v2.166.0/skip-tests.txt +2 -0
  200. package/resources/cloud-assemblies/0.36.0/InitStack.template.json +1 -0
  201. package/resources/cloud-assemblies/0.36.0/cdk.out +1 -0
  202. package/resources/cloud-assemblies/0.36.0/manifest.json +19 -0
  203. package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/InitStack.template.json +2 -0
  204. package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/cdk.out +1 -0
  205. package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/manifest.json.js +37 -0
  206. package/resources/cloud-assemblies/1.10.0-request-azs/InitStack.template.json +2 -0
  207. package/resources/cloud-assemblies/1.10.0-request-azs/cdk.out +1 -0
  208. package/resources/cloud-assemblies/1.10.0-request-azs/manifest.json.js +34 -0
  209. package/resources/integ.jest.config.js +25 -0
  210. package/resources/templates/sqs-template.json +36 -0
  211. package/skip-tests.txt +8 -0
  212. package/tests/cli-integ-tests/README.md +47 -0
  213. package/tests/cli-integ-tests/bootstrapping.integtest.d.ts +1 -0
  214. package/tests/cli-integ-tests/bootstrapping.integtest.js +412 -0
  215. package/tests/cli-integ-tests/bootstrapping.integtest.ts +493 -0
  216. package/tests/cli-integ-tests/cli-lib.integtest.d.ts +1 -0
  217. package/tests/cli-integ-tests/cli-lib.integtest.js +62 -0
  218. package/tests/cli-integ-tests/cli-lib.integtest.ts +90 -0
  219. package/tests/cli-integ-tests/cli.integtest.d.ts +1 -0
  220. package/tests/cli-integ-tests/cli.integtest.js +2104 -0
  221. package/tests/cli-integ-tests/cli.integtest.ts +2874 -0
  222. package/tests/cli-integ-tests/garbage-collection.integtest.d.ts +1 -0
  223. package/tests/cli-integ-tests/garbage-collection.integtest.js +314 -0
  224. package/tests/cli-integ-tests/garbage-collection.integtest.ts +392 -0
  225. package/tests/init-csharp/init-csharp.integtest.d.ts +1 -0
  226. package/tests/init-csharp/init-csharp.integtest.js +14 -0
  227. package/tests/init-csharp/init-csharp.integtest.ts +15 -0
  228. package/tests/init-fsharp/init-fsharp.integtest.d.ts +1 -0
  229. package/tests/init-fsharp/init-fsharp.integtest.js +14 -0
  230. package/tests/init-fsharp/init-fsharp.integtest.ts +15 -0
  231. package/tests/init-go/init-go.integtest.d.ts +1 -0
  232. package/tests/init-go/init-go.integtest.js +21 -0
  233. package/tests/init-go/init-go.integtest.ts +23 -0
  234. package/tests/init-java/init-java.integtest.d.ts +1 -0
  235. package/tests/init-java/init-java.integtest.js +14 -0
  236. package/tests/init-java/init-java.integtest.ts +14 -0
  237. package/tests/init-javascript/init-javascript.integtest.d.ts +1 -0
  238. package/tests/init-javascript/init-javascript.integtest.js +53 -0
  239. package/tests/init-javascript/init-javascript.integtest.ts +59 -0
  240. package/tests/init-python/init-python.integtest.d.ts +1 -0
  241. package/tests/init-python/init-python.integtest.js +19 -0
  242. package/tests/init-python/init-python.integtest.ts +20 -0
  243. package/tests/init-typescript-app/init-typescript-app.integtest.d.ts +1 -0
  244. package/tests/init-typescript-app/init-typescript-app.integtest.js +54 -0
  245. package/tests/init-typescript-app/init-typescript-app.integtest.ts +66 -0
  246. package/tests/init-typescript-lib/init-typescript-lib.integtest.d.ts +1 -0
  247. package/tests/init-typescript-lib/init-typescript-lib.integtest.js +13 -0
  248. package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +13 -0
  249. package/tests/tool-integrations/amplify.integtest.d.ts +1 -0
  250. package/tests/tool-integrations/amplify.integtest.js +39 -0
  251. package/tests/tool-integrations/amplify.integtest.ts +43 -0
  252. package/tests/tool-integrations/with-tool-context.d.ts +9 -0
  253. package/tests/tool-integrations/with-tool-context.js +13 -0
  254. package/tests/tool-integrations/with-tool-context.ts +14 -0
  255. package/tests/uberpackage/uberpackage.integtest.d.ts +1 -0
  256. package/tests/uberpackage/uberpackage.integtest.js +11 -0
  257. package/tests/uberpackage/uberpackage.integtest.ts +11 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,9 @@
1
+ var path = require('path');
2
+ var fs = require('fs');
3
+ var contents = fs.readFileSync(`${__dirname}/.eslintrc.json`, { encoding: 'utf-8' });
4
+ // Strip comments, JSON.parse() doesn't like those
5
+ contents = contents.replace(/^\/\/.*$/m, '');
6
+ var json = JSON.parse(contents);
7
+ // Patch the .json config with something that can only be represented in JS
8
+ json.parserOptions.tsconfigRootDir = __dirname;
9
+ module.exports = json;
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,16 @@
1
+ AWS Cloud Development Kit (AWS CDK)
2
+ Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ Third party attributions of this package can be found in the THIRD_PARTY_LICENSES file
package/README.md ADDED
@@ -0,0 +1,205 @@
1
+ # CDK CLI integration test
2
+ <!--BEGIN STABILITY BANNER-->
3
+
4
+ ---
5
+
6
+ ![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)
7
+
8
+ ---
9
+
10
+ <!--END STABILITY BANNER-->
11
+
12
+ This package contains CDK CLI integration test suites, as well as helper tools necessary to run those suites against various different distributions of the CDK (in the source repository, against a build directory, or against published releases).
13
+
14
+ > The tools and tests themselves should arguably be in different packages, but I want to prevent package proliferation. For now we'll keep them together.
15
+
16
+ ## Tests
17
+
18
+ The tests themselves are in the `tests/` directory:
19
+
20
+ ```text
21
+ tests/
22
+ ├── cli-integ-tests
23
+ ├── init-csharp
24
+ ├── init-fsharp
25
+ ├── init-java
26
+ ├── init-javascript
27
+ ├── init-python
28
+ ├── init-typescript-app
29
+ ├── init-typescript-lib
30
+ ├── init-go
31
+ └── uberpackage
32
+ ```
33
+
34
+ Each subdirectory contains one test **suite**, and in the development pipeline each suite is run individually in a CodeBuild job, all in parallel. This requires manual configuration in the pipeline: to add a new suite, first add a suite here, then add the suite to the pipeline as well. The safest strategy is to add a trivially succeeding suite first (for example, a single test with `expect(true).toBeTruthy()`), add it to the pipeline, and then write the actual tests.
35
+
36
+ Test suites are written as a collection of Jest tests, and they are run using Jest, using the code in the `lib/` directory as helpers.
37
+
38
+ ### Setup
39
+
40
+ Building the @aws-cdk-testing package is not very different from building the rest of the CDK. However, If you are having issues with the tests, you can ensure your environment is built properly by following the steps below:
41
+
42
+ ```shell
43
+ yarn install # Install dependencies
44
+ npx lerna run build --scope=aws-cdk # Build the CDK cli
45
+ yarn build # Build the @aws-cdk-testing/cli-integ package
46
+ ../../../scripts/align-version.sh # Align the versions of CDK packages
47
+ ```
48
+
49
+ ### Running tests with debugger
50
+
51
+ ```json
52
+ {
53
+ "version": "0.2.0",
54
+ "configurations": [
55
+ {
56
+ "type": "node",
57
+ "request": "launch",
58
+ "args": ["-a", "cli-integ-tests", "-t", "context in stage propagates to top"],
59
+ "name": "debug integ tests",
60
+ "program": "~/aws-cdk/packages/@aws-cdk-testing/cli-integ/bin/run-suite",
61
+ "console": "integratedTerminal",
62
+ "sourceMaps": true,
63
+ "skipFiles": [ "<node_internals>/**/*" ],
64
+ "stopOnEntry": false
65
+ }
66
+ ]
67
+ }
68
+ ```
69
+
70
+ 1. Assuming you checked out the `aws-cdk` repository in your `~` directory, use the above `launch.json`.
71
+ 2. In the `"args"` value after `"-t"`, place the name of the test that you'd like to run.
72
+ 3. Press the VS code green arrow to launch the debugger.
73
+
74
+ ### Running a test suite
75
+
76
+ You run a suite using the `bin/run-suite` tool. You must select either a version of the CLI and framework which can be `npm install`ed, or point to the root of the source tree:
77
+
78
+ ```shell
79
+ # Use the given source tree
80
+ $ bin/run-suite --use-source=/path/to/repo-root <SUITE_NAME>
81
+
82
+ # Automatically determine the source tree root
83
+ $ bin/run-suite -a <SUITE_NAME>
84
+
85
+ # Run against a released version
86
+ $ bin/run-suite --use-cli-release=2.34.5 <SUITE_NAME>
87
+ ```
88
+
89
+ To run a specific test, add `-t` and a substring of the test name. For example:
90
+
91
+ ```shell
92
+ bin/run-suite -a cli-integ-tests -t 'load old assemblies'
93
+ ```
94
+
95
+ ### Running a test suite against binaries
96
+
97
+ Some test suites require package binaries stages in CodeArtifact repositories to run. This requires you to do a full build, then create a CodeArtifact repository in your own account, uploading the packages there, and then running the tests in a shell configured to have NPM, Pip, Maven etc look for those packages in CodeArtifact.
98
+
99
+ ```shell
100
+ # Build and pack all of CDK (will take ~an hour)
101
+ $ ./build.sh
102
+ $ ./pack.sh
103
+
104
+ # Use publib to upload to CodeArtifact
105
+ $ npm install -g publib
106
+ # publib-ca is a CLI tool that comes with publib
107
+ $ publib-ca create
108
+ $ publib-ca publish /path/to/dist
109
+
110
+ # Run the tests against those repositories (may need to substitute 0.0.0 w/ local number)
111
+ $ source ~/.publib-ca/usage/activate.bash
112
+ $ bin/run-suite --use-cli-release=0.0.0 <SUITE_NAME>
113
+
114
+ # Clean up
115
+ $ publib-ca delete
116
+ ```
117
+
118
+ ## Tools
119
+
120
+ There are a number of tools in the `bin/` directory. They are:
121
+
122
+ ```text
123
+ bin/
124
+ ├── apply-patches
125
+ ├── query-github
126
+ ├── run-suite
127
+ ├── stage-distribution
128
+ └── test-root
129
+ ```
130
+
131
+ * `apply-patches`: used for regression testing. Applies patches to historical versions of the tests to fix false positive test failures.
132
+ * `query-github`: used for regression testing. Queries GitHub for previously released versions.
133
+ * `run-suite`: run one of the test suites in the `tests/` directory.
134
+ * `stage-distribution`: used for testing in the pipeline. Uploads candidate release binaries to CodeArtifact so that they can be installed using `npm install`, `pip install`, etc.
135
+ * `test-root`: return the directory containing all tests (used for applying patches).
136
+
137
+ ## Regression testing
138
+
139
+ The regression testing mechanism is somewhat involved and therefore deserves its own section. The principle is not too hard to explain though:
140
+
141
+ *We run the previous version of the CLI integ tests against the new candidate release of the CLI, to make sure we didn't accidentally introduce any breaking behavior*.
142
+
143
+ This is slightly complicated by two facts:
144
+
145
+ * (1) Both the CLI and the framework may have changed, and an incompatibility may have arisen between the framework and CLI. Newer CLIs must always support older framework versions. We therefore run two flavors of the integration tests:
146
+ * Old tests, new CLI, new framework
147
+ * Old tests, new CLI, old framework
148
+
149
+ The testing matrix looks like this:
150
+
151
+ ```text
152
+ OLD TESTS NEW TESTS
153
+
154
+ CLI CLI
155
+ Old New Old New
156
+ ┌────────┬────────┐ ┌────────┬────────┐
157
+ F'WORK │ prev │ │ F'WORK │ │ │
158
+ Old │ rls │ regr │ Old │ (N/A) │ ? │
159
+ │ integ │ │ │ │ │
160
+ ├────────┼────────┤ ├────────┼────────┤
161
+ │ │ │ │ │ cur │
162
+ New │ (N/A) │ regr │ New │ (N/A) │ rls │
163
+ │ │ │ │ │ integ │
164
+ └────────┴────────┘ └────────┴────────┘
165
+ ```
166
+
167
+ We are covering everything except "new tests, new CLI, old framework", which is not clear that it even makes sense to test because some new features may rely on framework support which will not be in the old version yet.
168
+
169
+ * (2) Sometimes, old tests will fail on newer releases when we introduce breaking changes to the framework or CLI for something serious (such as security reasons), or maybe because we had a bug in an old version that happened to pass, but now the test needs to be updated in order to pass a bugfix.
170
+
171
+ For this case we have a patching mechanism, so that in a NEW release of the tools, we include files that are copied over an OLD release of the test, that allows them to pass. For the simplest case there is a mechanism to suppress the run of a single test, so that we can skip the running of one test for one release. For more complicated cases we copy in patched `.js` source files which will replace old source files. (Patches are considered part of the *tools*, not part of the *tests*).
172
+
173
+ ### Mechanism
174
+
175
+ To run the tests in a regressory fashion, do the following:
176
+
177
+ * Download the current `@aws-cdk-testing/cli-integ` artifact at `V1`.
178
+ * Determine the previous version `V0` (use `query-github` for this).
179
+ * Download the previous `@aws-cdk-testing/cli-integ` artifact at `V0`.
180
+ * From the `V1` artifact, apply the `V0` patch set.
181
+ * Run the `V0` tests with the `--framework-version` option:
182
+
183
+ ```shell
184
+ # Old tests, new CLI, new framework
185
+ V0/bin/run-suite --use-cli-release=V1 --framework-version=V1 [...]
186
+
187
+ # Old tests, new CLI, old framework
188
+ V0/bin/run-suite --use-cli-release=V1 --framework-version=V0 [...]
189
+ ```
190
+
191
+ ### Patching
192
+
193
+ To patch a previous set of tests to make them pass with a new release, add a directory to `resources/cli-regression-patches`. The simplest method is to add a `skip-tests.txt` file:
194
+
195
+ ```shell
196
+ # The version of the tests that are currently failing (V0 in the paragraph above)
197
+ export VERSION=X.Y.Z
198
+
199
+ mkdir -p resources/cli-regression-patches/v${VERSION}
200
+ cp skip-tests.txt resources/cli-regression-patches/v${VERSION}/
201
+ ```
202
+
203
+ Now edit `resources/cli-regression-patches/vX.Y.Z/skip-tests.txt` and put the name of the test you want to skip on a line by itself.
204
+
205
+ If you need to replace source files, it's probably best to stick compiled `.js` files in here. `.ts` source files wouldn't compile because they'd be missing `imports`.
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ # Written in bash just because that's easier with all the file manipulation
3
+ set -eu
4
+ scriptdir=$(cd $(dirname $0) && pwd)
5
+ version="$1"
6
+ target_dir="$2"
7
+
8
+
9
+ if [[ ! -f "$2/skip-tests.txt" ]]; then
10
+ echo "$2: does not look like a test root directory." >&2
11
+ exit 1
12
+ fi
13
+
14
+
15
+ candidate_dir="${scriptdir}/../resources/cli-regression-patches/v${version}"
16
+
17
+ if [[ -d "$candidate_dir" ]]; then
18
+ echo "Found patch directory: ${candidate_dir}"
19
+ cp -vR "${candidate_dir}/"* "$2"
20
+ else
21
+ echo "No patch directory named: ${candidate_dir}"
22
+ fi
@@ -0,0 +1,52 @@
1
+ #!/bin/bash
2
+ set -eu
3
+ # Download old tests and run them. Written in bash, just because. Needs to do contortions, see below.
4
+ #
5
+ # Usage:
6
+ #
7
+ # download-and-run-old-tests <version> [...args to run-suite...]
8
+ set -x
9
+
10
+ scriptdir=$(cd $(dirname $0) && pwd)
11
+
12
+ version="$1"
13
+ target_directory="old_tests"
14
+ shift
15
+
16
+ rm -rf $target_directory && mkdir $target_directory
17
+
18
+ # The old tests package MUST be 'npm install <pkg>'ed as a dependency, but MUST NOT
19
+ # end up in a `node_modules` directory.
20
+ #
21
+ # - MUST be 'npm install'ed: we need transitive dependencies as well.
22
+ # - as a dependency: if we check out the source and do an `npm install --production` in the
23
+ # package.json directory, NPM will still try to resolve devDependencies (even though it doesn't
24
+ # need to install them), and the devDeps do not exist on npmjs.
25
+ # - MUST NOT end up in `node_modules`: Jest 27 will ignore all tests that have `node_modules` in
26
+ # the path, and this behavior is not configurable before Jest 28. Unfortunately, because of TypeScript
27
+ # typing issues, we cannot move past Jest 27.
28
+ #
29
+ # To achieve this, do an `npm install <pkg>` then follow up with an `mv` to move the files out.
30
+ if ! npm install --prefix $target_directory --no-save @aws-cdk-testing/cli-integ@$version > npm.log 2>&1; then
31
+ cat npm.log >&2
32
+ # Catch a "package does not exist" error, have to do it this way because for some reason,
33
+ # 'npm view <pkg>' doesn't exit with an error... :s
34
+ if grep -q 'code ETARGET' npm.log; then
35
+ echo "During migration, @aws-cdk-testing/cli-integ@$version does not exist yet." >&2
36
+
37
+
38
+ # Do create an empty junit.xml file -- if we don't, then the "upload report" phase will fail
39
+ # if there are 0 files to upload.
40
+ echo '<testsuites id="Norun" name="No run" tests="0" failures="0" time="0"></testsuites>' > junit.xml
41
+ exit 0
42
+ fi
43
+ exit 1
44
+ fi
45
+
46
+ mv $($target_directory/node_modules/.bin/test-root)/* $target_directory
47
+
48
+ # Apply new patches to old tests
49
+ ${scriptdir}/apply-patches $version $target_directory
50
+
51
+ # Run the suite from the old tests
52
+ exec $target_directory/bin/run-suite "$@"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('./query-github.js');
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const yargs = require("yargs");
4
+ const github_1 = require("../lib/github");
5
+ async function main() {
6
+ var _a;
7
+ const args = await yargs
8
+ .option('token', {
9
+ descripton: 'GitHub token (default: from environment GITHUB_TOKEN)',
10
+ alias: 't',
11
+ type: 'string',
12
+ requiresArg: true,
13
+ })
14
+ .command('last-release', 'Query the last release', cmd => cmd
15
+ .option('prior-to', {
16
+ description: 'Return the most recent release before the given version',
17
+ alias: 'p',
18
+ type: 'string',
19
+ requiresArg: true,
20
+ })
21
+ .option('major', {
22
+ description: 'Return the most recent release that matches',
23
+ alias: 'm',
24
+ type: 'string',
25
+ requiresArg: true,
26
+ }))
27
+ .demandCommand()
28
+ .help()
29
+ .showHelpOnFail(false)
30
+ .argv;
31
+ const command = args._[0];
32
+ const token = (_a = args.token) !== null && _a !== void 0 ? _a : process.env.GITHUB_TOKEN;
33
+ if (!token) {
34
+ throw new Error('Either pass --token or set GITHUB_TOKEN.');
35
+ }
36
+ switch (command) {
37
+ case 'last-release':
38
+ if (args['prior-to'] && args.major) {
39
+ throw new Error('Cannot pass both `--prior-to and --major at the same time');
40
+ }
41
+ // eslint-disable-next-line no-console
42
+ console.log(await (0, github_1.fetchPreviousVersion)(token, {
43
+ priorTo: args['prior-to'],
44
+ majorVersion: args.major,
45
+ }));
46
+ break;
47
+ }
48
+ }
49
+ main().catch(e => {
50
+ // eslint-disable-next-line no-console
51
+ console.error(e);
52
+ process.exitCode = 1;
53
+ });
54
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcnktZ2l0aHViLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsicXVlcnktZ2l0aHViLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0JBQStCO0FBQy9CLDBDQUFxRDtBQUVyRCxLQUFLLFVBQVUsSUFBSTs7SUFDakIsTUFBTSxJQUFJLEdBQUcsTUFBTSxLQUFLO1NBQ3JCLE1BQU0sQ0FBQyxPQUFPLEVBQUU7UUFDZixVQUFVLEVBQUUsdURBQXVEO1FBQ25FLEtBQUssRUFBRSxHQUFHO1FBQ1YsSUFBSSxFQUFFLFFBQVE7UUFDZCxXQUFXLEVBQUUsSUFBSTtLQUNsQixDQUFDO1NBQ0QsT0FBTyxDQUFDLGNBQWMsRUFBRSx3QkFBd0IsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUc7U0FDMUQsTUFBTSxDQUFDLFVBQVUsRUFBRTtRQUNsQixXQUFXLEVBQUUse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JlYWs7XG4gIH1cbn1cblxubWFpbigpLmNhdGNoKGUgPT4ge1xuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc29sZVxuICBjb25zb2xlLmVycm9yKGUpO1xuICBwcm9jZXNzLmV4aXRDb2RlID0gMTtcbn0pO1xuIl19
@@ -0,0 +1,56 @@
1
+ import * as yargs from 'yargs';
2
+ import { fetchPreviousVersion } from '../lib/github';
3
+
4
+ async function main() {
5
+ const args = await yargs
6
+ .option('token', {
7
+ descripton: 'GitHub token (default: from environment GITHUB_TOKEN)',
8
+ alias: 't',
9
+ type: 'string',
10
+ requiresArg: true,
11
+ })
12
+ .command('last-release', 'Query the last release', cmd => cmd
13
+ .option('prior-to', {
14
+ description: 'Return the most recent release before the given version',
15
+ alias: 'p',
16
+ type: 'string',
17
+ requiresArg: true,
18
+ })
19
+ .option('major', {
20
+ description: 'Return the most recent release that matches',
21
+ alias: 'm',
22
+ type: 'string',
23
+ requiresArg: true,
24
+ }))
25
+ .demandCommand()
26
+ .help()
27
+ .showHelpOnFail(false)
28
+ .argv;
29
+
30
+ const command = args._[0];
31
+
32
+ const token = args.token ?? process.env.GITHUB_TOKEN;
33
+ if (!token) {
34
+ throw new Error('Either pass --token or set GITHUB_TOKEN.');
35
+ }
36
+
37
+ switch (command) {
38
+ case 'last-release':
39
+ if (args['prior-to'] && args.major) {
40
+ throw new Error('Cannot pass both `--prior-to and --major at the same time');
41
+ }
42
+
43
+ // eslint-disable-next-line no-console
44
+ console.log(await fetchPreviousVersion(token, {
45
+ priorTo: args['prior-to'],
46
+ majorVersion: args.major,
47
+ }));
48
+ break;
49
+ }
50
+ }
51
+
52
+ main().catch(e => {
53
+ // eslint-disable-next-line no-console
54
+ console.error(e);
55
+ process.exitCode = 1;
56
+ });
package/bin/run-suite ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('./run-suite.js');
@@ -0,0 +1 @@
1
+ export {};