complete-cli 1.1.2 → 1.2.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.
@@ -113,14 +113,30 @@ function copyDynamicFiles(projectName, authorName, projectPath, packageManager)
113
113
  }
114
114
  }
115
115
  function copyPackageManagerSpecificFiles(projectPath, packageManager) {
116
- if (packageManager === PackageManager.pnpm) {
116
+ switch (packageManager) {
117
+ case PackageManager.npm: {
118
+ const npmrc = "save-exact=true\n";
119
+ const npmrcPath = path.join(projectPath, ".npmrc");
120
+ writeFile(npmrcPath, npmrc);
121
+ break;
122
+ }
117
123
  // `pnpm` requires the `shamefully-hoist` option to be enabled for "complete-lint" to work
118
124
  // correctly.
119
- const npmrc = `save-exact=true
120
- shamefully-hoist=true
121
- `;
122
- const npmrcPath = path.join(projectPath, ".npmrc");
123
- writeFile(npmrcPath, npmrc);
125
+ case PackageManager.pnpm: {
126
+ const npmrc = "save-exact=true\nshamefully-hoist=true\n";
127
+ const npmrcPath = path.join(projectPath, ".npmrc");
128
+ writeFile(npmrcPath, npmrc);
129
+ break;
130
+ }
131
+ case PackageManager.yarn: {
132
+ break;
133
+ }
134
+ case PackageManager.bun: {
135
+ const bunfig = "[install]\nexact = true\n";
136
+ const bunfigPath = path.join(projectPath, "bunfig.toml");
137
+ writeFile(bunfigPath, bunfig);
138
+ break;
139
+ }
124
140
  }
125
141
  }
126
142
  async function revertVersionsInPackageJSON(projectPath) {
@@ -169,6 +185,8 @@ async function installNodeModules(projectPath, skipInstall, packageManager) {
169
185
  }
170
186
  async function formatFiles(projectPath, packageManager) {
171
187
  const $$q = $q({ cwd: projectPath });
188
+ // Execa does not work properly with Bun in this context. Invoking `bunx` directly fixes the
189
+ // problem.
172
190
  await (packageManager === PackageManager.bun
173
191
  ? $$q `bunx prettier --write .`
174
192
  : $$q `prettier --write .`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "complete-cli",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "A command line tool for bootstrapping TypeScript projects.",
5
5
  "keywords": [
6
6
  "typescript"
@@ -185,14 +185,33 @@ function copyPackageManagerSpecificFiles(
185
185
  projectPath: string,
186
186
  packageManager: PackageManager,
187
187
  ) {
188
- if (packageManager === PackageManager.pnpm) {
188
+ switch (packageManager) {
189
+ case PackageManager.npm: {
190
+ const npmrc = "save-exact=true\n";
191
+ const npmrcPath = path.join(projectPath, ".npmrc");
192
+ writeFile(npmrcPath, npmrc);
193
+ break;
194
+ }
195
+
189
196
  // `pnpm` requires the `shamefully-hoist` option to be enabled for "complete-lint" to work
190
197
  // correctly.
191
- const npmrc = `save-exact=true
192
- shamefully-hoist=true
193
- `;
194
- const npmrcPath = path.join(projectPath, ".npmrc");
195
- writeFile(npmrcPath, npmrc);
198
+ case PackageManager.pnpm: {
199
+ const npmrc = "save-exact=true\nshamefully-hoist=true\n";
200
+ const npmrcPath = path.join(projectPath, ".npmrc");
201
+ writeFile(npmrcPath, npmrc);
202
+ break;
203
+ }
204
+
205
+ case PackageManager.yarn: {
206
+ break;
207
+ }
208
+
209
+ case PackageManager.bun: {
210
+ const bunfig = "[install]\nexact = true\n";
211
+ const bunfigPath = path.join(projectPath, "bunfig.toml");
212
+ writeFile(bunfigPath, bunfig);
213
+ break;
214
+ }
196
215
  }
197
216
  }
198
217
 
@@ -259,6 +278,8 @@ async function formatFiles(
259
278
  ) {
260
279
  const $$q = $q({ cwd: projectPath });
261
280
 
281
+ // Execa does not work properly with Bun in this context. Invoking `bunx` directly fixes the
282
+ // problem.
262
283
  await (packageManager === PackageManager.bun
263
284
  ? $$q`bunx prettier --write .`
264
285
  : $$q`prettier --write .`);