Skip to content

Commit

Permalink
fix @jsenv/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
dmail committed Nov 7, 2024
1 parent 9174fc4 commit 9c8bd9b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions packages/related/cli/jsenv_cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ write_files: {
const fromStat = statSync(fromUrl);
if (fromStat.isDirectory()) {
if (directoryEntryName === "src" || directoryEntryName === "tests") {
if (existsSync(toUrl)) {
// copy src and tests if they don't exists
if (existsSync(toUrl) && readdirSync(toUrl).length > 0) {
// copy src and tests if they don't exists or are empty
continue;
}
if (isWebAndHaveRootHtmlFile) {
Expand Down Expand Up @@ -325,11 +325,17 @@ write_files: {
label: "npm start",
run: () => runWithChildProcess("npm start"),
});
const packageTemplateObject = JSON.parse(templateFileContent);
packageTemplateObject.name = urlToFilename(directoryUrl);
const packageString = JSON.stringify(
packageTemplateObject,
null,
" ",
);
writeFileSync(toUrl, packageString);
} else {
writeFileSync(toUrl, templateFileContent);
}
const packageTemplateObject = JSON.parse(templateFileContent);
packageTemplateObject.name = urlToFilename(directoryUrl);
const packageString = JSON.stringify(packageTemplateObject, null, " ");
writeFileSync(toUrl, packageString);
continue;
}
const relativeUrl = urlToRelativeUrl(fromUrl, templateSourceDirectoryUrl);
Expand Down
2 changes: 1 addition & 1 deletion packages/related/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jsenv/cli",
"version": "0.2.1",
"version": "0.2.2",
"description": "Command Line Interface for jsenv",
"license": "MIT",
"repository": {
Expand Down

0 comments on commit 9c8bd9b

Please sign in to comment.