( args: CreateProjectInputs, logger: Logger, prompt?: Prompt )
| 57 | }); |
| 58 | |
| 59 | async function createProjectAdapter( |
| 60 | args: CreateProjectInputs, |
| 61 | logger: Logger, |
| 62 | prompt?: Prompt |
| 63 | ): Promise<z.infer<typeof createProjectOutputs>> { |
| 64 | const signerOrProvider = await getSignerOrProvider(args.network, logger, undefined, true); |
| 65 | const sdk = getContractSDK(signerOrProvider, args.network); |
| 66 | requireSigner(signerOrProvider); |
| 67 | |
| 68 | const projectType = ProjectType[args.projectType]; |
| 69 | |
| 70 | if (!args.description) { |
| 71 | if (prompt) { |
| 72 | args.description = await prompt({ |
| 73 | type: 'string', |
| 74 | message: 'Enter a short description of the project', |
| 75 | }); |
| 76 | } else { |
| 77 | throw new Error('Project description is required'); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | if (!args.deploymentVersion) { |
| 82 | if (prompt) { |
| 83 | args.deploymentVersion = await prompt({ |
| 84 | type: 'string', |
| 85 | defaultValue: '1.0.0', |
| 86 | message: 'Enter a deployment version', |
| 87 | }); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | if (!args.deploymentDescription) { |
| 92 | if (prompt) { |
| 93 | args.deploymentDescription = await prompt({ |
| 94 | type: 'string', |
| 95 | message: 'Enter a deployment description', |
| 96 | }); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | const projectMetadata = projectMetadataSchema.parse({ |
| 101 | name: args.name, |
| 102 | description: args.description, |
| 103 | image: args.image, |
| 104 | tags: args.tags, |
| 105 | website: args.website, |
| 106 | codeRepository: args.codeRepository, |
| 107 | }); |
| 108 | |
| 109 | const deploymentVersion = |
| 110 | args.deploymentVersion ?? |
| 111 | (await prompt?.({ |
| 112 | message: 'Enter the deployment version', |
| 113 | defaultValue: '1.0.0', |
| 114 | type: 'string', |
| 115 | })); |
| 116 |
no test coverage detected