@cbnventures/nova 0.39.0 → 0.40.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.
Files changed (95) hide show
  1. package/build/package.json +1 -1
  2. package/build/scaffold-versions.json +0 -19
  3. package/build/src/api/docker-hub.d.ts +14 -0
  4. package/build/src/api/docker-hub.d.ts.map +1 -0
  5. package/build/src/api/docker-hub.js +275 -0
  6. package/build/src/api/docker-hub.js.map +1 -0
  7. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +2 -2
  8. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
  9. package/build/src/cli/generate/github/workflows-blueprint-validate.js +60 -57
  10. package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
  11. package/build/src/cli/generate/github/workflows-blueprint.d.ts +3 -3
  12. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
  13. package/build/src/cli/generate/github/workflows-blueprint.js +15 -72
  14. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  15. package/build/src/cli/index.js +29 -0
  16. package/build/src/cli/index.js.map +1 -1
  17. package/build/src/cli/recipe/docker-hub/docker-hub-precheck.d.ts +3 -0
  18. package/build/src/cli/recipe/docker-hub/docker-hub-precheck.d.ts.map +1 -0
  19. package/build/src/cli/recipe/docker-hub/docker-hub-precheck.js +72 -0
  20. package/build/src/cli/recipe/docker-hub/docker-hub-precheck.js.map +1 -0
  21. package/build/src/cli/recipe/docker-hub/sync-identity.d.ts +5 -0
  22. package/build/src/cli/recipe/docker-hub/sync-identity.d.ts.map +1 -0
  23. package/build/src/cli/recipe/docker-hub/sync-identity.js +124 -0
  24. package/build/src/cli/recipe/docker-hub/sync-identity.js.map +1 -0
  25. package/build/src/cli/recipe/docker-hub/sync-policies.d.ts +5 -0
  26. package/build/src/cli/recipe/docker-hub/sync-policies.d.ts.map +1 -0
  27. package/build/src/cli/recipe/docker-hub/sync-policies.js +63 -0
  28. package/build/src/cli/recipe/docker-hub/sync-policies.js.map +1 -0
  29. package/build/src/cli/recipe/index.d.ts.map +1 -1
  30. package/build/src/cli/recipe/index.js +12 -0
  31. package/build/src/cli/recipe/index.js.map +1 -1
  32. package/build/src/cli/recipe/nova-config/normalize-order.js +3 -3
  33. package/build/src/cli/recipe/nova-config/normalize-order.js.map +1 -1
  34. package/build/src/cli/utility/configure.d.ts +1 -0
  35. package/build/src/cli/utility/configure.d.ts.map +1 -1
  36. package/build/src/cli/utility/configure.js +200 -4
  37. package/build/src/cli/utility/configure.js.map +1 -1
  38. package/build/src/lib/item.d.ts.map +1 -1
  39. package/build/src/lib/item.js +5 -0
  40. package/build/src/lib/item.js.map +1 -1
  41. package/build/src/lib/nova-config-order.d.ts.map +1 -1
  42. package/build/src/lib/nova-config-order.js +35 -1
  43. package/build/src/lib/nova-config-order.js.map +1 -1
  44. package/build/src/lib/nova-config.d.ts +1 -0
  45. package/build/src/lib/nova-config.d.ts.map +1 -1
  46. package/build/src/lib/nova-config.js +132 -1
  47. package/build/src/lib/nova-config.js.map +1 -1
  48. package/build/src/lib/regex.d.ts +2 -0
  49. package/build/src/lib/regex.d.ts.map +1 -1
  50. package/build/src/lib/regex.js +2 -0
  51. package/build/src/lib/regex.js.map +1 -1
  52. package/build/src/lib/schema.d.ts +34 -0
  53. package/build/src/lib/schema.d.ts.map +1 -1
  54. package/build/src/lib/schema.js +31 -0
  55. package/build/src/lib/schema.js.map +1 -1
  56. package/build/src/lib/workflow-templates.d.ts.map +1 -1
  57. package/build/src/lib/workflow-templates.js +2 -30
  58. package/build/src/lib/workflow-templates.js.map +1 -1
  59. package/build/src/types/api/docker-hub.d.ts +237 -0
  60. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +17 -16
  61. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +14 -15
  62. package/build/src/types/cli/index.d.ts +2 -0
  63. package/build/src/types/cli/recipe/docker-hub/docker-hub-precheck.d.ts +78 -0
  64. package/build/src/types/cli/recipe/docker-hub/sync-identity.d.ts +80 -0
  65. package/build/src/types/cli/recipe/docker-hub/sync-policies.d.ts +57 -0
  66. package/build/src/types/cli/recipe/index.d.ts +3 -1
  67. package/build/src/types/cli/utility/configure.d.ts +107 -0
  68. package/build/src/types/lib/item.d.ts +4 -0
  69. package/build/src/types/lib/nova-config-order.d.ts +34 -1
  70. package/build/src/types/lib/nova-config.d.ts +76 -0
  71. package/build/src/types/shared.d.ts +114 -3
  72. package/build/src/types/tests/api/docker-hub.test.d.ts +84 -0
  73. package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +4 -4
  74. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +21 -5
  75. package/build/src/types/tests/cli/recipe/nova-config/normalize-order.test.d.ts +4 -0
  76. package/build/src/types/tests/cli/utility/configure.test.d.ts +35 -0
  77. package/build/src/types/tests/lib/nova-config.test.d.ts +1 -1
  78. package/build/src/types/tests/scaffold-output-contract.test.d.ts +57 -0
  79. package/build/templates/generators/must-haves/agent-conventions/conventions/nova.md +6 -0
  80. package/build/templates/scaffold/app/android/package.json +1 -1
  81. package/build/templates/scaffold/app/apple/package.json +1 -1
  82. package/build/templates/scaffold/app/astro/package.json +1 -1
  83. package/build/templates/scaffold/app/discord-bot/package.json +1 -1
  84. package/build/templates/scaffold/app/express/package.json +1 -1
  85. package/build/templates/scaffold/app/nextjs/package.json +1 -1
  86. package/build/templates/scaffold/app/vite/package.json +1 -1
  87. package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
  88. package/build/templates/scaffold/package/github-action/package.json +1 -1
  89. package/build/templates/scaffold/package/homebridge/package.json +1 -1
  90. package/build/templates/scaffold/package/pfsense/package.json +2 -2
  91. package/build/templates/scaffold/package/pfsense/scripts/build-package.sh +7 -0
  92. package/build/templates/scaffold/package/pfsense/scripts/stage-package.mjs +48 -2
  93. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +1 -1
  94. package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +1 -1
  95. package/package.json +1 -1
