@create-node-app/core 0.1.0 → 0.1.1

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.d.ts CHANGED
@@ -3,6 +3,7 @@ type Addon = {
3
3
  ignorePackage?: boolean;
4
4
  };
5
5
 
6
+ declare const checkForLatestVersion: (packageName: string) => Promise<string | null>;
6
7
  declare const printEnvInfo: () => Promise<never>;
7
8
  type CnaOptions = {
8
9
  projectName: string;
@@ -36,4 +37,4 @@ type CnaOptionsTransform = (options: CnaOptions) => Promise<CnaOptions>;
36
37
  */
37
38
  declare const createNodeApp: (programName: string, options: CnaOptions, transformOptions: CnaOptionsTransform) => Promise<void>;
38
39
 
39
- export { CnaOptions, CnaOptionsTransform, createNodeApp, printEnvInfo };
40
+ export { CnaOptions, CnaOptionsTransform, checkForLatestVersion, createNodeApp, printEnvInfo };
package/dist/index.js CHANGED
@@ -30,12 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // index.ts
31
31
  var create_node_app_core_exports = {};
32
32
  __export(create_node_app_core_exports, {
33
+ checkForLatestVersion: () => checkForLatestVersion,
33
34
  createNodeApp: () => createNodeApp,
34
35
  printEnvInfo: () => printEnvInfo
35
36
  });
36
37
  module.exports = __toCommonJS(create_node_app_core_exports);
37
38
  var import_chalk4 = __toESM(require("chalk"));
38
39
  var import_envinfo = __toESM(require("envinfo"));
40
+ var import_child_process4 = require("child_process");
39
41
 
40
42
  // installer.ts
41
43
  var import_underscore2 = __toESM(require("underscore"));
@@ -853,6 +855,24 @@ Please update to npm 3 or higher for a better, fully supported experience.
853
855
  };
854
856
 
855
857
  // index.ts
858
+ var checkForLatestVersion = async (packageName) => {
859
+ try {
860
+ const response = await fetch(
861
+ `https://registry.npmjs.org/-/package/${packageName}/dist-tags`
862
+ );
863
+ if (!response.ok) {
864
+ throw new Error("Registry request failed");
865
+ }
866
+ const { latest } = await response.json();
867
+ return latest;
868
+ } catch (error) {
869
+ try {
870
+ return (0, import_child_process4.execSync)(`npm view ${packageName} version`).toString().trim();
871
+ } catch (error2) {
872
+ }
873
+ }
874
+ return null;
875
+ };
856
876
  var printEnvInfo = async () => {
857
877
  console.log(import_chalk4.default.bold("\nEnvironment Info:"));
858
878
  const info = await import_envinfo.default.run(
@@ -896,6 +916,7 @@ var createNodeApp = async (programName, options, transformOptions) => {
896
916
  };
897
917
  // Annotate the CommonJS export names for ESM import in node:
898
918
  0 && (module.exports = {
919
+ checkForLatestVersion,
899
920
  createNodeApp,
900
921
  printEnvInfo
901
922
  });
package/dist/index.mjs CHANGED
@@ -9,6 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
9
  // index.ts
10
10
  import chalk4 from "chalk";
11
11
  import envinfo from "envinfo";
12
+ import { execSync as execSync3 } from "child_process";
12
13
 
13
14
  // installer.ts
14
15
  import _2 from "underscore";
@@ -826,6 +827,24 @@ Please update to npm 3 or higher for a better, fully supported experience.
826
827
  };
827
828
 
828
829
  // index.ts
830
+ var checkForLatestVersion = async (packageName) => {
831
+ try {
832
+ const response = await fetch(
833
+ `https://registry.npmjs.org/-/package/${packageName}/dist-tags`
834
+ );
835
+ if (!response.ok) {
836
+ throw new Error("Registry request failed");
837
+ }
838
+ const { latest } = await response.json();
839
+ return latest;
840
+ } catch (error) {
841
+ try {
842
+ return execSync3(`npm view ${packageName} version`).toString().trim();
843
+ } catch (error2) {
844
+ }
845
+ }
846
+ return null;
847
+ };
829
848
  var printEnvInfo = async () => {
830
849
  console.log(chalk4.bold("\nEnvironment Info:"));
831
850
  const info = await envinfo.run(
@@ -868,6 +887,7 @@ var createNodeApp = async (programName, options, transformOptions) => {
868
887
  });
869
888
  };
870
889
  export {
890
+ checkForLatestVersion,
871
891
  createNodeApp,
872
892
  printEnvInfo
873
893
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@create-node-app/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",