@neurodevs/meta-node 0.19.15 → 0.19.17
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/.vscode/launch.json +53 -58
- package/.vscode/settings.json +62 -66
- package/.vscode/tasks.json +123 -129
- package/README.md +1 -0
- package/build/.spruce/settings.json +3 -7
- package/build/__tests__/AbstractAutomoduleTest.js +2 -4
- package/build/__tests__/AbstractAutomoduleTest.js.map +1 -1
- package/build/__tests__/AbstractPackageTest.d.ts +2 -0
- package/build/__tests__/AbstractPackageTest.js +4 -1
- package/build/__tests__/AbstractPackageTest.js.map +1 -1
- package/build/__tests__/impl/GitAutocloner.test.js +0 -3
- package/build/__tests__/impl/GitAutocloner.test.js.map +1 -1
- package/build/__tests__/impl/GitAutocommit.test.d.ts +2 -2
- package/build/__tests__/impl/GitAutocommit.test.js +3 -5
- package/build/__tests__/impl/GitAutocommit.test.js.map +1 -1
- package/build/__tests__/impl/NpmAutopackage.test.d.ts +18 -4
- package/build/__tests__/impl/NpmAutopackage.test.js +228 -26
- package/build/__tests__/impl/NpmAutopackage.test.js.map +1 -1
- package/build/__tests__/impl/NpmReleasePropagator.test.js +1 -4
- package/build/__tests__/impl/NpmReleasePropagator.test.js.map +1 -1
- package/build/__tests__/impl/NpmWorkspaceTypeChecker.test.js +0 -3
- package/build/__tests__/impl/NpmWorkspaceTypeChecker.test.js.map +1 -1
- package/build/impl/NpmAutopackage.d.ts +19 -1
- package/build/impl/NpmAutopackage.js +193 -14
- package/build/impl/NpmAutopackage.js.map +1 -1
- package/eslint.config.js +3 -0
- package/package.json +7 -5
- package/prettier.config.js +3 -0
- package/src/.spruce/settings.json +3 -7
- package/src/__tests__/AbstractAutomoduleTest.ts +2 -5
- package/src/__tests__/AbstractPackageTest.ts +6 -2
- package/src/__tests__/impl/GitAutocloner.test.ts +2 -5
- package/src/__tests__/impl/GitAutocommit.test.ts +4 -8
- package/src/__tests__/impl/NpmAutopackage.test.ts +291 -24
- package/src/__tests__/impl/NpmReleasePropagator.test.ts +3 -6
- package/src/__tests__/impl/NpmWorkspaceTypeChecker.test.ts +1 -5
- package/src/impl/NpmAutopackage.ts +248 -23
- package/tsconfig.json +24 -27
- package/eslint.config.mjs +0 -3
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ChildProcess
|
|
1
|
+
import { ChildProcess } from 'child_process'
|
|
2
2
|
import { readFile, writeFile } from 'fs/promises'
|
|
3
3
|
import { mkdir } from 'fs/promises'
|
|
4
4
|
import path from 'path'
|
|
5
|
-
import { promisify } from 'util'
|
|
6
5
|
import {
|
|
7
6
|
callsToExec,
|
|
8
7
|
callsToFetch,
|
|
@@ -21,9 +20,11 @@ import {
|
|
|
21
20
|
resetCallsToPathExists,
|
|
22
21
|
resetCallsToReadFile,
|
|
23
22
|
resetCallsToWriteFile,
|
|
23
|
+
resetFakeReadFileThrowsFor,
|
|
24
24
|
setFakeExecResult,
|
|
25
25
|
setFakeFetchResponse,
|
|
26
26
|
setFakeReadFileResult,
|
|
27
|
+
setFakeReadFileThrowsFor,
|
|
27
28
|
setPathShouldExist,
|
|
28
29
|
} from '@neurodevs/fake-node-core'
|
|
29
30
|
import { test, assert } from '@neurodevs/node-tdd'
|
|
@@ -37,8 +38,6 @@ import NpmAutopackage, {
|
|
|
37
38
|
import FakeAutocommit from '../../testDoubles/Autocommit/FakeAutocommit.js'
|
|
38
39
|
import AbstractPackageTest from '../AbstractPackageTest.js'
|
|
39
40
|
|
|
40
|
-
const exec = promisify(execSync)
|
|
41
|
-
|
|
42
41
|
export default class NpmAutopackageTest extends AbstractPackageTest {
|
|
43
42
|
private static instance: Autopackage
|
|
44
43
|
|
|
@@ -108,10 +107,18 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
|
|
|
108
107
|
'prettier.config.js'
|
|
109
108
|
)
|
|
110
109
|
|
|
110
|
+
private static readonly settingsJsonPath = path.join(
|
|
111
|
+
this.packageDir,
|
|
112
|
+
'.vscode',
|
|
113
|
+
'settings.json'
|
|
114
|
+
)
|
|
115
|
+
|
|
111
116
|
private static readonly customLib = this.generateId()
|
|
112
117
|
private static readonly customType = this.generateId()
|
|
113
118
|
private static readonly customInclude = this.generateId()
|
|
114
|
-
private static readonly
|
|
119
|
+
private static readonly customTsconfigOption = this.generateId()
|
|
120
|
+
private static readonly customJestOption = this.generateId()
|
|
121
|
+
private static readonly customScript = this.generateId()
|
|
115
122
|
|
|
116
123
|
private static readonly setupVscodeCmd = 'spruce setup.vscode --all true'
|
|
117
124
|
|
|
@@ -125,6 +132,9 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
|
|
|
125
132
|
[this.generateId()]: this.generateId(),
|
|
126
133
|
}
|
|
127
134
|
|
|
135
|
+
private static readonly yarnRemoveDevDepsCommand =
|
|
136
|
+
'yarn remove eslint eslint-config-spruce prettier chokidar-cli ts-node @types/node'
|
|
137
|
+
|
|
128
138
|
private static readonly yarnInstallDevDepsCommand =
|
|
129
139
|
'yarn add -D @neurodevs/generate-id @neurodevs/node-tdd @neurodevs/eslint-config-ndx @neurodevs/prettier-config-ndx'
|
|
130
140
|
|
|
@@ -145,6 +155,71 @@ export default esConfigNdx
|
|
|
145
155
|
private static readonly prettierConfigFile = `import prettierConfigNdx from '@neurodevs/prettier-config-ndx'
|
|
146
156
|
|
|
147
157
|
export default prettierConfigNdx
|
|
158
|
+
`
|
|
159
|
+
|
|
160
|
+
private static readonly settingsJsonFile = `{
|
|
161
|
+
"debug.node.autoAttach": "on",
|
|
162
|
+
"git.ignoreLimitWarning": true,
|
|
163
|
+
"javascript.validate.enable": false,
|
|
164
|
+
"files.watcherExclude": {
|
|
165
|
+
"**/.git/objects/**": true,
|
|
166
|
+
"**/.git/subtree-cache/**": true,
|
|
167
|
+
"**/build/**": true,
|
|
168
|
+
"**/node_modules/**": true
|
|
169
|
+
},
|
|
170
|
+
"search.exclude": {
|
|
171
|
+
"**/build/**": true,
|
|
172
|
+
"**/node_modules/**": true,
|
|
173
|
+
"**/.next/**": true
|
|
174
|
+
},
|
|
175
|
+
"editor.codeActionsOnSave": {
|
|
176
|
+
"source.fixAll.eslint": "always"
|
|
177
|
+
},
|
|
178
|
+
"editor.formatOnSave": true,
|
|
179
|
+
"editor.formatOnSaveMode": "file",
|
|
180
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
181
|
+
"editor.maxTokenizationLineLength": 20000000,
|
|
182
|
+
"[javascript]": {
|
|
183
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
184
|
+
"editor.formatOnSave": true
|
|
185
|
+
},
|
|
186
|
+
"[javascriptreact]": {
|
|
187
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
188
|
+
"editor.formatOnSave": true
|
|
189
|
+
},
|
|
190
|
+
"[typescript]": {
|
|
191
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
192
|
+
"editor.formatOnSave": true
|
|
193
|
+
},
|
|
194
|
+
"[typescriptreact]": {
|
|
195
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
196
|
+
"editor.formatOnSave": true
|
|
197
|
+
},
|
|
198
|
+
"eslint.enable": true,
|
|
199
|
+
"eslint.useFlatConfig": true,
|
|
200
|
+
"eslint.validate": [
|
|
201
|
+
"javascript",
|
|
202
|
+
"javascriptreact",
|
|
203
|
+
"typescript",
|
|
204
|
+
"typescriptreact"
|
|
205
|
+
],
|
|
206
|
+
"eslint.workingDirectories": ["./"],
|
|
207
|
+
"debug.javascript.unmapMissingSources": true,
|
|
208
|
+
"javascript.preferences.importModuleSpecifier": "relative",
|
|
209
|
+
"typescript.preferences.importModuleSpecifier": "relative",
|
|
210
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
211
|
+
"typescript.validate.enable": true,
|
|
212
|
+
"cSpell.ignorePaths": [
|
|
213
|
+
"**/package-lock.json",
|
|
214
|
+
"**/node_modules/**",
|
|
215
|
+
"**/build/**",
|
|
216
|
+
"**/vscode-extension/**",
|
|
217
|
+
"**/.git/objects/**",
|
|
218
|
+
".vscode",
|
|
219
|
+
".spruce"
|
|
220
|
+
],
|
|
221
|
+
"cSpell.words": ["arkit", "autogenerated", "scrollable", "serializable"]
|
|
222
|
+
}
|
|
148
223
|
`
|
|
149
224
|
|
|
150
225
|
private static readonly defaultOptions = {
|
|
@@ -330,7 +405,6 @@ export default prettierConfigNdx
|
|
|
330
405
|
'dependencies',
|
|
331
406
|
'devDependencies',
|
|
332
407
|
'jest',
|
|
333
|
-
'skill',
|
|
334
408
|
]
|
|
335
409
|
)
|
|
336
410
|
|
|
@@ -478,13 +552,28 @@ export default prettierConfigNdx
|
|
|
478
552
|
)
|
|
479
553
|
}
|
|
480
554
|
|
|
555
|
+
@test()
|
|
556
|
+
protected static async thenRemovesOldDevDependencies() {
|
|
557
|
+
this.setShouldInstallDevDeps()
|
|
558
|
+
await this.run()
|
|
559
|
+
|
|
560
|
+
assert.isEqualDeep(
|
|
561
|
+
callsToExec[6],
|
|
562
|
+
{
|
|
563
|
+
command: this.yarnRemoveDevDepsCommand,
|
|
564
|
+
options: { cwd: this.packageDir },
|
|
565
|
+
},
|
|
566
|
+
'Did not remove old devDependencies!'
|
|
567
|
+
)
|
|
568
|
+
}
|
|
569
|
+
|
|
481
570
|
@test()
|
|
482
571
|
protected static async thenInstallsDefaultDevDependencies() {
|
|
483
572
|
this.setShouldInstallDevDeps()
|
|
484
573
|
await this.run()
|
|
485
574
|
|
|
486
575
|
assert.isEqualDeep(
|
|
487
|
-
callsToExec[
|
|
576
|
+
callsToExec[11],
|
|
488
577
|
{
|
|
489
578
|
command: this.yarnInstallDevDepsCommand,
|
|
490
579
|
options: { cwd: this.packageDir },
|
|
@@ -554,7 +643,7 @@ export default prettierConfigNdx
|
|
|
554
643
|
}
|
|
555
644
|
|
|
556
645
|
@test()
|
|
557
|
-
protected static async
|
|
646
|
+
protected static async thenRemovesOldEslintConfigMjs() {
|
|
558
647
|
setPathShouldExist(
|
|
559
648
|
path.join(this.packageDir, 'eslint.config.mjs'),
|
|
560
649
|
true
|
|
@@ -564,12 +653,12 @@ export default prettierConfigNdx
|
|
|
564
653
|
await this.run()
|
|
565
654
|
|
|
566
655
|
assert.isEqualDeep(
|
|
567
|
-
callsToExec[
|
|
656
|
+
callsToExec[12],
|
|
568
657
|
{
|
|
569
658
|
command: `git rm eslint.config.mjs`,
|
|
570
659
|
options: { cwd: this.packageDir },
|
|
571
660
|
},
|
|
572
|
-
'Did not
|
|
661
|
+
'Did not remove old eslint.config.mjs!'
|
|
573
662
|
)
|
|
574
663
|
}
|
|
575
664
|
|
|
@@ -635,17 +724,106 @@ export default prettierConfigNdx
|
|
|
635
724
|
)
|
|
636
725
|
}
|
|
637
726
|
|
|
727
|
+
@test()
|
|
728
|
+
protected static async thenInstallsSettingsJsonFile() {
|
|
729
|
+
this.setShouldInstallDevDeps()
|
|
730
|
+
await this.run()
|
|
731
|
+
|
|
732
|
+
assert.isEqualDeep(
|
|
733
|
+
callsToWriteFile[7],
|
|
734
|
+
{
|
|
735
|
+
file: this.settingsJsonPath,
|
|
736
|
+
data: this.settingsJsonFile,
|
|
737
|
+
options: { encoding: 'utf-8' },
|
|
738
|
+
},
|
|
739
|
+
'Did not install settings.json!'
|
|
740
|
+
)
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
@test()
|
|
744
|
+
protected static async thenCommitsInstallSettingsJsonFile() {
|
|
745
|
+
this.setShouldInstallDevDeps()
|
|
746
|
+
await this.run()
|
|
747
|
+
|
|
748
|
+
assert.isEqualDeep(
|
|
749
|
+
FakeAutocommit.callsToConstructor[10],
|
|
750
|
+
{
|
|
751
|
+
commitMessage: `patch: install settings.json (@neurodevs/meta-node: ${this.metaNodeVersion})`,
|
|
752
|
+
cwd: this.packageDir,
|
|
753
|
+
},
|
|
754
|
+
'Did not commit install settings.json changes!'
|
|
755
|
+
)
|
|
756
|
+
}
|
|
757
|
+
|
|
638
758
|
@test()
|
|
639
759
|
protected static async lastlyOpensVscodeAtEnd() {
|
|
640
760
|
await this.run()
|
|
641
761
|
|
|
642
762
|
assert.isEqualDeep(
|
|
643
|
-
callsToExec[
|
|
763
|
+
callsToExec[12],
|
|
644
764
|
{ command: 'code .', options: { cwd: this.packageDir } },
|
|
645
765
|
'Did not open vscode at end!'
|
|
646
766
|
)
|
|
647
767
|
}
|
|
648
768
|
|
|
769
|
+
@test()
|
|
770
|
+
protected static async removesCertainKeysFromPackageJson() {
|
|
771
|
+
const keysToRemove = [
|
|
772
|
+
'skill',
|
|
773
|
+
'jest.testPathIgnorePatterns',
|
|
774
|
+
'jest.moduleNameMapper',
|
|
775
|
+
'scripts.build.resolve-paths',
|
|
776
|
+
'scripts.lint.tsc',
|
|
777
|
+
'scripts.post.watch.build',
|
|
778
|
+
'scripts.resolve-paths.lint',
|
|
779
|
+
'scripts.watch.rebuild',
|
|
780
|
+
'scripts.watch.tsc',
|
|
781
|
+
]
|
|
782
|
+
|
|
783
|
+
const pkg = JSON.parse(this.updatedPackageJson)
|
|
784
|
+
|
|
785
|
+
for (const key of keysToRemove) {
|
|
786
|
+
assert.isUndefined(
|
|
787
|
+
this.getByPath(pkg, key),
|
|
788
|
+
`Did not remove ${key} from package.json!`
|
|
789
|
+
)
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
@test()
|
|
794
|
+
protected static async installsEslintConfigIfNotExists() {
|
|
795
|
+
setFakeReadFileThrowsFor(this.eslintConfigJsPath)
|
|
796
|
+
|
|
797
|
+
await this.run()
|
|
798
|
+
|
|
799
|
+
const calls = callsToWriteFile.filter(
|
|
800
|
+
(call) => call.file === this.eslintConfigJsPath
|
|
801
|
+
)
|
|
802
|
+
|
|
803
|
+
assert.isEqual(
|
|
804
|
+
calls.length,
|
|
805
|
+
1,
|
|
806
|
+
'Should install eslint.config.js if it does not exist!'
|
|
807
|
+
)
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
@test()
|
|
811
|
+
protected static async installsPrettierConfigIfNotExists() {
|
|
812
|
+
setFakeReadFileThrowsFor(this.prettierConfigPath)
|
|
813
|
+
|
|
814
|
+
await this.run()
|
|
815
|
+
|
|
816
|
+
const calls = callsToWriteFile.filter(
|
|
817
|
+
(call) => call.file === this.prettierConfigPath
|
|
818
|
+
)
|
|
819
|
+
|
|
820
|
+
assert.isEqual(
|
|
821
|
+
calls.length,
|
|
822
|
+
1,
|
|
823
|
+
'Should install prettier.config.js if it does not exist!'
|
|
824
|
+
)
|
|
825
|
+
}
|
|
826
|
+
|
|
649
827
|
@test()
|
|
650
828
|
protected static async installsDevDependenciesIfGenerateIdNotLatest() {
|
|
651
829
|
setFakeExecResult(this.checkGenerateIdVersionCmd, {
|
|
@@ -906,7 +1084,10 @@ export default prettierConfigNdx
|
|
|
906
1084
|
protected static async doesNotThrowIfGenerateIdNotInPackageJson() {
|
|
907
1085
|
setFakeReadFileResult(
|
|
908
1086
|
this.packageJsonPath,
|
|
909
|
-
this.originalPackageJson.replace(
|
|
1087
|
+
JSON.stringify(this.originalPackageJson).replace(
|
|
1088
|
+
'@neurodevs/generate-id',
|
|
1089
|
+
''
|
|
1090
|
+
)
|
|
910
1091
|
)
|
|
911
1092
|
|
|
912
1093
|
await this.runTwice()
|
|
@@ -963,8 +1144,8 @@ export default prettierConfigNdx
|
|
|
963
1144
|
}
|
|
964
1145
|
|
|
965
1146
|
@test()
|
|
966
|
-
protected static async
|
|
967
|
-
|
|
1147
|
+
protected static async doesNotInstallEslintConfigFileIfContentsEqual() {
|
|
1148
|
+
setFakeReadFileResult(this.eslintConfigJsPath, this.eslintConfigFile)
|
|
968
1149
|
|
|
969
1150
|
await this.run()
|
|
970
1151
|
|
|
@@ -975,13 +1156,13 @@ export default prettierConfigNdx
|
|
|
975
1156
|
assert.isEqual(
|
|
976
1157
|
calls.length,
|
|
977
1158
|
0,
|
|
978
|
-
'Should not install eslint.config.js if
|
|
1159
|
+
'Should not install eslint.config.js if contents are equal!'
|
|
979
1160
|
)
|
|
980
1161
|
}
|
|
981
1162
|
|
|
982
1163
|
@test()
|
|
983
|
-
protected static async
|
|
984
|
-
|
|
1164
|
+
protected static async doesNotInstallPrettierConfigFileIfContentsEqual() {
|
|
1165
|
+
setFakeReadFileResult(this.prettierConfigPath, this.prettierConfigFile)
|
|
985
1166
|
|
|
986
1167
|
await this.run()
|
|
987
1168
|
|
|
@@ -992,7 +1173,24 @@ export default prettierConfigNdx
|
|
|
992
1173
|
assert.isEqual(
|
|
993
1174
|
calls.length,
|
|
994
1175
|
0,
|
|
995
|
-
'Should not install prettier.config.js if
|
|
1176
|
+
'Should not install prettier.config.js if contents are equal!'
|
|
1177
|
+
)
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
@test()
|
|
1181
|
+
protected static async doesNotInstallSettingsJsonFileIfContentsEqual() {
|
|
1182
|
+
setFakeReadFileResult(this.settingsJsonPath, this.settingsJsonFile)
|
|
1183
|
+
|
|
1184
|
+
await this.run()
|
|
1185
|
+
|
|
1186
|
+
const calls = callsToWriteFile.filter(
|
|
1187
|
+
(call) => call.file === this.settingsJsonPath
|
|
1188
|
+
)
|
|
1189
|
+
|
|
1190
|
+
assert.isEqual(
|
|
1191
|
+
calls.length,
|
|
1192
|
+
0,
|
|
1193
|
+
'Should not install settings.json if contents are equal!'
|
|
996
1194
|
)
|
|
997
1195
|
}
|
|
998
1196
|
|
|
@@ -1027,6 +1225,12 @@ export default prettierConfigNdx
|
|
|
1027
1225
|
await this.run()
|
|
1028
1226
|
}
|
|
1029
1227
|
|
|
1228
|
+
private static getByPath(obj: any, path: string) {
|
|
1229
|
+
return path
|
|
1230
|
+
.split('.')
|
|
1231
|
+
.reduce((acc, key) => (acc == null ? undefined : acc[key]), obj)
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1030
1234
|
private static setShouldInstallDevDeps() {
|
|
1031
1235
|
setFakeExecResult(this.checkGenerateIdVersionCmd, {
|
|
1032
1236
|
stdout: '0.0.1',
|
|
@@ -1065,7 +1269,7 @@ export default prettierConfigNdx
|
|
|
1065
1269
|
}
|
|
1066
1270
|
|
|
1067
1271
|
private static fakeExec() {
|
|
1068
|
-
NpmAutopackage.exec = fakeExec as
|
|
1272
|
+
NpmAutopackage.exec = fakeExec as any
|
|
1069
1273
|
resetCallsToExec()
|
|
1070
1274
|
|
|
1071
1275
|
this.setFakeMetaNodeVersion()
|
|
@@ -1111,7 +1315,10 @@ export default prettierConfigNdx
|
|
|
1111
1315
|
NpmAutopackage.readFile = fakeReadFile as unknown as typeof readFile
|
|
1112
1316
|
resetCallsToReadFile()
|
|
1113
1317
|
|
|
1114
|
-
setFakeReadFileResult(
|
|
1318
|
+
setFakeReadFileResult(
|
|
1319
|
+
this.packageJsonPath,
|
|
1320
|
+
JSON.stringify(this.originalPackageJsonWithDummies)
|
|
1321
|
+
)
|
|
1115
1322
|
|
|
1116
1323
|
setFakeReadFileResult(
|
|
1117
1324
|
this.tasksJsonPath,
|
|
@@ -1124,6 +1331,8 @@ export default prettierConfigNdx
|
|
|
1124
1331
|
)
|
|
1125
1332
|
|
|
1126
1333
|
setFakeReadFileResult(this.gitignorePath, this.originalGitignore)
|
|
1334
|
+
|
|
1335
|
+
resetFakeReadFileThrowsFor()
|
|
1127
1336
|
}
|
|
1128
1337
|
|
|
1129
1338
|
private static fakeWriteFile() {
|
|
@@ -1154,9 +1363,12 @@ export default prettierConfigNdx
|
|
|
1154
1363
|
}
|
|
1155
1364
|
|
|
1156
1365
|
private static get originalPackageJson() {
|
|
1157
|
-
return
|
|
1366
|
+
return {
|
|
1158
1367
|
name: this.packageName,
|
|
1159
1368
|
description: 'Old description',
|
|
1369
|
+
scripts: {
|
|
1370
|
+
customScript: this.customScript,
|
|
1371
|
+
},
|
|
1160
1372
|
dependencies: this.dependencies,
|
|
1161
1373
|
devDependencies: {
|
|
1162
1374
|
'@neurodevs/generate-id': '^1.0.0',
|
|
@@ -1164,12 +1376,36 @@ export default prettierConfigNdx
|
|
|
1164
1376
|
'@neurodevs/eslint-config-ndx': '^1.0.0',
|
|
1165
1377
|
'@neurodevs/prettier-config-ndx': '^1.0.0',
|
|
1166
1378
|
},
|
|
1167
|
-
|
|
1379
|
+
jest: {
|
|
1380
|
+
['customOption']: this.customJestOption,
|
|
1381
|
+
},
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
private static get originalPackageJsonWithDummies() {
|
|
1386
|
+
return {
|
|
1387
|
+
...this.originalPackageJson,
|
|
1388
|
+
scripts: {
|
|
1389
|
+
...this.originalPackageJson.scripts,
|
|
1390
|
+
'build.resolve-paths': 'dummy',
|
|
1391
|
+
'lint.tsc': 'dummy',
|
|
1392
|
+
'post.watch.build': 'dummy',
|
|
1393
|
+
'resolve-paths.lint': 'dummy',
|
|
1394
|
+
'watch.rebuild': 'dummy',
|
|
1395
|
+
'watch.tsc': 'dummy',
|
|
1396
|
+
},
|
|
1397
|
+
jest: {
|
|
1398
|
+
...this.originalPackageJson.jest,
|
|
1399
|
+
testPathIgnorePatterns: 'dummy',
|
|
1400
|
+
moduleNameMapper: 'dummy',
|
|
1401
|
+
},
|
|
1402
|
+
skill: 'dummy',
|
|
1403
|
+
}
|
|
1168
1404
|
}
|
|
1169
1405
|
|
|
1170
1406
|
private static get updatedPackageJson() {
|
|
1171
1407
|
return JSON.stringify({
|
|
1172
|
-
...
|
|
1408
|
+
...this.originalPackageJson,
|
|
1173
1409
|
name: this.scopedPackageName,
|
|
1174
1410
|
description: this.description,
|
|
1175
1411
|
type: 'module',
|
|
@@ -1185,7 +1421,38 @@ export default prettierConfigNdx
|
|
|
1185
1421
|
bugs: {
|
|
1186
1422
|
url: `https://github.com/${this.gitNamespace}/${this.packageName}/issues`,
|
|
1187
1423
|
},
|
|
1424
|
+
scripts: {
|
|
1425
|
+
...this.originalPackageJson.scripts,
|
|
1426
|
+
'build.ci': 'yarn run build.tsc && yarn run lint',
|
|
1427
|
+
'build.dev':
|
|
1428
|
+
'yarn run build.tsc --sourceMap ; yarn run lint ; prettier --write .',
|
|
1429
|
+
'build.copy-files':
|
|
1430
|
+
"mkdir -p build && rsync -avzq --exclude='*.ts' ./src/ ./build/",
|
|
1431
|
+
'build.tsc': 'yarn run build.copy-files && tsc',
|
|
1432
|
+
clean: 'yarn run clean.build',
|
|
1433
|
+
'clean.all':
|
|
1434
|
+
'yarn run clean.dependencies && yarn run clean.build',
|
|
1435
|
+
'clean.build': 'rm -rf build/',
|
|
1436
|
+
'clean.dependencies':
|
|
1437
|
+
'rm -rf node_modules/ package-lock.json yarn.lock',
|
|
1438
|
+
'fix.lint': "eslint --fix --cache '**/*.ts'",
|
|
1439
|
+
lint: "eslint --cache '**/*.ts'",
|
|
1440
|
+
rebuild:
|
|
1441
|
+
'yarn run clean.all && yarn install && yarn run build.dev',
|
|
1442
|
+
'update.dependencies': 'yarn run clean.dependencies && yarn',
|
|
1443
|
+
test: 'NODE_OPTIONS=--experimental-vm-modules jest',
|
|
1444
|
+
'watch.build.dev':
|
|
1445
|
+
"tsc-watch --sourceMap --onCompilationComplete 'yarn run build.copy-files'",
|
|
1446
|
+
},
|
|
1188
1447
|
dependencies: this.dependencies,
|
|
1448
|
+
jest: {
|
|
1449
|
+
...this.originalPackageJson.jest,
|
|
1450
|
+
testEnvironment: 'node',
|
|
1451
|
+
testRunner: 'jest-circus/runner',
|
|
1452
|
+
testMatch: ['<rootDir>/build/__tests__/**/*.test.js?(x)'],
|
|
1453
|
+
testTimeout: 5000,
|
|
1454
|
+
maxWorkers: 4,
|
|
1455
|
+
},
|
|
1189
1456
|
})
|
|
1190
1457
|
}
|
|
1191
1458
|
|
|
@@ -1196,7 +1463,7 @@ export default prettierConfigNdx
|
|
|
1196
1463
|
types: [this.customType],
|
|
1197
1464
|
},
|
|
1198
1465
|
include: [this.customInclude],
|
|
1199
|
-
customOption: this.
|
|
1466
|
+
customOption: this.customTsconfigOption,
|
|
1200
1467
|
}
|
|
1201
1468
|
}
|
|
1202
1469
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ChildProcess
|
|
1
|
+
import { ChildProcess } from 'node:child_process'
|
|
2
2
|
import { readFile } from 'node:fs/promises'
|
|
3
3
|
import { Readable } from 'node:stream'
|
|
4
|
-
import { promisify } from 'node:util'
|
|
5
4
|
import {
|
|
6
5
|
callsToExec,
|
|
7
6
|
fakeExec,
|
|
@@ -23,8 +22,6 @@ import NpmReleasePropagator, {
|
|
|
23
22
|
import { FakeAutocommit } from '../../index.js'
|
|
24
23
|
import AbstractPackageTest from '../AbstractPackageTest.js'
|
|
25
24
|
|
|
26
|
-
const exec = promisify(execSync)
|
|
27
|
-
|
|
28
25
|
export default class NpmReleasePropagatorTest extends AbstractPackageTest {
|
|
29
26
|
private static instance: ReleasePropagator
|
|
30
27
|
|
|
@@ -119,7 +116,7 @@ export default class NpmReleasePropagatorTest extends AbstractPackageTest {
|
|
|
119
116
|
|
|
120
117
|
try {
|
|
121
118
|
await this.run()
|
|
122
|
-
} catch (
|
|
119
|
+
} catch (_error) {
|
|
123
120
|
// Expected to throw
|
|
124
121
|
}
|
|
125
122
|
|
|
@@ -199,7 +196,7 @@ Please commit or stash these changes before running propagation!
|
|
|
199
196
|
}
|
|
200
197
|
|
|
201
198
|
private static setFakeExec() {
|
|
202
|
-
NpmReleasePropagator.exec = fakeExec as unknown as typeof exec
|
|
199
|
+
NpmReleasePropagator.exec = fakeExec as unknown as typeof this.exec
|
|
203
200
|
resetCallsToExec()
|
|
204
201
|
resetExecThrowsFor()
|
|
205
202
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { exec as execSync } from 'node:child_process'
|
|
2
1
|
import { readdir } from 'node:fs/promises'
|
|
3
|
-
import { promisify } from 'node:util'
|
|
4
2
|
|
|
5
3
|
import {
|
|
6
4
|
callsToExec,
|
|
@@ -16,8 +14,6 @@ import {
|
|
|
16
14
|
} from '@neurodevs/fake-node-core'
|
|
17
15
|
import { test, assert } from '@neurodevs/node-tdd'
|
|
18
16
|
|
|
19
|
-
const exec = promisify(execSync)
|
|
20
|
-
|
|
21
17
|
import NpmWorkspaceTypeChecker, {
|
|
22
18
|
WorkspaceTypeChecker,
|
|
23
19
|
} from '../../impl/NpmWorkspaceTypeChecker.js'
|
|
@@ -128,7 +124,7 @@ export default class NpmWorkspaceTypeCheckerTest extends AbstractPackageTest {
|
|
|
128
124
|
}
|
|
129
125
|
|
|
130
126
|
private static setFakeExec() {
|
|
131
|
-
NpmWorkspaceTypeChecker.exec = fakeExec as unknown as typeof exec
|
|
127
|
+
NpmWorkspaceTypeChecker.exec = fakeExec as unknown as typeof this.exec
|
|
132
128
|
resetCallsToExec()
|
|
133
129
|
}
|
|
134
130
|
|