create-awesome-node-app 0.4.17 → 0.4.18

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/README.md CHANGED
@@ -3,12 +3,6 @@
3
3
  <div align="center">
4
4
  <h1>🌟 Create Awesome Node App 🚀</h1>
5
5
 
6
- [Changelog](./CHANGELOG.md) |
7
- [Contributing](./CONTRIBUTING.md)
8
-
9
- </div>
10
- <div align="center">
11
-
12
6
  [![Continious Integration][cibadge]][ciurl]
13
7
  [![npm][npmversion]][npmurl]
14
8
  [![npm][npmdownloads]][npmurl]
package/dist/index.cjs CHANGED
@@ -3431,16 +3431,28 @@ var import_prompts = __toESM(require("prompts"), 1);
3431
3431
  var import_yargs = __toESM(require("yargs"), 1);
3432
3432
 
3433
3433
  // src/templates.ts
3434
+ var import_axios = __toESM(require("axios"), 1);
3434
3435
  var TEMPLATE_DATA_FILE_URL = "https://raw.githubusercontent.com/Create-Node-App/cna-templates/main/templates.json";
3435
- var templateDataMap = /* @__PURE__ */ new Map();
3436
+ var CACHE_TTL_MS = 36e5;
3437
+ var templateDataCache = {
3438
+ data: null,
3439
+ timestamp: 0
3440
+ };
3441
+ var fetchTemplateData = async () => {
3442
+ try {
3443
+ const response = await import_axios.default.get(TEMPLATE_DATA_FILE_URL);
3444
+ return response.data;
3445
+ } catch (error) {
3446
+ throw new Error("Failed to fetch template data");
3447
+ }
3448
+ };
3436
3449
  var getTemplateData = async () => {
3437
- if (templateDataMap.has(TEMPLATE_DATA_FILE_URL)) {
3438
- return templateDataMap.get(TEMPLATE_DATA_FILE_URL);
3450
+ const currentTime = Date.now();
3451
+ if (templateDataCache.data === null || currentTime - templateDataCache.timestamp > CACHE_TTL_MS) {
3452
+ templateDataCache.data = await fetchTemplateData();
3453
+ templateDataCache.timestamp = currentTime;
3439
3454
  }
3440
- const templateDataFile = await fetch(TEMPLATE_DATA_FILE_URL);
3441
- const templateData = await templateDataFile.json();
3442
- templateDataMap.set(TEMPLATE_DATA_FILE_URL, templateData);
3443
- return templateData;
3455
+ return templateDataCache.data;
3444
3456
  };
3445
3457
  var getTemplateCategories = async () => {
3446
3458
  const templateData = await getTemplateData();
@@ -3640,7 +3652,7 @@ var getCnaOptions = async (options) => {
3640
3652
  // package.json
3641
3653
  var package_default = {
3642
3654
  name: "create-awesome-node-app",
3643
- version: "0.4.17",
3655
+ version: "0.4.18",
3644
3656
  type: "module",
3645
3657
  description: "Command line tool to create Node apps with a lot of different templates and extensions.",
3646
3658
  license: "MIT",
@@ -3686,8 +3698,9 @@ var package_default = {
3686
3698
  },
3687
3699
  dependencies: {
3688
3700
  "@create-node-app/core": "*",
3701
+ axios: "^1.5.0",
3689
3702
  prompts: "^2.4.1",
3690
- semver: "^7.3.8",
3703
+ semver: "^5.7.2",
3691
3704
  yargs: "^17.0.1"
3692
3705
  },
3693
3706
  devDependencies: {
package/dist/index.js CHANGED
@@ -3441,16 +3441,28 @@ import prompts from "prompts";
3441
3441
  import yargs from "yargs";
3442
3442
 
3443
3443
  // src/templates.ts
3444
+ import axios from "axios";
3444
3445
  var TEMPLATE_DATA_FILE_URL = "https://raw.githubusercontent.com/Create-Node-App/cna-templates/main/templates.json";
3445
- var templateDataMap = /* @__PURE__ */ new Map();
3446
+ var CACHE_TTL_MS = 36e5;
3447
+ var templateDataCache = {
3448
+ data: null,
3449
+ timestamp: 0
3450
+ };
3451
+ var fetchTemplateData = async () => {
3452
+ try {
3453
+ const response = await axios.get(TEMPLATE_DATA_FILE_URL);
3454
+ return response.data;
3455
+ } catch (error) {
3456
+ throw new Error("Failed to fetch template data");
3457
+ }
3458
+ };
3446
3459
  var getTemplateData = async () => {
3447
- if (templateDataMap.has(TEMPLATE_DATA_FILE_URL)) {
3448
- return templateDataMap.get(TEMPLATE_DATA_FILE_URL);
3460
+ const currentTime = Date.now();
3461
+ if (templateDataCache.data === null || currentTime - templateDataCache.timestamp > CACHE_TTL_MS) {
3462
+ templateDataCache.data = await fetchTemplateData();
3463
+ templateDataCache.timestamp = currentTime;
3449
3464
  }
3450
- const templateDataFile = await fetch(TEMPLATE_DATA_FILE_URL);
3451
- const templateData = await templateDataFile.json();
3452
- templateDataMap.set(TEMPLATE_DATA_FILE_URL, templateData);
3453
- return templateData;
3465
+ return templateDataCache.data;
3454
3466
  };
3455
3467
  var getTemplateCategories = async () => {
3456
3468
  const templateData = await getTemplateData();
@@ -3650,7 +3662,7 @@ var getCnaOptions = async (options) => {
3650
3662
  // package.json
3651
3663
  var package_default = {
3652
3664
  name: "create-awesome-node-app",
3653
- version: "0.4.17",
3665
+ version: "0.4.18",
3654
3666
  type: "module",
3655
3667
  description: "Command line tool to create Node apps with a lot of different templates and extensions.",
3656
3668
  license: "MIT",
@@ -3696,8 +3708,9 @@ var package_default = {
3696
3708
  },
3697
3709
  dependencies: {
3698
3710
  "@create-node-app/core": "*",
3711
+ axios: "^1.5.0",
3699
3712
  prompts: "^2.4.1",
3700
- semver: "^7.3.8",
3713
+ semver: "^5.7.2",
3701
3714
  yargs: "^17.0.1"
3702
3715
  },
3703
3716
  devDependencies: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-awesome-node-app",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "type": "module",
5
5
  "description": "Command line tool to create Node apps with a lot of different templates and extensions.",
6
6
  "license": "MIT",
@@ -46,8 +46,9 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@create-node-app/core": "*",
49
+ "axios": "^1.5.0",
49
50
  "prompts": "^2.4.1",
50
- "semver": "^7.3.8",
51
+ "semver": "^5.7.2",
51
52
  "yargs": "^17.0.1"
52
53
  },
53
54
  "devDependencies": {