@hiiretail/gcp-infra-cli 0.65.6 → 0.66.2

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.
@@ -28,7 +28,7 @@ module.exports = class extends BaseGenerator {
28
28
  this.destinationPath(path.join('docs', filename)),
29
29
  {
30
30
  ...this.answers,
31
- c4System: system.replace(/\s/, ''),
31
+ c4System: system.replace(/\s/g, ''),
32
32
  },
33
33
  );
34
34
 
@@ -25,12 +25,21 @@ module.exports = class extends BaseGenerator {
25
25
  validate: required,
26
26
  },
27
27
  {
28
+ type: 'list',
29
+ name: 'createTable',
30
+ message: 'Do you want to create a table?',
31
+ default: 'no',
32
+ choices: ['yes', 'no'],
33
+ },
34
+ {
35
+ when: (response) => response.createTable === 'yes',
28
36
  type: 'input',
29
37
  name: 'tableId',
30
38
  message: 'Please provide the ID for the table',
31
39
  validate: required,
32
40
  },
33
41
  {
42
+ when: (response) => response.createTable === 'yes',
34
43
  type: 'input',
35
44
  name: 'expirationTime',
36
45
  message: 'Please provide the time when the table expires (in milliseconds since the epoch). If set to `null`, the table will persist indefinitely.',
@@ -92,6 +101,7 @@ module.exports = class extends BaseGenerator {
92
101
  datasetId,
93
102
  datasetName,
94
103
  description,
104
+ createTable,
95
105
  tableId,
96
106
  expirationTime,
97
107
  createRoutine,
@@ -103,25 +113,49 @@ module.exports = class extends BaseGenerator {
103
113
  } = this.answers;
104
114
 
105
115
  ['prod', 'staging'].forEach((env) => {
106
- this.copyDir(
107
- 'bigquery',
108
- path.join('infra', env, 'bigquery'),
109
- {
110
- ...this.answers,
111
- env,
112
- datasetId,
113
- datasetName,
114
- description,
115
- tableId,
116
- expirationTime,
117
- createRoutine,
118
- routineId,
119
- routineType,
120
- language,
121
- definitionBody,
122
- routineDescription,
123
- },
124
- );
116
+ if (createTable === 'no') {
117
+ this.copyDir(
118
+ 'bigquery',
119
+ path.join('infra', env, 'bigquery', datasetId),
120
+ {
121
+ ...this.answers,
122
+ env,
123
+ datasetId,
124
+ datasetName,
125
+ description,
126
+ createTable,
127
+ createRoutine,
128
+ routineId,
129
+ routineType,
130
+ language,
131
+ definitionBody,
132
+ routineDescription,
133
+ },
134
+ );
135
+ } else {
136
+ ['schema', 'bigquery'].forEach((folder) => {
137
+ this.copyDir(
138
+ folder,
139
+ path.join('infra', env, 'bigquery', datasetId),
140
+ {
141
+ ...this.answers,
142
+ env,
143
+ datasetId,
144
+ datasetName,
145
+ description,
146
+ createTable,
147
+ tableId,
148
+ expirationTime,
149
+ createRoutine,
150
+ routineId,
151
+ routineType,
152
+ language,
153
+ definitionBody,
154
+ routineDescription,
155
+ },
156
+ );
157
+ });
158
+ }
125
159
  });
126
160
  }
127
161
 
@@ -20,7 +20,7 @@ inputs = merge(
20
20
  local.project_vars.locals,
21
21
  {
22
22
  project_id = local.project_vars.locals.project_id
23
- tables = [
23
+ tables = <% if (createTable == 'no') { %>[]<% } else { %>[
24
24
  {
25
25
  table_id = "<%-tableId%>",
26
26
  schema = "./schema.json",
@@ -36,7 +36,7 @@ inputs = merge(
36
36
  labels = {
37
37
  env = "<%-env%>"
38
38
  },
39
- ],
39
+ ]<% } %>
40
40
 
41
41
  routines = <% if (createRoutine == 'no') { %>[]<% } else { %>[
42
42
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-cli",
3
- "version": "0.65.6",
3
+ "version": "0.66.2",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -47,11 +47,11 @@
47
47
  "eslint": "^6.8.0",
48
48
  "eslint-config-airbnb-base": "^14.0.0",
49
49
  "eslint-plugin-import": "^2.21.1",
50
- "jest": "^25.5.4",
50
+ "jest": "^27.5.1",
51
51
  "jest-sonar": "^0.2.5",
52
52
  "mock-fs": "^4.12.0",
53
+ "sprintf-js": "^1.1.2",
53
54
  "yeoman-assert": "^3.1.1",
54
- "yeoman-test": "^2.7.0",
55
- "sprintf-js": "^1.1.2"
55
+ "yeoman-test": "^2.7.0"
56
56
  }
57
57
  }