├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── node.js.yml ├── .gitignore ├── .releaserc.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── COPYRIGHT ├── LICENSE ├── README.md ├── bin ├── run └── run.cmd ├── jest.setup.js ├── package-lock.json ├── package.json ├── src ├── base-command.js ├── commands │ └── aem │ │ └── upload.js └── utils.js ├── test ├── commands │ └── aem │ │ └── upload.test.js └── utils.test.js └── view └── result.mst /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true, 4 | "es6": true, 5 | "jest": true 6 | }, 7 | "parserOptions": { 8 | "ecmaVersion": 2018 9 | }, 10 | "plugins": [ 11 | "jest" 12 | ], 13 | "extends": [ 14 | "plugin:jest/recommended", 15 | "eslint:recommended" 16 | ], 17 | "rules": { 18 | "no-var": 2 19 | } 20 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Expected Behaviour 2 | 3 | ### Actual Behaviour 4 | 5 | ### Reproduce Scenario (including but not limited to) 6 | 7 | #### Steps to Reproduce 8 | 9 | #### Platform and Version 10 | 11 | #### Sample Code that illustrates the problem 12 | 13 | #### Logs taken while reproducing problem 14 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 4 | 5 | 6 | 7 | ## Related Issue 8 | 9 | 10 | 11 | 12 | 13 | 14 | ## Motivation and Context 15 | 16 | 17 | 18 | ## How Has This Been Tested? 19 | 20 | 21 | 22 | 23 | 24 | ## Screenshots (if appropriate): 25 | 26 | ## Types of changes 27 | 28 | 29 | 30 | - [ ] Bug fix (non-breaking change which fixes an issue) 31 | - [ ] New feature (non-breaking change which adds functionality) 32 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 33 | 34 | ## Checklist: 35 | 36 | 37 | 38 | 39 | - [ ] I have signed the [Adobe Open Source CLA](http://opensource.adobe.com/cla.html). 40 | - [ ] My code follows the code style of this project. 41 | - [ ] My change requires a change to the documentation. 42 | - [ ] I have updated the documentation accordingly. 43 | - [ ] I have read the **CONTRIBUTING** document. 44 | - [ ] I have added tests to cover my changes. 45 | - [ ] All new and existing tests passed. 46 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [14.21, 16.20, 18.16] 20 | 21 | steps: 22 | - uses: actions/checkout@v2 23 | - name: Setup unit test environment 24 | run: sudo apt-get install librsvg2-bin imagemagick exiftool 25 | - name: Use Node.js ${{ matrix.node-version }} 26 | uses: actions/setup-node@v1 27 | with: 28 | node-version: ${{ matrix.node-version }} 29 | - name: Log used OS 30 | run: uname -a 31 | - name: Install dependencies (all) 32 | run: npm install 33 | - name: Run unit tests 34 | run: npm test 35 | 36 | sizewatcher: 37 | 38 | runs-on: ubuntu-latest 39 | 40 | steps: 41 | - uses: actions/checkout@v2 42 | - run: npx @adobe/sizewatcher 43 | semantic-release: 44 | runs-on: ubuntu-latest 45 | needs: [build] 46 | if: ${{ !contains(github.event.head_commit.message, '[ci skip]') && github.ref == 'refs/heads/master' }} 47 | steps: 48 | - uses: actions/checkout@v2 49 | with: 50 | persist-credentials: false 51 | - name: Use Node.js 18.16 52 | uses: actions/setup-node@v1 53 | with: 54 | node-version: '18.16' 55 | - run: npm install 56 | - run: npm run semantic-release 57 | env: 58 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 59 | NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *-debug.log 2 | *-error.log 3 | result-* 4 | upload-* 5 | .oclif.manifest.json 6 | oclif.manifest.json 7 | /.nyc_output 8 | /dist 9 | /lib 10 | /tmp 11 | /yarn.lock 12 | node_modules 13 | .DS_Store 14 | /test-results.xml 15 | coverage/ 16 | junit.xml 17 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@semantic-release/commit-analyzer", 4 | "@semantic-release/release-notes-generator", 5 | ["@semantic-release/changelog", { 6 | "changelogFile": "CHANGELOG.md" 7 | }], 8 | ["@semantic-release/npm"], 9 | ["@semantic-release/git", { 10 | "assets": ["package.json", "package-lock.json", "CHANGELOG.md"], 11 | "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" 12 | }], 13 | "@semantic-release/github" 14 | ], 15 | "branches": ["master"] 16 | } 17 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [1.2.0](https://github.com/adobe/aio-cli-plugin-aem/compare/v1.1.1...v1.2.0) (2023-08-04) 2 | 3 | 4 | ### Features 5 | 6 | * add support for proxies. ([#18](https://github.com/adobe/aio-cli-plugin-aem/issues/18)) ([fc93b6c](https://github.com/adobe/aio-cli-plugin-aem/commit/fc93b6c493d824ac95837fe1986ed26f420d0f17)) 7 | 8 | ## [1.1.1](https://github.com/adobe/aio-cli-plugin-aem/compare/v1.1.0...v1.1.1) (2023-05-31) 9 | 10 | 11 | ### Bug Fixes 12 | 13 | * allow uploads to local aem-sdk instances ([#17](https://github.com/adobe/aio-cli-plugin-aem/issues/17)) ([a63f20a](https://github.com/adobe/aio-cli-plugin-aem/commit/a63f20ad3e360d1d9a096336c7bcc0227a079d10)) 14 | 15 | # [1.1.0](https://github.com/adobe/aio-cli-plugin-aem/compare/v1.0.0...v1.1.0) (2023-05-09) 16 | 17 | 18 | ### Features 19 | 20 | * update to latest version of aem-upload. ([#16](https://github.com/adobe/aio-cli-plugin-aem/issues/16)) ([e909ddd](https://github.com/adobe/aio-cli-plugin-aem/commit/e909ddd903a76c7401894bb6f7dbfcd69dd28bd9)) 21 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Adobe Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at Grp-opensourceoffice@adobe.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thanks for choosing to contribute! 4 | 5 | The following are a set of guidelines to follow when contributing to this project. 6 | 7 | ## Code Of Conduct 8 | 9 | This project adheres to the Adobe [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [Grp-opensourceoffice@adobe.com](mailto:Grp-opensourceoffice@adobe.com). 10 | 11 | ## Contributor License Agreement 12 | 13 | All third-party contributions to this project must be accompanied by a signed contributor license agreement. This gives Adobe permission to redistribute your contributions as part of the project. [Sign our CLA](http://opensource.adobe.com/cla.html). You only need to submit an Adobe CLA one time, so if you have submitted one previously, you are good to go! 14 | 15 | ## Code Reviews 16 | 17 | All submissions should come in the form of pull requests and need to be reviewed by project committers. Read [GitHub's pull request documentation](https://help.github.com/articles/about-pull-requests/) for more information on sending pull requests. 18 | 19 | Lastly, please follow the [pull request template](.github/PULL_REQUEST_TEMPLATE.md) when submitting a pull request! 20 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2018 Adobe 2 | 3 | Adobe holds the copyright for all the files found in this repository. 4 | 5 | See the LICENSE file for licensing information. 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 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. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | Plugin to Adobe I/O CLI for executing commands related to Adobe Experience Manager. 3 | 4 | 5 | * [Overview](#overview) 6 | * [Usage](#usage) 7 | * [Adding New Commands](#adding-new-commands) 8 | * [Commands](#commands) 9 | * [Proxy Support](#proxy-support) 10 | * [Releasing](#releasing) 11 | * [Contributing](#contributing) 12 | * [Licensing](#licensing) 13 | 14 | 15 | 16 | # Usage 17 | To install the and use the command locally: 18 | 19 | ```sh-session 20 | $ npm install -g @adobe/aio-cli-plugin-aem 21 | $ aio-aem COMMAND 22 | running command... 23 | $ aio-aem (-v|--version|version) 24 | @adobe/aio-cli-plugin-aem/1.2.0 linux-x64 node-v18.16.1 25 | $ aio-aem --help [COMMAND] 26 | USAGE 27 | $ aio-aem COMMAND 28 | ... 29 | ``` 30 | 31 | 32 | # Adding New Commands 33 | 34 | To add a new command, do the following: 35 | 36 | * Create a new javascript file, named after the command, in src/commands/aem. 37 | * Use the contents of src/commands/aem/upload.js as a starting point for your command, paying 38 | particular attention to the command's `flags`, `args`, and `description`. For additional 39 | information and features, see [https://oclif.io](https://oclif.io/). 40 | * Ensure that the file's exports include an object with a property matching the command name. 41 | 42 | ## Testing Commands 43 | 44 | There are a couple options for running commands through the locally cloned repository. 45 | 46 | ``` 47 | // run command through Node.js 48 | node bin/run aem:COMMAND 49 | ``` 50 | 51 | ``` 52 | // run command as a binary (Mac) 53 | ./bin/run aem:COMMAND 54 | ``` 55 | 56 | ``` 57 | // run command as a binary (Windows) 58 | bin/run.cmd aem:COMMAND 59 | ``` 60 | 61 | ``` 62 | // run using specifed NPM command 63 | npm link // only needs to be run once 64 | aio-aem aem:COMMAND 65 | ``` 66 | 67 | # Commands 68 | 69 | * [`aio-aem aem:upload FILES_FOLDERS`](#aio-aem-aemupload-files_folders) 70 | 71 | ## `aio-aem aem:upload FILES_FOLDERS` 72 | 73 | Upload asset binaries to AEM 74 | 75 | ``` 76 | Upload asset binaries to AEM 77 | Uploads one or more files to a target AEM instance. The upload process uses the 78 | direct binary access algorithm, so the target instance must have direct binary 79 | access enabled; otherwise the upload will fail. 80 | 81 | The process will upload the files or directories (optionally recursively) provided in 82 | the command. 83 | 84 | Note that the process will only work with AEM instances that use basic 85 | (i.e. non-SSO) authentication. 86 | 87 | USAGE 88 | $ aio-aem aem:upload FILES_FOLDERS 89 | 90 | ARGUMENTS 91 | FILES_FOLDERS Space-delimited list of files and folders to upload. 92 | 93 | OPTIONS 94 | -c, --credential=credential [default: admin:admin] AEM credential 95 | The username and password for authenticating with the 96 | target AEM instance. Should be in the format 97 | :. 98 | 99 | -d, --deep Whether or not to recursively upload 100 | all descendant folders and files 101 | 102 | -h, --host=host [default: http://localhost:4502] AEM host 103 | The host value of the AEM instance where files will be 104 | uploaded. This should include everything in the host's 105 | URL up until /content/dam. 106 | 107 | -l, --log=log [default: upload-${timestamp}.log] Log file path 108 | The local path to where the process's log messages 109 | should be saved. 110 | 111 | -o, --output=output [default: result-${timestamp}.html] Result html file path 112 | The local path to where the process's metrics will be 113 | saved in html format. 114 | 115 | -r, --threads=threads [default: 5] Maximum threads 116 | Maximum number of files to upload concurrently. 117 | 118 | -t, --target=target [default: /content/dam/aem-upload-${timestamp}] Target AEM folder 119 | The folder in the target AEM instance where asset 120 | binaries should be uploaded. Should always begin with 121 | /content/dam. 122 | 123 | -v, --version Show version 124 | 125 | --help Show help 126 | 127 | DESCRIPTION 128 | Uploads one or more files to a target AEM instance. The upload process uses the 129 | direct binary access algorithm, so the target instance must have direct binary 130 | access enabled; otherwise the upload will fail. 131 | 132 | The process will upload the files or directories (optionally recursively) provided in 133 | the command. 134 | 135 | Note that the process will only work with AEM instances that use basic 136 | (i.e. non-SSO) authentication. 137 | 138 | EXAMPLES 139 | $ aio aem:upload myimage.jpg 140 | $ aio aem:upload -h http://myaeminstance -c admin:12345 myimage.jpg 141 | ``` 142 | 143 | _See code: [src/commands/aem/upload.js](https://github.com/adobe/aio-cli-plugin-aem/blob/v1.2.0/src/commands/aem/upload.js)_ 144 | 145 | 146 | # Proxy Support 147 | 148 | The AEM plugin supports proxies inline with the [AIO CLI](https://github.com/adobe/aio-cli#proxy-support). See the documentation there for details. 149 | 150 | # Releasing 151 | 152 | This module uses [semantic-release](https://github.com/semantic-release/semantic-release) when publishing new versions. The process is initiated upon merging commits to the `master` branch. Review semantic-release's documentation for commit message format. 153 | 154 | PRs whose messages do not meet semantic-release's format will _not_ generate a new release. 155 | 156 | Release notes are generated based on git commit messages. Release notes will appear in `CHANGELOG.md`. 157 | 158 | # Contributing 159 | 160 | Contributions are welcomed! Read the [Contributing Guide](CONTRIBUTING.md) for more information. 161 | 162 | # Licensing 163 | 164 | This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information. 165 | -------------------------------------------------------------------------------- /bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Copyright 2018 Adobe. All rights reserved. 5 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. You may obtain a copy 7 | of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | Unless required by applicable law or agreed to in writing, software distributed under 9 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 10 | OF ANY KIND, either express or implied. See the License for the specific language 11 | governing permissions and limitations under the License. 12 | */ 13 | 14 | require('@oclif/command').run() 15 | .catch(require('@oclif/errors/handle')) 16 | -------------------------------------------------------------------------------- /bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Copyright 2018 Adobe. All rights reserved. 4 | rem This file is licensed to you under the Apache License, Version 2.0 (the "License"); 5 | rem you may not use this file except in compliance with the License. You may obtain a copy 6 | rem of the License at http://www.apache.org/licenses/LICENSE-2.0 7 | rem 8 | rem Unless required by applicable law or agreed to in writing, software distributed under 9 | rem the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 10 | rem OF ANY KIND, either express or implied. See the License for the specific language 11 | rem governing permissions and limitations under the License. 12 | 13 | node "%~dp0\run" %* 14 | -------------------------------------------------------------------------------- /jest.setup.js: -------------------------------------------------------------------------------- 1 | const { stdout } = require('stdout-stderr') 2 | 3 | jest.setTimeout(30000) 4 | 5 | beforeEach(() => { 6 | stdout.start() 7 | jest.clearAllMocks() 8 | }) 9 | afterEach(() => { stdout.stop() }) -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@adobe/aio-cli-plugin-aem", 3 | "description": "AEM-related plugins to Adobe I/O CLI", 4 | "version": "1.2.0", 5 | "repository": "adobe/aio-cli-plugin-aem", 6 | "author": "Adobe", 7 | "contributors": [ 8 | "Mark Frisbey" 9 | ], 10 | "dependencies": { 11 | "@adobe/aem-upload": "^2.0.2", 12 | "@oclif/command": "^1", 13 | "@oclif/config": "^1.14.0", 14 | "@oclif/errors": "^1.1.2", 15 | "debug": "^4.1.0", 16 | "hpagent": "^1.2.0", 17 | "mustache": "^3.2.1", 18 | "winston": "^3.2.1" 19 | }, 20 | "devDependencies": { 21 | "@oclif/dev-cli": "^1.21.3", 22 | "@oclif/plugin-help": "^2.2.3", 23 | "@oclif/test": "^1", 24 | "@semantic-release/changelog": "^6.0.3", 25 | "@semantic-release/git": "^10.0.1", 26 | "acorn": "^6.4.1", 27 | "chalk": "^2.4.1", 28 | "codecov": "^3.6.5", 29 | "conventional-changelog-eslint": "^3.0.9", 30 | "eslint": "^6.8.0", 31 | "eslint-config-oclif": "^3.1.0", 32 | "eslint-config-standard": "^12.0.0", 33 | "eslint-plugin-import": "^2.20.2", 34 | "eslint-plugin-jest": "22.9.0", 35 | "eslint-plugin-node": "^9.0.0", 36 | "eslint-plugin-promise": "^4.0.0", 37 | "eslint-plugin-standard": "^4.0.0", 38 | "jest": "^29.5.0", 39 | "jest-haste-map": "^24.5.0", 40 | "jest-junit": "^6.0.0", 41 | "jest-resolve": "^24.5.0", 42 | "stdout-stderr": "^0.1.13" 43 | }, 44 | "optionalDependencies": { 45 | "semantic-release": "^21.0.2" 46 | }, 47 | "engines": { 48 | "node": ">=10.0.0" 49 | }, 50 | "files": [ 51 | "/oclif.manifest.json", 52 | "/src", 53 | "/bin", 54 | "/view" 55 | ], 56 | "keywords": [ 57 | "oclif-plugin" 58 | ], 59 | "bin": { 60 | "aio-aem": "./bin/run" 61 | }, 62 | "license": "Apache-2.0", 63 | "oclif": { 64 | "commands": "./src/commands", 65 | "bin": "aio-aem", 66 | "devPlugins": [ 67 | "@oclif/plugin-help" 68 | ] 69 | }, 70 | "scripts": { 71 | "posttest": "eslint src test", 72 | "test": "npm run unit-tests", 73 | "unit-tests": "jest --ci", 74 | "prepack": "oclif-dev manifest && oclif-dev readme", 75 | "postpack": "rm -f oclif.manifest.json", 76 | "version": "oclif-dev readme && git add README.md", 77 | "semantic-release": "semantic-release" 78 | }, 79 | "jest": { 80 | "collectCoverage": true, 81 | "testPathIgnorePatterns": [ 82 | "/tests/fixtures/" 83 | ], 84 | "coveragePathIgnorePatterns": [ 85 | "/tests/fixtures/" 86 | ], 87 | "reporters": [ 88 | "default", 89 | "jest-junit" 90 | ], 91 | "testEnvironment": "node", 92 | "setupFilesAfterEnv": [ 93 | "./jest.setup.js" 94 | ] 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/base-command.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const {Command, flags} = require('@oclif/command') 13 | 14 | class BaseCommand extends Command { 15 | async run() { 16 | return this.doRun(this.parse()); 17 | } 18 | 19 | async doRun(/* args */) { 20 | 21 | } 22 | } 23 | 24 | BaseCommand.flags = { 25 | version: flags.boolean({char: 'v', description: 'Show version'}), 26 | help: flags.boolean({description: 'Show help'}), 27 | } 28 | 29 | module.exports = BaseCommand 30 | -------------------------------------------------------------------------------- /src/commands/aem/upload.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Adobe. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const Path = require('path'); 14 | const fs = require('fs'); 15 | const winston = require('winston'); 16 | const mustache = require('mustache'); 17 | const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent'); 18 | 19 | const {flags} = require('@oclif/command'); 20 | const { 21 | FileSystemUploadOptions, 22 | FileSystemUpload, 23 | } = require('@adobe/aem-upload'); 24 | 25 | const BaseCommand = require('../../base-command'); 26 | const { trimRight } = require('../../utils'); 27 | 28 | function getLogger(logFile) { 29 | const { combine, timestamp, label, printf } = winston.format; 30 | const myFormat = printf(({ level, message, label, timestamp }) => { 31 | return `${timestamp} [${label}] ${level}: ${message}`; 32 | }); 33 | const log = winston.createLogger({ 34 | format: combine( 35 | label({ label: '' }), 36 | timestamp(), 37 | myFormat 38 | ), 39 | transports: [ 40 | new winston.transports.Console(), 41 | new winston.transports.File({ filename: logFile }) 42 | ] 43 | }); 44 | return log; 45 | } 46 | 47 | class UploadCommand extends BaseCommand { 48 | async doRun(args) { 49 | const { flags, argv } = args; 50 | 51 | const newFlags = Object.assign({}, flags); 52 | const timestamp = new Date().getTime(); 53 | Object.keys(newFlags).forEach(key => { 54 | if (typeof(newFlags[key]) === 'string') { 55 | newFlags[key] = newFlags[key].replace('${timestamp}', timestamp) 56 | } 57 | }); 58 | 59 | const { 60 | host, 61 | credential, 62 | target, 63 | log: logFile, 64 | output: htmlResult, 65 | threads, 66 | deep, 67 | } = newFlags; 68 | 69 | const uploadUrl = `${trimRight(host, ['/'])}${target}`; 70 | const uploadOptions = new FileSystemUploadOptions() 71 | .withUrl(uploadUrl) 72 | .withHttpOptions(this.buildHttpOptions(uploadUrl, credential)) 73 | .withDeepUpload(deep) 74 | .withMaxConcurrent(parseInt(threads, 10)); 75 | 76 | // setup logger 77 | const log = getLogger(logFile); 78 | 79 | // upload local folder 80 | const fileUpload = new FileSystemUpload({ log }); 81 | fileUpload.upload(uploadOptions, argv).then((allUploadResult) => { 82 | log.info('finished uploading files'); 83 | // generate html format result 84 | let mstTemplate = fs.readFileSync(Path.join(__dirname, '../../../view/result.mst')).toString(); 85 | let htmlOutput = mustache.render(mstTemplate, allUploadResult); 86 | fs.writeFileSync(htmlResult, htmlOutput); 87 | log.info(`Uploading result is saved to html file '${htmlResult}'`); 88 | }) 89 | .catch(err => { 90 | log.error('unhandled exception attempting to upload files', err); 91 | }); 92 | 93 | log.info(`Log file is saved to log file '${logFile}'`); 94 | } 95 | 96 | /** 97 | * Creates a simple object containing the options that will be provided 98 | * to Fetch for requests sent by the CLI. 99 | * @param {string} uploadUrl URL to which items are being uploaded. 100 | * @param {string} credential Basic auth credentials to include in 101 | * each request. 102 | * @returns {*} HTTP options for Fetch. 103 | */ 104 | buildHttpOptions(uploadUrl, credential) { 105 | const httpOptions = { 106 | headers: { 107 | Authorization: `Basic ${Buffer.from(credential).toString('base64')}` 108 | }, 109 | retryOptions: { 110 | retryOnHttpResponseError: UploadCommand.shouldRetry, 111 | }, 112 | }; 113 | const agent = this.getProxyAgent(uploadUrl); 114 | if (agent) { 115 | httpOptions.agent = agent; 116 | } 117 | return httpOptions; 118 | } 119 | 120 | /** 121 | * Determines whether a given HTTP response error should be retried. Qualifying errors will include 122 | * 404 response codes to the initiate/complete servlets. This is for handling eventual consistency 123 | * issues. 124 | * @param {*} [httpResponseError] An error received by the node-httptransfer module. 125 | * @returns {boolean} True if a request should be retried, false otherwise. 126 | */ 127 | static shouldRetry(httpResponseError = {}) { 128 | const { status, url = '' } = httpResponseError; 129 | const lowerCaseUrl = url.toLowerCase(); 130 | if (status === 404 && (lowerCaseUrl.includes('.initiateupload.json') || lowerCaseUrl.includes('.completeupload.json'))) { 131 | return true; 132 | } 133 | return false; 134 | } 135 | 136 | /** 137 | * Retrieves the HTTP agent that should be used to provide proxy capabilities 138 | * for the command. 139 | * @param {string} uploadUrl URL to which the uploading is being performed. 140 | * Will be used to determine which proxy to use. 141 | * @returns {*} An object that can be used as an HTTP agent for fetch. 142 | */ 143 | getProxyAgent(uploadUrl) { 144 | const url = new URL(uploadUrl); 145 | const httpsProxy = process.env.HTTPS_PROXY; 146 | const httpProxy = process.env.HTTP_PROXY; 147 | 148 | if (url.protocol === 'https:' && httpsProxy) { 149 | return new HttpsProxyAgent({ proxy: httpsProxy }); 150 | } else if (url.protocol === 'http:' && httpProxy) { 151 | return new HttpProxyAgent({ proxy: httpProxy }); 152 | } 153 | return undefined; 154 | } 155 | } 156 | 157 | UploadCommand.flags = Object.assign({}, BaseCommand.flags, { 158 | host: flags.string({ 159 | char: 'h', 160 | description: `AEM host 161 | The host value of the AEM instance where files will be 162 | uploaded. This should include everything in the host's 163 | URL up until /content/dam.`, 164 | default: 'http://localhost:4502' 165 | }), 166 | credential: flags.string({ 167 | char: 'c', 168 | description: `AEM credential 169 | The username and password for authenticating with the 170 | target AEM instance. Should be in the format 171 | :.`, 172 | default: 'admin:admin' 173 | }), 174 | target: flags.string({ 175 | char: 't', 176 | description: `Target AEM folder 177 | The folder in the target AEM instance where asset 178 | binaries should be uploaded. Should always begin with 179 | /content/dam.`, 180 | default: '/content/dam/aem-upload-${timestamp}' 181 | }), 182 | log: flags.string({ 183 | char: 'l', 184 | description: `Log file path 185 | The local path to where the process's log messages 186 | should be saved.`, 187 | default: 'upload-${timestamp}.log' 188 | }), 189 | output: flags.string({ 190 | char: 'o', 191 | description: `Result html file path 192 | The local path to where the process's metrics will be 193 | saved in html format.`, 194 | default: 'result-${timestamp}.html' 195 | }), 196 | threads: flags.string({ 197 | char: 'r', 198 | description: `Maximum threads 199 | Maximum number of files to upload concurrently.`, 200 | default: 5, 201 | }), 202 | deep: flags.boolean({ 203 | char: 'd', 204 | description: `Whether or not to recursively upload 205 | all descendant folders and files`, 206 | default: false, 207 | }) 208 | }) 209 | 210 | UploadCommand.strict = false 211 | 212 | UploadCommand.args = [{ 213 | name: 'files_folders', 214 | required: true, 215 | description: `Space-delimited list of files and folders to upload.` 216 | }]; 217 | 218 | UploadCommand.description = `Upload asset binaries to AEM 219 | Uploads one or more files to a target AEM instance. The upload process uses the 220 | direct binary access algorithm, so the target instance must have direct binary 221 | access enabled; otherwise the upload will fail. 222 | 223 | The process will upload the files or directories (optionally recursively) provided in 224 | the command. 225 | 226 | Note that the process will only work with AEM instances that use basic 227 | (i.e. non-SSO) authentication.` 228 | 229 | UploadCommand.examples = [ 230 | '$ aio aem:upload myimage.jpg', 231 | '$ aio aem:upload -h http://myaeminstance -c admin:12345 myimage.jpg ', 232 | ] 233 | 234 | module.exports = { 235 | upload: UploadCommand 236 | } 237 | -------------------------------------------------------------------------------- /src/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | function buildCharRegex(charArray) { 14 | let regex = '['; 15 | 16 | charArray.forEach(char => { 17 | if (char === '\\' || char === ']') { 18 | regex += '\\'; 19 | } 20 | regex += char; 21 | }); 22 | 23 | regex += ']'; 24 | 25 | return regex; 26 | } 27 | 28 | /** 29 | * Removes a given set of characters from the end of a string. 30 | * 31 | * @param {string} toTrim The value to be trimmed. 32 | * @param {Array} charArray An array of single characters to trim. 33 | */ 34 | module.exports.trimRight = function trimRight(toTrim, charArray) { 35 | if (toTrim && toTrim.replace) { 36 | return toTrim.replace(new RegExp(`${buildCharRegex(charArray)}*$`, 'g'), ''); 37 | } 38 | return toTrim; 39 | } 40 | -------------------------------------------------------------------------------- /test/commands/aem/upload.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Adobe. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const UploadCommand = require('../../../src/commands/aem/upload') 14 | const {stdout} = require('stdout-stderr') 15 | 16 | describe('upload tests', () => { 17 | const OLD_ENV = process.env; 18 | 19 | beforeAll(() => stdout.start()) 20 | afterAll(() => stdout.stop()) 21 | 22 | beforeEach(() => { 23 | jest.resetModules(); 24 | process.env = { ...OLD_ENV }; 25 | }); 26 | 27 | afterEach(() => { 28 | process.env = OLD_ENV; 29 | }); 30 | 31 | test('exports', async () => { 32 | expect(typeof UploadCommand.upload).toEqual('function') 33 | }) 34 | 35 | test('deep', async () => { 36 | expect(UploadCommand.upload.flags.deep.char).toEqual('d') 37 | }) 38 | 39 | test('http options', () => { 40 | const command = new UploadCommand.upload(); 41 | const options = command.buildHttpOptions('https://faketargeturl', 'testing:testing'); 42 | expect(options.headers).toStrictEqual({ 43 | Authorization: 'Basic dGVzdGluZzp0ZXN0aW5n' 44 | }); 45 | expect(typeof options.retryOptions.retryOnHttpResponseError).toStrictEqual('function'); 46 | const httpOptions = command.buildHttpOptions('http://faketargeturl', 'testing:testing'); 47 | expect(httpOptions).toStrictEqual(options); 48 | }); 49 | 50 | test('https proxy', () => { 51 | process.env.HTTPS_PROXY = 'https://fakeproxy'; 52 | const command = new UploadCommand.upload(); 53 | const options = command.buildHttpOptions('https://faketargeturl', 'testing:testing'); 54 | expect(options.headers).toStrictEqual({ 55 | Authorization: 'Basic dGVzdGluZzp0ZXN0aW5n' 56 | }); 57 | expect(options.agent.constructor.name).toEqual('HttpsProxyAgent'); 58 | }); 59 | 60 | test('http proxy', () => { 61 | process.env.HTTP_PROXY = 'http://fakeproxy'; 62 | const command = new UploadCommand.upload(); 63 | const options = command.buildHttpOptions('http://faketargeturl', 'testing:testing'); 64 | expect(options.headers).toStrictEqual({ 65 | Authorization: 'Basic dGVzdGluZzp0ZXN0aW5n' 66 | }); 67 | expect(options.agent.constructor.name).toEqual('HttpProxyAgent'); 68 | }); 69 | 70 | test('http both proxies', () => { 71 | process.env.HTTPS_PROXY = 'https://fakeproxy'; 72 | process.env.HTTP_PROXY = 'http://fakeproxy'; 73 | const command = new UploadCommand.upload(); 74 | const options = command.buildHttpOptions('https://fakeproxyurl', 'testing:testing'); 75 | expect(options.headers).toStrictEqual({ 76 | Authorization: 'Basic dGVzdGluZzp0ZXN0aW5n' 77 | }); 78 | expect(options.agent.constructor.name).toEqual('HttpsProxyAgent'); 79 | 80 | const httpOptions = command.buildHttpOptions('http://fakeproxyurl', 'testing:testing'); 81 | expect(httpOptions.agent.constructor.name).toEqual('HttpProxyAgent'); 82 | }); 83 | 84 | test('should retry', () => { 85 | expect(UploadCommand.upload.shouldRetry()).toStrictEqual(false); 86 | expect(UploadCommand.upload.shouldRetry({})).toStrictEqual(false); 87 | expect(UploadCommand.upload.shouldRetry({ 88 | status: 200, 89 | url: 'http://fakeurl/path.initiateupload.json', 90 | })).toStrictEqual(false); 91 | expect(UploadCommand.upload.shouldRetry({ 92 | status: 404, 93 | url: 'http://fakeurl/path.initiateupload.json', 94 | })).toStrictEqual(true); 95 | expect(UploadCommand.upload.shouldRetry({ 96 | status: 404, 97 | url: 'http://fakeurl/path.completeupload.json', 98 | })).toStrictEqual(true); 99 | expect(UploadCommand.upload.shouldRetry({ 100 | status: 200, 101 | url: 'http://fakeurl/path.completeupload.json', 102 | })).toStrictEqual(false); 103 | expect(UploadCommand.upload.shouldRetry({ 104 | status: 404, 105 | url: 'http://fakeurl/path', 106 | })).toStrictEqual(false); 107 | }); 108 | }); 109 | -------------------------------------------------------------------------------- /test/utils.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const utils = require('../src/utils'); 14 | 15 | test('trim right', async () => { 16 | expect(utils.trimRight('/', ['/'])).toEqual(''); 17 | expect(utils.trimRight('http://localhost/', ['/'])).toEqual('http://localhost'); 18 | expect(utils.trimRight('http://localhost//////', ['/'])).toEqual('http://localhost'); 19 | }) 20 | -------------------------------------------------------------------------------- /view/result.mst: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Skyline upload result 7 | 8 | 9 | 10 | 11 |

Overall result

12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
HostTotal File#Total Uploaded#Total File SizeTotal Spent Time(ms)Time Spent Creating Folders(ms)
{{host}}{{totalFiles}}{{totalCompleted}}{{totalFileSize}}{{totalTime}}{{folderCreateSpent}}
39 | 40 |

Folders Created

41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {{#createdFolders}} 52 | 53 | 54 | 55 | 56 | 57 | {{#retryErrors}} 58 | 59 | 60 | 61 | 62 | {{/retryErrors}} 63 | {{/createdFolders}} 64 | 65 |
TitlePathTotal Spent Time(ms)
{{folderTitle}}{{folderPath}}{{elapsedTime}}
Retry Error{{code}}{{message}}
66 | 67 |

Detailed result

68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | {{#detailedResult}} 80 | 81 | 82 | 83 | 84 | 85 | {{#result.errors}} 86 | 87 | 88 | 89 | 90 | {{/result.errors}} 91 | {{/detailedResult}} 92 | 93 |
File URLFile SizeFile Path
{{fileUrl}}{{fileSize}}{{filePath}}
Error{{.}}
94 | 95 | --------------------------------------------------------------------------------