@neurodevs/meta-node 0.14.29 → 0.16.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.
Files changed (66) hide show
  1. package/build/__tests__/AbstractPackageTest.d.ts +4 -0
  2. package/build/__tests__/AbstractPackageTest.js +11 -1
  3. package/build/__tests__/AbstractPackageTest.js.map +1 -1
  4. package/build/__tests__/impl/GitAutocloner.test.js +9 -9
  5. package/build/__tests__/impl/GitAutocloner.test.js.map +1 -1
  6. package/build/__tests__/impl/GitAutocommit.test.d.ts +11 -0
  7. package/build/__tests__/impl/GitAutocommit.test.js +49 -0
  8. package/build/__tests__/impl/GitAutocommit.test.js.map +1 -0
  9. package/build/__tests__/impl/ImplAutomodule.test.js +1 -1
  10. package/build/__tests__/impl/ImplAutomodule.test.js.map +1 -1
  11. package/build/__tests__/impl/NpmAutopackage.test.d.ts +1 -3
  12. package/build/__tests__/impl/NpmAutopackage.test.js +38 -64
  13. package/build/__tests__/impl/NpmAutopackage.test.js.map +1 -1
  14. package/build/__tests__/impl/NpmPropagationCoordinator.test.d.ts +18 -0
  15. package/build/__tests__/impl/NpmPropagationCoordinator.test.js +73 -0
  16. package/build/__tests__/impl/NpmPropagationCoordinator.test.js.map +1 -0
  17. package/build/__tests__/impl/NpmReleasePropagator.test.d.ts +17 -0
  18. package/build/__tests__/impl/NpmReleasePropagator.test.js +115 -0
  19. package/build/__tests__/impl/NpmReleasePropagator.test.js.map +1 -0
  20. package/build/__tests__/impl/UiAutomodule.test.js +1 -1
  21. package/build/__tests__/impl/UiAutomodule.test.js.map +1 -1
  22. package/build/impl/GitAutocommit.d.ts +15 -0
  23. package/build/impl/GitAutocommit.js +27 -0
  24. package/build/impl/GitAutocommit.js.map +1 -0
  25. package/build/impl/NpmAutopackage.d.ts +1 -9
  26. package/build/impl/NpmAutopackage.js +11 -48
  27. package/build/impl/NpmAutopackage.js.map +1 -1
  28. package/build/impl/NpmPropagationCoordinator.d.ts +23 -0
  29. package/build/impl/NpmPropagationCoordinator.js +59 -0
  30. package/build/impl/NpmPropagationCoordinator.js.map +1 -0
  31. package/build/impl/NpmReleasePropagator.d.ts +41 -0
  32. package/build/impl/NpmReleasePropagator.js +78 -0
  33. package/build/impl/NpmReleasePropagator.js.map +1 -0
  34. package/build/index.d.ts +12 -0
  35. package/build/index.js +15 -0
  36. package/build/index.js.map +1 -1
  37. package/build/scripts/runNpmReleasePropagator.d.ts +1 -0
  38. package/build/scripts/runNpmReleasePropagator.js +8 -0
  39. package/build/scripts/runNpmReleasePropagator.js.map +1 -0
  40. package/build/testDoubles/Autocommit/FakeAutocommit.d.ts +11 -0
  41. package/build/testDoubles/Autocommit/FakeAutocommit.js +18 -0
  42. package/build/testDoubles/Autocommit/FakeAutocommit.js.map +1 -0
  43. package/build/testDoubles/PropagationCoordinator/FakePropagationCoordinator.d.ts +11 -0
  44. package/build/testDoubles/PropagationCoordinator/FakePropagationCoordinator.js +18 -0
  45. package/build/testDoubles/PropagationCoordinator/FakePropagationCoordinator.js.map +1 -0
  46. package/build/testDoubles/ReleasePropagator/FakeReleasePropagator.d.ts +8 -0
  47. package/build/testDoubles/ReleasePropagator/FakeReleasePropagator.js +15 -0
  48. package/build/testDoubles/ReleasePropagator/FakeReleasePropagator.js.map +1 -0
  49. package/package.json +3 -3
  50. package/src/__tests__/AbstractPackageTest.ts +27 -1
  51. package/src/__tests__/impl/GitAutocloner.test.ts +13 -9
  52. package/src/__tests__/impl/GitAutocommit.test.ts +60 -0
  53. package/src/__tests__/impl/ImplAutomodule.test.ts +1 -1
  54. package/src/__tests__/impl/NpmAutopackage.test.ts +60 -91
  55. package/src/__tests__/impl/NpmPropagationCoordinator.test.ts +93 -0
  56. package/src/__tests__/impl/NpmReleasePropagator.test.ts +151 -0
  57. package/src/__tests__/impl/UiAutomodule.test.ts +1 -1
  58. package/src/impl/GitAutocommit.ts +40 -0
  59. package/src/impl/NpmAutopackage.ts +20 -64
  60. package/src/impl/NpmPropagationCoordinator.ts +94 -0
  61. package/src/impl/NpmReleasePropagator.ts +135 -0
  62. package/src/index.ts +24 -0
  63. package/src/scripts/runNpmReleasePropagator.ts +9 -0
  64. package/src/testDoubles/Autocommit/FakeAutocommit.ts +26 -0
  65. package/src/testDoubles/PropagationCoordinator/FakePropagationCoordinator.ts +26 -0
  66. package/src/testDoubles/ReleasePropagator/FakeReleasePropagator.ts +23 -0
