livingdocs-cli 1.3.1 → 2.1.0

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.
@@ -6,20 +6,19 @@ const errorReporter = require('../../lib/api/error_reporter')
6
6
  const resultReporter = require('../../lib/api/channel_config_result_reporter')
7
7
  const readChannelConfig = require('../../lib/read_channel_config')
8
8
 
9
- const description = `See what would be updated in a publish command`
10
- const commandFlags = {
11
- project: sharedFlags.project,
12
- env: sharedFlags.env,
13
- token: {...sharedFlags.configWriteToken, required: true},
14
- host: {...sharedFlags.host, required: true},
15
- dist: {
16
- ...sharedFlags.dist,
17
- required: true,
18
- description: 'The folder or filename to the channelConfig.'
19
- }
20
- }
21
-
22
9
  class PlanCommand extends Command {
10
+ static description = `See what would be updated in a publish command`
11
+ static flags = {
12
+ project: sharedFlags.project,
13
+ env: sharedFlags.env,
14
+ token: {...sharedFlags.configWriteToken, required: true},
15
+ host: {...sharedFlags.host, required: true},
16
+ dist: {
17
+ ...sharedFlags.dist,
18
+ required: true,
19
+ description: 'The folder or filename to the channelConfig.'
20
+ }
21
+ }
23
22
 
24
23
  async run () {
25
24
  const {token, host, dist} = this.parse(PlanCommand).flags
@@ -35,6 +34,4 @@ class PlanCommand extends Command {
35
34
  }
36
35
  }
37
36
 
38
- PlanCommand.description = description
39
- PlanCommand.flags = commandFlags
40
37
  module.exports = PlanCommand
@@ -9,20 +9,19 @@ const resultReporter = require('../../lib/api/channel_config_result_reporter')
9
9
  const readChannelConfig = require('../../lib/read_channel_config')
10
10
  const updateRevisionNumber = require('../../lib/update_revision_number')
11
11
 
12
- const description = `Publish a ChannelConfig to your project`
13
- const commandFlags = {
14
- project: sharedFlags.project,
15
- env: sharedFlags.env,
16
- token: {...sharedFlags.configWriteToken, required: true},
17
- host: {...sharedFlags.host, required: true},
18
- dist: {
19
- ...sharedFlags.dist,
20
- required: true,
21
- description: 'The folder or filename to the channelConfig.'
22
- }
23
- }
24
-
25
12
  class PublishCommand extends Command {
13
+ static description = `Publish a ChannelConfig to your project`
14
+ static flags = {
15
+ project: sharedFlags.project,
16
+ env: sharedFlags.env,
17
+ token: {...sharedFlags.configWriteToken, required: true},
18
+ host: {...sharedFlags.host, required: true},
19
+ dist: {
20
+ ...sharedFlags.dist,
21
+ required: true,
22
+ description: 'The folder or filename to the channelConfig.'
23
+ }
24
+ }
26
25
 
27
26
  async run () {
28
27
  const {token, host, dist, env} = this.parse(PublishCommand).flags
@@ -59,6 +58,4 @@ class PublishCommand extends Command {
59
58
  }
60
59
  }
61
60
 
62
- PublishCommand.description = description
63
- PublishCommand.flags = commandFlags
64
61
  module.exports = PublishCommand
@@ -7,24 +7,23 @@ const errorReporter = require('../../lib/api/error_reporter')
7
7
  const resultReporter = require('../../lib/api/channel_config_result_reporter')
8
8
  const readChannelConfig = require('../../lib/read_channel_config')
9
9
 
10
- const description = `Upload a ChannelConfig into a draft for your project`
11
- const commandFlags = {
12
- project: sharedFlags.project,
13
- env: sharedFlags.env,
14
- token: {...sharedFlags.configWriteToken, required: true},
15
- host: {...sharedFlags.host, required: true},
16
- dist: flags.string({
17
- char: 'd',
18
- required: true,
19
- description: 'The folder or filename to the channelConfig.'
20
- }),
21
- draftName: flags.string({
22
- description: 'The name of the draft the config will be saved under.',
23
- required: true
24
- })
25
- }
26
-
27
10
  class UploadCommand extends Command {
11
+ static description = `Upload a ChannelConfig into a draft for your project`
12
+ static flags = {
13
+ project: sharedFlags.project,
14
+ env: sharedFlags.env,
15
+ token: {...sharedFlags.configWriteToken, required: true},
16
+ host: {...sharedFlags.host, required: true},
17
+ dist: flags.string({
18
+ char: 'd',
19
+ required: true,
20
+ description: 'The folder or filename to the channelConfig.'
21
+ }),
22
+ draftName: flags.string({
23
+ description: 'The name of the draft the config will be saved under.',
24
+ required: true
25
+ })
26
+ }
28
27
 
29
28
  async run () {
30
29
  const {token, host, dist} = this.parse(UploadCommand).flags
@@ -45,6 +44,4 @@ class UploadCommand extends Command {
45
44
  }
46
45
  }
47
46
 
48
- UploadCommand.description = description
49
- UploadCommand.flags = commandFlags
50
47
  module.exports = UploadCommand
@@ -5,17 +5,16 @@ const {Command, flags} = require('@oclif/command')
5
5
  const sharedFlags = require('../../lib/cli/shared_flags')
6
6
  const liApi = require('../../lib/api/livingdocs_api')
7
7
 
8
- const description = `Upload assets to your project`
9
- const commandFlags = {
10
- token: {...sharedFlags.configWriteToken, required: true},
11
- host: sharedFlags.host,
12
- assets: flags.string({
13
- char: 'a',
14
- description: 'The folder where you asset files are located.'
15
- })
16
- }
17
-
18
8
  class UploadAssetsCommand extends Command {
9
+ static description = `Upload assets to your project`
10
+ static flags = {
11
+ token: {...sharedFlags.configWriteToken, required: true},
12
+ host: sharedFlags.host,
13
+ assets: flags.string({
14
+ char: 'a',
15
+ description: 'The folder where you asset files are located.'
16
+ })
17
+ }
19
18
 
20
19
  async run () {
21
20
  const {token, host, assets} = this.parse(UploadAssetsCommand).flags
@@ -44,6 +43,4 @@ class UploadAssetsCommand extends Command {
44
43
 
45
44
  }
46
45
 
47
- UploadAssetsCommand.description = description
48
- UploadAssetsCommand.flags = commandFlags
49
46
  module.exports = UploadAssetsCommand
@@ -1,4 +1,6 @@
1
1
  const fs = require('fs-extra')
2
+ const yaml = require('js-yaml')
3
+
2
4
  const _get = require('lodash/get')
3
5
 
4
6
  let cliConfig
@@ -31,7 +33,8 @@ function readFile () {
31
33
  const filepath = `${workingDir}/.livingdocs-cli`
32
34
 
33
35
  if (fs.existsSync(filepath)) {
34
- const config = fs.readJsonSync(filepath)
36
+
37
+ const config = yaml.load(fs.readFileSync(filepath))
35
38
  return config
36
39
 
37
40
  }