-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tailwind starting page (#30)
Co-authored-by: Martin Chełminiak <[email protected]>
- Loading branch information
Showing
13 changed files
with
541 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/core/installMachine/installSteps/homepage/install.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { homepageFiles } from '../../../templates/homepage/installConfig'; | ||
import { templateGenerator } from '../../../utils/generator/generator'; | ||
import { getTemplateDirectory } from '../../../utils/getTemplateDirectory'; | ||
import { logger } from '../../../utils/logger'; | ||
|
||
export const modifyHomepage = async (destinationDirectory: string) => { | ||
await logger.withSpinner('tailwind', 'Setting up your welcome homepage...', async (spinner) => { | ||
try { | ||
const templateDirectory = getTemplateDirectory(`/templates/homepage/files/`); | ||
templateGenerator(homepageFiles, templateDirectory, destinationDirectory); | ||
} catch (error) { | ||
spinner.fail('Tailwind installation failed'); | ||
console.error('Error during tailwind installation:', error); | ||
} | ||
}); | ||
}; |
36 changes: 36 additions & 0 deletions
36
packages/core/installMachine/installSteps/tailwind/install.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { execSync } from 'child_process'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { tailwindFiles } from '../../../templates/tailwind/installConfig'; | ||
import { templateGenerator } from '../../../utils/generator/generator'; | ||
import { getTemplateDirectory } from '../../../utils/getTemplateDirectory'; | ||
import { logger } from '../../../utils/logger'; | ||
|
||
export const installTailwind = async (destinationDirectory: string) => { | ||
await logger.withSpinner('tailwind', 'Adding Tailwind...', async (spinner) => { | ||
try { | ||
installTailwindPackage(destinationDirectory); | ||
copyTailwindFiles(destinationDirectory); | ||
spinner.succeed('Tailwind installed.'); | ||
} catch (error) { | ||
spinner.fail('Tailwind installation failed'); | ||
console.error('Error during tailwind installation:', error); | ||
} | ||
}); | ||
}; | ||
|
||
const copyTailwindFiles = (destinationDirectory: string) => { | ||
const templateDirectory = getTemplateDirectory(`/templates/tailwind/files/`); | ||
templateGenerator(tailwindFiles, templateDirectory, destinationDirectory); | ||
}; | ||
|
||
const installTailwindPackage = async (destinationDirectory: string) => { | ||
const packageJsonPath = path.join(destinationDirectory, 'apps/web/package.json'); | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); | ||
delete packageJson.dependencies['@repo/ui']; | ||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2)); | ||
process.chdir(path.join(destinationDirectory, 'apps/web')); | ||
execSync('pnpm add -D tailwindcss postcss autoprefixer', { stdio: 'inherit' }); | ||
process.chdir(destinationDirectory); | ||
execSync('pnpm install', { stdio: 'inherit' }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { Metadata } from 'next'; | ||
import { Roboto, Playfair_Display } from 'next/font/google'; | ||
import './globals.css'; | ||
|
||
const roboto = Roboto({ | ||
subsets: ['latin'], | ||
weight: ['400', '700'], | ||
variable: '--font-roboto', | ||
}); | ||
|
||
const playfair = Playfair_Display({ | ||
subsets: ['latin'], | ||
variable: '--font-playfair', | ||
}); | ||
|
||
export const metadata: Metadata = { | ||
title: 'Welcome to Stapler', | ||
description: 'Experience the future of organization with Stapler', | ||
}; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
return ( | ||
<html lang="en" className={`${roboto.variable} ${playfair.variable}`}> | ||
<body className="font-sans">{children}</body> | ||
</html> | ||
); | ||
} |
Oops, something went wrong.