Skip to content

Commit

Permalink
feat: make create script better
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman committed Dec 3, 2023
1 parent 4d6e505 commit 597719f
Show file tree
Hide file tree
Showing 16 changed files with 808 additions and 80 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/lib/ui-dashboard-grid/ui-dashboard-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export function UiDashboardGrid({ links }: UiDashboardGridProps) {
const items = links.map((item, index) => (
<UnstyledButton component={Link} to={item.to} key={item.label} className={classes.item}>
<item.icon color={theme.colors[item.color ?? getColorByIndex(index)][6]} size={64} />
<Text size="xs" mt={7}>
<Text size="lg" mt={7} c={theme.colors[item.color ?? getColorByIndex(index)][6]}>
{item.label}
</Text>
</UnstyledButton>
))

return (
<SimpleGrid cols={{ xs: 1, sm: 2, md: 3 }} spacing={{ base: 'sm', md: 'xl' }}>
<SimpleGrid cols={{ xs: 1, sm: 2, md: 3 }} spacing={{ base: 'sm', md: 'xl' }} px="md">
{items}
</SimpleGrid>
)
Expand Down
13 changes: 13 additions & 0 deletions packages/create-pubkey-ui-app/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@
"rules": {
"@nx/dependency-checks": "error"
}
},
{
"files": ["./package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": [
"error",
{
"buildTargets": ["build-base"],
"ignoredDependencies": ["@nx/webpack", "prettier"]
}
]
}
}
]
}
14 changes: 13 additions & 1 deletion packages/create-pubkey-ui-app/bin/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/usr/bin/env node

import { createWorkspace } from 'create-nx-workspace'
import { execAndWait } from 'create-nx-workspace/src/utils/child-process-utils'
import { detectInvokedPackageManager } from 'create-nx-workspace/src/utils/package-manager'
import { getPackageManagerCommand } from 'nx/src/utils/package-manager'

async function main() {
const pm = detectInvokedPackageManager()
const name = process.argv[2] // TODO: use libraries like yargs or enquirer to set your workspace name
if (!name) {
throw new Error('Please provide a name for the workspace')
Expand All @@ -18,10 +22,18 @@ async function main() {
const { directory } = await createWorkspace(`@pubkey-ui/generators@${presetVersion}`, {
name,
nxCloud: false,
packageManager: 'npm',
packageManager: pm,
webName: 'web',
commit: {
name: '',
email: '',
message: 'chore: initial commit',
},
})

console.log('Installing dependencies...')
await execAndWait(getPackageManagerCommand(pm).install, directory)

console.log(`Successfully created the workspace: ${directory}.`)
}

Expand Down
5 changes: 4 additions & 1 deletion packages/create-pubkey-ui-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"version": "0.0.1",
"dependencies": {
"create-nx-workspace": "17.1.3",
"tslib": "^2.3.0"
"tslib": "^2.3.0",
"@nx/plugin": "^17.1.3",
"@nx/webpack": "^17.1.3",
"prettier": "^2.6.2"
},
"type": "commonjs",
"main": "./src/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ import themeGenerator from '../theme/theme-generator'
import { ApplicationGeneratorSchema } from './application-generator-schema'

export async function applicationGenerator(tree: Tree, rawOptions: ApplicationGeneratorSchema) {
// Best prettier config ever.
tree.write(
'.prettierrc',
JSON.stringify(
{
singleQuote: true,
printWidth: 120,
semi: false,
trailingComma: 'all',
arrowParens: 'always',
},
null,
2,
),
)
tree.write('.prettierignore', ['/dist', '/coverage', 'tmp', '/.yarn', '/.nx/cache'].join('\n'))

const options: NormalizedApplicationGeneratorSchema = normalizeApplicationGeneratorSchema(rawOptions)
// const npmScope = getNpmScope(tree)
// Set up the base project.
Expand Down
Loading

0 comments on commit 597719f

Please sign in to comment.