@uscreen.de/dev-service 0.12.5 → 0.12.6

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
@@ -271,8 +271,7 @@ services:
271
271
  - thread_pool.bulk.queue_size=200
272
272
  volumes:
273
273
  elasticsearch-data:
274
- external:
275
- name: "foobar-dev-repo-elasticsearch-data"
274
+ name: "foobar-dev-repo-elasticsearch-data"
276
275
  ```
277
276
 
278
277
  This action has the following features & caveats:
@@ -331,6 +330,14 @@ And the folder structure would look like this:
331
330
 
332
331
  > Format according to https://keepachangelog.com
333
332
 
333
+ ### v0.12.6
334
+ #### Fixed
335
+ - work with current docker compose
336
+
337
+ ### v0.12.0
338
+ #### Added
339
+ - mariadb template
340
+
334
341
  ### v0.11.17
335
342
  #### Fixed
336
343
  - custom services with container ports lower than 60 now work as expected
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uscreen.de/dev-service",
3
- "version": "0.12.5",
3
+ "version": "0.12.6",
4
4
  "description": "cli to manage services in dev repos",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/check.js CHANGED
@@ -110,13 +110,10 @@ const getOwnPorts = () =>
110
110
  ps.push('ps', '-q')
111
111
 
112
112
  exec(`docker-compose ${ps.join(' ')}`, function (err, stdout, stderr) {
113
- if (err) {
114
- return reject(err)
115
- }
113
+ if (err) return reject(err)
116
114
 
117
- if (stderr.toString().trim()) {
118
- return reject(stderr.toString().trim())
119
- }
115
+ const errMessage = stderr.toString().trim()
116
+ if (errMessage) return reject(Error(errMessage))
120
117
 
121
118
  const ids = stdout.split('\n').filter((id) => id)
122
119
 
@@ -133,9 +130,10 @@ const getOwnPorts = () =>
133
130
  const getContainerPorts = (containerId) =>
134
131
  new Promise((resolve, reject) => {
135
132
  exec(`docker port ${containerId}`, function (err, stdout, stderr) {
136
- if (err || stderr.toString().trim()) {
137
- return reject(err)
138
- }
133
+ if (err) return reject(err)
134
+
135
+ const errMessage = stderr.toString().trim()
136
+ if (errMessage) return reject(Error(errMessage))
139
137
 
140
138
  const lines = stdout.split('\n').filter((l) => l)
141
139
  const ports = lines
@@ -210,9 +208,10 @@ const getProcess = async (pid) =>
210
208
  exec(
211
209
  `ps -p ${pid} -ww -o pid,ppid,uid,gid,args`,
212
210
  function (err, stdout, stderr) {
213
- if (err || stderr.toString().trim()) {
214
- return reject(err)
215
- }
211
+ if (err) return reject(err)
212
+
213
+ const errMessage = stderr.toString().trim()
214
+ if (errMessage) return reject(Error(errMessage))
216
215
 
217
216
  const processes = stdout
218
217
  .toString()
package/src/install.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import path from 'path'
4
+ import os from 'os'
4
5
  import fs from 'fs-extra'
5
6
  import YAML from 'yaml'
6
7
  import parseJson from 'parse-json'
@@ -52,6 +53,8 @@ const fillTemplate = (template, data, removeSections, keepSections) => {
52
53
  template = template.replace(new RegExp(`{{/?${k}}}\n?`, 'gm'), '')
53
54
  }
54
55
 
56
+ template = template.replace('{{current_uid}}', os.userInfo().uid)
57
+
55
58
  return template
56
59
  }
57
60
 
@@ -79,9 +82,9 @@ const ensureNamedVolumes = async (content) => {
79
82
 
80
83
  const volumes = []
81
84
  for (const key in data.volumes) {
82
- if (!data.volumes[key].external) continue
85
+ if (!data.volumes[key]) continue
83
86
 
84
- const name = data.volumes[key].external.name
87
+ const name = data.volumes[key].name
85
88
  if (!name) continue
86
89
 
87
90
  volumes.push(name)
@@ -141,9 +144,7 @@ const readCustomServiceData = (service) => {
141
144
 
142
145
  // volume is named => we add it to top level "volumes" directive:
143
146
  volumes[volumeName] = {
144
- external: {
145
- name: `{{projectname}}-${volumeName}`
146
- }
147
+ name: `{{projectname}}-${volumeName}`
147
148
  }
148
149
  }
149
150
  }
package/src/utils.js CHANGED
@@ -61,7 +61,7 @@ const getComposePath = (containerId) =>
61
61
  if (err) reject(err)
62
62
 
63
63
  const errMessage = stderr.toString().trim()
64
- if (errMessage) reject(new Error(errMessage))
64
+ if (errMessage) reject(Error(errMessage))
65
65
 
66
66
  const [data] = JSON.parse(stdout)
67
67
 
@@ -81,9 +81,10 @@ const getComposePath = (containerId) =>
81
81
  export const getComposePaths = () =>
82
82
  new Promise((resolve, reject) => {
83
83
  exec('docker ps -q', function (err, stdout, stderr) {
84
- if (err || stderr.toString().trim()) {
85
- return reject(err)
86
- }
84
+ if (err) reject(err)
85
+
86
+ const errMessage = stderr.toString().trim()
87
+ if (errMessage) reject(Error(errMessage))
87
88
 
88
89
  const containers = stdout.split(/\n/).filter((r) => r)
89
90
 
@@ -7,7 +7,7 @@ services:
7
7
  ports:
8
8
  - 9200:9200
9
9
  {{mapped-volumes}}
10
- user: ${CURRENT_UID}
10
+ user: '{{current_uid}}'
11
11
  {{/mapped-volumes}}
12
12
  environment:
13
13
  - cluster.name={{projectname}}-elasticsearch-cluster
@@ -22,6 +22,5 @@ services:
22
22
 
23
23
  volumes:
24
24
  elasticsearch-data:
25
- external:
26
- name: {{volumesPrefix}}-elasticsearch-data
25
+ name: {{volumesPrefix}}-elasticsearch-data
27
26
  {{/named-volumes}}
@@ -7,7 +7,7 @@ services:
7
7
  ports:
8
8
  - 3306:3306
9
9
  {{mapped-volumes}}
10
- user: ${CURRENT_UID}
10
+ user: '{{current_uid}}'
11
11
  {{/mapped-volumes}}
12
12
  environment:
13
13
  - MARIADB_ROOT_PASSWORD=rootpassword
@@ -20,6 +20,5 @@ services:
20
20
 
21
21
  volumes:
22
22
  mariadb-data:
23
- external:
24
- name: {{volumesPrefix}}-mariadb-data
23
+ name: {{volumesPrefix}}-mariadb-data
25
24
  {{/named-volumes}}
@@ -7,7 +7,7 @@ services:
7
7
  ports:
8
8
  - 27017:27017
9
9
  {{mapped-volumes}}
10
- user: ${CURRENT_UID}
10
+ user: '{{current_uid}}'
11
11
  {{/mapped-volumes}}
12
12
  volumes:
13
13
  {{mapped-volumes}}
@@ -18,6 +18,5 @@ services:
18
18
 
19
19
  volumes:
20
20
  mongo-data:
21
- external:
22
- name: {{volumesPrefix}}-mongo-data
21
+ name: {{volumesPrefix}}-mongo-data
23
22
  {{/named-volumes}}
@@ -9,7 +9,7 @@ services:
9
9
  - 5672:5672
10
10
  - 15672:15672
11
11
  {{mapped-volumes}}
12
- user: ${CURRENT_UID}
12
+ user: '{{current_uid}}'
13
13
  {{/mapped-volumes}}
14
14
  volumes:
15
15
  {{mapped-volumes}}
@@ -20,6 +20,5 @@ services:
20
20
 
21
21
  volumes:
22
22
  rabbit-data:
23
- external:
24
- name: {{volumesPrefix}}-rabbit-data
23
+ name: {{volumesPrefix}}-rabbit-data
25
24
  {{/named-volumes}}