Skip to content

Commit

Permalink
fix: fix the Nx warning about project name and root (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman authored Feb 23, 2024
1 parent e31e290 commit 5b0f6c8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { AnchorApplicationSchema } from './anchor-application-schema'
export async function anchorApplicationGenerator(tree: Tree, rawOptions: AnchorApplicationSchema) {
const options: AnchorApplicationNormalizedSchema = anchorApplicationNormalizeSchema(rawOptions)
await libraryGenerator(tree, {
directory: options.name,
projectNameAndRootFormat: 'as-provided',
name: options.name,
bundler: 'rollup',
unitTestRunner: 'jest',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { NextApplicationSchema } from '../generators/next-application/next-application-schema'

export type NormalizedNextApplicationSchema = Required<NextApplicationSchema>
export type NormalizedNextApplicationSchema = Required<NextApplicationSchema> & {
directory: string
}

export type NextApplicationUi = NextApplicationSchema['ui']
export function normalizeNextApplicationSchema(options: NextApplicationSchema): NormalizedNextApplicationSchema {
const webName = options.webName ?? options.name
return {
...options,
anchor: options.anchor,
anchorName: options.anchorName ?? 'anchor',
directory: webName,
port: options.port ?? 3000,
skipFormat: options.skipFormat ?? false,
ui: options.ui ?? 'tailwind',
webName: options.webName ?? options.name,
webName,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { NormalizedReactApplicationSchema } from './normalize-react-application-
export async function generateReactApplication(tree: Tree, options: NormalizedReactApplicationSchema) {
await reactApplicationGenerator(tree, {
name: options.webName,
directory: options.directory,
style: 'css',
skipFormat: options.skipFormat,
projectNameAndRootFormat: 'as-provided',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { ReactApplicationSchema } from '../generators/react-application/react-application-schema'

export type NormalizedReactApplicationSchema = Required<ReactApplicationSchema>
export type NormalizedReactApplicationSchema = Required<ReactApplicationSchema> & {
directory: string
}

export type ReactApplicationUi = ReactApplicationSchema['ui']
export function normalizeReactApplicationSchema(options: ReactApplicationSchema): NormalizedReactApplicationSchema {
const webName = options.webName ?? options.name
return {
...options,
anchor: options.anchor,
anchorName: options.anchorName ?? 'anchor',
directory: webName,
port: options.port ?? 3000,
skipFormat: options.skipFormat ?? false,
ui: options.ui ?? 'tailwind',
webName: options.webName ?? options.name,
webName,
}
}

0 comments on commit 5b0f6c8

Please sign in to comment.