diff --git a/libs/vue/src/index.ts b/libs/vue/src/index.ts index e69de29b..1582ca64 100644 --- a/libs/vue/src/index.ts +++ b/libs/vue/src/index.ts @@ -0,0 +1,4 @@ +export { applicationGenerator } from './schematics/application/schematic'; +export { libraryGenerator } from './schematics/library/schematic'; +export { componentGenerator } from './schematics/component/schematic'; +export { vuexGenerator } from './schematics/vuex/schematic'; diff --git a/libs/vue/src/schematics/application/schematic.ts b/libs/vue/src/schematics/application/schematic.ts index c0604338..143369cc 100644 --- a/libs/vue/src/schematics/application/schematic.ts +++ b/libs/vue/src/schematics/application/schematic.ts @@ -29,6 +29,7 @@ import { updateWorkspace, } from '@nrwl/workspace'; import { appsDir } from '@nrwl/workspace/src/utils/ast-utils'; +import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter'; import { ApplicationSchematicSchema } from './schema'; import { checkPeerDeps } from '../../utils'; @@ -303,7 +304,9 @@ function addBabel(options: NormalizedSchema) { ]); } -export default function (options: ApplicationSchematicSchema): Rule { +export function applicationSchematic( + options: ApplicationSchematicSchema +): Rule { return (host: Tree, context: SchematicContext) => { checkPeerDeps(context, options); const normalizedOptions = normalizeOptions(host, options); @@ -385,3 +388,9 @@ export default function (options: ApplicationSchematicSchema): Rule { ]); }; } + +export default applicationSchematic; +export const applicationGenerator = wrapAngularDevkitSchematic( + '@nx-plus/vue', + 'application' +); diff --git a/libs/vue/src/schematics/component/schematic.ts b/libs/vue/src/schematics/component/schematic.ts index a5aed7a9..2f03611d 100644 --- a/libs/vue/src/schematics/component/schematic.ts +++ b/libs/vue/src/schematics/component/schematic.ts @@ -16,6 +16,7 @@ import { toClassName, toFileName, } from '@nrwl/workspace'; +import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter'; import { ComponentSchematicSchema } from './schema'; interface NormalizedSchema extends ComponentSchematicSchema { @@ -55,7 +56,7 @@ function createComponent(options: NormalizedSchema): Rule { ); } -export default function (schema: ComponentSchematicSchema): Rule { +export function componentSchematic(schema: ComponentSchematicSchema): Rule { return (host: Tree) => { const options = normalizeOptions(host, schema); return chain([ @@ -64,3 +65,9 @@ export default function (schema: ComponentSchematicSchema): Rule { ]); }; } + +export default componentSchematic; +export const componentGenerator = wrapAngularDevkitSchematic( + '@nx-plus/vue', + 'component' +); diff --git a/libs/vue/src/schematics/library/schematic.ts b/libs/vue/src/schematics/library/schematic.ts index ff5a23e3..85a074a7 100644 --- a/libs/vue/src/schematics/library/schematic.ts +++ b/libs/vue/src/schematics/library/schematic.ts @@ -31,6 +31,7 @@ import { readJsonInTree, NxJson, } from '@nrwl/workspace'; +import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter'; import { libsDir } from '@nrwl/workspace/src/utils/ast-utils'; import { LibrarySchematicSchema } from './schema'; @@ -309,7 +310,7 @@ function updateTsConfig(options: NormalizedSchema): Rule { ]); } -export default function (options: LibrarySchematicSchema): Rule { +export function librarySchematic(options: LibrarySchematicSchema): Rule { return (host: Tree) => { const normalizedOptions = normalizeOptions(host, options); return chain([ @@ -354,3 +355,9 @@ export default function (options: LibrarySchematicSchema): Rule { ]); }; } + +export default librarySchematic; +export const libraryGenerator = wrapAngularDevkitSchematic( + '@nx-plus/vue', + 'library' +); diff --git a/libs/vue/src/schematics/vuex/schematic.ts b/libs/vue/src/schematics/vuex/schematic.ts index b5e5a16a..592a8297 100644 --- a/libs/vue/src/schematics/vuex/schematic.ts +++ b/libs/vue/src/schematics/vuex/schematic.ts @@ -11,6 +11,7 @@ import { InsertChange, insertImport, } from '@nrwl/workspace/src/utils/ast-utils'; +import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter'; import * as semver from 'semver'; import * as ts from 'typescript'; import { VuexSchematicSchema } from './schema'; @@ -135,7 +136,7 @@ function addStoreToMain(options: VuexSchematicSchema, isVue3: boolean): Rule { }; } -export default function (options: VuexSchematicSchema): Rule { +export function vuexSchematic(options: VuexSchematicSchema): Rule { const vue = loadModule('vue', appRootPath); const isVue3 = semver.major(vue.version) === 3; @@ -146,3 +147,6 @@ export default function (options: VuexSchematicSchema): Rule { formatFiles(options), ]); } + +export default vuexSchematic; +export const vuexGenerator = wrapAngularDevkitSchematic('@nx-plus/vue', 'vuex');