SAP / cf-html5-apps-repo-cli-plugin

Cloud Foundry CLI plugin to work with SAP Cloud HTML5 Applications Repository
Apache License 2.0
43 stars 6 forks source link

HTML5-Push command creates a directory structure in repo #28

Open IObert opened 4 years ago

IObert commented 4 years ago

Description

When I use cf html5-push -n cloud-everywhere-html5-host . to push my sample app in the repo, the CLI tells me the push was successful. However, the web app doesn't work as the directory structure in the repo is incorrect. When I run cf html5-get todoapp, I get:

/todoapp-1.0.0/.DS_Store   
/todoapp-1.0.0/asset-manifest.json   
/todoapp-1.0.0/favicon.ico   
/todoapp-1.0.0/index.html   
/todoapp-1.0.0/manifest.json   
/todoapp-1.0.0/precache-manifest.a27f27aad95390114b2aa4e993149d28.js   
/todoapp-1.0.0/service-worker.js   
/todoapp-1.0.0/static/static/.DS_Store   
/todoapp-1.0.0/static/static/css/main.77c5918b.chunk.css   
/todoapp-1.0.0/static/static/js/1.5055ae49.chunk.js   
/todoapp-1.0.0/static/static/js/main.be25fbed.chunk.js   
/todoapp-1.0.0/static/static/js/runtime~main.ca8789d6.js   
/todoapp-1.0.0/static/static/media/logo.60a8874b.png   
/todoapp-1.0.0/xs-app.json   

The nested static folder shouldn't be there as the original project only has only one folder with that name (see attachment)

Environment

CLI Output

Set environment variable DEBUG=1, run the flow and paste output here:

cf html5-push -n cloud-everywhere-html5-host .
Initializing command 'html5-push'
Executing command 'html5-push': args: '[-n cloud-everywhere-html5-host .]'
Redeploy flag: false
Service name: cloud-everywhere-html5-host
Checking if '.' is an app-host-id
Getting context (org/space/username)
Resolving app-host-id by service instance name 'cloud-everywhere-html5-host'
Making request to: /v2/service_instances?q=name:cloud-everywhere-html5-host&q=space_guid:41d9a14f-e4a9-48d1-a8de-706c107c5979
Resolved app-host-id is 'ad610053-5e94-46c6-b237-9e59b5859c30'
Getting context (org/space/username)
Redeploying HTML5 applications in org D056949trial_CFTrialJan20 / space dev as marius.obert@sap.com...
Checking if './' directory is an application directory
Directory './' contains manifest.json
Directory './' contains xs-app.json
Reading ./manifest.json
Extracting application name from: {
  "short_name": "React App",
  "name": "Create React App Sample",
  "icons": [
    {
      "src": "favicon.ico",
      "sizes": "64x64 32x32 24x24 16x16",
      "type": "image/x-icon"
    }
  ],
  "start_url": ".",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff",
  "sap.app": {
    "id": "todoapp",
    "applicationVersion": {
      "version": "1.0.0"
    }
  }
}
Creating service key for app-host-id 'ad610053-5e94-46c6-b237-9e59b5859c30'
Making request to: /v2/service_keys
Obtaining access token for service key 'html5-key-1582028962'
Making request to: https://cftrialjan20.authentication.eu10.hana.ondemand.com/oauth/token
Zipping the directory: '.'
Adding file to archive: './.DS_Store'
Adding file to archive: './asset-manifest.json'
Adding file to archive: './favicon.ico'
Adding file to archive: './index.html'
Adding file to archive: './manifest.json'
Adding file to archive: './precache-manifest.a27f27aad95390114b2aa4e993149d28.js'
Adding file to archive: './service-worker.js'
Adding file to archive: './static'
Adding file to archive: './xs-app.json'
Adding '/var/folders/xh/tp1v0wc51w5bvmgmk05ydkkr0000gn/T/todoapp-1.0.0.zip' as part to multipart request
Making request to: https://html5-apps-repo-dt.cfapps.eu10.hana.ondemand.com/applications/content/
Successfully uploaded: [/var/folders/xh/tp1v0wc51w5bvmgmk05ydkkr0000gn/T/todoapp-1.0.0.zip]
Deleting temporarry zip file: '/var/folders/xh/tp1v0wc51w5bvmgmk05ydkkr0000gn/T/todoapp-1.0.0.zip'
Deleting temporarry service key: 'html5-key-1582028962'
Making request to: /v2/service_keys/ca750c95-0d08-44f4-ab40-9ecae53816f9
OK
micellius commented 4 years ago

Hi @IObert . Thanks for reporting an issue.

I managed to reproduce the issue you have. The problem is with relative path that you use. Please try one of the following:

hschaefer123 commented 4 years ago

Hi, i also ran into the same issue on win10 using

cf html5-push -n webshop_html5_repo_host deployer/resources/shop

the only working solution for ui5 is the generated dist folder without subdirectories.

If i used an absolute path, the path is also part of the directory in html-list output:

/stzhwebshopuishop-1.0.0/view/d:/@stzh/stzh.webshop/deployer/resources/shop/view/fragment/CategoryMenu.fragment.xml

My current workaround is changing the directory and callig it in place cd deployer/resources/shop && cf html5-push -n webshop_html5_repo_host

but wourld be great if the path option would be fixed also.

Regards Holger