@contentstack/cli-cm-export 0.1.1-beta.14 → 0.1.1-beta.15

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/README.md CHANGED
@@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-export
37
37
  $ csdx COMMAND
38
38
  running command...
39
39
  $ csdx (-v|--version|version)
40
- @contentstack/cli-cm-export/0.1.1-beta.14 linux-x64 node-v16.14.2
40
+ @contentstack/cli-cm-export/0.1.1-beta.15 linux-x64 node-v16.14.2
41
41
  $ csdx --help [COMMAND]
42
42
  USAGE
43
43
  $ csdx COMMAND
@@ -87,5 +87,5 @@ EXAMPLES
87
87
  csdx cm:export -A -B [optional] branch name
88
88
  ```
89
89
 
90
- _See code: [src/commands/cm/export.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.14/packages/contentstack-export/src/commands/cm/export.js)_
90
+ _See code: [src/commands/cm/export.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.15/packages/contentstack-export/src/commands/cm/export.js)_
91
91
  <!-- commandsstop -->
@@ -1 +1 @@
1
- {"version":"0.1.1-beta.14","commands":{"cm:export":{"id":"cm:export","description":"Export content from a stack\n...\nExport content from one stack to another\n","pluginName":"@contentstack/cli-cm-export","pluginType":"core","aliases":[],"examples":["csdx cm:export -A","csdx cm:export -A -s <stack_ApiKey> -d <path/of/export/destination/dir>","csdx cm:export -A -c <path/to/config/dir>","csdx cm:export -A -m <single module name>","csdx cm:export -A --secured-assets","csdx cm:export -a <management_token_alias>","csdx cm:export -a <management_token_alias> -d <path/to/export/destination/dir>","csdx cm:export -a <management_token_alias> -c <path/to/config/file>","csdx cm:export -A -m <single module name>","csdx cm:export -A -m <single module name> -t <content type>","csdx cm:export -A -B [optional] branch name"],"flags":{"config":{"name":"config","type":"option","char":"c","description":"[optional] path of the config"},"stack-uid":{"name":"stack-uid","type":"option","char":"s","description":"API key of the source stack"},"data":{"name":"data","type":"option","char":"d","description":"path or location to store the data"},"management-token-alias":{"name":"management-token-alias","type":"option","char":"a","description":"alias of the management token"},"auth-token":{"name":"auth-token","type":"boolean","char":"A","description":"to use auth token","allowNo":false},"module":{"name":"module","type":"option","char":"m","description":"[optional] specific module name"},"content-type":{"name":"content-type","type":"option","char":"t","description":"[optional] content type"},"branch":{"name":"branch","type":"option","char":"B","description":"[optional] branch name"},"secured-assets":{"name":"secured-assets","type":"boolean","description":"[optional] use when assets are secured","allowNo":false}},"args":[]}}}
1
+ {"version":"0.1.1-beta.15","commands":{"cm:export":{"id":"cm:export","description":"Export content from a stack\n...\nExport content from one stack to another\n","pluginName":"@contentstack/cli-cm-export","pluginType":"core","aliases":[],"examples":["csdx cm:export -A","csdx cm:export -A -s <stack_ApiKey> -d <path/of/export/destination/dir>","csdx cm:export -A -c <path/to/config/dir>","csdx cm:export -A -m <single module name>","csdx cm:export -A --secured-assets","csdx cm:export -a <management_token_alias>","csdx cm:export -a <management_token_alias> -d <path/to/export/destination/dir>","csdx cm:export -a <management_token_alias> -c <path/to/config/file>","csdx cm:export -A -m <single module name>","csdx cm:export -A -m <single module name> -t <content type>","csdx cm:export -A -B [optional] branch name"],"flags":{"config":{"name":"config","type":"option","char":"c","description":"[optional] path of the config"},"stack-uid":{"name":"stack-uid","type":"option","char":"s","description":"API key of the source stack"},"data":{"name":"data","type":"option","char":"d","description":"path or location to store the data"},"management-token-alias":{"name":"management-token-alias","type":"option","char":"a","description":"alias of the management token"},"auth-token":{"name":"auth-token","type":"boolean","char":"A","description":"to use auth token","allowNo":false},"module":{"name":"module","type":"option","char":"m","description":"[optional] specific module name"},"content-type":{"name":"content-type","type":"option","char":"t","description":"[optional] content type"},"branch":{"name":"branch","type":"option","char":"B","description":"[optional] branch name"},"secured-assets":{"name":"secured-assets","type":"boolean","description":"[optional] use when assets are secured","allowNo":false}},"args":[]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-export",
3
3
  "description": "Contentstack CLI plugin to export content from stack",
4
- "version": "0.1.1-beta.14",
4
+ "version": "0.1.1-beta.15",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
@@ -18,6 +18,7 @@
18
18
  "is-valid-path": "^0.1.1",
19
19
  "lodash": "^4.17.20",
20
20
  "path": "^0.12.7",
21
+ "progress-stream": "^2.0.0",
21
22
  "proxyquire": "^2.1.3",
22
23
  "request": "^2.88.2",
23
24
  "winston": "^2.2.0"
@@ -103,6 +103,7 @@ module.exports = {
103
103
  ],
104
104
  // no of asset version files (of a single asset) that'll be downloaded parallelly
105
105
  downloadLimit: 5,
106
+ enableDownloadStatus: false
106
107
  },
107
108
  content_types: {
108
109
  dirName: 'content_types',
@@ -11,6 +11,7 @@ const fs = require('fs')
11
11
  const Promise = require('bluebird')
12
12
  const _ = require('lodash')
13
13
  const chalk = require('chalk')
14
+ const progress = require('progress-stream')
14
15
 
15
16
  const helper = require('../util/helper')
16
17
  const {addlogs} = require('../util/log')
@@ -269,10 +270,26 @@ ExportAssets.prototype = {
269
270
 
270
271
  self.assetStream.url = encodeURI(self.assetStream.url);
271
272
  const assetStreamRequest = nativeRequest(self.assetStream)
272
- assetStreamRequest.on('response', function () {
273
+ assetStreamRequest.on('response', function (response) {
274
+
273
275
  helper.makeDirectory(assetFolderPath)
274
276
  const assetFileStream = fs.createWriteStream(assetFilePath)
275
- assetStreamRequest.pipe(assetFileStream)
277
+
278
+ if(assetConfig.enableDownloadStatus) {
279
+ const str = progress({
280
+ length: response.headers['content-length'],
281
+ time: 5000,
282
+ })
283
+
284
+ str.on('progress', function (progressData) {
285
+ console.log(`${asset.filename}: ${Math.round(progressData.percentage)}%`)
286
+ })
287
+
288
+ assetStreamRequest.pipe(str).pipe(assetFileStream)
289
+ } else {
290
+ assetStreamRequest.pipe(assetFileStream)
291
+ }
292
+
276
293
  assetFileStream.on('close', function () {
277
294
  addlogs(config, 'Downloaded ' + asset.filename + ': ' + asset.uid + ' successfully!', 'success')
278
295
  return resolve()