create-gen-app 0.9.0 → 0.10.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/esm/licenses.js CHANGED
@@ -2,6 +2,8 @@ import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  const PLACEHOLDER_PATTERN = /{{(\w+)}}/g;
4
4
  let cachedTemplates = null;
5
+ export const DEFAULT_LICENSE = 'MIT';
6
+ export const CLOSED_LICENSE = 'CLOSED';
5
7
  export const LICENSE_VALUE_KEYS = ['LICENSE', 'license'];
6
8
  export const LICENSE_AUTHOR_KEYS = [
7
9
  'USERFULLNAME',
@@ -46,7 +48,19 @@ export function renderLicense(licenseName, context) {
46
48
  });
47
49
  }
48
50
  export function listSupportedLicenses() {
49
- return Object.keys(loadLicenseTemplates());
51
+ const licenses = Object.keys(loadLicenseTemplates());
52
+ // Sort with DEFAULT_LICENSE first, CLOSED_LICENSE last, then alphabetically
53
+ return licenses.sort((a, b) => {
54
+ if (a === DEFAULT_LICENSE)
55
+ return -1;
56
+ if (b === DEFAULT_LICENSE)
57
+ return 1;
58
+ if (a === CLOSED_LICENSE)
59
+ return 1;
60
+ if (b === CLOSED_LICENSE)
61
+ return -1;
62
+ return a.localeCompare(b);
63
+ });
50
64
  }
51
65
  export function findLicenseValue(answers) {
52
66
  return getAnswerValue(answers, LICENSE_VALUE_KEYS);
package/licenses.d.ts CHANGED
@@ -4,6 +4,8 @@ interface LicenseContext {
4
4
  email: string;
5
5
  }
6
6
  export type SupportedLicense = string;
7
+ export declare const DEFAULT_LICENSE = "MIT";
8
+ export declare const CLOSED_LICENSE = "CLOSED";
7
9
  export declare const LICENSE_VALUE_KEYS: string[];
8
10
  export declare const LICENSE_AUTHOR_KEYS: string[];
9
11
  export declare const LICENSE_EMAIL_KEYS: string[];
package/licenses.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.LICENSE_EMAIL_KEYS = exports.LICENSE_AUTHOR_KEYS = exports.LICENSE_VALUE_KEYS = void 0;
36
+ exports.LICENSE_EMAIL_KEYS = exports.LICENSE_AUTHOR_KEYS = exports.LICENSE_VALUE_KEYS = exports.CLOSED_LICENSE = exports.DEFAULT_LICENSE = void 0;
37
37
  exports.isSupportedLicense = isSupportedLicense;
38
38
  exports.renderLicense = renderLicense;
39
39
  exports.listSupportedLicenses = listSupportedLicenses;
@@ -44,6 +44,8 @@ const fs = __importStar(require("fs"));
44
44
  const path = __importStar(require("path"));
45
45
  const PLACEHOLDER_PATTERN = /{{(\w+)}}/g;
46
46
  let cachedTemplates = null;
47
+ exports.DEFAULT_LICENSE = 'MIT';
48
+ exports.CLOSED_LICENSE = 'CLOSED';
47
49
  exports.LICENSE_VALUE_KEYS = ['LICENSE', 'license'];
48
50
  exports.LICENSE_AUTHOR_KEYS = [
49
51
  'USERFULLNAME',
@@ -88,7 +90,19 @@ function renderLicense(licenseName, context) {
88
90
  });
89
91
  }
90
92
  function listSupportedLicenses() {
91
- return Object.keys(loadLicenseTemplates());
93
+ const licenses = Object.keys(loadLicenseTemplates());
94
+ // Sort with DEFAULT_LICENSE first, CLOSED_LICENSE last, then alphabetically
95
+ return licenses.sort((a, b) => {
96
+ if (a === exports.DEFAULT_LICENSE)
97
+ return -1;
98
+ if (b === exports.DEFAULT_LICENSE)
99
+ return 1;
100
+ if (a === exports.CLOSED_LICENSE)
101
+ return 1;
102
+ if (b === exports.CLOSED_LICENSE)
103
+ return -1;
104
+ return a.localeCompare(b);
105
+ });
92
106
  }
93
107
  function findLicenseValue(answers) {
94
108
  return getAnswerValue(answers, exports.LICENSE_VALUE_KEYS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-gen-app",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "Clone and customize template repositories with variable replacement",
6
6
  "main": "index.js",
@@ -36,5 +36,5 @@
36
36
  "makage": "0.1.8"
37
37
  },
38
38
  "keywords": [],
39
- "gitHead": "3d31881a64d8eb1c88d9540871f72bc255da446c"
39
+ "gitHead": "458e933c0f7c9cd37649d80c9fc81783f1f9f2fd"
40
40
  }