@create-node-app/core 0.3.3 → 0.3.5

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.
package/dist/index.js CHANGED
@@ -708,7 +708,6 @@ var runCommandInProjectDir = async (root, command, args = [], successMessage = "
708
708
  // don't show output in console
709
709
  stdio: "ignore"
710
710
  });
711
- console.log();
712
711
  console.log(import_chalk3.default.green(successMessage));
713
712
  } catch (error) {
714
713
  console.log();
@@ -791,10 +790,10 @@ var run = async ({
791
790
  }
792
791
  } else {
793
792
  console.log(import_chalk3.default.yellow("Skip package installation."));
794
- const packageJson = JSON.parse(
793
+ const packageJson2 = JSON.parse(
795
794
  import_fs5.default.readFileSync(`${root}/package.json`, "utf8")
796
795
  );
797
- packageJson.dependencies = dependencies.reduce((dep, elem) => {
796
+ packageJson2.dependencies = dependencies.reduce((dep, elem) => {
798
797
  const nextDep = dep;
799
798
  if (/.+@(\^|~)?[0-9a-zA-Z-.]+$/.test(elem)) {
800
799
  const [name, version] = elem.split("@");
@@ -804,7 +803,7 @@ var run = async ({
804
803
  }
805
804
  return nextDep;
806
805
  }, {});
807
- packageJson.devDependencies = devDependencies.reduce((dep, elem) => {
806
+ packageJson2.devDependencies = devDependencies.reduce((dep, elem) => {
808
807
  const nextDep = dep;
809
808
  if (/.+@(\^|~)?[0-9a-zA-Z-.]+$/.test(elem)) {
810
809
  const [name, version] = elem.split("@");
@@ -816,7 +815,7 @@ var run = async ({
816
815
  }, {});
817
816
  import_fs5.default.writeFileSync(
818
817
  import_path4.default.join(root, "package.json"),
819
- JSON.stringify(packageJson, null, 2) + import_os3.default.EOL
818
+ JSON.stringify(packageJson2, null, 2) + import_os3.default.EOL
820
819
  );
821
820
  console.log();
822
821
  console.log(import_chalk3.default.green("Successfully updated package.json."));
@@ -829,36 +828,56 @@ var run = async ({
829
828
  "git",
830
829
  ["init"],
831
830
  "Successfully initialized git repository.",
832
- "Failed to initialize git repository."
831
+ "Failed to initialize git repository. Run `git init` to initialize git repository after the process is completed."
833
832
  );
834
833
  if (installDependencies && isOnline) {
835
- const packageJson = JSON.parse(
834
+ const packageJson2 = JSON.parse(
836
835
  import_fs5.default.readFileSync(`${root}/package.json`, "utf8")
837
836
  );
838
- if (packageJson.scripts && packageJson.scripts["format"]) {
837
+ if (packageJson2.scripts && packageJson2.scripts["format"]) {
839
838
  try {
840
839
  await runCommandInProjectDir(
841
840
  root,
842
841
  runCommand,
843
842
  ["format"],
844
- "Successfully formatted code."
843
+ "Successfully formatted code.",
844
+ `Failed to format code. Run \`${runCommand} format\` to format code after the process is completed.`
845
845
  );
846
846
  } catch {
847
847
  }
848
848
  }
849
- if (packageJson.scripts && packageJson.scripts["lint:fix"]) {
849
+ if (packageJson2.scripts && packageJson2.scripts["lint:fix"]) {
850
850
  try {
851
851
  await runCommandInProjectDir(
852
852
  root,
853
853
  runCommand,
854
854
  ["lint:fix"],
855
855
  "Successfully fixed linting errors.",
856
- "Failed to fix linting errors."
856
+ `Failed to fix linting errors. Run \`${runCommand} lint:fix\` to fix linting errors after the process is completed.`
857
857
  );
858
858
  } catch {
859
859
  }
860
860
  }
861
861
  }
862
+ console.log();
863
+ console.log(import_chalk3.default.green("Successfully created project " + appName + "."));
864
+ console.log();
865
+ console.log("Done! Now run:");
866
+ console.log();
867
+ console.log(import_chalk3.default.cyan(` cd ${appName}`));
868
+ console.log(import_chalk3.default.cyan(` ${installCommand}`));
869
+ const packageJson = JSON.parse(
870
+ import_fs5.default.readFileSync(`${root}/package.json`, "utf8")
871
+ );
872
+ const lookForScripts = ["sls:offline", "dev", "start"];
873
+ for (const script of lookForScripts) {
874
+ if (packageJson.scripts && packageJson.scripts[script]) {
875
+ console.log(import_chalk3.default.cyan(` ${runCommand} ${script}`));
876
+ break;
877
+ }
878
+ }
879
+ console.log();
880
+ console.log(import_chalk3.default.green("Happy hacking!"));
862
881
  };
863
882
  var createApp = async ({
864
883
  name,
package/dist/index.mjs CHANGED
@@ -679,7 +679,6 @@ var runCommandInProjectDir = async (root, command, args = [], successMessage = "
679
679
  // don't show output in console
680
680
  stdio: "ignore"
681
681
  });
682
- console.log();
683
682
  console.log(chalk3.green(successMessage));
684
683
  } catch (error) {
685
684
  console.log();
@@ -762,10 +761,10 @@ var run = async ({
762
761
  }
763
762
  } else {
764
763
  console.log(chalk3.yellow("Skip package installation."));
765
- const packageJson = JSON.parse(
764
+ const packageJson2 = JSON.parse(
766
765
  fs4.readFileSync(`${root}/package.json`, "utf8")
767
766
  );
768
- packageJson.dependencies = dependencies.reduce((dep, elem) => {
767
+ packageJson2.dependencies = dependencies.reduce((dep, elem) => {
769
768
  const nextDep = dep;
770
769
  if (/.+@(\^|~)?[0-9a-zA-Z-.]+$/.test(elem)) {
771
770
  const [name, version] = elem.split("@");
@@ -775,7 +774,7 @@ var run = async ({
775
774
  }
776
775
  return nextDep;
777
776
  }, {});
778
- packageJson.devDependencies = devDependencies.reduce((dep, elem) => {
777
+ packageJson2.devDependencies = devDependencies.reduce((dep, elem) => {
779
778
  const nextDep = dep;
780
779
  if (/.+@(\^|~)?[0-9a-zA-Z-.]+$/.test(elem)) {
781
780
  const [name, version] = elem.split("@");
@@ -787,7 +786,7 @@ var run = async ({
787
786
  }, {});
788
787
  fs4.writeFileSync(
789
788
  path3.join(root, "package.json"),
790
- JSON.stringify(packageJson, null, 2) + os3.EOL
789
+ JSON.stringify(packageJson2, null, 2) + os3.EOL
791
790
  );
792
791
  console.log();
793
792
  console.log(chalk3.green("Successfully updated package.json."));
@@ -800,36 +799,56 @@ var run = async ({
800
799
  "git",
801
800
  ["init"],
802
801
  "Successfully initialized git repository.",
803
- "Failed to initialize git repository."
802
+ "Failed to initialize git repository. Run `git init` to initialize git repository after the process is completed."
804
803
  );
805
804
  if (installDependencies && isOnline) {
806
- const packageJson = JSON.parse(
805
+ const packageJson2 = JSON.parse(
807
806
  fs4.readFileSync(`${root}/package.json`, "utf8")
808
807
  );
809
- if (packageJson.scripts && packageJson.scripts["format"]) {
808
+ if (packageJson2.scripts && packageJson2.scripts["format"]) {
810
809
  try {
811
810
  await runCommandInProjectDir(
812
811
  root,
813
812
  runCommand,
814
813
  ["format"],
815
- "Successfully formatted code."
814
+ "Successfully formatted code.",
815
+ `Failed to format code. Run \`${runCommand} format\` to format code after the process is completed.`
816
816
  );
817
817
  } catch {
818
818
  }
819
819
  }
820
- if (packageJson.scripts && packageJson.scripts["lint:fix"]) {
820
+ if (packageJson2.scripts && packageJson2.scripts["lint:fix"]) {
821
821
  try {
822
822
  await runCommandInProjectDir(
823
823
  root,
824
824
  runCommand,
825
825
  ["lint:fix"],
826
826
  "Successfully fixed linting errors.",
827
- "Failed to fix linting errors."
827
+ `Failed to fix linting errors. Run \`${runCommand} lint:fix\` to fix linting errors after the process is completed.`
828
828
  );
829
829
  } catch {
830
830
  }
831
831
  }
832
832
  }
833
+ console.log();
834
+ console.log(chalk3.green("Successfully created project " + appName + "."));
835
+ console.log();
836
+ console.log("Done! Now run:");
837
+ console.log();
838
+ console.log(chalk3.cyan(` cd ${appName}`));
839
+ console.log(chalk3.cyan(` ${installCommand}`));
840
+ const packageJson = JSON.parse(
841
+ fs4.readFileSync(`${root}/package.json`, "utf8")
842
+ );
843
+ const lookForScripts = ["sls:offline", "dev", "start"];
844
+ for (const script of lookForScripts) {
845
+ if (packageJson.scripts && packageJson.scripts[script]) {
846
+ console.log(chalk3.cyan(` ${runCommand} ${script}`));
847
+ break;
848
+ }
849
+ }
850
+ console.log();
851
+ console.log(chalk3.green("Happy hacking!"));
833
852
  };
834
853
  var createApp = async ({
835
854
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@create-node-app/core",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",