@tsed/cli 7.0.0-alpha.3 → 7.0.0-alpha.4

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.
@@ -120,7 +120,7 @@ export class InitCmd {
120
120
  await createTasksRunner([
121
121
  {
122
122
  title: "Write RC files",
123
- skip: () => !ctx.GH_TOKEN,
123
+ skip: () => !ctx.premium,
124
124
  task: () => {
125
125
  return Promise.all([render(".npmrc", ctx), render(".yarnrc", ctx)]);
126
126
  }
@@ -1,5 +1,5 @@
1
1
  import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces/index.js";
2
- import { hasFeature, hasValue } from "../utils/hasFeature.js";
2
+ import { hasFeature, hasValue, hasValuePremium } from "../utils/hasFeature.js";
3
3
  import { isPlatform } from "../utils/isPlatform.js";
4
4
  export var FeatureType;
5
5
  (function (FeatureType) {
@@ -16,11 +16,11 @@ export var FeatureType;
16
16
  FeatureType["CONFIG_DOTENV"] = "config:dotenv";
17
17
  FeatureType["CONFIG_JSON"] = "config:json";
18
18
  FeatureType["CONFIG_YAML"] = "config:yaml";
19
- FeatureType["CONFIG_AWS_SECRETS"] = "config:aws_secrets";
20
- FeatureType["CONFIG_IOREDIS"] = "config:ioredis";
21
- FeatureType["CONFIG_MONGO"] = "config:mongo";
22
- FeatureType["CONFIG_VAULT"] = "config:vault";
23
- FeatureType["CONFIG_POSTGRES"] = "config:postgres";
19
+ FeatureType["CONFIG_AWS_SECRETS"] = "config:aws_secrets:premium";
20
+ FeatureType["CONFIG_IOREDIS"] = "config:ioredis:premium";
21
+ FeatureType["CONFIG_MONGO"] = "config:mongo:premium";
22
+ FeatureType["CONFIG_VAULT"] = "config:vault:premium";
23
+ FeatureType["CONFIG_POSTGRES"] = "config:postgres:premium";
24
24
  // DOC
25
25
  FeatureType["SWAGGER"] = "swagger";
26
26
  FeatureType["SCALAR"] = "scalar";
@@ -453,13 +453,12 @@ export const FeaturesPrompt = (availableRuntimes, availablePackageManagers) => [
453
453
  ],
454
454
  when: hasValue("featuresDB", FeatureType.TYPEORM)
455
455
  },
456
- // {
457
- // type: "password",
458
- // name: "GH_TOKEN",
459
- // message:
460
- // "Enter GH_TOKEN to use the premium @tsedio package or leave blank (see https://tsed.dev/plugins/premium/install-premium-plugins.html)"
461
- // // when: hasValue("featuresDB.type", "prisma")
462
- // },
456
+ {
457
+ type: "password",
458
+ name: "GH_TOKEN",
459
+ message: "Enter GH_TOKEN to use the premium @tsedio package or leave blank (see https://tsed.dev/plugins/premium/install-premium-plugins.html)",
460
+ when: hasValuePremium()
461
+ },
463
462
  {
464
463
  message: "Choose unit framework",
465
464
  type: "list",
@@ -4,6 +4,10 @@ export function mapToContext(options) {
4
4
  options = mapUniqFeatures(options);
5
5
  options.features.forEach((feature) => {
6
6
  const [base, type] = feature.split(":");
7
+ if (feature?.endsWith(":premium")) {
8
+ feature = feature.replace(":premium", "");
9
+ options.premium = true;
10
+ }
7
11
  options[camelCase(base)] = true;
8
12
  type && (options[camelCase(type)] = true);
9
13
  feature && (options[camelCase(feature)] = true);
@@ -18,15 +18,3 @@ export function getFeaturesPrompt(runtimes, availablePackageManagers, options) {
18
18
  });
19
19
  });
20
20
  }
21
- export function getFrameworksPrompt() {
22
- return {
23
- ...FrameworksPrompt,
24
- choices: FrameworksPrompt.choices.map((choice, index) => {
25
- return cleanObject({
26
- ...FeaturesMap[choice],
27
- checked: index === 0,
28
- value: choice
29
- });
30
- })
31
- };
32
- }
@@ -5,3 +5,6 @@ export function hasValue(expression, value) {
5
5
  export function hasFeature(feature) {
6
6
  return (ctx) => !!ctx.features.find((item) => item === feature);
7
7
  }
8
+ export function hasValuePremium() {
9
+ return (ctx) => !!ctx.features.find((item) => item.endsWith(":premium"));
10
+ }