Skip to content

Commit

Permalink
fix: moved message
Browse files Browse the repository at this point in the history
  • Loading branch information
gagdiez committed Aug 27, 2024
1 parent 6a933dc commit 826a2ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ import { trackUsage } from './tracking';

show.creatingApp();

if (contract !== 'none' && process.platform === 'win32') {
trackUsage('none', false, 'none');
return show.windowsWarning();
}

let createSuccess;
try {
createSuccess = await createProject({
Expand Down
7 changes: 6 additions & 1 deletion src/messages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from 'chalk';
import { trackingMessage } from './tracking';
import { trackingMessage, trackUsage } from './tracking';
import { Contract, Frontend, FrontendMessage, ProjectName } from './types';

if (process.env.NEAR_NO_COLOR) {
Expand Down Expand Up @@ -139,3 +139,8 @@ export const depsInstall = () =>

export const depsInstallError = () =>
show(chalk.red('Error installing NEAR project dependencies'));

export const sorryWindowsUsers = () => {
trackUsage('none', false, 'none');
return chalk`{red Sorry, Windows is not supported for this option yet.}`;
};
7 changes: 5 additions & 2 deletions src/user-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ export async function getUserArgs(): Promise<UserConfig> {
return { contract, frontend, components, projectName, install };
}

type Choices<T> = { title: string, description?: string, value: T }[];
type Choices<T> = { title: string, description?: string, value: T, validate?: boolean | string }[];

const appChoices: Choices<App> = [
{ title: 'A Web App', description: 'A Web App that talks with Near contracts', value: 'gateway' },
{ title: 'A Smart Contract', description: 'A smart contract to be deployed in the Near Blockchain', value: 'contract' },
{
title: 'A Smart Contract', description: 'A smart contract to be deployed in the Near Blockchain', value: 'contract',
validate: process.platform !== 'win32' ? show.sorryWindowsUsers() : true
},
];
const contractChoices: Choices<Contract> = [
{ title: 'JS/TS Contract', description: 'A Near contract written in javascript/typescript', value: 'ts' },
Expand Down

0 comments on commit 826a2ae

Please sign in to comment.