-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(svelte): support for projectNameAndRootFormat
- Loading branch information
1 parent
9d8b1cb
commit 8a8f0d9
Showing
14 changed files
with
272 additions
and
88 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
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
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
4 changes: 2 additions & 2 deletions
4
packages/svelte/src/generators/application/application.spec.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
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
45 changes: 45 additions & 0 deletions
45
packages/svelte/src/generators/application/lib/normalize-options.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,45 @@ | ||
import { getWorkspaceLayout, joinPathFragments, names, Tree } from '@nx/devkit'; | ||
import { NormalizedSchema, Schema } from '../schema'; | ||
import { determineProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils'; | ||
|
||
export async function normalizeOptions( | ||
host: Tree, | ||
options: Schema, | ||
callingGenerator = '@nxext/solid:application' | ||
): Promise<NormalizedSchema> { | ||
const { | ||
projectName: appProjectName, | ||
projectRoot, | ||
projectNameAndRootFormat, | ||
} = await determineProjectNameAndRootOptions(host, { | ||
name: options.name, | ||
projectType: 'application', | ||
directory: options.directory, | ||
projectNameAndRootFormat: options.projectNameAndRootFormat, | ||
rootProject: options.rootProject, | ||
callingGenerator, | ||
}); | ||
options.rootProject = projectRoot === '.'; | ||
options.projectNameAndRootFormat = projectNameAndRootFormat; | ||
|
||
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`; | ||
const e2eProjectRoot = options.rootProject ? 'e2e' : `${projectRoot}-e2e`; | ||
|
||
const parsedTags = options.tags | ||
? options.tags.split(',').map((s) => s.trim()) | ||
: []; | ||
|
||
const fileName = 'App'; | ||
|
||
return { | ||
...options, | ||
name: names(options.name).fileName, | ||
projectName: appProjectName, | ||
projectRoot, | ||
e2eProjectName, | ||
e2eProjectRoot, | ||
parsedTags, | ||
fileName, | ||
skipFormat: false, | ||
}; | ||
} |
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
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
43 changes: 43 additions & 0 deletions
43
packages/svelte/src/generators/library/lib/normalize-options.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,43 @@ | ||
import { names, Tree } from '@nx/devkit'; | ||
import { NormalizedSchema, SvelteLibrarySchema } from '../schema'; | ||
import { determineProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils'; | ||
|
||
export async function normalizeOptions( | ||
host: Tree, | ||
options: SvelteLibrarySchema | ||
): Promise<NormalizedSchema> { | ||
const { | ||
projectName, | ||
names: projectNames, | ||
projectRoot, | ||
importPath, | ||
} = await determineProjectNameAndRootOptions(host, { | ||
name: options.name, | ||
projectType: 'library', | ||
directory: options.directory, | ||
importPath: options.importPath, | ||
projectNameAndRootFormat: options.projectNameAndRootFormat, | ||
callingGenerator: '@nx/react:library', | ||
}); | ||
const name = names(options.name).fileName; | ||
const projectDirectory = options.directory | ||
? `${names(options.directory).fileName}/${name}` | ||
: name; | ||
const fileName = options.simpleName | ||
? projectNames.projectSimpleName | ||
: projectNames.projectFileName; | ||
|
||
const parsedTags = options.tags | ||
? options.tags.split(',').map((s) => s.trim()) | ||
: []; | ||
|
||
return { | ||
...options, | ||
name: projectName, | ||
projectRoot, | ||
parsedTags, | ||
fileName, | ||
projectDirectory, | ||
importPath, | ||
}; | ||
} |
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
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
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
Oops, something went wrong.