@adinsure-ops/ops-cli 4.0.0-rc6

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.
Files changed (71) hide show
  1. package/CHANGELOGS.md +55 -0
  2. package/LICENSE +1 -0
  3. package/README.md +576 -0
  4. package/bin/run +5 -0
  5. package/bin/run.cmd +3 -0
  6. package/lib/command.base.d.ts +17 -0
  7. package/lib/command.base.jira.d.ts +11 -0
  8. package/lib/command.base.jira.js +37 -0
  9. package/lib/command.base.js +73 -0
  10. package/lib/commands/doctor.d.ts +54 -0
  11. package/lib/commands/doctor.js +311 -0
  12. package/lib/commands/download/client.d.ts +18 -0
  13. package/lib/commands/download/client.js +72 -0
  14. package/lib/commands/download/identity-server.d.ts +18 -0
  15. package/lib/commands/download/identity-server.js +72 -0
  16. package/lib/commands/download/platform.d.ts +18 -0
  17. package/lib/commands/download/platform.js +72 -0
  18. package/lib/commands/download/scheduler.d.ts +18 -0
  19. package/lib/commands/download/scheduler.js +72 -0
  20. package/lib/commands/download/server.d.ts +18 -0
  21. package/lib/commands/download/server.js +72 -0
  22. package/lib/commands/download/studio.d.ts +20 -0
  23. package/lib/commands/download/studio.js +89 -0
  24. package/lib/commands/gitlab/next-nightly-tag.d.ts +30 -0
  25. package/lib/commands/gitlab/next-nightly-tag.js +171 -0
  26. package/lib/commands/jira/issue.d.ts +17 -0
  27. package/lib/commands/jira/issue.js +31 -0
  28. package/lib/commands/jira/labels.d.ts +22 -0
  29. package/lib/commands/jira/labels.js +70 -0
  30. package/lib/commands/log/add.d.ts +17 -0
  31. package/lib/commands/log/add.js +107 -0
  32. package/lib/commands/log/generate.d.ts +22 -0
  33. package/lib/commands/log/generate.js +155 -0
  34. package/lib/commands/log/validate.d.ts +11 -0
  35. package/lib/commands/log/validate.js +58 -0
  36. package/lib/commands/login.d.ts +23 -0
  37. package/lib/commands/login.js +144 -0
  38. package/lib/commands/npm/check.publish.d.ts +17 -0
  39. package/lib/commands/npm/check.publish.js +78 -0
  40. package/lib/commands/npm/publish.d.ts +23 -0
  41. package/lib/commands/npm/publish.js +163 -0
  42. package/lib/commands/prepare-content.d.ts +29 -0
  43. package/lib/commands/prepare-content.js +386 -0
  44. package/lib/commands/sql.d.ts +24 -0
  45. package/lib/commands/sql.js +147 -0
  46. package/lib/commands/translate.d.ts +37 -0
  47. package/lib/commands/translate.js +149 -0
  48. package/lib/commands/version.d.ts +48 -0
  49. package/lib/commands/version.js +267 -0
  50. package/lib/config.d.ts +7 -0
  51. package/lib/config.js +9 -0
  52. package/lib/hooks/init/version-override.d.ts +2 -0
  53. package/lib/hooks/init/version-override.js +15 -0
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.js +4 -0
  56. package/lib/lib/command.d.ts +9 -0
  57. package/lib/lib/command.js +71 -0
  58. package/lib/lib/npm.d.ts +15 -0
  59. package/lib/lib/npm.js +79 -0
  60. package/lib/lib/npmrc.d.ts +17 -0
  61. package/lib/lib/npmrc.js +44 -0
  62. package/lib/security/cache.d.ts +7 -0
  63. package/lib/security/cache.js +33 -0
  64. package/lib/security/context.d.ts +58 -0
  65. package/lib/security/context.js +224 -0
  66. package/lib/types/changelog.types.d.ts +6 -0
  67. package/lib/types/changelog.types.js +2 -0
  68. package/lib/types/npm.types.d.ts +34 -0
  69. package/lib/types/npm.types.js +2 -0
  70. package/oclif.manifest.json +1 -0
  71. package/package.json +118 -0