@@ -19,6 +19,7 @@ export declare class Runner {
19
19
  private static parseStringArrayInput;
20
20
  private static parseStringRecordInput;
21
21
  private static promptArtifacts;
22
+ private static promptDockerHub;
22
23
  private static promptFlow;
23
24
  private static promptProject;
24
25
  private static promptEntities;
@@ -1 +1 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/cli/utility/configure.ts"],"names":[],"mappings":"AAsDA,OAAO,KAAK,EAsBV,0DAA0D,EAI1D,wDAAwD,EAExD,yDAAyD,EAEzD,uDAAuD,EACvD,6DAA6D,EAE7D,2DAA2D,EAC3D,0DAA0D,EAE1D,wDAAwD,EACxD,2DAA2D,EAC3D,yDAAyD,EAEzD,sEAAsE,EAEtE,oEAAoE,EAEpE,mEAAmE,EAEnE,iEAAiE,EAKjE,iEAAiE,EAGjE,+DAA+D,EAE/D,uDAAuD,EAEvD,qDAAqD,EAErD,wDAAwD,EAExD,sDAAsD,EAMtD,+DAA+D,EAG/D,6DAA6D,EAkqC7D,wCAAwC,EAGxC,wCAAwC,EAEzC,MAAM,wCAAwC,CAAC;AAUhD,qBAAa,MAAM;WAaG,GAAG,CAAC,OAAO,EAAE,wCAAwC,GAAG,wCAAwC;IAuIpH,OAAO,CAAC,MAAM,CAAC,yBAAyB;WAoB1B,qBAAqB,CAAC,KAAK,EAAE,wDAAwD,GAAG,0DAA0D;WA8ElJ,oBAAoB,CAAC,KAAK,EAAE,uDAAuD,GAAG,yDAAyD;WAuC/I,wBAAwB,CAAC,KAAK,EAAE,2DAA2D,GAAG,6DAA6D;WA0B3J,qBAAqB,CAAC,KAAK,EAAE,wDAAwD,GAAG,0DAA0D;WA2BlJ,sBAAsB,CAAC,KAAK,EAAE,yDAAyD,GAAG,2DAA2D;WAoBrJ,iCAAiC,CAAC,KAAK,EAAE,oEAAoE,GAAG,sEAAsE;WAoCtL,8BAA8B,CAAC,KAAK,EAAE,iEAAiE,GAAG,mEAA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,CAAC,MAAM,CAAC,YAAY;IA4E3B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqEhC,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAsEtC"}
@@ -2,6 +2,7 @@ import { promises as fs } from 'node:fs';
2
2
  import { join, relative, sep } from 'node:path';
3
3
  import chalk from 'chalk';
4
4
  import prompts from 'prompts';
5
+ import { Runner as DockerHub } from '../../api/docker-hub.js';
5
6
  import { GITHUB_RUNNER_IMAGES_README_URL, Runner as GithubRunnerImages, } from '../../api/github-runner-images.js';
6
7
  import { libEnvGithub } from '../../lib/env-github.js';
7
8
  import { libEnvManagedSet } from '../../lib/env-managed-set.js';
@@ -12,7 +13,7 @@ import { libEnvStatus } from '../../lib/env-status.js';
12
13
  import { getSupportedIgnoreFileBundles, isSupportedIgnoreFileConfigPath, } from '../../lib/ignore-files.js';
13
14
  import { libItemAllowedAgents, libItemAllowedPoliciesByRole, libItemAllowedRecipes, libItemOperatingSystemFilePatterns, libItemOperatingSystemFilesByPlatform, libItemRecipesByCategory, libItemSyncRoles, libItemValidEntityRoles, } from '../../lib/item.js';
14
15
  import { Runner as LibNovaConfig } from '../../lib/nova-config.js';
15
- import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_GITHUB_LABEL_COLOR, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.js';
16
+ import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_DOCKER_IMAGE_COMPONENT, LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_GITHUB_LABEL_COLOR, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.js';
16
17
  import { Runner as LibReleaseHistory } from '../../lib/release-history.js';
17
18
  import { discoverPathsWithFile, isPlainObject, pathExists, resolveTemplatePath, } from '../../lib/utility.js';
18
19
  import { Runner as LibVersionStrategyMigration } from '../../lib/version-strategy-migration.js';
@@ -407,6 +408,187 @@ export class Runner {
407
408
  }
408
409
  return 'back';
409
410
  }
