@neurodevs/meta-node 0.13.0 → 0.14.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 (25) hide show
  1. package/build/__tests__/AbstractPackageTest.d.ts +21 -0
  2. package/build/__tests__/AbstractPackageTest.js +62 -1
  3. package/build/__tests__/AbstractPackageTest.js.map +1 -1
  4. package/build/__tests__/impl/TypescriptClassSnippetSuite.test.d.ts +21 -2
  5. package/build/__tests__/impl/TypescriptClassSnippetSuite.test.js +200 -35
  6. package/build/__tests__/impl/TypescriptClassSnippetSuite.test.js.map +1 -1
  7. package/build/__tests__/impl/VscodeSnippetKeybinder.test.d.ts +0 -9
  8. package/build/__tests__/impl/VscodeSnippetKeybinder.test.js +2 -25
  9. package/build/__tests__/impl/VscodeSnippetKeybinder.test.js.map +1 -1
  10. package/build/impl/TypescriptClassSnippetSuite.d.ts +39 -1
  11. package/build/impl/TypescriptClassSnippetSuite.js +230 -1
  12. package/build/impl/TypescriptClassSnippetSuite.js.map +1 -1
  13. package/build/scripts/installSnippetSuite.d.ts +1 -0
  14. package/build/scripts/installSnippetSuite.js +17 -0
  15. package/build/scripts/installSnippetSuite.js.map +1 -0
  16. package/build/testDoubles/SnippetSuite/FakeSnippetSuite.d.ts +2 -0
  17. package/build/testDoubles/SnippetSuite/FakeSnippetSuite.js +5 -0
  18. package/build/testDoubles/SnippetSuite/FakeSnippetSuite.js.map +1 -1
  19. package/package.json +1 -1
  20. package/src/__tests__/AbstractPackageTest.ts +51 -1
  21. package/src/__tests__/impl/TypescriptClassSnippetSuite.test.ts +248 -2
  22. package/src/__tests__/impl/VscodeSnippetKeybinder.test.ts +2 -42
  23. package/src/impl/TypescriptClassSnippetSuite.ts +292 -1
  24. package/src/scripts/installSnippetSuite.ts +15 -0
  25. package/src/testDoubles/SnippetSuite/FakeSnippetSuite.ts +6 -0
