@ngrx/schematics
Advanced tools
Comparing version 12.0.0 to 12.1.0
{ | ||
"name": "@ngrx/schematics", | ||
"version": "12.0.0", | ||
"version": "12.1.0", | ||
"description": "NgRx Schematics for Angular", | ||
@@ -5,0 +5,0 @@ "repository": { |
"use strict"; | ||
exports.__esModule = true; | ||
exports.platformVersion = void 0; | ||
exports.platformVersion = '^12.0.0'; | ||
exports.platformVersion = '^12.1.0'; | ||
//# sourceMappingURL=libs-version.js.map |
@@ -15,6 +15,10 @@ "use strict"; | ||
var schematics_1 = require("@angular-devkit/schematics"); | ||
var schematics_core_1 = require("@ngrx/schematics/schematics-core"); | ||
var schematics_core_1 = require("../../schematics-core"); | ||
var strings_1 = require("../../schematics-core/utility/strings"); | ||
function default_1(options) { | ||
return function (host, context) { | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
options.prefix = options.creators | ||
? strings_1.camelize(options.prefix || 'load') | ||
: strings_1.capitalize(options.prefix || 'load'); | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name); | ||
@@ -21,0 +25,0 @@ options.name = parsedPath.name; |
@@ -13,2 +13,3 @@ import { | ||
} from '@ngrx/schematics-core/testing'; | ||
import { capitalize } from '../../schematics-core/utility/strings'; | ||
@@ -22,2 +23,3 @@ describe('Action Schematic', () => { | ||
name: 'foo', | ||
prefix: 'load', | ||
project: 'bar', | ||
@@ -178,2 +180,24 @@ group: false, | ||
}); | ||
it.each(['load', 'delete', 'update'])( | ||
'should create a action with prefix', | ||
async (prefix) => { | ||
const tree = await schematicRunner | ||
.runSchematicAsync( | ||
'action', | ||
{ ...creatorDefaultOptions, prefix: prefix }, | ||
appTree | ||
) | ||
.toPromise(); | ||
const fileContent = tree.readContent( | ||
`${projectPath}/src/app/foo.actions.ts` | ||
); | ||
expect(fileContent).toMatch( | ||
new RegExp(`export const ${prefix}Foos = createAction`) | ||
); | ||
expect(fileContent).toMatch( | ||
new RegExp(`'\\[Foo] ${capitalize(prefix)} Foos'`) | ||
); | ||
} | ||
); | ||
}); | ||
@@ -180,0 +204,0 @@ |
@@ -16,2 +16,8 @@ { | ||
}, | ||
"prefix": { | ||
"description": "The prefix of the action.", | ||
"type": "string", | ||
"default": "load", | ||
"x-prompt": "What should be the prefix of the action?" | ||
}, | ||
"path": { | ||
@@ -18,0 +24,0 @@ "type": "string", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
489911
6692