-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: New schematics installer mechanism (#15459)
closes #15380
- Loading branch information
Showing
213 changed files
with
7,967 additions
and
4,759 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
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 |
---|---|---|
@@ -1,73 +1,37 @@ | ||
import { | ||
chain, | ||
noop, | ||
Rule, | ||
SchematicContext, | ||
Tree, | ||
} from '@angular-devkit/schematics'; | ||
import { | ||
addLibraryFeature, | ||
addFeatures, | ||
addPackageJsonDependenciesForLibrary, | ||
ASM_MODULE, | ||
ASM_ROOT_MODULE, | ||
CLI_ASM_FEATURE, | ||
analyzeApplication, | ||
analyzeCrossFeatureDependencies, | ||
finalizeInstallation, | ||
LibraryOptions as SpartacusAsmOptions, | ||
readPackageJson, | ||
shouldAddFeature, | ||
SPARTACUS_ASM, | ||
validateSpartacusInstallation, | ||
} from '@spartacus/schematics'; | ||
import { peerDependencies } from '../../package.json'; | ||
import { | ||
ASM_FEATURE_NAME_CONSTANT, | ||
ASM_FOLDER_NAME, | ||
ASM_MODULE_NAME, | ||
ASM_TRANSLATIONS, | ||
ASM_TRANSLATION_CHUNKS_CONFIG, | ||
SPARTACUS_ASM_ASSETS, | ||
SPARTACUS_ASM_ROOT, | ||
SCSS_FILE_NAME, | ||
} from '../constants'; | ||
|
||
export function addAsmFeatures(options: SpartacusAsmOptions): Rule { | ||
return (tree: Tree, _context: SchematicContext): Rule => { | ||
const packageJson = readPackageJson(tree); | ||
validateSpartacusInstallation(packageJson); | ||
|
||
const features = analyzeCrossFeatureDependencies( | ||
options.features as string[] | ||
); | ||
|
||
return chain([ | ||
analyzeApplication(options, features), | ||
|
||
addFeatures(options, features), | ||
addPackageJsonDependenciesForLibrary(peerDependencies, options), | ||
|
||
shouldAddFeature(CLI_ASM_FEATURE, options.features) | ||
? addAsmFeature(options) | ||
: noop(), | ||
finalizeInstallation(options, features), | ||
]); | ||
}; | ||
} | ||
|
||
function addAsmFeature(options: SpartacusAsmOptions): Rule { | ||
return addLibraryFeature(options, { | ||
folderName: ASM_FOLDER_NAME, | ||
moduleName: ASM_MODULE_NAME, | ||
featureModule: { | ||
name: ASM_MODULE, | ||
importPath: SPARTACUS_ASM, | ||
}, | ||
rootModule: { | ||
name: ASM_ROOT_MODULE, | ||
importPath: SPARTACUS_ASM_ROOT, | ||
}, | ||
lazyLoadingChunk: { | ||
moduleSpecifier: SPARTACUS_ASM_ROOT, | ||
namedImports: [ASM_FEATURE_NAME_CONSTANT], | ||
}, | ||
styles: { | ||
scssFileName: SCSS_FILE_NAME, | ||
importStyle: SPARTACUS_ASM, | ||
}, | ||
i18n: { | ||
resources: ASM_TRANSLATIONS, | ||
chunks: ASM_TRANSLATION_CHUNKS_CONFIG, | ||
importPath: SPARTACUS_ASM_ASSETS, | ||
}, | ||
}); | ||
} |
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 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 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
Oops, something went wrong.