@jsenv/cli 0.2.1 → 0.2.2

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 (2) hide show
  1. package/jsenv_cli.js +12 -6
  2. package/package.json +1 -1
package/jsenv_cli.js CHANGED
@@ -285,8 +285,8 @@ write_files: {
285
285
  const fromStat = statSync(fromUrl);
286
286
  if (fromStat.isDirectory()) {
287
287
  if (directoryEntryName === "src" || directoryEntryName === "tests") {
288
- if (existsSync(toUrl)) {
289
- // copy src and tests if they don't exists
288
+ if (existsSync(toUrl) && readdirSync(toUrl).length > 0) {
289
+ // copy src and tests if they don't exists or are empty
290
290
  continue;
291
291
  }
292
292
  if (isWebAndHaveRootHtmlFile) {
@@ -325,11 +325,17 @@ write_files: {
325
325
  label: "npm start",
326
326
  run: () => runWithChildProcess("npm start"),
327
327
  });
328
+ const packageTemplateObject = JSON.parse(templateFileContent);
329
+ packageTemplateObject.name = urlToFilename(directoryUrl);
330
+ const packageString = JSON.stringify(
331
+ packageTemplateObject,
332
+ null,
333
+ " ",
334
+ );
335
+ writeFileSync(toUrl, packageString);
336
+ } else {
337
+ writeFileSync(toUrl, templateFileContent);
328
338
  }
329
- const packageTemplateObject = JSON.parse(templateFileContent);
330
- packageTemplateObject.name = urlToFilename(directoryUrl);
331
- const packageString = JSON.stringify(packageTemplateObject, null, " ");
332
- writeFileSync(toUrl, packageString);
333
339
  continue;
334
340
  }
335
341
  const relativeUrl = urlToRelativeUrl(fromUrl, templateSourceDirectoryUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Command Line Interface for jsenv",
5
5
  "license": "MIT",
6
6
  "repository": {