@git.zone/cli 2.13.8 → 2.13.11

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 (106) hide show
  1. package/assets/templates/gitignore/_gitignore +4 -0
  2. package/assets/templates/{npmextra/npmextra.json → smartconfig/_smartconfig.json} +3 -0
  3. package/dist_ts/00_commitinfo_data.js +2 -2
  4. package/dist_ts/classes.gitzoneconfig.js +4 -4
  5. package/dist_ts/gitzone.cli.js +1 -15
  6. package/dist_ts/mod_commit/index.js +4 -4
  7. package/dist_ts/mod_config/classes.commitconfig.d.ts +3 -3
  8. package/dist_ts/mod_config/classes.commitconfig.js +20 -20
  9. package/dist_ts/mod_config/classes.releaseconfig.d.ts +3 -3
  10. package/dist_ts/mod_config/classes.releaseconfig.js +21 -21
  11. package/dist_ts/mod_config/index.js +12 -12
  12. package/dist_ts/mod_format/classes.baseformatter.d.ts +2 -9
  13. package/dist_ts/mod_format/classes.baseformatter.js +13 -26
  14. package/dist_ts/mod_format/classes.formatplanner.d.ts +1 -3
  15. package/dist_ts/mod_format/classes.formatplanner.js +11 -39
  16. package/dist_ts/mod_format/classes.formatstats.d.ts +0 -5
  17. package/dist_ts/mod_format/classes.formatstats.js +3 -35
  18. package/dist_ts/mod_format/formatters/cleanup.formatter.js +1 -2
  19. package/dist_ts/mod_format/formatters/copy.formatter.js +5 -8
  20. package/dist_ts/mod_format/formatters/gitignore.formatter.d.ts +5 -0
  21. package/dist_ts/mod_format/formatters/gitignore.formatter.js +23 -29
  22. package/dist_ts/mod_format/formatters/packagejson.formatter.js +5 -5
  23. package/dist_ts/mod_format/formatters/prettier.formatter.js +4 -12
  24. package/dist_ts/mod_format/formatters/{npmextra.formatter.d.ts → smartconfig.formatter.d.ts} +6 -1
  25. package/dist_ts/mod_format/formatters/smartconfig.formatter.js +180 -0
  26. package/dist_ts/mod_format/formatters/templates.formatter.js +1 -10
  27. package/dist_ts/mod_format/formatters/tsconfig.formatter.js +6 -4
  28. package/dist_ts/mod_format/index.d.ts +0 -4
  29. package/dist_ts/mod_format/index.js +27 -78
  30. package/dist_ts/mod_format/interfaces.format.d.ts +1 -18
  31. package/dist_ts/mod_format/interfaces.format.js +16 -2
  32. package/dist_ts/mod_format/mod.plugins.d.ts +2 -7
  33. package/dist_ts/mod_format/mod.plugins.js +3 -8
  34. package/dist_ts/mod_services/classes.globalregistry.js +2 -2
  35. package/dist_ts/mod_services/classes.servicemanager.d.ts +2 -2
  36. package/dist_ts/mod_services/classes.servicemanager.js +21 -21
  37. package/dist_ts/plugins.d.ts +2 -2
  38. package/dist_ts/plugins.js +3 -3
  39. package/package.json +11 -17
  40. package/readme.md +231 -218
  41. package/ts/00_commitinfo_data.ts +1 -1
  42. package/ts/classes.gitzoneconfig.ts +3 -3
  43. package/ts/gitzone.cli.ts +0 -17
  44. package/ts/mod_commit/index.ts +3 -3
  45. package/ts/mod_config/classes.commitconfig.ts +19 -19
  46. package/ts/mod_config/classes.releaseconfig.ts +20 -20
  47. package/ts/mod_config/index.ts +11 -11
  48. package/ts/mod_format/classes.baseformatter.ts +14 -25
  49. package/ts/mod_format/classes.formatplanner.ts +10 -39
  50. package/ts/mod_format/classes.formatstats.ts +2 -42
  51. package/ts/mod_format/formatters/cleanup.formatter.ts +0 -1
  52. package/ts/mod_format/formatters/copy.formatter.ts +4 -8
  53. package/ts/mod_format/formatters/gitignore.formatter.ts +25 -29
  54. package/ts/mod_format/formatters/packagejson.formatter.ts +4 -4
  55. package/ts/mod_format/formatters/prettier.formatter.ts +3 -13
  56. package/ts/mod_format/formatters/smartconfig.formatter.ts +213 -0
  57. package/ts/mod_format/formatters/templates.formatter.ts +0 -9
  58. package/ts/mod_format/formatters/tsconfig.formatter.ts +6 -3
  59. package/ts/mod_format/index.ts +35 -98
  60. package/ts/mod_format/interfaces.format.ts +16 -19
  61. package/ts/mod_format/mod.plugins.ts +2 -12
  62. package/ts/mod_services/classes.globalregistry.ts +2 -2
  63. package/ts/mod_services/classes.servicemanager.ts +20 -20
  64. package/ts/plugins.ts +2 -2
  65. package/dist_ts/mod_format/classes.changecache.d.ts +0 -26
  66. package/dist_ts/mod_format/classes.changecache.js +0 -181
  67. package/dist_ts/mod_format/classes.dependency-analyzer.d.ts +0 -13
  68. package/dist_ts/mod_format/classes.dependency-analyzer.js +0 -93
  69. package/dist_ts/mod_format/classes.rollbackmanager.d.ts +0 -22
  70. package/dist_ts/mod_format/classes.rollbackmanager.js +0 -259
  71. package/dist_ts/mod_format/format.cleanup.d.ts +0 -2
  72. package/dist_ts/mod_format/format.cleanup.js +0 -25
  73. package/dist_ts/mod_format/format.copy.d.ts +0 -24
  74. package/dist_ts/mod_format/format.copy.js +0 -77
  75. package/dist_ts/mod_format/format.gitignore.d.ts +0 -2
  76. package/dist_ts/mod_format/format.gitignore.js +0 -48
  77. package/dist_ts/mod_format/format.license.d.ts +0 -2
  78. package/dist_ts/mod_format/format.license.js +0 -26
  79. package/dist_ts/mod_format/format.npmextra.d.ts +0 -5
  80. package/dist_ts/mod_format/format.npmextra.js +0 -125
  81. package/dist_ts/mod_format/format.packagejson.d.ts +0 -2
  82. package/dist_ts/mod_format/format.packagejson.js +0 -145
  83. package/dist_ts/mod_format/format.prettier.d.ts +0 -2
  84. package/dist_ts/mod_format/format.prettier.js +0 -56
  85. package/dist_ts/mod_format/format.readme.d.ts +0 -1
  86. package/dist_ts/mod_format/format.readme.js +0 -29
  87. package/dist_ts/mod_format/format.templates.d.ts +0 -5
  88. package/dist_ts/mod_format/format.templates.js +0 -68
  89. package/dist_ts/mod_format/format.tsconfig.d.ts +0 -2
  90. package/dist_ts/mod_format/format.tsconfig.js +0 -28
  91. package/dist_ts/mod_format/formatters/npmextra.formatter.js +0 -142
  92. package/ts/mod_format/classes.changecache.ts +0 -235
  93. package/ts/mod_format/classes.dependency-analyzer.ts +0 -117
  94. package/ts/mod_format/classes.rollbackmanager.ts +0 -340
  95. package/ts/mod_format/format.cleanup.ts +0 -26
  96. package/ts/mod_format/format.copy.ts +0 -93
  97. package/ts/mod_format/format.gitignore.ts +0 -54
  98. package/ts/mod_format/format.license.ts +0 -32
  99. package/ts/mod_format/format.npmextra.ts +0 -151
  100. package/ts/mod_format/format.packagejson.ts +0 -196
  101. package/ts/mod_format/format.prettier.ts +0 -66
  102. package/ts/mod_format/format.readme.ts +0 -29
  103. package/ts/mod_format/format.templates.ts +0 -79
  104. package/ts/mod_format/format.tsconfig.ts +0 -31
  105. package/ts/mod_format/formatters/npmextra.formatter.ts +0 -174
  106. /package/{npmextra.json → .smartconfig.json} +0 -0
