Skip to content

Commit dd2790c

Browse files
committed
feat: Use new templates from NPM
1 parent c269a44 commit dd2790c

File tree

6 files changed

+21
-24
lines changed

6 files changed

+21
-24
lines changed

src/features/instance/applications/components/NewApplication/CLIInstructions.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { Alert, AlertDescription } from '@/components/ui/alert';
21
import { Button } from '@/components/ui/button';
32
import { CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
43
import { Separator } from '@/components/ui/separator';
54
import { useCopyToClipboard } from '@/hooks/useCopyToClipboard';
6-
import { CheckIcon, CopyIcon, TerminalIcon } from 'lucide-react';
5+
import { CheckIcon, CopyIcon } from 'lucide-react';
76
import { FormState, UseFormWatch } from 'react-hook-form';
87
import { z } from 'zod';
98
import { NewApplicationSchema } from './schema';
@@ -54,13 +53,6 @@ export function CLIInstructions({
5453
</Button>
5554
</div>
5655
{cliStep.note && <p className="text-muted-foreground text-sm mt-2">{cliStep.note}</p>}
57-
58-
{cliStep.alert && (
59-
<Alert className="mt-2">
60-
<TerminalIcon className="w-4 h-4" />
61-
<AlertDescription>{cliStep.alert}</AlertDescription>
62-
</Alert>
63-
)}
6456
</div>
6557

6658
<Separator className="bg-black" />

src/features/instance/applications/components/NewApplication/templates.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ export const templates = [
44
name: 'Web + REST ORM',
55
description: "Define your entities in schema.graphql, add your HTML/CSS/JS in web, and you're cooking!",
66
tags: ['Harper', 'ORM', 'REST', 'GraphQL'],
7-
githubUrl: 'https://github.com/HarperFast/application-template/tree/fabric',
7+
npm: '@harperfast/template-vanilla-studio',
8+
githubUrl: 'https://github.com/HarperFast/create-harper/tree/main/template-vanilla',
89
},
910
{
1011
id: 'harper-ts',
1112
name: 'TypeScript',
1213
description: 'The same Web + REST ORM from the first template, but with TypeScript sprinkled in.',
1314
tags: ['Harper', 'TypeScript', 'GraphQL'],
14-
githubUrl: 'https://github.com/HarperFast/application-template/tree/fabric-typescript',
15+
npm: '@harperfast/template-vanilla-ts-studio',
16+
githubUrl: 'https://github.com/HarperFast/create-harper/tree/main/template-vanilla-ts',
1517
},
1618
// {
1719
// id: 'nextjs',

src/features/instance/applications/components/NewApplication/useCLISteps.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { isLocalStudio } from '@/config/constants';
22
import { useInstanceClientParams } from '@/config/useInstanceClient';
33
import { useInstanceAuth } from '@/hooks/useAuth';
44
import { Cluster, Instance } from '@/integrations/api/api.patch';
5+
import { excludeFalsy } from '@/lib/arrays/excludeFalsy';
56
import { toKebabCase } from '@/lib/string/to-kebab-case';
67
import { getOperationsUrlForCluster } from '@/lib/urls/getOperationsUrlForCluster';
78
import { getOperationsUrlForInstance } from '@/lib/urls/getOperationsUrlForInstance';
@@ -20,29 +21,29 @@ export function useCLISteps(appName: string) {
2021

2122
return useMemo(() => {
2223
const directoryName = toKebabCase(appName);
24+
const createArgs = [
25+
user?.username && ` --deploymentUsername="${user?.username}"`,
26+
target && ` --deploymentURL="${target}"`,
27+
].filter(excludeFalsy).join('');
2328
return [
2429
{
2530
title: 'Install Harper CLI',
2631
code: 'npm install -g harperdb',
2732
},
2833
{
29-
title: 'Clone Template',
30-
code: `git clone https://github.com/HarperFast/application-template.git ${directoryName}
31-
cd ${directoryName}`,
34+
title: 'Set up your app',
35+
code: `npm create harper ${directoryName}${createArgs.length ? ' --' : ''}${createArgs}`,
36+
note: 'You will be asked some easy questions to get you started. To make deployments easy, enter your'
37+
+ ' password for this cluster. It will get saved into your local .env file.',
3238
},
3339
{
3440
title: 'Start Local Harper Instance',
3541
code: 'npm run dev',
36-
alert: 'You will be prompted to configure your instance',
42+
note: 'You will be prompted to configure your instance.',
3743
},
3844
{
3945
title: 'Make Changes!',
40-
code: `pico schema.graphql`,
41-
},
42-
{
43-
title: 'Configure your .env file',
44-
code: `npm run login ${user?.username}@${target}`,
45-
note: `Your credentials are your own! Remember to exclude the .env file from source control.`,
46+
code: `pico schemas/examplePeople.graphql`,
4647
},
4748
{
4849
title: 'Deploy Application',

src/features/instance/applications/components/NewApplication/useCreateFromTemplate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function useCreateFromTemplate(
3535
}
3636
mutate({
3737
project,
38-
template: template.githubUrl,
38+
template: template.npm || template.githubUrl,
3939
...instanceParams,
4040
}, {
4141
onSuccess: () => {

src/features/instance/applications/lib/parseReadMe.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export function parseReadMe(
1111
contents = contents.replaceAll(/https?:\/\/localhost:9926/g, rest9926URL);
1212
}
1313
if (response.project) {
14-
contents = contents.replaceAll('Your New Harper Fabric App', response.project);
14+
contents = contents
15+
.replaceAll('Your New Harper Fabric App', response.project)
16+
.replaceAll('your-project-name-here', response.project);
1517
}
1618
return contents;
1719
}

src/integrations/api/instance/applications/addComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function addComponent({
1818
project,
1919
template,
2020
replicated: entityType === 'cluster',
21-
});
21+
}, { timeout: 300_000 });
2222
return data;
2323
}
2424

0 commit comments

Comments
 (0)