411
+ static async promptDockerHub(config) {
412
+ const liveCategories = await DockerHub.fetchCategories();
413
+ if (liveCategories === undefined) {
414
+ Logger.error('Unable to load Docker Hub categories. The Docker Hub section was cancelled.');
415
+ return 'back';
416
+ }
417
+ const existing = config['dockerHub'];
418
+ const existingRecipes = (config['recipes'] !== undefined) ? config['recipes']['docker-hub'] : undefined;
419
+ const categoryChoices = liveCategories.map((category) => ({
420
+ title: category['name'],
421
+ value: category['slug'],
422
+ selected: (existing !== undefined
423
+ && existing['categories'] !== undefined
424
+ && existing['categories'].includes(category['slug']) === true),
425
+ }));
426
+ const visibilityOrder = [
427
+ 'public',
428
+ 'private',
429
+ ];
430
+ const visibilityInitial = (existing !== undefined && existing['visibility'] !== undefined) ? visibilityOrder.indexOf(existing['visibility']) + 1 : 0;
431
+ let immutableInitial = 0;
432
+ if (existing !== undefined && existing['immutableTags'] !== undefined) {
433
+ immutableInitial = (existing['immutableTags']['enabled'] === true) ? 1 : 2;
434
+ }
435
+ const validateDockerHubComponent = (dockerHubComponentValue) => {
436
+ const trimmed = (typeof dockerHubComponentValue === 'string') ? dockerHubComponentValue.trim() : '';
437
+ if (trimmed.length === 0) {
438
+ return 'This value is required.';
439
+ }
440
+ if (LIB_REGEX_PATTERN_DOCKER_IMAGE_COMPONENT.test(trimmed) === false) {
441
+ return 'Use one lowercase Docker image-name component without a registry, path, tag, or digest.';
442
+ }
443
+ return true;
444
+ };
445
+ const basicsOutput = await Runner.promptWithCancel([
446
+ {
447
+ type: 'text',
448
+ name: 'dockerHubNamespace',
449
+ message: 'Docker Hub namespace',
450
+ initial: (existing !== undefined) ? existing['namespace'] : '',
451
+ validate: validateDockerHubComponent,
452
+ },
453
+ {
454
+ type: 'text',
455
+ name: 'dockerHubRepository',
456
+ message: 'Docker Hub repository',
457
+ initial: (existing !== undefined) ? existing['repository'] : '',
458
+ validate: validateDockerHubComponent,
459
+ },
460
+ {
461
+ type: 'select',
462
+ name: 'dockerHubVisibility',
463
+ message: 'Repository visibility (sync this field?)',
464
+ choices: [
465
+ {
466
+ title: 'Skip (don\'t sync this field)',
467
+ value: 'skip',
468
+ },
469
+ {
470
+ title: 'Public',
471
+ value: 'public',
472
+ },
473
+ {
474
+ title: 'Private',
475
+ value: 'private',
476
+ },
477
+ ],
478
+ initial: visibilityInitial,
479
+ },
480
+ {
481
+ type: 'multiselect',
482
+ name: 'dockerHubCategories',
483
+ message: 'Repository categories (maximum 3)',
484
+ choices: categoryChoices,
485
+ max: 3,
486
+ },
487
+ {
488
+ type: 'select',
489
+ name: 'dockerHubImmutableTags',
490
+ message: 'Immutable tags (sync this field?)',
491
+ choices: [
492
+ {
493
+ title: 'Skip (don\'t sync this field)',
494
+ value: 'skip',
495
+ },
496
+ {
497
+ title: 'Enable',
498
+ value: true,
499
+ },
500
+ {
501
+ title: 'Disable',
502
+ value: false,
503
+ },
504
+ ],
505
+ initial: immutableInitial,
506
+ },
507
+ ]);
508
+ if (basicsOutput['cancelled'] === true) {
509
+ return 'back';
510
+ }
511
+ const basicsOutputResult = basicsOutput['result'];
512
+ const namespaceInput = String(basicsOutputResult.dockerHubNamespace).trim();
513
+ const repositoryInput = String(basicsOutputResult.dockerHubRepository).trim();
514
+ const dockerHub = {
515
+ namespace: namespaceInput,
516
+ repository: repositoryInput,
517
+ };
518
+ const visibilityValue = basicsOutputResult.dockerHubVisibility;
519
+ const categorySlugs = (Array.isArray(basicsOutputResult.dockerHubCategories) === true) ? basicsOutputResult.dockerHubCategories : [];
520
+ const immutableValue = basicsOutputResult.dockerHubImmutableTags;
521
+ if (categorySlugs.length > 3) {
522
+ Logger.error('Docker Hub accepts at most 3 repository categories. The Docker Hub section was cancelled.');
523
+ return 'back';
524
+ }
525
+ if (visibilityValue !== 'skip') {
526
+ dockerHub.visibility = visibilityValue;
527
+ }
528
+ dockerHub.categories = categorySlugs;
529
+ let immutableRules = [];
530
+ if (immutableValue !== 'skip') {
531
+ const rulesOutput = await Runner.promptWithCancel({
532
+ type: 'text',
533
+ name: 'dockerHubImmutableTagsRules',
534
+ message: 'Immutable tag rules as a JSON string array',
535
+ initial: (existing !== undefined && existing['immutableTags'] !== undefined) ? JSON.stringify(existing['immutableTags']['rules']) : '[]',
536
+ validate: Runner['isStringArrayInput'],
537
+ });
538
+ if (rulesOutput['cancelled'] === true) {
539
+ return 'back';
540
+ }
541
+ const rulesOutputResult = rulesOutput['result'];
542
+ immutableRules = Runner.parseStringArrayInput(rulesOutputResult.dockerHubImmutableTagsRules);
543
+ dockerHub.immutableTags = {
544
+ enabled: immutableValue,
545
+ rules: immutableRules,
546
+ };
547
+ }
548
+ const syncIdentityInitial = (existingRecipes !== undefined
549
+ && existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity']['enabled'] : true;
550
+ const syncPoliciesInitial = (existingRecipes !== undefined
551
+ && existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies']['enabled'] : false;
552
+ const recipesOutput = await Runner.promptWithCancel([
553
+ {
554
+ type: 'confirm',
555
+ name: 'dockerHubRecipeSyncIdentity',
556
+ message: 'Enable sync-identity recipe?',
557
+ initial: syncIdentityInitial,
558
+ },
559
+ {
560
+ type: 'confirm',
561
+ name: 'dockerHubRecipeSyncPolicies',
562
+ message: 'Enable sync-policies recipe?',
563
+ initial: syncPoliciesInitial,
564
+ },
565
+ ]);
566
+ if (recipesOutput['cancelled'] === true) {
567
+ return 'back';
568
+ }
569
+ const recipesOutputResult = recipesOutput['result'];
570
+ const dockerHubRecipesInput = {
571
+ 'sync-identity': {
572
+ ...((existingRecipes !== undefined && existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity'] : {}),
573
+ enabled: recipesOutputResult.dockerHubRecipeSyncIdentity,
574
+ },
575
+ 'sync-policies': {
576
+ ...((existingRecipes !== undefined && existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies'] : {}),
577
+ enabled: recipesOutputResult.dockerHubRecipeSyncPolicies,
578
+ },
579
+ };
580
+ const recipes = (config['recipes'] !== undefined) ? { ...config['recipes'] } : {};
581
+ Reflect.set(recipes, 'docker-hub', dockerHubRecipesInput);
582
+ Reflect.set(config, 'dockerHub', dockerHub);
583
+ Reflect.set(config, 'recipes', recipes);
584
+ Logger.customize({
585
+ name: 'Runner.promptDockerHub',
586
+ purpose: 'updated',
587
+ padTop: 1,
588
+ padBottom: 1,
589
+ }).info('Docker Hub repository settings updated.');
590
+ return 'back';
591
+ }
410
592
  static async promptFlow(config) {
411
593
  const category = {
412
594
  project: {
@@ -429,6 +611,11 @@ export class Runner {
429
611
  description: 'Configure GitHub repository settings, recipes, and policies.',
430
612
  handler: Runner['promptGithubMenu'],
431
613
  },
614
+ dockerHub: {
615
+ label: 'Docker Hub',
616
+ description: 'Configure Docker Hub repository settings, recipes, and policies.',
617
+ handler: Runner['promptDockerHub'],
618
+ },
432
619
  workflows: {
433
620
  label: 'Workflows',
434
621
  description: 'Configure workflow templates and settings.',
@@ -533,6 +720,10 @@ export class Runner {
533
720
  const projectName = (existingProjectName !== undefined) ? { ...existingProjectName } : {};
534
721
  const projectDescription = (existingProjectDescription !== undefined) ? { ...existingProjectDescription } : {};
535
722
  const projectKeywords = (existingProjectKeywords !== undefined) ? [...existingProjectKeywords] : [];
723
+ const hasDockerHub = config['dockerHub'] !== undefined;
724
+ const shortDescriptionLimit = (hasDockerHub === true) ? 100 : Infinity;
725
+ const shortDescriptionCount = (projectDescription['short'] !== undefined) ? projectDescription['short'].length : 0;
726
+ const shortDescriptionMessage = (hasDockerHub === true) ? `Short description (${shortDescriptionCount}/100)` : 'Short description';
536
727
  const validateProjectNameTitle = (projectNameTitleValue) => {
537
728
  return Runner.normalizeText(projectNameTitleValue, Infinity)['result'];
538
729
  };
@@ -540,7 +731,12 @@ export class Runner {
540
731
  return Runner.normalizeProjectSlug(projectNameSlugValue)['result'];
541
732
  };
542
733
  const validateProjectDescriptionShort = (projectDescriptionShortValue) => {
543
- return Runner.normalizeText(projectDescriptionShortValue, Infinity)['result'];
734
+ if (hasDockerHub === true
735
+ && typeof projectDescriptionShortValue === 'string'
736
+ && projectDescriptionShortValue.trim().length > 100) {
737
+ return 'Docker Hub\'s limit is 100 characters.';
738
+ }
739
+ return Runner.normalizeText(projectDescriptionShortValue, shortDescriptionLimit)['result'];
544
740
  };
545
741
  const validateProjectDescriptionLong = (projectDescriptionLongValue) => {
546
742
  return Runner.normalizeText(projectDescriptionLongValue, Infinity)['result'];
@@ -566,7 +762,7 @@ export class Runner {
566
762
  {
567
763
  type: 'text',
568
764
  name: 'projectDescriptionShort',
569
- message: 'Short description',
765
+ message: shortDescriptionMessage,
570
766
  initial: projectDescription['short'] ?? '',
571
767
  validate: validateProjectDescriptionShort,
572
768
  },
@@ -591,7 +787,7 @@ export class Runner {
591
787
  const questionsOutputResultValue = questionsOutput['result'];
592
788
  const projectNameTitleInput = Runner.normalizeText(questionsOutputResultValue.projectNameTitle, Infinity)['sanitized'];
593
789
  const projectNameSlugInput = Runner.normalizeProjectSlug(questionsOutputResultValue.projectNameSlug)['sanitized'];
594
- const projectDescriptionShortInput = Runner.normalizeText(questionsOutputResultValue.projectDescriptionShort, Infinity)['sanitized'];
790
+ const projectDescriptionShortInput = Runner.normalizeText(questionsOutputResultValue.projectDescriptionShort, shortDescriptionLimit)['sanitized'];
595
791
  const projectDescriptionLongInput = Runner.normalizeText(questionsOutputResultValue.projectDescriptionLong, Infinity)['sanitized'];
596
792
  const projectKeywordsInput = Runner.normalizeTextArray(questionsOutputResultValue.projectKeywords, 50)['sanitized'];
597
793
  if (projectNameTitleInput !== undefined) {