@@ -1,10 +1,239 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const promises_1 = require("fs/promises");
7
+ const expandHomeDir_1 = __importDefault(require("../scripts/expandHomeDir"));
3
8
  class TypescriptClassSnippetSuite {
4
- constructor() { }
9
+ constructor() {
10
+ this.vscodeDir = (0, expandHomeDir_1.default)('~/Library/Application Support/Code/User');
11
+ this.snippetStartMarker = '// === TYPESCRIPT CLASS SNIPPETS BEGIN ===';
12
+ this.snippetEndMarker = '// === TYPESCRIPT CLASS SNIPPETS END ===';
13
+ this.keybindStartMarker = '// === TYPESCRIPT CLASS KEYBINDINGS BEGIN ===';
14
+ this.keybindEndMarker = '// === TYPESCRIPT CLASS KEYBINDINGS END ===';
15
+ this.snippets = `
16
+ // === PUBLIC ===
17
+ "Public constructor": { "scope": "typescript", "prefix": "public.constructor", "body": ["public constructor() {}"] },
18
+ "Public field": { "scope": "typescript", "prefix": "public.field", "body": ["public newField = undefined"] },
19
+ "Public readonly field": { "scope": "typescript", "prefix": "public.readonly.field", "body": ["public readonly newField = undefined"] },
20
+ "Public getter": { "scope": "typescript", "prefix": "public.getter", "body": ["public get newProperty() { return undefined }"] },
21
+ "Public setter": { "scope": "typescript", "prefix": "public.setter", "body": ["public set newProperty(_value: unknown) {}"] },
22
+ "Public method": { "scope": "typescript", "prefix": "public.method", "body": ["public newMethod() {}"] },
23
+ "Public async method": { "scope": "typescript", "prefix": "public.async.method", "body": ["public async newMethod() {}"] },
24
+ "Public abstract method": { "scope": "typescript", "prefix": "public.abstract.method", "body": ["public abstract newMethod(): unknown"] },
25
+
26
+ // === PROTECTED ===
27
+ "Protected constructor": { "scope": "typescript", "prefix": "protected.constructor", "body": ["protected constructor() {}"] },
28
+ "Protected field": { "scope": "typescript", "prefix": "protected.field", "body": ["protected newField = undefined"] },
29
+ "Protected readonly field": { "scope": "typescript", "prefix": "protected.readonly.field", "body": ["protected readonly newField = undefined"] },
30
+ "Protected getter": { "scope": "typescript", "prefix": "protected.getter", "body": ["protected get newProperty() { return undefined }"] },
31
+ "Protected setter": { "scope": "typescript", "prefix": "protected.setter", "body": ["protected set newProperty(_value: unknown) {}"] },
32
+ "Protected method": { "scope": "typescript", "prefix": "protected.method", "body": ["protected newMethod() {}"] },
33
+ "Protected async method": { "scope": "typescript", "prefix": "protected.async.method", "body": ["protected async newMethod() {}"] },
34
+ "Protected abstract method": { "scope": "typescript", "prefix": "protected.abstract.method", "body": ["protected abstract newMethod(): unknown"] },
35
+
36
+ // === PRIVATE ===
37
+ "Private constructor": { "scope": "typescript", "prefix": "private.constructor", "body": ["private constructor() {}"] },
38
+ "Private field": { "scope": "typescript", "prefix": "private.field", "body": ["private newField = undefined"] },
39
+ "Private readonly field": { "scope": "typescript", "prefix": "private.readonly.field", "body": ["private readonly newField = undefined"] },
40
+ "Private getter": { "scope": "typescript", "prefix": "private.getter", "body": ["private get newProperty() { return undefined }"] },
41
+ "Private setter": { "scope": "typescript", "prefix": "private.setter", "body": ["private set newProperty(_value: unknown) {}"] },
42
+ "Private method": { "scope": "typescript", "prefix": "private.method", "body": ["private newMethod() {}"] },
43
+ "Private async method": { "scope": "typescript", "prefix": "private.async.method", "body": ["private async newMethod() {}"] },
44
+ "Private abstract method": { "scope": "typescript", "prefix": "private.abstract.method", "body": ["private abstract newMethod(): unknown"] },
45
+
46
+ // === PUBLIC STATIC ===
47
+ "Public static field": { "scope": "typescript", "prefix": "public.static.field", "body": ["public static newField = undefined"] },
48
+ "Public static readonly field": { "scope": "typescript", "prefix": "public.static.readonly.field", "body": ["public static readonly newField = undefined"] },
49
+ "Public static getter": { "scope": "typescript", "prefix": "public.static.getter", "body": ["public static get newProperty() { return undefined }"] },
50
+ "Public static setter": { "scope": "typescript", "prefix": "public.static.setter", "body": ["public static set newProperty(_value: unknown) {}"] },
51
+ "Public static method": { "scope": "typescript", "prefix": "public.static.method", "body": ["public static newMethod() {}"] },
52
+ "Public static async method": { "scope": "typescript", "prefix": "public.static.async.method", "body": ["public static async newMethod() {}"] },
53
+
54
+ // === PROTECTED STATIC ===
55
+ "Protected static field": { "scope": "typescript", "prefix": "protected.static.field", "body": ["protected static newField = undefined"] },
56
+ "Protected static readonly field": { "scope": "typescript", "prefix": "protected.static.readonly.field", "body": ["protected static readonly newField = undefined"] },
57
+ "Protected static getter": { "scope": "typescript", "prefix": "protected.static.getter", "body": ["protected static get newProperty() { return undefined }"] },
58
+ "Protected static setter": { "scope": "typescript", "prefix": "protected.static.setter", "body": ["protected static set newProperty(_value: unknown) {}"] },
59
+ "Protected static method": { "scope": "typescript", "prefix": "protected.static.method", "body": ["protected static newMethod() {}"] },
60
+ "Protected static async method": { "scope": "typescript", "prefix": "protected.static.async.method", "body": ["protected static async newMethod() {}"] },
61
+
62
+ // === PRIVATE STATIC ===
63
+ "Private static field": { "scope": "typescript", "prefix": "private.static.field", "body": ["private static newField = undefined"] },
64
+ "Private static readonly field": { "scope": "typescript", "prefix": "private.static.readonly.field", "body": ["private static readonly newField = undefined"] },
65
+ "Private static getter": { "scope": "typescript", "prefix": "private.static.getter", "body": ["private static get newProperty() { return undefined }"] },
66
+ "Private static setter": { "scope": "typescript", "prefix": "private.static.setter", "body": ["private static set newProperty(_value: unknown) {}"] },
67
+ "Private static method": { "scope": "typescript", "prefix": "private.static.method", "body": ["private static newMethod() {}"] },
68
+ "Private static async method": { "scope": "typescript", "prefix": "private.static.async.method", "body": ["private static async newMethod() {}"] }
69
+ `.replace(/^[ \t]+/gm, '');
70
+ this.indentedSnippets = this.snippets
71
+ .split('\n')
72
+ .map((line) => (line.trim() ? ' ' + line : line))
73
+ .join('\n');
74
+ this.keybindings = `
75
+ // === PUBLIC (Ctrl+1) ===
76
+ { "key": "ctrl+1 f1", "command": "editor.action.insertSnippet", "args": { "name": "Public constructor" } },
77
+ { "key": "ctrl+1 f2", "command": "editor.action.insertSnippet", "args": { "name": "Public field" } },
78
+ { "key": "ctrl+1 f3", "command": "editor.action.insertSnippet", "args": { "name": "Public readonly field" } },
79
+ { "key": "ctrl+1 f4", "command": "editor.action.insertSnippet", "args": { "name": "Public getter" } },
80
+ { "key": "ctrl+1 f5", "command": "editor.action.insertSnippet", "args": { "name": "Public setter" } },
81
+ { "key": "ctrl+1 f6", "command": "editor.action.insertSnippet", "args": { "name": "Public method" } },
82
+ { "key": "ctrl+1 f7", "command": "editor.action.insertSnippet", "args": { "name": "Public async method" } },
83
+ { "key": "ctrl+1 f8", "command": "editor.action.insertSnippet", "args": { "name": "Public abstract method" } },
84
+
85
+ // === PROTECTED (Ctrl+2) ===
86
+ { "key": "ctrl+2 f1", "command": "editor.action.insertSnippet", "args": { "name": "Protected constructor" } },
87
+ { "key": "ctrl+2 f2", "command": "editor.action.insertSnippet", "args": { "name": "Protected field" } },
88
+ { "key": "ctrl+2 f3", "command": "editor.action.insertSnippet", "args": { "name": "Protected readonly field" } },
89
+ { "key": "ctrl+2 f4", "command": "editor.action.insertSnippet", "args": { "name": "Protected getter" } },
90
+ { "key": "ctrl+2 f5", "command": "editor.action.insertSnippet", "args": { "name": "Protected setter" } },
91
+ { "key": "ctrl+2 f6", "command": "editor.action.insertSnippet", "args": { "name": "Protected method" } },
92
+ { "key": "ctrl+2 f7", "command": "editor.action.insertSnippet", "args": { "name": "Protected async method" } },
93
+ { "key": "ctrl+2 f8", "command": "editor.action.insertSnippet", "args": { "name": "Protected abstract method" } },
94
+
95
+ // === PRIVATE (Ctrl+3) ===
96
+ { "key": "ctrl+3 f1", "command": "editor.action.insertSnippet", "args": { "name": "Private constructor" } },
97
+ { "key": "ctrl+3 f2", "command": "editor.action.insertSnippet", "args": { "name": "Private field" } },
98
+ { "key": "ctrl+3 f3", "command": "editor.action.insertSnippet", "args": { "name": "Private readonly field" } },
99
+ { "key": "ctrl+3 f4", "command": "editor.action.insertSnippet", "args": { "name": "Private getter" } },
100
+ { "key": "ctrl+3 f5", "command": "editor.action.insertSnippet", "args": { "name": "Private setter" } },
101
+ { "key": "ctrl+3 f6", "command": "editor.action.insertSnippet", "args": { "name": "Private method" } },
102
+ { "key": "ctrl+3 f7", "command": "editor.action.insertSnippet", "args": { "name": "Private async method" } },
103
+ { "key": "ctrl+3 f8", "command": "editor.action.insertSnippet", "args": { "name": "Private abstract method" } },
104
+
105
+ // === PUBLIC STATIC (Ctrl+1 Alt) ===
106
+ { "key": "ctrl+1 alt+f2", "command": "editor.action.insertSnippet", "args": { "name": "Public static field" } },
107
+ { "key": "ctrl+1 alt+f3", "command": "editor.action.insertSnippet", "args": { "name": "Public static readonly field" } },
108
+ { "key": "ctrl+1 alt+f4", "command": "editor.action.insertSnippet", "args": { "name": "Public static getter" } },
109
+ { "key": "ctrl+1 alt+f5", "command": "editor.action.insertSnippet", "args": { "name": "Public static setter" } },
110
+ { "key": "ctrl+1 alt+f6", "command": "editor.action.insertSnippet", "args": { "name": "Public static method" } },
111
+ { "key": "ctrl+1 alt+f7", "command": "editor.action.insertSnippet", "args": { "name": "Public static async method" } },
112
+
113
+ // === PROTECTED STATIC (Ctrl+2 Alt) ===
114
+ { "key": "ctrl+2 alt+f2", "command": "editor.action.insertSnippet", "args": { "name": "Protected static field" } },
115
+ { "key": "ctrl+2 alt+f3", "command": "editor.action.insertSnippet", "args": { "name": "Protected static readonly field" } },
116
+ { "key": "ctrl+2 alt+f4", "command": "editor.action.insertSnippet", "args": { "name": "Protected static getter" } },
117
+ { "key": "ctrl+2 alt+f5", "command": "editor.action.insertSnippet", "args": { "name": "Protected static setter" } },
118
+ { "key": "ctrl+2 alt+f6", "command": "editor.action.insertSnippet", "args": { "name": "Protected static method" } },
119
+ { "key": "ctrl+2 alt+f7", "command": "editor.action.insertSnippet", "args": { "name": "Protected static async method" } },
120
+
121
+ // === PRIVATE STATIC (Ctrl+3 Alt) ===
122
+ { "key": "ctrl+3 alt+f2", "command": "editor.action.insertSnippet", "args": { "name": "Private static field" } },
123
+ { "key": "ctrl+3 alt+f3", "command": "editor.action.insertSnippet", "args": { "name": "Private static readonly field" } },
124
+ { "key": "ctrl+3 alt+f4", "command": "editor.action.insertSnippet", "args": { "name": "Private static getter" } },
125
+ { "key": "ctrl+3 alt+f5", "command": "editor.action.insertSnippet", "args": { "name": "Private static setter" } },
126
+ { "key": "ctrl+3 alt+f6", "command": "editor.action.insertSnippet", "args": { "name": "Private static method" } },
127
+ { "key": "ctrl+3 alt+f7", "command": "editor.action.insertSnippet", "args": { "name": "Private static async method" } }
128
+ `.replace(/^[ \t]+/gm, '');
129
+ this.indentedKeybindings = this.keybindings
130
+ .split('\n')
131
+ .map((line) => (line.trim() ? ' ' + line : line))
132
+ .join('\n');
133
+ }
5
134
  static Create() {
6
135
  return new (this.Class ?? this)();
7
136
  }
137
+ async install() {
138
+ await this.installGlobalSnippets();
139
+ await this.installGlobalKeybindings();
140
+ }
141
+ async installGlobalSnippets() {
142
+ this.originalSnippetsFile = await this.loadSnippetsFile();
143
+ if (!this.hasSnippetMarkers) {
144
+ await this.installFreshSnippets();
145
+ }
146
+ else {
147
+ await this.updateExistingSnippets();
148
+ }
149
+ }
150
+ async loadSnippetsFile() {
151
+ return await this.readFile(this.snippetsPath, 'utf-8');
152
+ }
153
+ get snippetsPath() {
154
+ return `${this.vscodeDir}/snippets/custom.code-snippets`;
155
+ }
156
+ get hasSnippetMarkers() {
157
+ return this.snippetStartIdx !== -1 && this.snippetEndIdx !== -1;
158
+ }
159
+ get snippetStartIdx() {
160
+ return this.originalSnippetsFile.indexOf(this.snippetStartMarker);
161
+ }
162
+ get snippetEndIdx() {
163
+ return (this.originalSnippetsFile.indexOf(this.snippetEndMarker) +
164
+ this.snippetEndMarker.length);
165
+ }
166
+ async installFreshSnippets() {
167
+ await this.writeFile(this.snippetsPath, this.freshSnippetsFile);
168
+ }
169
+ get freshSnippetsFile() {
170
+ const lastBraceIdx = this.originalSnippetsFile.lastIndexOf('}');
171
+ const before = this.originalSnippetsFile.slice(0, lastBraceIdx);
172
+ return `${before}${this.snippetsBlock}\n}`;
173
+ }
174
+ get snippetsBlock() {
175
+ return ` ${this.snippetStartMarker}\n${this.indentedSnippets}\n ${this.snippetEndMarker}`;
176
+ }
177
+ async updateExistingSnippets() {
178
+ const before = this.originalSnippetsFile.slice(0, this.snippetStartIdx);
179
+ const existing = this.originalSnippetsFile.slice(this.snippetStartIdx, this.snippetEndIdx);
180
+ const after = this.originalSnippetsFile.slice(this.snippetEndIdx);
181
+ if (existing.trim() !== this.snippetsBlock.trim()) {
182
+ await this.writeFile(this.snippetsPath, `${before}${this.snippetsBlock}${after}`);
183
+ }
184
+ }
185
+ async installGlobalKeybindings() {
186
+ this.originalKeybindingsFile = await this.loadKeybindingsFile();
187
+ if (!this.hasKeybindMarkers) {
188
+ await this.installFreshKeybindings();
189
+ }
190
+ else {
191
+ await this.updateExistingKeybindings();
192
+ }
193
+ }
194
+ async loadKeybindingsFile() {
195
+ return await this.readFile(this.keybindingsPath, 'utf-8');
196
+ }
197
+ get keybindingsPath() {
198
+ return `${this.vscodeDir}/keybindings.json`;
199
+ }
200
+ get hasKeybindMarkers() {
201
+ return this.keybindStartIdx !== -1 && this.keybindEndIdx !== -1;
202
+ }
203
+ get keybindStartIdx() {
204
+ return this.originalKeybindingsFile.indexOf(this.keybindStartMarker);
205
+ }
206
+ get keybindEndIdx() {
207
+ return (this.originalKeybindingsFile.indexOf(this.keybindEndMarker) +
208
+ this.keybindEndMarker.length);
209
+ }
210
+ async installFreshKeybindings() {
211
+ await this.writeFile(this.keybindingsPath, this.freshKeybindingsFile);
212
+ }
213
+ get freshKeybindingsFile() {
214
+ const lastBraceIdx = this.originalKeybindingsFile.lastIndexOf(']');
215
+ const before = this.originalKeybindingsFile.slice(0, lastBraceIdx);
216
+ return `${before}${this.keybindingBlock}\n]`;
217
+ }
218
+ get keybindingBlock() {
219
+ return ` ${this.keybindStartMarker}\n${this.indentedKeybindings}\n ${this.keybindEndMarker}`;
220
+ }
221
+ async updateExistingKeybindings() {
222
+ const before = this.originalKeybindingsFile.slice(0, this.keybindStartIdx);
223
+ const existing = this.originalKeybindingsFile.slice(this.keybindStartIdx, this.keybindEndIdx);
224
+ const after = this.originalKeybindingsFile.slice(this.keybindEndIdx);
225
+ if (existing.trim() !== this.keybindingBlock.trim()) {
226
+ await this.writeFile(this.keybindingsPath, `${before}${this.keybindingBlock}${after}`);
227
+ }
228
+ }
229
+ get readFile() {
230
+ return TypescriptClassSnippetSuite.readFile;
231
+ }
232
+ get writeFile() {
233
+ return TypescriptClassSnippetSuite.writeFile;
234
+ }
8
235
  }
