@optimizely/ocp-cli-v2 2.0.0-beta.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/LICENSE +201 -0
- package/README.md +51 -0
- package/bin/ocp.js +3 -0
- package/bin/run.js +3 -0
- package/dist/commands/accounts/whoami.d.ts +5 -0
- package/dist/commands/accounts/whoami.js +22 -0
- package/dist/commands/accounts/whoami.js.map +1 -0
- package/dist/commands/accounts/whois.d.ts +12 -0
- package/dist/commands/accounts/whois.js +57 -0
- package/dist/commands/accounts/whois.js.map +1 -0
- package/dist/commands/app/BaseBuildCommand.d.ts +37 -0
- package/dist/commands/app/BaseBuildCommand.js +255 -0
- package/dist/commands/app/BaseBuildCommand.js.map +1 -0
- package/dist/commands/app/abandon.d.ts +11 -0
- package/dist/commands/app/abandon.js +146 -0
- package/dist/commands/app/abandon.js.map +1 -0
- package/dist/commands/app/getLogLevel.d.ts +16 -0
- package/dist/commands/app/getLogLevel.js +66 -0
- package/dist/commands/app/getLogLevel.js.map +1 -0
- package/dist/commands/app/init.d.ts +27 -0
- package/dist/commands/app/init.js +326 -0
- package/dist/commands/app/init.js.map +1 -0
- package/dist/commands/app/logs.d.ts +24 -0
- package/dist/commands/app/logs.js +231 -0
- package/dist/commands/app/logs.js.map +1 -0
- package/dist/commands/app/package.d.ts +8 -0
- package/dist/commands/app/package.js +51 -0
- package/dist/commands/app/package.js.map +1 -0
- package/dist/commands/app/prepare.d.ts +16 -0
- package/dist/commands/app/prepare.js +119 -0
- package/dist/commands/app/prepare.js.map +1 -0
- package/dist/commands/app/register.d.ts +10 -0
- package/dist/commands/app/register.js +102 -0
- package/dist/commands/app/register.js.map +1 -0
- package/dist/commands/app/setLogLevel.d.ts +16 -0
- package/dist/commands/app/setLogLevel.js +83 -0
- package/dist/commands/app/setLogLevel.js.map +1 -0
- package/dist/commands/app/validate.d.ts +5 -0
- package/dist/commands/app/validate.js +26 -0
- package/dist/commands/app/validate.js.map +1 -0
- package/dist/commands/availability/list.d.ts +6 -0
- package/dist/commands/availability/list.js +32 -0
- package/dist/commands/availability/list.js.map +1 -0
- package/dist/commands/dev-server/start.d.ts +36 -0
- package/dist/commands/dev-server/start.js +209 -0
- package/dist/commands/dev-server/start.js.map +1 -0
- package/dist/commands/dev.d.ts +8 -0
- package/dist/commands/dev.js +12 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/directory/info.d.ts +13 -0
- package/dist/commands/directory/info.js +85 -0
- package/dist/commands/directory/info.js.map +1 -0
- package/dist/commands/directory/install.d.ts +12 -0
- package/dist/commands/directory/install.js +46 -0
- package/dist/commands/directory/install.js.map +1 -0
- package/dist/commands/directory/list.d.ts +14 -0
- package/dist/commands/directory/list.js +114 -0
- package/dist/commands/directory/list.js.map +1 -0
- package/dist/commands/directory/listFunctions.d.ts +15 -0
- package/dist/commands/directory/listFunctions.js +86 -0
- package/dist/commands/directory/listFunctions.js.map +1 -0
- package/dist/commands/directory/listGlobalFunctions.d.ts +13 -0
- package/dist/commands/directory/listGlobalFunctions.js +64 -0
- package/dist/commands/directory/listGlobalFunctions.js.map +1 -0
- package/dist/commands/directory/listInstalls.d.ts +15 -0
- package/dist/commands/directory/listInstalls.js +72 -0
- package/dist/commands/directory/listInstalls.js.map +1 -0
- package/dist/commands/directory/listSourceFunctions.d.ts +14 -0
- package/dist/commands/directory/listSourceFunctions.js +71 -0
- package/dist/commands/directory/listSourceFunctions.js.map +1 -0
- package/dist/commands/directory/publish.d.ts +15 -0
- package/dist/commands/directory/publish.js +201 -0
- package/dist/commands/directory/publish.js.map +1 -0
- package/dist/commands/directory/status.d.ts +11 -0
- package/dist/commands/directory/status.js +50 -0
- package/dist/commands/directory/status.js.map +1 -0
- package/dist/commands/directory/uninstall.d.ts +13 -0
- package/dist/commands/directory/uninstall.js +55 -0
- package/dist/commands/directory/uninstall.js.map +1 -0
- package/dist/commands/directory/unpublish.d.ts +17 -0
- package/dist/commands/directory/unpublish.js +187 -0
- package/dist/commands/directory/unpublish.js.map +1 -0
- package/dist/commands/directory/upgrade.d.ts +15 -0
- package/dist/commands/directory/upgrade.js +113 -0
- package/dist/commands/directory/upgrade.js.map +1 -0
- package/dist/commands/env/get.d.ts +5 -0
- package/dist/commands/env/get.js +23 -0
- package/dist/commands/env/get.js.map +1 -0
- package/dist/commands/env/set.d.ts +8 -0
- package/dist/commands/env/set.js +63 -0
- package/dist/commands/env/set.js.map +1 -0
- package/dist/commands/jobs/list.d.ts +27 -0
- package/dist/commands/jobs/list.js +245 -0
- package/dist/commands/jobs/list.js.map +1 -0
- package/dist/commands/jobs/runtimeStatus.d.ts +11 -0
- package/dist/commands/jobs/runtimeStatus.js +55 -0
- package/dist/commands/jobs/runtimeStatus.js.map +1 -0
- package/dist/commands/jobs/status.d.ts +11 -0
- package/dist/commands/jobs/status.js +57 -0
- package/dist/commands/jobs/status.js.map +1 -0
- package/dist/commands/jobs/terminate.d.ts +11 -0
- package/dist/commands/jobs/terminate.js +35 -0
- package/dist/commands/jobs/terminate.js.map +1 -0
- package/dist/commands/jobs/trigger.d.ts +14 -0
- package/dist/commands/jobs/trigger.js +47 -0
- package/dist/commands/jobs/trigger.js.map +1 -0
- package/dist/commands/review/list.d.ts +9 -0
- package/dist/commands/review/list.js +74 -0
- package/dist/commands/review/list.js.map +1 -0
- package/dist/commands/review/open.d.ts +8 -0
- package/dist/commands/review/open.js +32 -0
- package/dist/commands/review/open.js.map +1 -0
- package/dist/hooks/command-not-found.d.ts +3 -0
- package/dist/hooks/command-not-found.js +93 -0
- package/dist/hooks/command-not-found.js.map +1 -0
- package/dist/hooks/preupdate.d.ts +10 -0
- package/dist/hooks/preupdate.js +42 -0
- package/dist/hooks/preupdate.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/AppContext.d.ts +9 -0
- package/dist/lib/AppContext.js +43 -0
- package/dist/lib/AppContext.js.map +1 -0
- package/dist/lib/AppPackager.d.ts +17 -0
- package/dist/lib/AppPackager.js +57 -0
- package/dist/lib/AppPackager.js.map +1 -0
- package/dist/lib/AppUpdater.d.ts +11 -0
- package/dist/lib/AppUpdater.js +143 -0
- package/dist/lib/AppUpdater.js.map +1 -0
- package/dist/lib/AppUploader.d.ts +9 -0
- package/dist/lib/AppUploader.js +37 -0
- package/dist/lib/AppUploader.js.map +1 -0
- package/dist/lib/BuildPipeline.d.ts +24 -0
- package/dist/lib/BuildPipeline.js +26 -0
- package/dist/lib/BuildPipeline.js.map +1 -0
- package/dist/lib/BuildPipelineFactory.d.ts +10 -0
- package/dist/lib/BuildPipelineFactory.js +23 -0
- package/dist/lib/BuildPipelineFactory.js.map +1 -0
- package/dist/lib/Config.d.ts +15 -0
- package/dist/lib/Config.js +47 -0
- package/dist/lib/Config.js.map +1 -0
- package/dist/lib/CustomHelp.d.ts +19 -0
- package/dist/lib/CustomHelp.js +81 -0
- package/dist/lib/CustomHelp.js.map +1 -0
- package/dist/lib/DependencyStage.d.ts +1 -0
- package/dist/lib/DependencyStage.js +3 -0
- package/dist/lib/DependencyStage.js.map +1 -0
- package/dist/lib/EnvironmentalOutput.d.ts +1 -0
- package/dist/lib/EnvironmentalOutput.js +22 -0
- package/dist/lib/EnvironmentalOutput.js.map +1 -0
- package/dist/lib/Moria.d.ts +51 -0
- package/dist/lib/Moria.js +30 -0
- package/dist/lib/Moria.js.map +1 -0
- package/dist/lib/MoriaApi.d.ts +22 -0
- package/dist/lib/MoriaApi.js +74 -0
- package/dist/lib/MoriaApi.js.map +1 -0
- package/dist/lib/NodeBuildPipeline.d.ts +25 -0
- package/dist/lib/NodeBuildPipeline.js +60 -0
- package/dist/lib/NodeBuildPipeline.js.map +1 -0
- package/dist/lib/PackageManager.d.ts +242 -0
- package/dist/lib/PackageManager.js +511 -0
- package/dist/lib/PackageManager.js.map +1 -0
- package/dist/lib/Rivendell.d.ts +409 -0
- package/dist/lib/Rivendell.js +391 -0
- package/dist/lib/Rivendell.js.map +1 -0
- package/dist/lib/RivendellApi.d.ts +22 -0
- package/dist/lib/RivendellApi.js +159 -0
- package/dist/lib/RivendellApi.js.map +1 -0
- package/dist/lib/Shards.d.ts +3 -0
- package/dist/lib/Shards.js +41 -0
- package/dist/lib/Shards.js.map +1 -0
- package/dist/lib/StringUtils.d.ts +1 -0
- package/dist/lib/StringUtils.js +9 -0
- package/dist/lib/StringUtils.js.map +1 -0
- package/dist/lib/TeminalPassthru.d.ts +7 -0
- package/dist/lib/TeminalPassthru.js +12 -0
- package/dist/lib/TeminalPassthru.js.map +1 -0
- package/dist/lib/TerminalConfirm.d.ts +3 -0
- package/dist/lib/TerminalConfirm.js +31 -0
- package/dist/lib/TerminalConfirm.js.map +1 -0
- package/dist/lib/TerminalInput.d.ts +32 -0
- package/dist/lib/TerminalInput.js +207 -0
- package/dist/lib/TerminalInput.js.map +1 -0
- package/dist/lib/TerminalMenu.d.ts +34 -0
- package/dist/lib/TerminalMenu.js +186 -0
- package/dist/lib/TerminalMenu.js.map +1 -0
- package/dist/lib/TerminalOutput.d.ts +5 -0
- package/dist/lib/TerminalOutput.js +12 -0
- package/dist/lib/TerminalOutput.js.map +1 -0
- package/dist/lib/TerminalSpinner.d.ts +14 -0
- package/dist/lib/TerminalSpinner.js +69 -0
- package/dist/lib/TerminalSpinner.js.map +1 -0
- package/dist/lib/Tracking.d.ts +15 -0
- package/dist/lib/Tracking.js +19 -0
- package/dist/lib/Tracking.js.map +1 -0
- package/dist/lib/build.d.ts +5 -0
- package/dist/lib/build.js +41 -0
- package/dist/lib/build.js.map +1 -0
- package/dist/lib/die.d.ts +5 -0
- package/dist/lib/die.js +14 -0
- package/dist/lib/die.js.map +1 -0
- package/dist/lib/directoryExists.d.ts +1 -0
- package/dist/lib/directoryExists.js +9 -0
- package/dist/lib/directoryExists.js.map +1 -0
- package/dist/lib/formatBuildState.d.ts +2 -0
- package/dist/lib/formatBuildState.js +23 -0
- package/dist/lib/formatBuildState.js.map +1 -0
- package/dist/lib/formatError.d.ts +1 -0
- package/dist/lib/formatError.js +55 -0
- package/dist/lib/formatError.js.map +1 -0
- package/dist/lib/formatJobStatus.d.ts +3 -0
- package/dist/lib/formatJobStatus.js +28 -0
- package/dist/lib/formatJobStatus.js.map +1 -0
- package/dist/lib/formatReviewStatus.d.ts +4 -0
- package/dist/lib/formatReviewStatus.js +28 -0
- package/dist/lib/formatReviewStatus.js.map +1 -0
- package/dist/lib/formatTimstamp.d.ts +1 -0
- package/dist/lib/formatTimstamp.js +25 -0
- package/dist/lib/formatTimstamp.js.map +1 -0
- package/dist/lib/formatVersionState.d.ts +2 -0
- package/dist/lib/formatVersionState.js +37 -0
- package/dist/lib/formatVersionState.js.map +1 -0
- package/dist/lib/gatherAppEnv.d.ts +3 -0
- package/dist/lib/gatherAppEnv.js +71 -0
- package/dist/lib/gatherAppEnv.js.map +1 -0
- package/dist/lib/handleInterrupt.d.ts +1 -0
- package/dist/lib/handleInterrupt.js +17 -0
- package/dist/lib/handleInterrupt.js.map +1 -0
- package/dist/lib/jobRuntime.d.ts +3 -0
- package/dist/lib/jobRuntime.js +16 -0
- package/dist/lib/jobRuntime.js.map +1 -0
- package/dist/lib/migrateOptiCli.d.ts +1 -0
- package/dist/lib/migrateOptiCli.js +30 -0
- package/dist/lib/migrateOptiCli.js.map +1 -0
- package/dist/lib/parseDate.d.ts +2 -0
- package/dist/lib/parseDate.js +26 -0
- package/dist/lib/parseDate.js.map +1 -0
- package/dist/lib/templating/TemplateRenderer.d.ts +13 -0
- package/dist/lib/templating/TemplateRenderer.js +63 -0
- package/dist/lib/templating/TemplateRenderer.js.map +1 -0
- package/dist/lib/templating/fetchTemplatesManifest.d.ts +1 -0
- package/dist/lib/templating/fetchTemplatesManifest.js +9 -0
- package/dist/lib/templating/fetchTemplatesManifest.js.map +1 -0
- package/dist/lib/templating/types.d.ts +27 -0
- package/dist/lib/templating/types.js +3 -0
- package/dist/lib/templating/types.js.map +1 -0
- package/dist/oclif.manifest.json +1616 -0
- package/dist/utils/utils.d.ts +5 -0
- package/dist/utils/utils.js +61 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +180 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# OCP CLI
|
|
2
|
+
|
|
3
|
+
Interfacing with Optimizely Connect Platform (OCP).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
OCP CLI requires a recent version of nodejs as well as Yarn. We suggest installing Yarn through `corepack`, as described here: https://yarnpkg.com/getting-started/install
|
|
8
|
+
|
|
9
|
+
Install OCP CLI with:
|
|
10
|
+
|
|
11
|
+
`yarn global add @optimizely/ocp-cli`
|
|
12
|
+
|
|
13
|
+
Commands can then be executed as follows:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
ocp
|
|
17
|
+
ocp <namespace> -h
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
### `ocp dev-server`
|
|
23
|
+
|
|
24
|
+
Start the local development server for OCP applications.
|
|
25
|
+
|
|
26
|
+
The `@optimizely/ocp-local-env` package is automatically managed by this command:
|
|
27
|
+
- First run: Automatically installs the package globally
|
|
28
|
+
- Daily check: Checks for updates once per day and auto-upgrades when available
|
|
29
|
+
- No manual installation required
|
|
30
|
+
|
|
31
|
+
**Options:**
|
|
32
|
+
- `-p, --port <port>` - Port to run the server on (default: 3000)
|
|
33
|
+
- `-c, --config <path>` - Path to custom config file
|
|
34
|
+
- `--path <path>` - Path to the OCP app root directory (default: current directory)
|
|
35
|
+
- `-v, --verbose` - Enable verbose logging
|
|
36
|
+
- `--no-open` - Don't automatically open browser
|
|
37
|
+
|
|
38
|
+
**Examples:**
|
|
39
|
+
```bash
|
|
40
|
+
# Start server in current directory on default port
|
|
41
|
+
ocp dev-server start
|
|
42
|
+
|
|
43
|
+
# Start on custom port
|
|
44
|
+
ocp dev-server start -p 4000
|
|
45
|
+
|
|
46
|
+
# Start with specific app directory
|
|
47
|
+
ocp dev-server start --path /path/to/my-app
|
|
48
|
+
|
|
49
|
+
# Short version to start server
|
|
50
|
+
ocp dev
|
|
51
|
+
```
|
package/bin/ocp.js
ADDED
package/bin/run.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const die_1 = require("../../lib/die");
|
|
5
|
+
const formatError_1 = require("../../lib/formatError");
|
|
6
|
+
const Rivendell_1 = require("../../lib/Rivendell");
|
|
7
|
+
const chalk = require("chalk");
|
|
8
|
+
const yaml = require("js-yaml");
|
|
9
|
+
class Whoami extends core_1.Command {
|
|
10
|
+
async run() {
|
|
11
|
+
try {
|
|
12
|
+
const me = await Rivendell_1.Rivendell.whoami();
|
|
13
|
+
this.log(chalk.gray(yaml.dump(me)));
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
(0, die_1.die)((0, formatError_1.formatError)(e));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = Whoami;
|
|
21
|
+
Whoami.description = 'Show your account information';
|
|
22
|
+
//# sourceMappingURL=whoami.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../src/commands/accounts/whoami.ts"],"names":[],"mappings":";;AAAA,sCAAsC;AACtC,uCAAoC;AACpC,uDAAoD;AACpD,mDAAgD;AAChD,+BAA+B;AAC/B,gCAAgC;AAEhC,MAAqB,MAAO,SAAQ,cAAO;IAGlC,KAAK,CAAC,GAAG;QACd,IAAI;YACF,MAAM,EAAE,GAAG,MAAM,qBAAS,CAAC,MAAM,EAAE,CAAC;YACpC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SACrC;QAAC,OAAO,CAAM,EAAE;YACf,IAAA,SAAG,EAAC,IAAA,yBAAW,EAAC,CAAC,CAAC,CAAC,CAAC;SACrB;IACH,CAAC;;AAVH,yBAWC;AAVe,kBAAW,GAAG,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Whois extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
term: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
availability: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
private render;
|
|
12
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const chalk = require("chalk");
|
|
4
|
+
const table = require("text-table");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const die_1 = require("../../lib/die");
|
|
7
|
+
const formatError_1 = require("../../lib/formatError");
|
|
8
|
+
const Rivendell_1 = require("../../lib/Rivendell");
|
|
9
|
+
const StringUtils_1 = require("../../lib/StringUtils");
|
|
10
|
+
class Whois extends core_1.Command {
|
|
11
|
+
async run() {
|
|
12
|
+
const { args, flags } = await this.parse(Whois);
|
|
13
|
+
try {
|
|
14
|
+
const accounts = await Rivendell_1.Rivendell.searchAccounts(args.term, flags.availability);
|
|
15
|
+
if (accounts.length) {
|
|
16
|
+
this.render(accounts);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const zone = flags.availability || 'us';
|
|
20
|
+
this.log(chalk.yellow(`No accounts matching search term '${args.term}' found in ${zone}.`));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
(0, die_1.die)((0, formatError_1.formatError)(e));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
render(accounts) {
|
|
28
|
+
const header = ['id', 'tracker Id', 'name', 'target product'].map((item) => chalk.grey(item));
|
|
29
|
+
const rows = accounts.map((account) => [
|
|
30
|
+
account.id,
|
|
31
|
+
account.trackerId,
|
|
32
|
+
account.name,
|
|
33
|
+
account.accountType,
|
|
34
|
+
]);
|
|
35
|
+
const t = table([header, ...rows], {
|
|
36
|
+
hsep: ' '.repeat(8),
|
|
37
|
+
stringLength: StringUtils_1.styledStringLength,
|
|
38
|
+
});
|
|
39
|
+
this.log(`\n${t}\n`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = Whois;
|
|
43
|
+
Whois.description = 'Look up basic account information';
|
|
44
|
+
Whois.args = {
|
|
45
|
+
term: core_1.Args.string({
|
|
46
|
+
required: true,
|
|
47
|
+
description: 'The search term (e.g. 1.web)',
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
Whois.flags = {
|
|
51
|
+
availability: core_1.Flags.string({
|
|
52
|
+
char: 'a',
|
|
53
|
+
description: 'The availability zone that will be targeted (default: us)',
|
|
54
|
+
default: 'us',
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=whois.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whois.js","sourceRoot":"","sources":["../../../src/commands/accounts/whois.ts"],"names":[],"mappings":";;AAAA,+BAA+B;AAC/B,oCAAoC;AACpC,sCAAmD;AACnD,uCAAoC;AACpC,uDAAoD;AACpD,mDAAgD;AAChD,uDAA2D;AAG3D,MAAqB,KAAM,SAAQ,cAAO;IAkBjC,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEhD,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,qBAAS,CAAC,cAAc,CAC7C,IAAI,CAAC,IAAI,EACT,KAAK,CAAC,YAAY,CACnB,CAAC;YAEF,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;aACvB;iBAAM;gBACL,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC;gBACxC,IAAI,CAAC,GAAG,CACN,KAAK,CAAC,MAAM,CACV,qCAAqC,IAAI,CAAC,IAAI,cAAc,IAAI,GAAG,CACpE,CACF,CAAC;aACH;SACF;QAAC,OAAO,CAAM,EAAE;YACf,IAAA,SAAG,EAAC,IAAA,yBAAW,EAAC,CAAC,CAAC,CAAC,CAAC;SACrB;IACH,CAAC;IAEO,MAAM,CAAC,QAAmB;QAChC,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACzE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CACjB,CAAC;QACF,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YACrC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,SAAS;YACjB,OAAO,CAAC,IAAI;YACZ,OAAO,CAAC,WAAW;SACpB,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE;YACjC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;YACnB,YAAY,EAAE,gCAAkB;SACjC,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;;AAzDH,wBA0DC;AAzDe,iBAAW,GAAG,mCAAmC,CAAC;AAElD,UAAI,GAAG;IACnB,IAAI,EAAE,WAAI,CAAC,MAAM,CAAC;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,8BAA8B;KAC5C,CAAC;CACH,CAAC;AAEY,WAAK,GAAG;IACpB,YAAY,EAAE,YAAK,CAAC,MAAM,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,2DAA2D;QACxE,OAAO,EAAE,IAAI;KACd,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { AppContext } from '../../lib/AppContext';
|
|
3
|
+
import { Rivendell } from '../../lib/Rivendell';
|
|
4
|
+
import AppVersion = Rivendell.AppVersion;
|
|
5
|
+
export declare abstract class BaseBuildCommand extends Command {
|
|
6
|
+
static flags: {
|
|
7
|
+
noProgress: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
upgradeDeps: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
rcDependencies: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
noPrompt: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
path: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
protected noProgress: boolean;
|
|
14
|
+
protected upgradeDeps: boolean;
|
|
15
|
+
protected rcDependencies: boolean;
|
|
16
|
+
protected noPrompt: boolean;
|
|
17
|
+
protected path: string;
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
protected runInternal({ upload, publish, usePreviousAppEnvValues, }: {
|
|
20
|
+
upload: boolean;
|
|
21
|
+
publish: boolean;
|
|
22
|
+
usePreviousAppEnvValues: boolean;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
protected fetchAppVersion(context: AppContext, shard: string): Promise<AppVersion | null>;
|
|
25
|
+
protected isRelease(appVersionId: string): boolean;
|
|
26
|
+
protected isDevVersion(appVersionId?: string): boolean;
|
|
27
|
+
protected reviewAppVersion(appId: string, version: string): Promise<void>;
|
|
28
|
+
protected isInReview(appId: string, version: string): Promise<boolean>;
|
|
29
|
+
protected requiresReview(version: string): Promise<boolean>;
|
|
30
|
+
private uploadPackage;
|
|
31
|
+
private build;
|
|
32
|
+
private registerOrUpdateVersion;
|
|
33
|
+
private registerVersion;
|
|
34
|
+
private updateVersion;
|
|
35
|
+
private startBuild;
|
|
36
|
+
private watchForBuildCompletion;
|
|
37
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseBuildCommand = void 0;
|
|
4
|
+
const chalk = require("chalk");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const AppContext_1 = require("../../lib/AppContext");
|
|
8
|
+
const AppPackager_1 = require("../../lib/AppPackager");
|
|
9
|
+
const AppUpdater_1 = require("../../lib/AppUpdater");
|
|
10
|
+
const AppUploader_1 = require("../../lib/AppUploader");
|
|
11
|
+
const BuildPipelineFactory_1 = require("../../lib/BuildPipelineFactory");
|
|
12
|
+
const die_1 = require("../../lib/die");
|
|
13
|
+
const directoryExists_1 = require("../../lib/directoryExists");
|
|
14
|
+
const formatBuildState_1 = require("../../lib/formatBuildState");
|
|
15
|
+
const gatherAppEnv_1 = require("../../lib/gatherAppEnv");
|
|
16
|
+
const handleInterrupt_1 = require("../../lib/handleInterrupt");
|
|
17
|
+
const TerminalSpinner_1 = require("../../lib/TerminalSpinner");
|
|
18
|
+
const build_1 = require("../../lib/build");
|
|
19
|
+
const Rivendell_1 = require("../../lib/Rivendell");
|
|
20
|
+
const formatError_1 = require("../../lib/formatError");
|
|
21
|
+
const RivendellApi_1 = require("../../lib/RivendellApi");
|
|
22
|
+
const Shards_1 = require("../../lib/Shards");
|
|
23
|
+
var ApiError = RivendellApi_1.RivendellApi.ApiError;
|
|
24
|
+
var BuildState = Rivendell_1.Rivendell.BuildState;
|
|
25
|
+
var AppVersionState = Rivendell_1.Rivendell.AppVersionState;
|
|
26
|
+
var ReviewStatus = Rivendell_1.Rivendell.ReviewStatus;
|
|
27
|
+
class BaseBuildCommand extends core_1.Command {
|
|
28
|
+
async run() {
|
|
29
|
+
const { flags } = await this.parse(this.constructor);
|
|
30
|
+
this.noProgress = flags.noProgress;
|
|
31
|
+
this.upgradeDeps = flags.upgradeDeps;
|
|
32
|
+
this.rcDependencies = flags.rcDependencies;
|
|
33
|
+
this.noPrompt = flags.noPrompt;
|
|
34
|
+
this.path = flags.path;
|
|
35
|
+
}
|
|
36
|
+
async runInternal({ upload, publish, usePreviousAppEnvValues, }) {
|
|
37
|
+
(0, handleInterrupt_1.handleInterrupt)();
|
|
38
|
+
if (!(0, directoryExists_1.directoryExists)(this.path)) {
|
|
39
|
+
(0, die_1.die)('Specified path to app does not exist');
|
|
40
|
+
}
|
|
41
|
+
process.chdir(this.path);
|
|
42
|
+
const context = (0, AppContext_1.appContext)();
|
|
43
|
+
if (!context.appId || !context.version || !context.runtime) {
|
|
44
|
+
(0, die_1.die)('Unable to read App ID or version info. Ensure you are uploading the right directory.');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (this.rcDependencies &&
|
|
48
|
+
!this.isDevVersion(`${context.appId}@${context.version}`)) {
|
|
49
|
+
(0, die_1.die)('Cannot use --rc-dependencies with non-dev version');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!usePreviousAppEnvValues) {
|
|
53
|
+
(0, gatherAppEnv_1.validateAppEnvs)(await (0, Shards_1.targetShards)());
|
|
54
|
+
}
|
|
55
|
+
const shards = await (0, Shards_1.applicableShards)();
|
|
56
|
+
await AppUpdater_1.AppUpdater.ensureDependencies(upload, this.noPrompt || this.upgradeDeps, context.runtime, true, this.rcDependencies ? 'rc' : 'stable');
|
|
57
|
+
try {
|
|
58
|
+
const pipeline = BuildPipelineFactory_1.BuildPipelineFactory.create(context.runtime, process.cwd());
|
|
59
|
+
await pipeline.validate();
|
|
60
|
+
}
|
|
61
|
+
catch (_a) {
|
|
62
|
+
this.exit(1);
|
|
63
|
+
}
|
|
64
|
+
if (upload) {
|
|
65
|
+
this.log(chalk.gray('Verifying upload constraints...'));
|
|
66
|
+
try {
|
|
67
|
+
(0, child_process_1.execSync)('git rev-parse --is-inside-work-tree');
|
|
68
|
+
}
|
|
69
|
+
catch (_b) {
|
|
70
|
+
this.log(chalk.red('\nApp must be in an initialized Git repository'));
|
|
71
|
+
this.exit(1);
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const version = await this.fetchAppVersion(context, 'us');
|
|
75
|
+
const packageUrl = (version === null || version === void 0 ? void 0 : version.state) === AppVersionState.RUNNING
|
|
76
|
+
? version.packageUrl
|
|
77
|
+
: await this.uploadPackage(context);
|
|
78
|
+
const registrationShards = shards.includes('us')
|
|
79
|
+
? shards
|
|
80
|
+
: ['us', ...shards];
|
|
81
|
+
for (const shard of registrationShards) {
|
|
82
|
+
let appEnv = (0, gatherAppEnv_1.gatherAppEnv)(shard);
|
|
83
|
+
if (usePreviousAppEnvValues && Object.keys(appEnv).length > 0) {
|
|
84
|
+
this.log(chalk.yellow('\n--use-previous-app-env-values is on. Ignoring values from .env file'));
|
|
85
|
+
appEnv = {};
|
|
86
|
+
}
|
|
87
|
+
await this.registerOrUpdateVersion(context, packageUrl, appEnv, usePreviousAppEnvValues, shard);
|
|
88
|
+
}
|
|
89
|
+
if ((version === null || version === void 0 ? void 0 : version.state) !== AppVersionState.RUNNING) {
|
|
90
|
+
await this.build(context, publish);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
(0, die_1.die)((0, formatError_1.formatError)(e));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async fetchAppVersion(context, shard) {
|
|
99
|
+
var _a;
|
|
100
|
+
try {
|
|
101
|
+
return await Rivendell_1.Rivendell.fetchAppVersion(context, shard);
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
if (e instanceof ApiError && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
105
|
+
this.log(chalk.gray('Existing version not found...'));
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
isRelease(appVersionId) {
|
|
112
|
+
return !this.isDevVersion(appVersionId);
|
|
113
|
+
}
|
|
114
|
+
isDevVersion(appVersionId) {
|
|
115
|
+
var _a;
|
|
116
|
+
return (_a = appVersionId === null || appVersionId === void 0 ? void 0 : appVersionId.includes('-dev')) !== null && _a !== void 0 ? _a : false;
|
|
117
|
+
}
|
|
118
|
+
async reviewAppVersion(appId, version) {
|
|
119
|
+
if (await this.requiresReview(version)) {
|
|
120
|
+
const appVersion = await this.fetchAppVersion({ appId, version }, 'us');
|
|
121
|
+
if ((appVersion === null || appVersion === void 0 ? void 0 : appVersion.state) === AppVersionState.PUBLISHED &&
|
|
122
|
+
appVersion.reviewStatus !== ReviewStatus.NOT_REQUIRED) {
|
|
123
|
+
await Rivendell_1.Rivendell.reviewAppVersion(appId, version);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async isInReview(appId, version) {
|
|
128
|
+
const appVersion = await this.fetchAppVersion({ appId, version }, 'us');
|
|
129
|
+
return appVersion
|
|
130
|
+
? appVersion.reviewStatus === ReviewStatus.IN_REVIEW
|
|
131
|
+
: false;
|
|
132
|
+
}
|
|
133
|
+
async requiresReview(version) {
|
|
134
|
+
return this.isRelease(version) && !(await Rivendell_1.Rivendell.isAdmin());
|
|
135
|
+
}
|
|
136
|
+
async uploadPackage(context) {
|
|
137
|
+
try {
|
|
138
|
+
await Rivendell_1.Rivendell.fetchApp(context.appId);
|
|
139
|
+
if (!context.runtime) {
|
|
140
|
+
throw new Error('Runtime is not specified in app.yml');
|
|
141
|
+
}
|
|
142
|
+
const packageData = await new AppPackager_1.AppPackager('./', context.runtime).package();
|
|
143
|
+
return await new AppUploader_1.AppUploader(context, packageData).upload();
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
this.log('App ID must be registered before it can be uploaded. Try:');
|
|
147
|
+
this.log(' ocp app register');
|
|
148
|
+
throw e;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async build(context, publish) {
|
|
152
|
+
try {
|
|
153
|
+
const build = await this.startBuild(context, publish);
|
|
154
|
+
await this.watchForBuildCompletion(context, build.id, publish);
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
this.log('App ID must be registered before it can be uploaded. Try:');
|
|
158
|
+
this.log(' ocp app register');
|
|
159
|
+
throw e;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async registerOrUpdateVersion(context, packageUrl, appEnv, usePreviousAppEnvValues, shard) {
|
|
163
|
+
try {
|
|
164
|
+
this.log(chalk.gray(`Checking for existing version (${shard})...`));
|
|
165
|
+
const version = await this.fetchAppVersion(context, shard);
|
|
166
|
+
if ((version === null || version === void 0 ? void 0 : version.state) === AppVersionState.RUNNING) {
|
|
167
|
+
this.log(`AppVersion already running (${shard})`);
|
|
168
|
+
}
|
|
169
|
+
else if (version) {
|
|
170
|
+
await this.updateVersion(context, packageUrl, appEnv, usePreviousAppEnvValues, shard);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
await this.registerVersion(context, packageUrl, appEnv, usePreviousAppEnvValues, shard);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
(0, die_1.die)(`${(0, formatError_1.formatError)(e)} (${shard})`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async registerVersion(context, packageUrl, appEnv, usePreviousAppEnvValues, shard) {
|
|
181
|
+
this.log(chalk.gray(`Registering a new version (${shard})...`));
|
|
182
|
+
await Rivendell_1.Rivendell.registerAppVersion(context.appId, context.version, packageUrl, appEnv, usePreviousAppEnvValues, shard);
|
|
183
|
+
}
|
|
184
|
+
async updateVersion(context, packageUrl, appEnv, usePreviousAppEnvValues, shard) {
|
|
185
|
+
this.log(chalk.gray(`Updating existing version (${shard})...`));
|
|
186
|
+
await Rivendell_1.Rivendell.updateAppVersion(context.appId, context.version, packageUrl, appEnv, usePreviousAppEnvValues, shard);
|
|
187
|
+
}
|
|
188
|
+
async startBuild(context, publish) {
|
|
189
|
+
this.log(chalk.gray(`Starting ${publish ? 'build' : 'validation'}...`));
|
|
190
|
+
return publish
|
|
191
|
+
? await Rivendell_1.Rivendell.build(context.appId, context.version, this.rcDependencies)
|
|
192
|
+
: await Rivendell_1.Rivendell.verify(context.appId, context.version);
|
|
193
|
+
}
|
|
194
|
+
async watchForBuildCompletion(context, id, publish) {
|
|
195
|
+
this.log(chalk.gray(`Waiting for ${publish ? 'build' : 'validation'} (id=${id}) to complete... CTRL+C to stop checking.`));
|
|
196
|
+
const spinner = this.noProgress
|
|
197
|
+
? null
|
|
198
|
+
: new TerminalSpinner_1.TerminalSpinner().start(`Status: ${(0, formatBuildState_1.formatBuildState)(BuildState.NEW)}`);
|
|
199
|
+
const requiresReview = await this.requiresReview(context.version);
|
|
200
|
+
try {
|
|
201
|
+
const errors = await (0, build_1.watchBuild)(id, (state) => {
|
|
202
|
+
spinner === null || spinner === void 0 ? void 0 : spinner.update(`Status: ${(0, formatBuildState_1.formatBuildState)(state)}`);
|
|
203
|
+
});
|
|
204
|
+
spinner === null || spinner === void 0 ? void 0 : spinner.stop();
|
|
205
|
+
if (errors.length > 0) {
|
|
206
|
+
(0, die_1.die)(`${publish ? 'Build' : 'Validation'} failed:\n${errors
|
|
207
|
+
.map((e) => ` * ${e}`)
|
|
208
|
+
.join('\n')}`);
|
|
209
|
+
}
|
|
210
|
+
else if (publish) {
|
|
211
|
+
if (requiresReview) {
|
|
212
|
+
this.log(chalk.green('Build complete.'));
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this.log(chalk.green('Build complete. Ready to be published.'));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
this.log(chalk.green('Validation complete. No errors found.'));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
(0, die_1.die)((0, formatError_1.formatError)(err));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.BaseBuildCommand = BaseBuildCommand;
|
|
228
|
+
BaseBuildCommand.flags = {
|
|
229
|
+
noProgress: core_1.Flags.boolean({
|
|
230
|
+
aliases: ['no-progress'],
|
|
231
|
+
description: "Don't display any progress indicators",
|
|
232
|
+
default: false,
|
|
233
|
+
}),
|
|
234
|
+
upgradeDeps: core_1.Flags.boolean({
|
|
235
|
+
aliases: ['upgrade-deps'],
|
|
236
|
+
description: 'Automatically update dependencies',
|
|
237
|
+
default: false,
|
|
238
|
+
}),
|
|
239
|
+
rcDependencies: core_1.Flags.boolean({
|
|
240
|
+
aliases: ['rc-dependencies'],
|
|
241
|
+
description: 'Use unstable OCP dependencies. Only allowed for dev builds.',
|
|
242
|
+
default: false,
|
|
243
|
+
}),
|
|
244
|
+
noPrompt: core_1.Flags.boolean({
|
|
245
|
+
aliases: ['no-prompt'],
|
|
246
|
+
description: 'Use default answer to any prompt question (default is yes, except for destructive operations)',
|
|
247
|
+
default: false,
|
|
248
|
+
}),
|
|
249
|
+
path: core_1.Flags.string({
|
|
250
|
+
char: 'p',
|
|
251
|
+
description: 'The root directory of the app',
|
|
252
|
+
default: './',
|
|
253
|
+
}),
|
|
254
|
+
};
|
|
255
|
+
//# sourceMappingURL=BaseBuildCommand.js.map
|