Upload a Webpackage
TOC
Basics
As coder you can develop and test your webpackage(s) locally using the CDT (Coder DevTools). In order to provide it for a larger audience you should upload it.
Uploading a webpackage means to transfer all files of a webpackage folder into a selected store of a Cubbles Base instance.
Upload Configuration
Details for the upload of a webpackage are configured by the uploadConfigs
Object in the .webpackage
file within the root folder of each webpackage.
Initial setup
Initially the .webpackage
file doesn't contain any configuration.
Just run the grunt task +webpackage-upload
to initialize the file with respect to webpackage upload:
# [...]/my-cubbles-project/devtools $ grunt +webpackage-upload
Now you see the .webpackage
file containing an "uploadConfigs"
object with 2 example configurations. Just rename / adapt them to your needs. You can define as many configurations as you like. When running an upload you will be prompted to select one of these.
The configuration object explained:
url [mandatory, string/url]
: This is the url of the Cubbles Base the webpackage will be uploaded to.proxy [optional, string/url]
: If your connection to the Cubbles Base is routed over a proxy server, use this attribute to provide the proxy url.dryRun [optional, boolean]
: This option allows you to run the upload task, without uploading anything. It's perfect to check your store permissions or your.cubblesignore
configuration.debug [optional, boolean]
: Set the debug option to "true" prints more details.
Ignore files from upload (.cubblesignore
)
The .cubblesignore
file allows you to prevent individually defined files and folders from upload. Internally we use the glob package - so just read the glob-primer for supported patterns.
.webpackage { } | |
.webpackage (initialised) { "uploadConfigs": { "dryRun": { "url": "https://cubbles.world/sandbox", "proxy": "", "dryRun": true }, "release": { "url": "https://cubbles.world/sandbox", "proxy": "" } } } |
Some real world examples:
- https://github.com/iCubbles/ckeditor/blob/master/webpackages/ckeditor/.webpackage
- https://github.com/iCubbles/cubx-polymer-elements/blob/master/webpackages/com.incowia.cubx-google-map/.webpackage
- https://github.com/iCubbles/demo.elections/blob/master/webpackages/com.incowia.demo.elections/.webpackage
Required Permissions
Uploading a webpackage into a server-side store requires your accout to have appropriated permissions.
You can easily check your current permissions for 1..n stores via curl:
$ curl -s -X POST -H "Content-type: application/json" https://cubbles.world/_api/authenticate -d '{"user":"{username}","password":"{password}","stores":["sandbox","shared"]}' {"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiMyIsImdyb3VwcyI6WyJiZGUtdGVzdC5kZXZlbG9wZXJzIiwiY29yZS5kZXZlbG9wZXJzIiwiaW5jb3dpYS5kZXZlbG9wZXJzIiwib2Rpbi5kZXZlbG9wZXJzIiwicGNwLXNhbmRib3guZGV2ZWxvcGVycyIsInNhbmRib3guZGV2ZWxvcGVycyJdLCJwZXJtaXNzaW9ucyI6eyJzYW5kYm94Ijp7InVwbG9hZCI6dHJ1ZX19LCJpYXQiOjE0ODgxNzk2NDYsImV4cCI6MTQ4ODE4MzI0Nn0.hg1a7CvY02h3JBF8f8ZL9_mS_J3w-o6eo83nXvHHR1M"}
The response contains an access token.
Just use https://jwt.io/ to decode it and look at the permissions
property to see for which of the passed stores you have rights for:
Perform an Upload
To perform an upload
- run the grunt task
+webpackage-upload,
- choose the configuration to be used and
- provide provide your credentials.
# [...]/my-cubbles-project/devtools $ grunt +webpackage-upload Currently mapped Webpackage: super-package (@see ..\webpackages\.workspace) Running "+webpackage-upload" task > Reading available configs from '..\webpackages\super-package\.webpackage' ? Please type the index of your choice to SELECT A CONFIG or to CANCEL the upload: 1 Starting upload ... ? username: hrbu ? password: ************* Done, without errors.
Then your webpackage is released and all components a ready to be used.
Use the artifactsearch of the store you uploaded into to see each artifact of your webpackage listed (here the "sandbox" store): https://cubbles.world/sandbox/cubx.core.artifactsearch@1.6.0/artifactsearch/index.html