package/CHANGELOGS.md ADDED
@@ -0,0 +1,55 @@
1
+ # Changelogs
2
+
3
+ ## 4.0.0: 2021-05-31
4
+
5
+ - new auth options
6
+
7
+ ## 3.9.0: 2021-05-30
8
+
9
+ - additional options for translations output filename
10
+
11
+ ## 3.8.1: 2021-05-17
12
+
13
+ - fix GitLab next nightly tag when tags with `test` and `qa` annotation exists
14
+
15
+ ## 3.8.0: 2021-05-05
16
+
17
+ - added GitLab next nightly tag
18
+
19
+ ## 3.7.0: 2021-04-28
20
+
21
+ - added download commands for AdInsure Server, Client, IdentityServer and Scheduler
22
+
23
+ ## 3.6.1: 2021-12-02
24
+
25
+ - improve workspace search pattern for npm publish
26
+
27
+ ## 3.6.0: 2021-11-30
28
+
29
+ - add ability to transform files with prepare-content
30
+
31
+ ## 3.5.0: 2021-11-24
32
+
33
+ - renaming prepare-content command
34
+
35
+ ## 3.4.0: 2021-10-24
36
+
37
+ - added Jira command for listing labels and setting them
38
+ - added Jira command for listing issue
39
+
40
+ ## 3.3.1: 2021-10-16
41
+
42
+ - exclude should be optional for npm:publish
43
+
44
+ ## 3.3.0: 2021-10-14
45
+
46
+ - introduced npm check command
47
+ - introcuced npm publish command
48
+ - introduced doctor command
49
+ - introduced download:platform and download:studio command
50
+
51
+ ## 3.2.4: 2021-10-09
52
+
53
+ - ignore VERSION file when using 'new' command
54
+ - Unexpected token in JSON files should not stop execution
55
+ - introduce `--exclude-dir` parameter for `version` command
package/LICENSE ADDED
@@ -0,0 +1 @@
1
+ (c) Copyright 2021 Adacta d.o.o., all rights reserved.
package/README.md ADDED
@@ -0,0 +1,576 @@
1
+ # Operations CLI
2
+
3
+ Operations CLI for supporting AdInsure development processes.
4
+
5
+ # Latest version
6
+
7
+ 3.6.1
8
+
9
+ ## Install
10
+
11
+ OPS CLI can be downloaded and installed using installer.
12
+ For versions check [tags](https://git.adacta-fintech.com/ops/ops-cli/-/tags)
13
+ or [download a JSON](https://adinsure.blob.core.windows.net/ops-cli/version) containing version and other information.
14
+
15
+ | Platform| Link|
16
+ |:---|:---|
17
+ |Windows 64-bit|https://adinsure.blob.core.windows.net/ops-cli/win/ops-v3.6.1-x64.exe|
18
+ |Debian 64-bit |https://adinsure.blob.core.windows.net/ops-cli/deb/ops_3.6.1-1_amd64.deb|
19
+
20
+ ## CLI development
21
+
22
+ For development you will need **[Node.js](https://nodejs.org/en/)** (recommended 16 LTS, minimal 8.0.0) and **[Yarn](https://yarnpkg.com/en/)** installed.
23
+
24
+ We recommend **[Visual Studio Code](https://code.visualstudio.com/)** IDE.
25
+
26
+ To quick start development:
27
+
28
+ - Clone this repository (`git clone https://git.adacta-fintech.com/ops/ops-cli.git`)
29
+ - Open in VS Code
30
+ - Run `yarn install`
31
+ - For easier debugging, run `yarn link`
32
+
33
+ You can run and debug commands directly from terminal by running `ops [command]` (if you `yarn link`-ed the package) or execute `.\bin\run [command]` (if you didn't).
34
+
35
+ ## Commands
36
+
37
+ <!-- commands -->
38
+ * [`ops help [COMMAND]`](#ops-help-command)
39
+ * [`ops log <component> <issue> [options]`](#ops-log-component-issue-options)
40
+ * [`ops log:gen [options]`](#ops-loggen-options)
41
+ * [`ops log:validate [options]`](#ops-logvalidate-options)
42
+ * [`ops login`](#ops-login)
43
+ * [`ops version <type> [flags]`](#ops-version)
44
+ * [`ops sql <type> <module> [flags]`](#ops-sql-type-module-flags)
45
+
46
+ ## `ops help [COMMAND]`
47
+
48
+ display help for ops
49
+
50
+ ```
51
+ USAGE
52
+ $ ops help [COMMAND]
53
+
54
+ ARGUMENTS
55
+ COMMAND command to show help for
56
+
57
+ OPTIONS
58
+ --all see all commands in CLI
59
+ ```
60
+
61
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.0/src\commands\help.ts)_
62
+
63
+ ## `ops download <flags>`
64
+
65
+ download platform from azure storage
66
+
67
+ ```
68
+ USAGE
69
+ $ ops download <flags>
70
+
71
+ OPTIONS
72
+ -o, --output=output [default: ./] output directory
73
+ -v, --version=version (required) version we want to download
74
+
75
+ ALIASES
76
+ $ ops download
77
+ $ ops download:platform
78
+
79
+ EXAMPLE
80
+ $ ops download -v 6.0.0 -o ~/Downloads
81
+ ```
82
+
83
+ ## `ops download:studio <flags>`
84
+
85
+ download studio vsix from azure storage
86
+
87
+ ```
88
+ USAGE
89
+ $ ops download:studio <flags>
90
+
91
+ OPTIONS
92
+ -i, --install install plugin to vscode. save to temp folder and remove vsix after.
93
+ -o, --output=output [default: ./] output directory
94
+ -v, --version=version (required) version we want to download
95
+
96
+ ALIASES
97
+ $ ops download:studio
98
+
99
+ EXAMPLES
100
+ $ ops download:studio -v 15.0.0 -o ~/Downloads
101
+ $ ops download:studio -v 15.0.0 -i
102
+ ```
103
+
104
+ ## `ops doctor`
105
+
106
+ check if everyting is installed
107
+
108
+ ```
109
+ USAGE
110
+ $ ops doctor
111
+
112
+ EXAMPLE
113
+ $ ops doctor
114
+ ```
115
+
116
+ ## `ops jira:issue <issue>`
117
+
118
+ get Jira issue
119
+
120
+ ```
121
+ USAGE
122
+ $ ops jira:issue <issue>
123
+
124
+ ARGUMENTS
125
+ ISSUE Jira issue number
126
+
127
+ OPTIONS
128
+ --hostname=hostname [default: https://jira.adacta-fintech.com] jira hostname
129
+ --password=password (required) jira password
130
+ --username=username (required) jira username
131
+
132
+ EXAMPLE
133
+ $ ops jira:issue LJADIRD-1337
134
+ ```
135
+
136
+ ## `ops jira:issue <issue> -a [label] -r [label]`
137
+
138
+ list or edit labels on Jira issue
139
+
140
+ ```
141
+ USAGE
142
+ $ ops jira:labels <issue> -a [label] -r [label]
143
+
144
+ ARGUMENTS
145
+ ISSUE Jira issue number
146
+
147
+ OPTIONS
148
+ -a, --add=add add label
149
+ -r, --remove=remove remove label
150
+ --hostname=hostname [default: https://jira.adacta-fintech.com] jira hostname
151
+ --password=password (required) jira password
152
+ --username=username (required) jira username
153
+
154
+ EXAMPLE
155
+ $ ops jira:labels LJADIRD-1337
156
+ ```
157
+
158
+ ## `ops log <issue> -t <type> -c [component]`
159
+
160
+ creates a new changelog entry
161
+
162
+ ```
163
+ USAGE
164
+ $ ops log <issue> -t <type> -c [component]
165
+
166
+ ARGUMENTS
167
+ ISSUE Jira issue number
168
+ TYPE (feature|fixed|improve|breaking) Change type
169
+ COMPONENT (Configuration|DevOps|Implementation|Platform) Component for which new changelog should be generated
170
+
171
+
172
+ OPTIONS
173
+ -c, --component=component Component for which new changelog should be generated
174
+ -t, --type=feature|fixed|improve|breaking (required) type of changelog
175
+
176
+ ALIASES
177
+ $ ops log
178
+ $ ops log:add
179
+
180
+ EXAMPLES
181
+ $ ops log LJADIRD-1234 -t feature
182
+ $ ops log LJADIRD-5678 -t fixed
183
+ $ ops log LJADIRD-8765 -t breaking -c Platform
184
+ $ ops log LJADIRD-4321 -t improve -c Configuration
185
+ ```
186
+
187
+ ## `ops log:gen [options]`
188
+
189
+ generates final changelog from unreleased notes on the root,
190
+ final changelog for implementation component is placed under basic/Changelog.md
191
+
192
+ ```
193
+ USAGE
194
+ $ ops log:gen [options]
195
+
196
+ OPTIONS
197
+ -c, --components=components components separated by comma (,) to process for final changelog
198
+ -f, --file=file [default: CHANGELOG.md] file to update with new changelogs
199
+ -p, --preview generates a preview markdown of current unreleased changelogs
200
+ -v, --version=version version for which you're generating changelogs
201
+ --force update target file without prompting for confirmation
202
+ --ignore-no-changelogs generate final changelog even if no unreleased changelogs exist
203
+
204
+ ALIASES
205
+ $ ops log:gen
206
+
207
+ EXAMPLE
208
+ $ ops log:gen
209
+ $ ops log:gen -p
210
+ $ ops log:gen -c Platform
211
+ $ ops log:gen -c Platform,Configuration
212
+ $ ops log:gen -c Implementation -f CHANGELOG.Implementation.md
213
+ ```
214
+
215
+ ## `ops log:validate [options]`
216
+
217
+ validates formatting of all unreleased changelogs:
218
+
219
+ - 2.4.2 - added an exit statement that will force exit on changelog validation errors, preparing it for CI
220
+
221
+ ```
222
+ USAGE
223
+ $ ops log:validate [options]
224
+
225
+ ALIASES
226
+ $ ops log:validate
227
+
228
+ EXAMPLE
229
+ $ ops log:validate
230
+ ```
231
+
232
+ ## `ops login`
233
+
234
+ log in to use ops services
235
+
236
+ ```
237
+ USAGE
238
+ $ ops login
239
+
240
+ OPTIONS
241
+ --servicePrincipal authenticate using service principal credentials
242
+ -c, --clientId (application) client id
243
+ -s, --secret client secret
244
+
245
+ EXAMPLES
246
+ $ ops login
247
+ $ ops login --servicePrincipal -c {client id} -s {secret}
248
+ ```
249
+
250
+ ## `ops version <type>`
251
+
252
+ creates everything necessary for the new release
253
+
254
+ ```
255
+ USAGE
256
+ $ ops version <type> [flags]
257
+
258
+ ARGUMENTS
259
+ TYPE (patch|minor|major|prerelease|preminor|premajor|new) Type of release
260
+
261
+ OPTIONS
262
+ -i, --independent increment npm packages independent of VERSION file
263
+ -v, --version=version force version
264
+ --no-deps skip dependency update
265
+ --no-script skip creation of script
266
+ --only-npm-packages=only-npm-packages [default: .*] regular expression for which NPM packages to include
267
+ --script-prefix=script-prefix [default: 7.10] prefix for db script version creation.
268
+ --exclude-dir exclude directories where to search for package.json
269
+
270
+ EXAMPLES
271
+ $ ops version minor
272
+ $ ops version new-version -v 3.4.0
273
+ $ ops version new-version -v 3.2.1 --script-prefix 7.10
274
+ $ ops version patch --no-deps
275
+ $ ops version patch --no-script
276
+ $ ops version new -v 3.2.1 --only-npm-packages "@adinsure/"
277
+ ```
278
+
279
+ * *prerelease* is generated from YearMonth incremental number (example: 201909.1) or RC (example: rc.0). prereleases generated in same month will have only last number incremented and first prerelease generated in next month will bump first number and start with 0 (example: 201910.0)
280
+
281
+ * *patch* increments third number and prerelease number is ommited. (example: 3.4.0-201909.2 -> 3.4.0 and 3.3.11 -> 3.3.12)
282
+
283
+ * *preminor* increments for prerelease in second number (example: 3.2.3 -> 3.3.0-201910.0)
284
+
285
+ * *minor* increments second number (example: 3.4.3 -> 3.5.0)
286
+
287
+ * *premajor* increments to prerelease in first number (example: 3.4.3 -> 4.0.0-201911.0)
288
+
289
+ * *major* increments first number (example: 3.4.5 -> 4.0.0)
290
+
291
+ * *new-version* allows setting own version regardles of VERSION file. **Incrementing NPM version separately is not supported in this case. NPM packages are also bumped to specified version.**
292
+
293
+ > Prerelease Note: Prerelease should only be user in **master** branch.
294
+
295
+ > Patch Note: Patch is used on **release/x.x** branches for creating patch releases
296
+
297
+ > When creating new **release/x.x** branch 2 steps are needed:
298
+ > * creating *patch* version on **release/x.x** branch
299
+ > * creating *preminor* or *premajor* version on **master** branch
300
+
301
+ > Dependencies for packages are updated on all package.json files. If prerelease version in specified full version is specified (example: 4.0.0-201911.0), or if non prerelease version ends with x (example: 3.5.x)
302
+
303
+ > NPM packages node: For npm package to update properly *wsrun-version* preset needs to be in *scripts* portion of *package.json*. (example: `"wsrun-version": "yarn wsrun -p @adinsure-tools/* -p @adinsure/* -c"`)
304
+
305
+ ## `ops sql <type> <module> [flags]`
306
+
307
+ creates a new database script
308
+
309
+ ```
310
+ USAGE
311
+ $ ops sql <type> <module> [flags]
312
+
313
+ ARGUMENTS
314
+ TYPE (schema|data|migration) Type of database scripts
315
+ MODULE (acc|claims|core|pas|reins|shared) Module of data database scripts
316
+
317
+ OPTIONS
318
+ -l, --layer=layer name of the configuration layer for which you are generating database script
319
+ -v, --version=version version for which you're generating database script
320
+
321
+ EXAMPLES
322
+ $ ops sql schema
323
+ $ ops sql data shared --layer basic
324
+ ```
325
+
326
+ ## `ops npm:check-publish [options]`
327
+
328
+ check if npm packages was published
329
+
330
+ USAGE
331
+ $ ops npm:check-publish [options]
332
+
333
+ OPTIONS
334
+ -p, --package=package package name filter you want to check
335
+ -v, --version=version (required) version we want to check if published
336
+ -x, --exclude=exclude exclude packages from filter
337
+ --pat=pat PAT token or AZURE_DEVOPS_EXT_PAT environment variable
338
+
339
+ ALIASES
340
+ $ ops npm:check-publish
341
+
342
+ EXAMPLES
343
+ $ ops npm:check-publish -v 6.0.1
344
+ $ ops npm:check-publish -p @adinsure/* -v 6.0.0
345
+ $ ops npm:check-publish -p @adinsure/* -x @adisure/demo -v 6.0.0
346
+
347
+ ## `ops npm:publish [options]`
348
+
349
+ publish npm packages
350
+
351
+ USAGE
352
+ $ ops npm:publish [options]
353
+
354
+ OPTIONS
355
+ -p, --package=package package name filter you want to check
356
+ -v, --version=version (required) version we want to check if published
357
+ -x, --exclude=exclude exclude packages from filter
358
+ --pat=pat PAT token or AZURE_DEVOPS_EXT_PAT environment variable
359
+
360
+ ALIASES
361
+ $ ops npm:publish
362
+
363
+ EXAMPLES
364
+ $ ops npm:publish -v 15.0.0
365
+ $ ops npm:publish -v 15.0.0
366
+ $ ops npm:publish -p @adinsure-tooling/* -v 15.0.0
367
+ $ ops npm:publish -p @adinsure-tooling/* -x @adisure-tooling/studio-services -v 6.0.0
368
+
369
+ ## `ops prepare-content -d <destination> -s [source]`
370
+
371
+ creates a directory/file structure from `/source` to `/destination</source>` as defined in the `.opsprepare` file. Actual
372
+ destination path for each file will be specified destination path with appended relative path from working directory where command is executed to specified source directory or current directory (if source is not specified). Be careful about using
373
+ `..` notation in target and source paths as it may lead to unpredictable results due to relative path resolving.
374
+
375
+ > Introduced in version 3.1.0.
376
+
377
+ ```
378
+ USAGE
379
+ $ ops prepare-content -d <destination> -s [source]
380
+
381
+
382
+ OPTIONS
383
+ -d, --destination=destination path to target directory
384
+ -s, --source=source optional path to source directory containing .opsprepare file, (default: current directory)
385
+
386
+ EXAMPLES
387
+ $ ops prepare-content -d ./target_directory/
388
+ copies everything defined in .opsprepare
389
+ from current directory
390
+ to ./target_directory
391
+
392
+ $ ops prepare-content -d ./target_directory/ -s ./source_directory
393
+ copies everything defined in ./source_directory/.opsprepare
394
+ from ./source_directory/
395
+ to ./target_directory/source_directory
396
+
397
+ $ ops prepare-content -d C:\git\target_directory
398
+ copies everything defined in .opsprepare
399
+ from current directory
400
+ to C:\git\target_directory
401
+
402
+ $ ops prepare-content -d C:\git\target_directory -s C:\git\subfolder\subfolder
403
+ when executed in c:\git it copies everything defined in C:\git\subfolder\subfolder\.opsprepare
404
+ from C:\git\subfolder\subfolder
405
+ to C:\git\target_directory\subfolder\subfolder
406
+ ```
407
+
408
+ ### .opsprepare dotfile
409
+
410
+ The prepare-content command uses `.opsprepare` dotfile as instruction set for content preparation.
411
+ The syntax resembles that of `.gitignore` but differs in how it functions and doesn't support advanced
412
+ pattern matching.
413
+
414
+ Following operations/transformations are currently supported:
415
+
416
+ - Copy: copies the file/directory from source path to destination path with same name
417
+ - Transform: transform source file to destination file with same name
418
+ - Removal: remove file/directory (based on source path) from destination path
419
+
420
+ Before diving into the actual syntax and supported tokens let's look at an example
421
+ of how using `ops prepare-content` creates a target directory structure with files
422
+ based on the specified `.opsprepare` file residing in source directory.
423
+
424
+ This is the example source directory structure:
425
+
426
+ ```
427
+ src_data
428
+ ├── .opsprepare
429
+ ├── README.tpl
430
+ ├── bin
431
+ │   ├── ops.sh
432
+ │   └── run
433
+ │   └── ops
434
+ ├── dist
435
+ │   └── server
436
+ │   └── main.cs
437
+ ├── src
438
+ │   ├── commands
439
+ │   │   ├── prepare.ts
440
+ │   │   └── version.ts
441
+ │   ├── config.ts
442
+ │   └── main.ts
443
+ └── transform
444
+ └── render-tpl.js
445
+ ```
446
+
447
+ Contents of `.opsprepare` file in the `src_data` directory:
448
+
449
+ ```
450
+ # Comment
451
+ src
452
+ dist/server
453
+ !src/commands
454
+ !src/config.ts
455
+ src/config.ts {cp:/src/configuration.ts}
456
+ # Another comment
457
+ !bin/run
458
+ README.md {js:/transform/render-tpl.js:render}
459
+ README.tpl {cp:/README.tpl.src}
460
+ ```
461
+
462
+ Running `ops -s src_data -d dst_data` with `src_data/.opsprepare` containing above content
463
+ results in:
464
+
465
+ ```sh
466
+ dst_data
467
+ └── src_data
468
+ ├── README.md
469
+ ├── README.tpl.src
470
+ ├── dist
471
+ │   └── server
472
+ │   └── main.cs
473
+ └── src
474
+ ├── main.ts
475
+ └── src
476
+ └── configuration.ts
477
+ ```
478
+
479
+ What actually happened:
480
+
481
+ 1. First note that all data was copied into `dst_data/src_data` because `.opsprepare` files relative
482
+ location to `ops` execution directiory is `src_data`.
483
+ 2. `src` directory was copied recursively to destination
484
+ 3. `dist/server` directory was copied recursively including its full path path relative to `src_data`
485
+ 4. `src/config.ts` file was transformed (copied) to `src/configuration.ts` in the destination
486
+ 5. `README.md` file was created at the destination as a result of JavaScript based transformation
487
+ 6. `README.tpl` file was transformed (copied) to `README.tpl.src` in the destination
488
+ 7. `src/commands` directory was removed from destination
489
+ 8. `src/config.ts` file was removed from destination
490
+ 9. `bin/run` directory was removed from destination
491
+
492
+ Note that copying and explicit transformations are performed before any removal operations.
493
+
494
+ #### Comments
495
+
496
+ Any line prefixed by `#` is considered a comment and will not result in any file/directory operation.
497
+ #### Copy operations
498
+
499
+ Any file/directory not prefixed by `!` or `#` having explicit transformation defined in `{...}` after
500
+ its name will be copied to the destination with it's full path relative to `ops` execution directory
501
+ to the target directory.
502
+
503
+ #### Transformation operations
504
+
505
+ Transformation operations are always specified using curly braces following the source file name. Base
506
+ syntax looks like this:
507
+
508
+ ```
509
+ {<transformation type>:<transformation parameters>}
510
+ ```
511
+
512
+ Two types of transformation operations are supported:
513
+
514
+ - cp: copy transformation which supports renaming of the source file at the destination
515
+ - js: JavasSript based transformation which results in the file containing string returned by the
516
+ transformation function contained in transformation module.
517
+
518
+ **cp - copy transformation syntax**
519
+
520
+ ```
521
+ {cp:<destination path>}
522
+
523
+ Examples:
524
+ {cp:/dst/newfilename}
525
+ {cp:dst/newfilenames}
526
+ ```
527
+
528
+ Copy transformation is supported for both files and directories. Source file or directory will be
529
+ copied to the destination path with its new name. The destination will always be relative to the
530
+ destination path of entire `prepare-content` operation therefore paths in the transformation block
531
+ can start with or without the `/` character but using makes the syntax more readable.
532
+
533
+ **js - JavaScript transformation syntax**
534
+
535
+ ```
536
+ {js:<transformation_module_path>:<transformation_function_name>}
537
+
538
+ Example:
539
+ {js:/transformations/templateRenderer.js:renderEjsTemplate}
540
+ ```
541
+
542
+ JavaScript transformation is supported only for files, not directories.
543
+
544
+ Transformation module path should be relative to `.opsprepare` file but can start with `/` character
545
+ for better readability. It can export multiple functions though only one can be used in single
546
+ transformation specification.
547
+
548
+ Transformation function that is defined in the transformation module will be called with a single
549
+ parameter - absolute path of the source file.
550
+
551
+ Transformation function MUST return a string. This string will become the content of the file on
552
+ destination.
553
+
554
+ Destination file will be created with the same name as source file and content returned by the
555
+ transformation function. The existence of actual source file will not be validated by the
556
+ `prepare-content` operation (warning is shown if it doesn't exist), such validation is responsibility
557
+ of the transformation function if required.
558
+
559
+ Example transformation module `transform.js` with exported function called transform:
560
+
561
+ ```js
562
+ module.exports = {
563
+ render: (path) => {
564
+ /*
565
+ Some transformation happens in here and it's result which is
566
+ a string is assigned to result variable which is returned.
567
+ */
568
+ return result;
569
+ }
570
+ }
571
+ ```
572
+
573
+ #### Removal operations
574
+
575
+ Any file/directory prefixed by `!` will be removed from the destination based on it's full path
576
+ relative from `ops` execution directory to source file/directory path.
package/bin/run ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('@oclif/command').run()
4
+ .then(require('@oclif/command/flush'))
5
+ .catch(require('@oclif/errors/handle'))
package/bin/run.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
@@ -0,0 +1,17 @@
1
+ import { Command } from '@oclif/command';
2
+ import { IConfig } from '@oclif/config';
3
+ import SecurityContext from './security/context';
4
+ export default abstract class CommandBase extends Command {
5
+ protected readonly security: SecurityContext;
6
+ constructor(argv: string[], config: IConfig);
7
+ getGitRoot(startDir?: string): Promise<string>;
8
+ getVersion(versionFile?: string, ...filesToCheck: string[]): Promise<string>;
9
+ /**
10
+ * Resolve path to Changelog folder from current execution directory
11
+ */
12
+ getChangelogsRoot(): Promise<string>;
13
+ /**
14
+ * Get all files inside directory and normalize it against {baseRelativePath}.
15
+ */
16
+ getFilesRecursive(dir: string, baseRelativePath: string, filter: RegExp): Promise<string[]>;
17
+ }
@@ -0,0 +1,11 @@
1
+ import { flags } from '@oclif/command';
2
+ import JiraApi = require('jira-client');
3
+ import CommandBase from './command.base';
4
+ export default abstract class CommandBaseJira extends CommandBase {
5
+ static flags: {
6
+ username: flags.IOptionFlag<string>;
7
+ password: flags.IOptionFlag<string>;
8
+ hostname: flags.IOptionFlag<string>;
9
+ };
10
+ jiraInit(url: string, username: string, password: string): Promise<JiraApi>;
11
+ }