@@ -0,0 +1,40 @@
1
+ import { exec as execSync } from 'node:child_process'
2
+ import { promisify } from 'node:util'
3
+
4
+ export default class GitAutocommit implements Autocommit {
5
+ public static Class?: AutocommitConstructor
6
+ public static exec = promisify(execSync)
7
+
8
+ private commitMessage: string
9
+ private cwd?: string
10
+
11
+ protected constructor(commitMessage: string, cwd?: string) {
12
+ this.commitMessage = commitMessage
13
+ this.cwd = cwd
14
+ }
15
+
16
+ public static async Create(commitMessage: string, cwd?: string) {
17
+ const instance = new (this.Class ?? this)(commitMessage, cwd)
18
+ await instance.run()
19
+
20
+ return instance
21
+ }
22
+
23
+ public async run() {
24
+ const execOptions = { cwd: this.cwd ?? process.cwd() }
25
+
26
+ await this.exec('git add .', execOptions)
27
+ await this.exec(`git commit -m "${this.commitMessage}"`, execOptions)
28
+ await this.exec('git push', execOptions)
29
+ }
30
+
31
+ private get exec() {
32
+ return GitAutocommit.exec
33
+ }
34
+ }
35
+
36
+ export interface Autocommit {
37
+ run(): Promise<void>
38
+ }
39
+
40
+ export type AutocommitConstructor = new (commitMessage: string) => Autocommit
@@ -6,6 +6,8 @@ import { promisify } from 'util'
6
6
  import { pathExists } from 'fs-extra'
7
7
  import { parse } from 'jsonc-parser'
8
8
 
