@create-node-app/core 0.2.6 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ type TemplateOrExtension = {
3
3
  ignorePackage?: boolean;
4
4
  };
5
5
 
6
+ declare const checkNodeVersion: (requiredVersion: string, packageName: string) => void;
6
7
  declare const checkForLatestVersion: (packageName: string) => Promise<string | null>;
7
8
  declare const printEnvInfo: () => Promise<never>;
8
9
  type CnaOptions = {
@@ -35,4 +36,4 @@ type CnaOptionsTransform = (options: CnaOptions) => Promise<CnaOptions>;
35
36
  */
36
37
  declare const createNodeApp: (programName: string, options: CnaOptions, transformOptions: CnaOptionsTransform) => Promise<void>;
37
38
 
38
- export { CnaOptions, CnaOptionsTransform, checkForLatestVersion, createNodeApp, printEnvInfo };
39
+ export { CnaOptions, CnaOptionsTransform, checkForLatestVersion, checkNodeVersion, createNodeApp, printEnvInfo };
package/dist/index.js CHANGED
@@ -31,12 +31,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var create_node_app_core_exports = {};
32
32
  __export(create_node_app_core_exports, {
33
33
  checkForLatestVersion: () => checkForLatestVersion,
34
+ checkNodeVersion: () => checkNodeVersion,
34
35
  createNodeApp: () => createNodeApp,
35
36
  printEnvInfo: () => printEnvInfo
36
37
  });
37
38
  module.exports = __toCommonJS(create_node_app_core_exports);
38
39
  var import_chalk4 = __toESM(require("chalk"));
39
40
  var import_envinfo = __toESM(require("envinfo"));
41
+ var import_semver3 = __toESM(require("semver"));
40
42
  var import_child_process4 = require("child_process");
41
43
 
42
44
  // installer.ts
@@ -941,6 +943,18 @@ Please update to npm 3 or higher for a better, fully supported experience.
941
943
  };
942
944
 
943
945
  // index.ts
946
+ var checkNodeVersion = (requiredVersion, packageName) => {
947
+ if (!import_semver3.default.satisfies(process.version, requiredVersion)) {
948
+ console.error(
949
+ import_chalk4.default.red(
950
+ `You are running Node ${process.version}.
951
+ ${packageName} requires Node ${requiredVersion}.
952
+ Please update your version of Node.`
953
+ )
954
+ );
955
+ process.exit(1);
956
+ }
957
+ };
944
958
  var checkForLatestVersion = async (packageName) => {
945
959
  try {
946
960
  const response = await fetch(
@@ -1003,6 +1017,7 @@ var createNodeApp = async (programName, options, transformOptions) => {
1003
1017
  // Annotate the CommonJS export names for ESM import in node:
1004
1018
  0 && (module.exports = {
1005
1019
  checkForLatestVersion,
1020
+ checkNodeVersion,
1006
1021
  createNodeApp,
1007
1022
  printEnvInfo
1008
1023
  });
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 semver3 from "semver";
12
13
  import { execSync as execSync3 } from "child_process";
13
14
 
14
15
  // installer.ts
@@ -913,6 +914,18 @@ Please update to npm 3 or higher for a better, fully supported experience.
913
914
  };
914
915
 
915
916
  // index.ts
917
+ var checkNodeVersion = (requiredVersion, packageName) => {
918
+ if (!semver3.satisfies(process.version, requiredVersion)) {
919
+ console.error(
920
+ chalk4.red(
921
+ `You are running Node ${process.version}.
922
+ ${packageName} requires Node ${requiredVersion}.
923
+ Please update your version of Node.`
924
+ )
925
+ );
926
+ process.exit(1);
927
+ }
928
+ };
916
929
  var checkForLatestVersion = async (packageName) => {
917
930
  try {
918
931
  const response = await fetch(
@@ -974,6 +987,7 @@ var createNodeApp = async (programName, options, transformOptions) => {
974
987
  };
975
988
  export {
976
989
  checkForLatestVersion,
990
+ checkNodeVersion,
977
991
  createNodeApp,
978
992
  printEnvInfo
979
993
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@create-node-app/core",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",