-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(preact): repair missing directory prop and align the code to nx20
- Loading branch information
1 parent
9607dc7
commit c1fdefc
Showing
13 changed files
with
195 additions
and
206 deletions.
There are no files selected for viewing
23 changes: 0 additions & 23 deletions
23
packages/preact/src/generators/library/files/eslintrc.js.template
This file was deleted.
Oops, something went wrong.
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
26 changes: 26 additions & 0 deletions
26
packages/preact/src/generators/library/lib/create-files.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,26 @@ | ||
import { | ||
generateFiles, | ||
joinPathFragments, | ||
names, | ||
offsetFromRoot, | ||
Tree, | ||
} from '@nx/devkit'; | ||
import { NormalizedSchema } from '../schema'; | ||
import { useFlatConfig } from '@nx/eslint/src/utils/flat-config'; | ||
|
||
export function createFiles(host: Tree, options: NormalizedSchema) { | ||
generateFiles( | ||
host, | ||
joinPathFragments(__dirname, '..', './files'), | ||
options.projectRoot, | ||
{ | ||
...options, | ||
...names(options.name), | ||
offsetFromRoot: offsetFromRoot(options.projectRoot), | ||
} | ||
); | ||
|
||
if (!options.publishable && !options.buildable) { | ||
host.delete(`${options.projectRoot}/package.json`); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
packages/preact/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 { Tree } from '@nx/devkit'; | ||
import { NormalizedSchema, PreactLibrarySchema } from '../schema'; | ||
import { | ||
determineProjectNameAndRootOptions, | ||
ensureProjectName | ||
} from '@nx/devkit/src/generators/project-name-and-root-utils'; | ||
|
||
export async function normalizeOptions( | ||
tree: Tree, | ||
options: PreactLibrarySchema | ||
): Promise<NormalizedSchema> { | ||
await ensureProjectName(tree, options, 'library'); | ||
const { | ||
projectName, | ||
names: projectNames, | ||
projectRoot, | ||
importPath, | ||
} = await determineProjectNameAndRootOptions(tree, { | ||
name: options.name, | ||
projectType: 'library', | ||
directory: options.directory, | ||
importPath: options.importPath, | ||
rootProject: false, | ||
}); | ||
const fileName = | ||
/* options.simpleName | ||
? projectNames.projectSimpleName | ||
: */ projectNames.projectFileName; | ||
|
||
const parsedTags = options.tags | ||
? options.tags.split(',').map((s) => s.trim()) | ||
: []; | ||
|
||
return { | ||
...options, | ||
projectName, | ||
projectRoot, | ||
parsedTags, | ||
fileName, | ||
projectDirectory: projectRoot, | ||
importPath, | ||
}; | ||
} |
17 changes: 0 additions & 17 deletions
17
packages/preact/src/generators/library/lib/update-jest-config.ts
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
packages/preact/src/generators/library/lib/update-npm-scope.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,18 @@ | ||
import { Tree, updateJson } from '@nx/devkit'; | ||
import { NormalizedSchema } from '../schema'; | ||
|
||
export function updateNpmScopeIfBuildableOrPublishable( | ||
host: Tree, | ||
options: NormalizedSchema | ||
) { | ||
if (options.buildable || options.publishable) { | ||
updateLibPackageNpmScope(host, options); | ||
} | ||
} | ||
|
||
function updateLibPackageNpmScope(host: Tree, options: NormalizedSchema) { | ||
return updateJson(host, `${options.projectRoot}/package.json`, (json) => { | ||
json.name = options.importPath; | ||
return json; | ||
}); | ||
} |
28 changes: 0 additions & 28 deletions
28
packages/preact/src/generators/library/lib/update-tsconfig.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.