Browse Source

feat: add separate proxy-index command to schematics

pull/5279/head
Arman Ozak 6 years ago
parent
commit
80a93bfada
  1. 5
      npm/ng-packs/packages/schematics/src/collection.json
  2. 20
      npm/ng-packs/packages/schematics/src/commands/proxy-index/index.ts
  3. 18
      npm/ng-packs/packages/schematics/src/commands/proxy-index/schema.json

5
npm/ng-packs/packages/schematics/src/collection.json

@ -5,6 +5,11 @@
"factory": "./commands/proxy-add",
"schema": "./commands/proxy-add/schema.json"
},
"proxy-index": {
"description": "ABP Proxy Generator Index Schematics",
"factory": "./commands/proxy-index",
"schema": "./commands/proxy-index/schema.json"
},
"proxy-refresh": {
"description": "ABP Proxy Generator Refresh Schematics",
"factory": "./commands/proxy-refresh",

20
npm/ng-packs/packages/schematics/src/commands/proxy-index/index.ts

@ -0,0 +1,20 @@
import { SchematicContext, Tree } from '@angular-devkit/schematics';
import {
buildDefaultPath,
createProxyIndexGenerator,
removeDefaultPlaceholders,
resolveProject,
} from '../../utils';
export default function(schema: { target?: string }) {
const params = removeDefaultPlaceholders(schema);
return async (host: Tree, _context: SchematicContext) => {
const target = await resolveProject(host, params.target!);
const targetPath = buildDefaultPath(target.definition);
const generateIndex = createProxyIndexGenerator(targetPath);
return generateIndex(host);
};
}

18
npm/ng-packs/packages/schematics/src/commands/proxy-index/schema.json

@ -0,0 +1,18 @@
{
"$schema": "http://json-schema.org/schema",
"id": "SchematicsAbpIndexProxy",
"title": "ABP Index Proxy Schema",
"type": "object",
"properties": {
"target": {
"description": "Target Angular project to place the generated code",
"type": "string",
"$default": {
"$source": "argv",
"index": 0
},
"x-prompt": "Plese enter target Angular project to place the generated code. (default: workspace \"defaultProject\")"
}
},
"required": []
}
Loading…
Cancel
Save