236
+ TypescriptClassSnippetSuite.readFile = promises_1.readFile;
237
+ TypescriptClassSnippetSuite.writeFile = promises_1.writeFile;
9
238
  exports.default = TypescriptClassSnippetSuite;
10
239
  //# sourceMappingURL=TypescriptClassSnippetSuite.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TypescriptClassSnippetSuite.js","sourceRoot":"","sources":["../../src/impl/TypescriptClassSnippetSuite.ts"],"names":[],"mappings":";;AAAA,MAAqB,2BAA2B;IAG5C,gBAAyB,CAAC;IAEnB,MAAM,CAAC,MAAM;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAA;IACrC,CAAC;CACJ;AARD,8CAQC"}
1
+ {"version":3,"file":"TypescriptClassSnippetSuite.js","sourceRoot":"","sources":["../../src/impl/TypescriptClassSnippetSuite.ts"],"names":[],"mappings":";;;;;AAAA,0CAAiD;AACjD,6EAAoD;AAEpD,MAAqB,2BAA2B;IAQ5C;QA6BiB,cAAS,GAAG,IAAA,uBAAa,EACtC,yCAAyC,CAC5C,CAAA;QAUO,uBAAkB,GAAG,4CAA4C,CAAA;QASjE,qBAAgB,GAAG,0CAA0C,CAAA;QAmF7D,uBAAkB,GAAG,+CAA+C,CAAA;QACpE,qBAAgB,GAAG,6CAA6C,CAAA;QA+BvD,aAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsD3B,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,C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IAED,IAAY,QAAQ;QAChB,OAAO,2BAA2B,CAAC,QAAQ,CAAA;IAC/C,CAAC;IAED,IAAY,SAAS;QACjB,OAAO,2BAA2B,CAAC,SAAS,CAAA;IAChD,CAAC;;AAzKa,oCAAQ,GAAG,mBAAQ,AAAX,CAAW;AACnB,qCAAS,GAAG,oBAAS,AAAZ,CAAY;kBAHlB,2BAA2B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const TypescriptClassSnippetSuite_1 = __importDefault(require("../impl/TypescriptClassSnippetSuite"));
7
+ async function main() {
8
+ console.log('Installing TypeScript Class Snippet Suite...');
9
+ const instance = TypescriptClassSnippetSuite_1.default.Create();
10
+ await instance.install();
11
+ console.log('Installation complete!');
12
+ }
13
+ main().catch((err) => {
14
+ console.error(err);
15
+ process.exit(1);
16
+ });
17
+ //# sourceMappingURL=installSnippetSuite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installSnippetSuite.js","sourceRoot":"","sources":["../../src/scripts/installSnippetSuite.ts"],"names":[],"mappings":";;;;;AAAA,sGAA6E;AAE7E,KAAK,UAAU,IAAI;IACf,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAA;IAE3D,MAAM,QAAQ,GAAG,qCAA2B,CAAC,MAAM,EAAE,CAAA;IACrD,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAA;IAExB,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;AACzC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAA"}
@@ -1,6 +1,8 @@
1
1
  import { SnippetSuite } from '../../impl/TypescriptClassSnippetSuite';
2
2
  export default class FakeSnippetSuite implements SnippetSuite {
3
3
  static numCallsToConstructor: number;
4
+ static numCallsToInstall: number;
4
5
  constructor();
6
+ install(): Promise<void>;
5
7
  static resetTestDouble(): void;
6
8
  }
@@ -4,10 +4,15 @@ class FakeSnippetSuite {
4
4
  constructor() {
5
5
  FakeSnippetSuite.numCallsToConstructor++;
6
6
  }
7
+ async install() {
8
+ FakeSnippetSuite.numCallsToInstall++;
9
+ }
7
10
  static resetTestDouble() {
8
11
  FakeSnippetSuite.numCallsToConstructor = 0;
12
+ FakeSnippetSuite.numCallsToInstall = 0;
9
13
  }
10
14
  }
11
15
  FakeSnippetSuite.numCallsToConstructor = 0;
16
+ FakeSnippetSuite.numCallsToInstall = 0;
12
17
  exports.default = FakeSnippetSuite;
13
18
  //# sourceMappingURL=FakeSnippetSuite.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FakeSnippetSuite.js","sourceRoot":"","sources":["../../../src/testDoubles/SnippetSuite/FakeSnippetSuite.ts"],"names":[],"mappings":";;AAEA,MAAqB,gBAAgB;IAGjC;QACI,gBAAgB,CAAC,qBAAqB,EAAE,CAAA;IAC5C,CAAC;IAEM,MAAM,CAAC,eAAe;QACzB,gBAAgB,CAAC,qBAAqB,GAAG,CAAC,CAAA;IAC9C,CAAC;;AARa,sCAAqB,GAAG,CAAC,CAAA;kBADtB,gBAAgB"}
1
+ {"version":3,"file":"FakeSnippetSuite.js","sourceRoot":"","sources":["../../../src/testDoubles/SnippetSuite/FakeSnippetSuite.ts"],"names":[],"mappings":";;AAEA,MAAqB,gBAAgB;IAIjC;QACI,gBAAgB,CAAC,qBAAqB,EAAE,CAAA;IAC5C,CAAC;IAEM,KAAK,CAAC,OAAO;QAChB,gBAAgB,CAAC,iBAAiB,EAAE,CAAA;IACxC,CAAC;IAEM,MAAM,CAAC,eAAe;QACzB,gBAAgB,CAAC,qBAAqB,GAAG,CAAC,CAAA;QAC1C,gBAAgB,CAAC,iBAAiB,GAAG,CAAC,CAAA;IAC1C,CAAC;;AAda,sCAAqB,GAAG,CAAC,CAAA;AACzB,kCAAiB,GAAG,CAAC,CAAA;kBAFlB,gBAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neurodevs/meta-node",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Meta-layer utilities for maintaining Node.js package ecosystems.",
5
5
  "keywords": [
6
6
  "nodejs",
@@ -1,4 +1,6 @@
1
- import AbstractSpruceTest from '@sprucelabs/test-utils'
1
+ import AbstractSpruceTest, { generateId } from '@sprucelabs/test-utils'
2
+ import { setFakeReadFileResult } from '@neurodevs/fake-node-core'
3
+ import expandHomeDir from '../scripts/expandHomeDir'
2
4
 
3
5
  export default class AbstractPackageTest extends AbstractSpruceTest {
4
6
  protected static async beforeEach() {
@@ -8,4 +10,52 @@ export default class AbstractPackageTest extends AbstractSpruceTest {
8
10
  protected static normalize(input: string) {
9
11
  return input.replace(/\s+/g, ' ').trim()
10
12
  }
13
+
14
+ protected static readonly vscodeDir = expandHomeDir(
15
+ '~/Library/Application Support/Code/User'
16
+ )
17
+
18
+ protected static get snippetsPath() {
19
+ return `${this.vscodeDir}/snippets/custom.code-snippets`
20
+ }
21
+
22
+ protected static readonly originalSnippet = { [generateId()]: {} }
23
+
24
+ protected static readonly originalSnippets = {
25
+ ...this.originalSnippet,
26
+ }
27
+
28
+ protected static readonly originalSnippetsFile = JSON.stringify(
29
+ this.originalSnippets,
30
+ null,
31
+ 4
32
+ )
33
+
34
+ protected static get keybindingsPath() {
35
+ return `${this.vscodeDir}/keybindings.json`
36
+ }
37
+
38
+ protected static readonly originalKeybinding = {
39
+ key: generateId(),
40
+ command: generateId(),
41
+ }
42
+
43
+ protected static readonly originalKeybindings = [this.originalKeybinding]
44
+
45
+ protected static readonly originalKeybindingsFile = JSON.stringify(
46
+ this.originalKeybindings,
47
+ null,
48
+ 4
49
+ )
50
+
51
+ protected static setFakeSnippetsFile() {
52
+ setFakeReadFileResult(this.snippetsPath, this.originalSnippetsFile)
53
+ }
54
+
55
+ protected static setFakeKeybindingsFile() {
56
+ setFakeReadFileResult(
57
+ this.keybindingsPath,
58
+ this.originalKeybindingsFile
59
+ )
60
+ }
11
61
  }