@@ -17,15 +17,15 @@ export class CopyFormatter extends BaseFormatter {
17
17
  async analyze(): Promise<IPlannedChange[]> {
18
18
  const changes: IPlannedChange[] = [];
19
19
 
20
- // Get copy configuration from npmextra.json
21
- const npmextraConfig = new plugins.npmextra.Npmextra();
22
- const copyConfig = npmextraConfig.dataFor<{ patterns: ICopyPattern[] }>(
20
+ // Get copy configuration from .smartconfig.json
21
+ const smartconfigInstance = new plugins.smartconfig.Smartconfig();
22
+ const copyConfig = smartconfigInstance.dataFor<{ patterns: ICopyPattern[] }>(
23
23
  'gitzone.format.copy',
24
24
  { patterns: [] },
25
25
  );
26
26
 
27
27
  if (!copyConfig.patterns || copyConfig.patterns.length === 0) {
28
- logVerbose('No copy patterns configured in npmextra.json');
28
+ logVerbose('No copy patterns configured in .smartconfig.json');
29
29
  return changes;
30
30
  }
31
31
 
@@ -103,10 +103,6 @@ export class CopyFormatter extends BaseFormatter {
103
103
  async applyChange(change: IPlannedChange): Promise<void> {
104
104
  if (!change.content) return;
105
105
 
106
- // Ensure destination directory exists
107
- const destDir = plugins.path.dirname(change.path);
108
- await plugins.smartfs.directory(destDir).recursive().create();
109
-
110
106
  if (change.type === 'create') {
111
107
  await this.createFile(change.path, change.content);
112
108
  } else {
@@ -1,42 +1,39 @@
1
1
  import { BaseFormatter } from '../classes.baseformatter.js';
2
2
  import type { IPlannedChange } from '../interfaces.format.js';
3
3
  import * as plugins from '../mod.plugins.js';
4
+ import * as paths from '../../paths.js';
4
5
  import { logger } from '../../gitzone.logging.js';
5
6
 
6
- // Standard gitignore template content (without front-matter)
7
- const GITIGNORE_TEMPLATE = `.nogit/
8
-
9
- # artifacts
10
- coverage/
11
- public/
12
-
13
- # installs
14
- node_modules/
15
-
16
- # caches
17
- .yarn/
18
- .cache/
19
- .rpt2_cache
20
-
21
- # builds
22
- dist/
23
- dist_*/
24
-
25
- # AI
26
- .claude/
27
- .serena/
28
-
29
- #------# custom`;
30
-
31
7
  export class GitignoreFormatter extends BaseFormatter {
32
8
  get name(): string {
33
9
  return 'gitignore';
34
10
  }
35
11
 
12
+ /**
13
+ * Read the standard gitignore template from the asset file,
14
+ * stripping the YAML frontmatter.
15
+ */
16
+ private async getStandardTemplate(): Promise<string> {
17
+ const templatePath = plugins.path.join(paths.templatesDir, 'gitignore', '_gitignore');
18
+ const raw = (await plugins.smartfs
19
+ .file(templatePath)
20
+ .encoding('utf8')
21
+ .read()) as string;
22
+
23
+ // Strip YAML frontmatter (---\n...\n---)
24
+ const frontmatterEnd = raw.indexOf('---', 3);
25
+ if (frontmatterEnd !== -1) {
26
+ return raw.slice(frontmatterEnd + 3).trimStart();
27
+ }
28
+ return raw;
29
+ }
30
+
36
31
  async analyze(): Promise<IPlannedChange[]> {
37
32
  const changes: IPlannedChange[] = [];
38
33
  const gitignorePath = '.gitignore';
39
34
 
35
+ const standardTemplate = await this.getStandardTemplate();
36
+
40
37
  // Check if file exists and extract custom content
41
38
  let customContent = '';
42
39
  const exists = await plugins.smartfs.file(gitignorePath).exists();
@@ -59,11 +56,11 @@ export class GitignoreFormatter extends BaseFormatter {
59
56
  }
60
57
 
61
58
  // Compute new content
62
- let newContent = GITIGNORE_TEMPLATE;
59
+ let newContent = standardTemplate;
63
60
  if (customContent) {
64
- newContent = GITIGNORE_TEMPLATE + '\n' + customContent + '\n';
61
+ newContent = standardTemplate + '\n' + customContent + '\n';
65
62
  } else {
66
- newContent = GITIGNORE_TEMPLATE + '\n';
63
+ newContent = standardTemplate + '\n';
67
64
  }
68
65
 
69
66
  // Read current content to compare
@@ -75,7 +72,6 @@ export class GitignoreFormatter extends BaseFormatter {
75
72
  .read()) as string;
76
73
  }
77
74
 
78
- // Determine change type
79
75
  if (!exists) {
80
76
  changes.push({
81
77
  type: 'create',
@@ -100,9 +100,9 @@ export class PackageJsonFormatter extends BaseFormatter {
100
100
  // Parse and compute new content
101
101
  const packageJson = JSON.parse(currentContent);
102
102
 
103
- // Get gitzone config from npmextra
104
- const npmextraConfig = new plugins.npmextra.Npmextra(paths.cwd);
105
- const gitzoneData: any = npmextraConfig.dataFor('@git.zone/cli', {});
103
+ // Get gitzone config from smartconfig
104
+ const smartconfigInstance = new plugins.smartconfig.Smartconfig(paths.cwd);
105
+ const gitzoneData: any = smartconfigInstance.dataFor('@git.zone/cli', {});
106
106
 
107
107
  // Set metadata from gitzone config
108
108
  if (gitzoneData.module) {
@@ -156,7 +156,7 @@ export class PackageJsonFormatter extends BaseFormatter {
156
156
  'dist_ts_web/**/*',
157
157
  'assets/**/*',
158
158
  'cli.js',
159
- 'npmextra.json',
159
+ '.smartconfig.json',
160
160
  'readme.md',
161
161
  ];
162
162
 
@@ -21,7 +21,7 @@ export class PrettierFormatter extends BaseFormatter {
21
21
  const rootConfigFiles = [
22
22
  'package.json',
23
23
  'tsconfig.json',
24
- 'npmextra.json',
24
+ '.smartconfig.json',
25
25
  '.prettierrc',
26
26
  '.prettierrc.json',
27
27
  '.prettierrc.js',
@@ -79,12 +79,9 @@ export class PrettierFormatter extends BaseFormatter {
79
79
  // Remove duplicates
80
80
  const uniqueFiles = [...new Set(allFiles)];
81
81
 
82
- // Get all files that match the pattern
83
- const files = uniqueFiles;
84
-
85
82
  // Ensure we only process actual files (not directories)
86
83
  const validFiles: string[] = [];
87
- for (const file of files) {
84
+ for (const file of uniqueFiles) {
88
85
  try {
89
86
  const stats = await plugins.smartfs.file(file).stat();
90
87
  if (!stats.isDirectory) {
@@ -96,14 +93,7 @@ export class PrettierFormatter extends BaseFormatter {
96
93
  }
97
94
  }
98
95
 
99
- // Check which files need formatting
100
96
  for (const file of validFiles) {
101
- // Skip files that haven't changed
102
- if (!(await this.shouldProcessFile(file))) {
103
- logVerbose(`Skipping ${file} - no changes detected`);
104
- continue;
105
- }
106
-
107
97
  changes.push({
108
98
  type: 'modify',
109
99
  path: file,
@@ -232,7 +222,7 @@ export class PrettierFormatter extends BaseFormatter {
232
222
 
233
223
  private async getPrettierConfig(): Promise<any> {
234
224
  // Try to load prettier config from the project
235
- const prettierConfig = new plugins.npmextra.Npmextra();
225
+ const prettierConfig = new plugins.smartconfig.Smartconfig();
236
226
  return prettierConfig.dataFor('prettier', {
237
227
  // Default prettier config
238
228
  singleQuote: true,
@@ -0,0 +1,213 @@
1
+ import { BaseFormatter } from '../classes.baseformatter.js';
2
+ import type { IPlannedChange } from '../interfaces.format.js';
3
+ import * as plugins from '../mod.plugins.js';
4
+ import { logger, logVerbose } from '../../gitzone.logging.js';
5
+
6
+ /**
7
+ * Migrates .smartconfig.json from old namespace keys to new package-scoped keys
8
+ */
9
+ const migrateNamespaceKeys = (smartconfigJson: any): boolean => {
10
+ let migrated = false;
11
+ const migrations = [
12
+ { oldKey: 'gitzone', newKey: '@git.zone/cli' },
13
+ { oldKey: 'tsdoc', newKey: '@git.zone/tsdoc' },
14
+ { oldKey: 'npmdocker', newKey: '@git.zone/tsdocker' },
15
+ { oldKey: 'npmci', newKey: '@ship.zone/szci' },
16
+ { oldKey: 'szci', newKey: '@ship.zone/szci' },
17
+ ];
18
+ for (const { oldKey, newKey } of migrations) {
19
+ if (smartconfigJson[oldKey]) {
20
+ if (!smartconfigJson[newKey]) {
21
+ smartconfigJson[newKey] = smartconfigJson[oldKey];
22
+ } else {
23
+ smartconfigJson[newKey] = {
24
+ ...smartconfigJson[oldKey],
25
+ ...smartconfigJson[newKey],
26
+ };
27
+ }
28
+ delete smartconfigJson[oldKey];
29
+ migrated = true;
30
+ }
31
+ }
32
+ return migrated;
33
+ };
34
+
35
+ /**
36
+ * Migrates npmAccessLevel from @ship.zone/szci to @git.zone/cli.release.accessLevel
37
+ */
38
+ const migrateAccessLevel = (smartconfigJson: any): boolean => {
39
+ const szciConfig = smartconfigJson['@ship.zone/szci'];
40
+
41
+ if (!szciConfig?.npmAccessLevel) {
42
+ return false;
43
+ }
44
+
45
+ const gitzoneConfig = smartconfigJson['@git.zone/cli'] || {};
46
+ if (gitzoneConfig?.release?.accessLevel) {
47
+ delete szciConfig.npmAccessLevel;
48
+ return true;
49
+ }
50
+
51
+ if (!smartconfigJson['@git.zone/cli']) {
52
+ smartconfigJson['@git.zone/cli'] = {};
53
+ }
54
+ if (!smartconfigJson['@git.zone/cli'].release) {
55
+ smartconfigJson['@git.zone/cli'].release = {};
56
+ }
57
+
58
+ smartconfigJson['@git.zone/cli'].release.accessLevel = szciConfig.npmAccessLevel;
59
+ delete szciConfig.npmAccessLevel;
60
+
61
+ return true;
62
+ };
63
+
64
+ // Config file names in priority order (newest → oldest)
65
+ const CONFIG_FILE_NAMES = ['.smartconfig.json', 'smartconfig.json', 'npmextra.json'];
66
+ const TARGET_CONFIG_FILE = '.smartconfig.json';
67
+
68
+ export class SmartconfigFormatter extends BaseFormatter {
69
+ get name(): string {
70
+ return 'smartconfig';
71
+ }
72
+
73
+ /**
74
+ * Find the config file, checking in priority order.
75
+ * Returns the path and whether it needs renaming.
76
+ */
77
+ private async findConfigFile(): Promise<{ path: string; needsRename: boolean } | null> {
78
+ for (const filename of CONFIG_FILE_NAMES) {
79
+ const exists = await plugins.smartfs.file(filename).exists();
80
+ if (exists) {
81
+ return {
82
+ path: filename,
83
+ needsRename: filename !== TARGET_CONFIG_FILE,
84
+ };
85
+ }
86
+ }
87
+ return null;
88
+ }
89
+
90
+ async analyze(): Promise<IPlannedChange[]> {
91
+ const changes: IPlannedChange[] = [];
92
+
93
+ const configFile = await this.findConfigFile();
94
+ if (!configFile) {
95
+ logVerbose('No config file found (.smartconfig.json, smartconfig.json, or npmextra.json), skipping');
96
+ return changes;
97
+ }
98
+
99
+ // Read current content
100
+ const currentContent = (await plugins.smartfs
101
+ .file(configFile.path)
102
+ .encoding('utf8')
103
+ .read()) as string;
104
+
105
+ // Parse and apply migrations
106
+ const smartconfigJson = JSON.parse(currentContent);
107
+ migrateNamespaceKeys(smartconfigJson);
108
+ migrateAccessLevel(smartconfigJson);
109
+
110
+ // Ensure namespaces exist
111
+ if (!smartconfigJson['@git.zone/cli']) {
112
+ smartconfigJson['@git.zone/cli'] = {};
113
+ }
114
+ if (!smartconfigJson['@ship.zone/szci']) {
115
+ smartconfigJson['@ship.zone/szci'] = {};
116
+ }
117
+
118
+ const newContent = JSON.stringify(smartconfigJson, null, 2);
119
+
120
+ // If file needs renaming, plan a create + delete
121
+ if (configFile.needsRename) {
122
+ changes.push({
123
+ type: 'create',
124
+ path: TARGET_CONFIG_FILE,
125
+ module: this.name,
126
+ description: `Migrate ${configFile.path} to ${TARGET_CONFIG_FILE}`,
127
+ content: newContent,
128
+ });
129
+ changes.push({
130
+ type: 'delete',
131
+ path: configFile.path,
132
+ module: this.name,
133
+ description: `Remove old ${configFile.path}`,
134
+ });
135
+ } else if (newContent !== currentContent) {
136
+ // File is already .smartconfig.json, just needs content update
137
+ changes.push({
138
+ type: 'modify',
139
+ path: TARGET_CONFIG_FILE,
140
+ module: this.name,
141
+ description: 'Migrate and format .smartconfig.json',
142
+ content: newContent,
143
+ });
144
+ }
145
+
146
+ return changes;
147
+ }
148
+
149
+ async applyChange(change: IPlannedChange): Promise<void> {
150
+ if (change.type === 'delete') {
151
+ await this.deleteFile(change.path);
152
+ logger.log('info', `Removed old config file ${change.path}`);
153
+ return;
154
+ }
155
+
156
+ if (!change.content) return;
157
+
158
+ // Parse the content to check for missing required fields
159
+ const smartconfigJson = JSON.parse(change.content);
160
+
161
+ const expectedRepoInformation: string[] = [
162
+ 'projectType',
163
+ 'module.githost',
164
+ 'module.gitscope',
165
+ 'module.gitrepo',
166
+ 'module.description',
167
+ 'module.npmPackagename',
168
+ 'module.license',
169
+ ];
170
+
171
+ const interactInstance = new plugins.smartinteract.SmartInteract();
172
+ for (const expectedRepoInformationItem of expectedRepoInformation) {
173
+ if (
174
+ !plugins.smartobject.smartGet(
175
+ smartconfigJson['@git.zone/cli'],
176
+ expectedRepoInformationItem,
177
+ )
178
+ ) {
179
+ interactInstance.addQuestions([
180
+ {
181
+ message: `What is the value of ${expectedRepoInformationItem}`,
182
+ name: expectedRepoInformationItem,
183
+ type: 'input',
184
+ default: 'undefined variable',
185
+ },
186
+ ]);
187
+ }
188
+ }
189
+
190
+ const answerbucket = await interactInstance.runQueue();
191
+ for (const expectedRepoInformationItem of expectedRepoInformation) {
192
+ const cliProvidedValue = answerbucket.getAnswerFor(
193
+ expectedRepoInformationItem,
194
+ );
195
+ if (cliProvidedValue) {
196
+ plugins.smartobject.smartAdd(
197
+ smartconfigJson['@git.zone/cli'],
198
+ expectedRepoInformationItem,
199
+ cliProvidedValue,
200
+ );
201
+ }
202
+ }
203
+
204
+ const finalContent = JSON.stringify(smartconfigJson, null, 2);
205
+
206
+ if (change.type === 'create') {
207
+ await this.createFile(change.path, finalContent);
208
+ } else {
209
+ await this.modifyFile(change.path, finalContent);
210
+ }
211
+ logger.log('info', `Updated ${change.path}`);
212
+ }
213
+ }
@@ -62,9 +62,6 @@ export class TemplatesFormatter extends BaseFormatter {
62
62
  { templatePath: 'html/index.html', destPath: 'html/index.html' },
63
63
  ]);
64
64
  changes.push(...websiteChanges);
65
- } else if (projectType === 'service') {
66
- const serviceChanges = await this.analyzeTemplate('service_update', []);
67
- changes.push(...serviceChanges);
68
65
  } else if (projectType === 'wcc') {
69
66
  const wccChanges = await this.analyzeTemplate('wcc_update', [
70
67
  { templatePath: 'html/index.html', destPath: 'html/index.html' },
@@ -139,12 +136,6 @@ export class TemplatesFormatter extends BaseFormatter {
139
136
  async applyChange(change: IPlannedChange): Promise<void> {
140
137
  if (!change.content) return;
141
138
 
142
- // Ensure destination directory exists
143
- const destDir = plugins.path.dirname(change.path);
144
- if (destDir && destDir !== '.') {
145
- await plugins.smartfs.directory(destDir).recursive().create();
146
- }
147
-
148
139
  if (change.type === 'create') {
149
140
  await this.createFile(change.path, change.content);
150
141
  } else {
@@ -30,9 +30,10 @@ export class TsconfigFormatter extends BaseFormatter {
30
30
  const tsconfigObject = JSON.parse(currentContent);
31
31
  tsconfigObject.compilerOptions = tsconfigObject.compilerOptions || {};
32
32
  tsconfigObject.compilerOptions.baseUrl = '.';
33
- tsconfigObject.compilerOptions.paths = {};
33
+ const existingPaths = tsconfigObject.compilerOptions.paths || {};
34
34
 
35
- // Get module paths from tspublish
35
+ // Get module paths from tspublish, merging with existing custom paths
36
+ const tspublishPaths: Record<string, string[]> = {};
36
37
  try {
37
38
  const tsPublishMod = await import('@git.zone/tspublish');
38
39
  const tsPublishInstance = new tsPublishMod.TsPublish();
@@ -40,7 +41,7 @@ export class TsconfigFormatter extends BaseFormatter {
40
41
 
41
42
  for (const publishModule of Object.keys(publishModules)) {
42
43
  const publishConfig = publishModules[publishModule];
43
- tsconfigObject.compilerOptions.paths[`${publishConfig.name}`] = [
44
+ tspublishPaths[`${publishConfig.name}`] = [
44
45
  `./${publishModule}/index.js`,
45
46
  ];
46
47
  }
@@ -48,6 +49,8 @@ export class TsconfigFormatter extends BaseFormatter {
48
49
  logVerbose(`Could not get tspublish modules: ${error.message}`);
49
50
  }
50
51
 
52
+ tsconfigObject.compilerOptions.paths = { ...existingPaths, ...tspublishPaths };
53
+
51
54
  const newContent = JSON.stringify(tsconfigObject, null, 2);
52
55
 
53
56
  // Only add change if content differs