9
+ import GitAutocommit from './GitAutocommit.js'
10
+
9
11
  export default class NpmAutopackage implements Autopackage {
10
12
  public static Class?: AutopackageConstructor
11
13
  public static chdir = chdir
@@ -214,25 +216,11 @@ export default class NpmAutopackage implements Autopackage {
214
216
  }
215
217
 
216
218
  private async commitCreatePackage() {
217
- await this.gitAddAll()
218
- await this.gitCommitCreatePackage()
219
- await this.gitPush()
220
- }
221
-
222
- private async gitAddAll() {
223
- await this.exec('git add .')
224
- }
225
-
226
- private async gitCommitCreatePackage() {
227
- await this.exec(
228
- `git commit -m "patch: create package (@neurodevs/meta-node: ${this.metaNodeVersion})"`
219
+ await this.GitAutocommit(
220
+ `patch: create package (@neurodevs/meta-node: ${this.metaNodeVersion})`
229
221
  )
230
222
  }
231
223
 
232
- private async gitPush() {
233
- await this.exec('git push')
234
- }
235
-
236
224
  private async updatePackageJson() {
237
225
  this.originalPackageJson = await this.loadPackageJsonFile()
238
226
 
@@ -333,14 +321,8 @@ export default class NpmAutopackage implements Autopackage {
333
321
  }
334
322
 
335
323
  private async commitUpdatePackageJson() {
336
- await this.gitAddAll()
337
- await this.gitCommitUpdatePackage()
338
- await this.gitPush()
339
- }
340
-
341
- private async gitCommitUpdatePackage() {
342
- await this.exec(
343
- `git commit -m "patch: update package.json (@neurodevs/meta-node: ${this.metaNodeVersion})"`
324
+ await this.GitAutocommit(
325
+ `patch: update package.json (@neurodevs/meta-node: ${this.metaNodeVersion})`
344
326
  )
345
327
  }
346
328
 
@@ -379,14 +361,8 @@ export default class NpmAutopackage implements Autopackage {
379
361
  }
380
362
 
381
363
  private async commitUpdateGitignore() {
382
- await this.gitAddAll()
383
- await this.gitCommitUpdateGitignore()
384
- await this.gitPush()
385
- }
386
-
387
- private async gitCommitUpdateGitignore() {
388
- await this.exec(
389
- `git commit -m "patch: add build dir to gitignore (@neurodevs/meta-node: ${this.metaNodeVersion})"`
364
+ await this.GitAutocommit(
365
+ `patch: add build dir to gitignore (@neurodevs/meta-node: ${this.metaNodeVersion})`
390
366
  )
391
367
  }
392
368
 
@@ -409,14 +385,8 @@ export default class NpmAutopackage implements Autopackage {
409
385
  }
410
386
 
411
387
  private async commitSetupVscode() {
412
- await this.gitAddAll()
413
- await this.gitCommitSetupVscode()
414
- await this.gitPush()
415
- }
416
-
417
- private async gitCommitSetupVscode() {
418
- await this.exec(
419
- `git commit -m "patch: setup vscode (@neurodevs/meta-node: ${this.metaNodeVersion})"`
388
+ await this.GitAutocommit(
389
+ `patch: setup vscode (@neurodevs/meta-node: ${this.metaNodeVersion})`
420
390
  )
421
391
  }
422
392
 
@@ -499,14 +469,8 @@ export default class NpmAutopackage implements Autopackage {
499
469
  }
500
470
 
501
471
  private async commitUpdateVscodeTasks() {
502
- await this.gitAddAll()
503
- await this.gitCommitUpdateVscodeTasks()
504
- await this.gitPush()
505
- }
506
-
507
- private async gitCommitUpdateVscodeTasks() {
508
- await this.exec(
509
- `git commit -m "patch: update vscode tasks.json (@neurodevs/meta-node: ${this.metaNodeVersion})"`
472
+ await this.GitAutocommit(
473
+ `patch: update vscode tasks.json (@neurodevs/meta-node: ${this.metaNodeVersion})`
510
474
  )
511
475
  }
512
476
 
@@ -556,14 +520,8 @@ export default class NpmAutopackage implements Autopackage {
556
520
  }
557
521
 
558
522
  private async commitInstallDevDependencies() {
559
- await this.gitAddAll()
560
- await this.gitCommitInstallDevDependencies()
561
- await this.gitPush()
562
- }
563
-
564
- private async gitCommitInstallDevDependencies() {
565
- await this.exec(
566
- `git commit -m "patch: install default devDependencies (@neurodevs/meta-node: ${this.metaNodeVersion})"`
523
+ await this.GitAutocommit(
524
+ `patch: install default devDependencies (@neurodevs/meta-node: ${this.metaNodeVersion})`
567
525
  )
568
526
  }
569
527
 
@@ -604,14 +562,8 @@ export default abstract class AbstractPackageTest extends AbstractModuleTest {
604
562
  `
605
563
 
606
564
  private async commitInstallAbstractPackageTest() {
607
- await this.gitAddAll()
608
- await this.gitCommitInstallAbstractPackageTest()
609
- await this.gitPush()
610
- }
611
-
612
- private async gitCommitInstallAbstractPackageTest() {
613
- await this.exec(
614
- `git commit -m "patch: install AbstractPackageTest (@neurodevs/meta-node: ${this.metaNodeVersion})"`
565
+ await this.GitAutocommit(
566
+ `patch: install AbstractPackageTest (@neurodevs/meta-node: ${this.metaNodeVersion})`
615
567
  )
616
568
  }
617
569
 
@@ -648,6 +600,10 @@ export default abstract class AbstractPackageTest extends AbstractModuleTest {
648
600
  private get writeFile() {
649
601
  return NpmAutopackage.writeFile
650
602
  }
603
+
604
+ private GitAutocommit(commitMessage: string) {
605
+ return GitAutocommit.Create(commitMessage)
606
+ }
651
607
  }
652
608
 
653
609
  export interface Autopackage {
@@ -0,0 +1,94 @@
1
+ import { readFile } from 'node:fs/promises'
2
+
3
+ import NpmReleasePropagator, {
4
+ PackageJson,
5
+ ReleasePropagatorOptions,
6
+ } from './NpmReleasePropagator.js'
7
+
8
+ export default class NpmPropagationCoordinator implements PropagationCoordinator {
9
+ public static Class?: PropagationCoordinatorConstructor
10
+ public static readFile = readFile
11
+
12
+ private repoPath: string
13
+ private repoPaths: string[]
14
+
15
+ private currentRepoPath!: string
16
+ private currentPkgJson!: PackageJson
17
+
18
+ protected constructor(repoPath: string, repoPaths: string[]) {
19
+ this.repoPath = repoPath
20
+ this.repoPaths = repoPaths
21
+ }
22
+
23
+ public static Create(repoPath: string, repoPaths: string[]) {
24
+ return new (this.Class ?? this)(repoPath, repoPaths)
25
+ }
26
+
27
+ public async run() {
28
+ const pkg = await this.loadPackageJson()
29
+ const repoPaths = await this.determineWhereToPropagate()
30
+
31
+ const propagator = this.NpmReleaseCoordinator({
32
+ packageName: pkg.name,
33
+ packageVersion: pkg.version,
34
+ repoPaths,
35
+ })
36
+
37
+ await propagator.run()
38
+ }
39
+
40
+ private async loadPackageJson() {
41
+ const pkgJson = await this.readFile(
42
+ `${this.repoPath}/package.json`,
43
+ 'utf-8'
44
+ )
45
+ return JSON.parse(pkgJson)
46
+ }
47
+
48
+ private async determineWhereToPropagate() {
49
+ const repoPaths: string[] = []
50
+
51
+ for (const repoPath of this.repoPaths) {
52
+ this.currentRepoPath = repoPath
53
+ this.currentPkgJson = await this.loadCurrentPkgJson()
54
+
55
+ if (this.isDependency ?? this.isDevDependency) {
56
+ repoPaths.push(repoPath)
57
+ }
58
+ }
59
+ return repoPaths
60
+ }
61
+
62
+ private get isDependency() {
63
+ return this.currentPkgJson?.dependencies?.[this.repoPath]
64
+ }
65
+
66
+ private get isDevDependency() {
67
+ return this.currentPkgJson?.devDependencies?.[this.repoPath]
68
+ }
69
+
70
+ private async loadCurrentPkgJson() {
71
+ const pkgJson = await this.readFile(
72
+ `${this.currentRepoPath}/package.json`,
73
+ 'utf-8'
74
+ )
75
+ return JSON.parse(pkgJson)
76
+ }
77
+
78
+ private get readFile() {
79
+ return NpmPropagationCoordinator.readFile
80
+ }
81
+
82
+ private NpmReleaseCoordinator(options: ReleasePropagatorOptions) {
83
+ return NpmReleasePropagator.Create(options)
84
+ }
85
+ }
86
+
87
+ export interface PropagationCoordinator {
88
+ run(): Promise<void>
89
+ }
90
+
91
+ export type PropagationCoordinatorConstructor = new (
92
+ repoPath: string,
93
+ repoPaths: string[]
94
+ ) => PropagationCoordinator
@@ -0,0 +1,135 @@
1
+ import { exec as execSync } from 'node:child_process'
2
+ import { readFile } from 'node:fs/promises'
3
+ import path from 'node:path'
4
+ import { promisify } from 'node:util'
5
+
6
+ import GitAutocommit from './GitAutocommit.js'
7
+
8
+ export default class NpmReleasePropagator implements ReleasePropagator {
9
+ public static Class?: ReleasePropagatorConstructor
10
+ public static exec = promisify(execSync)
11
+ public static readFile = readFile
12
+
13
+ private packageName: string
14
+ private packageVersion: string
15
+ private repoPaths: string[]
16
+
17
+ private currentRepoPath!: string
18
+ private currentPackageJson!: PackageJson
19
+ private metaNodeVersion!: string
20
+
21
+ protected constructor(options: ReleasePropagatorOptions) {
22
+ const { packageName, packageVersion, repoPaths } = options
23
+
24
+ this.packageName = packageName
25
+ this.packageVersion = packageVersion
26
+ this.repoPaths = repoPaths
27
+ }
28
+
29
+ public static Create(options: ReleasePropagatorOptions) {
30
+ return new (this.Class ?? this)(options)
31
+ }
32
+
33
+ public async run() {
34
+ for (const repoPath of this.repoPaths) {
35
+ this.currentRepoPath = repoPath
36
+
37
+ await this.throwIfPreviousReleaseNotFound()
38
+ await this.installReleaseForCurrentRepo()
39
+ await this.gitCommitChanges()
40
+ }
41
+ }
42
+
43
+ private async throwIfPreviousReleaseNotFound() {
44
+ await this.loadCurrentPackageJson()
45
+
46
+ if (!(this.isDependency || this.isDevDependency)) {
47
+ throw new Error(
48
+ `Cannot propagate release for ${this.packageName} because it is not listed in either dependencies or devDependencies! Please install it in the target repository before running propagation.`
49
+ )
50
+ }
51
+ }
52
+
53
+ private async loadCurrentPackageJson() {
54
+ const raw = await this.readFile(this.currentPackageJsonPath, 'utf-8')
55
+ this.currentPackageJson = JSON.parse(raw)
56
+ }
57
+
58
+ private get currentPackageJsonPath() {
59
+ return `${this.currentRepoPath}/package.json`
60
+ }
61
+
62
+ private get isDependency() {
63
+ return this.currentPackageJson?.dependencies?.[this.packageName]
64
+ }
65
+
66
+ private get isDevDependency() {
67
+ return this.currentPackageJson?.devDependencies?.[this.packageName]
68
+ }
69
+
70
+ private async installReleaseForCurrentRepo() {
71
+ await this.exec(
72
+ `yarn add ${this.isDevDependency ? '-D ' : ''}${this.packageName}@${this.packageVersion}`,
73
+ {
74
+ cwd: this.currentRepoPath,
75
+ }
76
+ )
77
+ }
78
+
79
+ private async gitCommitChanges() {
80
+ await this.setCurrentMetaNodeVersion()
81
+
82
+ await this.GitAutocommit(
83
+ `patch: propagate ${this.packageName}@${this.packageVersion} (@neurodevs/meta-node: ${this.metaNodeVersion})`
84
+ )
85
+ }
86
+
87
+ private async setCurrentMetaNodeVersion() {
88
+ const globalRoot = await this.exec('yarn global dir')
89
+
90
+ const pkgPath = path.join(
91
+ globalRoot.stdout.trim(),
92
+ 'node_modules',
93
+ '@neurodevs',
94
+ 'meta-node',
95
+ 'package.json'
96
+ )
97
+
98
+ const raw = await this.readFile(pkgPath, { encoding: 'utf-8' })
99
+ const pkg = JSON.parse(raw)
100
+
101
+ this.metaNodeVersion = pkg.version
102
+ }
103
+
104
+ private get exec() {
105
+ return NpmReleasePropagator.exec
106
+ }
107
+
108
+ private get readFile() {
109
+ return NpmReleasePropagator.readFile
110
+ }
111
+
112
+ private GitAutocommit(commitMessage: string) {
113
+ return GitAutocommit.Create(commitMessage, this.currentRepoPath)
114
+ }
115
+ }
116
+
117
+ export interface ReleasePropagator {
118
+ run(): Promise<void>
119
+ }
120
+
121
+ export type ReleasePropagatorConstructor = new (
122
+ options: ReleasePropagatorOptions
123
+ ) => ReleasePropagator
124
+
125
+ export interface ReleasePropagatorOptions {
126
+ packageName: string
127
+ packageVersion: string
128
+ repoPaths: string[]
129
+ }
130
+
131
+ export interface PackageJson {
132
+ version?: string
133
+ dependencies?: Record<string, string>
134
+ devDependencies?: Record<string, string>
135
+ }
package/src/index.ts CHANGED
@@ -6,6 +6,14 @@ export * from './impl/GitAutocloner.js'
6
6
  export { default as FakeAutocloner } from './testDoubles/Autocloner/FakeAutocloner.js'
7
7
  export * from './testDoubles/Autocloner/FakeAutocloner.js'
8
8
 
9
+ // Autocommit
10
+
11
+ export { default as GitAutocommit } from './impl/GitAutocommit.js'
12
+ export * from './impl/GitAutocommit.js'
13
+
14
+ export { default as FakeAutocommit } from './testDoubles/Autocommit/FakeAutocommit.js'
15
+ export * from './testDoubles/Autocommit/FakeAutocommit.js'
16
+
9
17
  // Autodocumenter
10
18
 
11
19
  export { default as PackageAutodocumenter } from './impl/PackageAutodocumenter.js'
@@ -36,6 +44,22 @@ export * from './impl/NpmAutopackage.js'
36
44
  export { default as FakeAutopackage } from './testDoubles/Autopackage/FakeAutopackage.js'
37
45
  export * from './testDoubles/Autopackage/FakeAutopackage.js'
38
46
 
47
+ // PropagationCoordinator
48
+
49
+ export { default as NpmPropagationCoordinator } from './impl/NpmPropagationCoordinator.js'
50
+ export * from './impl/NpmPropagationCoordinator.js'
51
+
52
+ export { default as FakePropagationCoordinator } from './testDoubles/PropagationCoordinator/FakePropagationCoordinator.js'
53
+ export * from './testDoubles/PropagationCoordinator/FakePropagationCoordinator.js'
54
+
55
+ // ReleasePropagator
56
+
57
+ export { default as NpmReleasePropagator } from './impl/NpmReleasePropagator.js'
58
+ export * from './impl/NpmReleasePropagator.js'
59
+
60
+ export { default as FakeReleasePropagator } from './testDoubles/ReleasePropagator/FakeReleasePropagator.js'
61
+ export * from './testDoubles/ReleasePropagator/FakeReleasePropagator.js'
62
+
39
63
  // SnippetKeybinder
40
64
 
41
65
  export { default as VscodeSnippetKeybinder } from './impl/VscodeSnippetKeybinder.js'
@@ -0,0 +1,9 @@
1
+ import NpmReleasePropagator from '../impl/NpmReleasePropagator.js'
2
+
3
+ const propagator = NpmReleasePropagator.Create({
4
+ packageName: '@neurodevs/node-tdd',
5
+ packageVersion: '0.2.3',
6
+ repoPaths: ['/Users/ericthecurious/dev/node-ble'],
7
+ })
8
+
9
+ await propagator.run()
@@ -0,0 +1,26 @@
1
+ import { Autocommit } from '../../impl/GitAutocommit.js'
2
+
3
+ export default class FakeAutocommit implements Autocommit {
4
+ public static callsToConstructor: {
5
+ commitMessage?: string
6
+ cwd?: string
7
+ }[] = []
8
+
9
+ public static numCallsToRun = 0
10
+
11
+ public constructor(commitMessage?: string, cwd?: string) {
12
+ FakeAutocommit.callsToConstructor.push({
13
+ commitMessage,
14
+ cwd,
15
+ })
16
+ }
17
+
18
+ public async run() {
19
+ FakeAutocommit.numCallsToRun++
20
+ }
21
+
22
+ public static resetTestDouble() {
23
+ FakeAutocommit.callsToConstructor = []
24
+ FakeAutocommit.numCallsToRun = 0
25
+ }
26
+ }
@@ -0,0 +1,26 @@
1
+ import { PropagationCoordinator } from '../../impl/NpmPropagationCoordinator.js'
2
+
3
+ export default class FakePropagationCoordinator implements PropagationCoordinator {
4
+ public static callsToConstructor: {
5
+ repoPath?: string
6
+ repoPaths?: string[]
7
+ }[] = []
8
+
9
+ public static numCallsToRun = 0
10
+
11
+ public constructor(repoPath?: string, repoPaths?: string[]) {
12
+ FakePropagationCoordinator.callsToConstructor.push({
13
+ repoPath,
14
+ repoPaths,
15
+ })
16
+ }
17
+
18
+ public async run() {
19
+ FakePropagationCoordinator.numCallsToRun += 1
20
+ }
21
+
22
+ public static resetTestDouble() {
23
+ FakePropagationCoordinator.callsToConstructor = []
24
+ FakePropagationCoordinator.numCallsToRun = 0
25
+ }
26
+ }
@@ -0,0 +1,23 @@
1
+ import {
2
+ ReleasePropagator,
3
+ ReleasePropagatorOptions,
4
+ } from '../../impl/NpmReleasePropagator.js'
5
+
6
+ export default class FakeReleasePropagator implements ReleasePropagator {
7
+ public static callsToConstructor: (ReleasePropagatorOptions | undefined)[] =
8
+ []
9
+ public static numCallsToRun = 0
10
+
11
+ public constructor(options?: ReleasePropagatorOptions) {
12
+ FakeReleasePropagator.callsToConstructor.push(options)
13
+ }
14
+
15
+ public async run() {
16
+ FakeReleasePropagator.numCallsToRun++
17
+ }
18
+
19
+ public static resetTestDouble() {
20
+ FakeReleasePropagator.callsToConstructor = []
21
+ FakeReleasePropagator.numCallsToRun = 0
22
+ }
23
+ }