@ngrx/schematics
Advanced tools
Comparing version 14.0.0-beta.0 to 14.0.0-rc.0
{ | ||
"name": "@ngrx/schematics", | ||
"version": "14.0.0-beta.0", | ||
"version": "14.0.0-rc.0", | ||
"description": "NgRx Schematics for Angular", | ||
@@ -5,0 +5,0 @@ "repository": { |
"use strict"; | ||
exports.__esModule = true; | ||
exports.platformVersion = void 0; | ||
exports.platformVersion = '^14.0.0-beta.0'; | ||
exports.platformVersion = '^14.0.0-rc.0'; | ||
//# sourceMappingURL=libs-version.js.map |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
exports.__esModule = true; | ||
var schematics_1 = require("@angular-devkit/schematics"); | ||
var schematics_core_1 = require("../../schematics-core"); | ||
function updateWorkspaceCli(host, value) { | ||
function updateSchematicCollections(host) { | ||
var workspace = (0, schematics_core_1.getWorkspace)(host); | ||
var path = (0, schematics_core_1.getWorkspacePath)(host); | ||
workspace['cli'] = __assign(__assign({}, workspace['cli']), value); | ||
if (!(workspace['cli'] && workspace['cli']['schematicCollections'])) { | ||
throw new Error('schematicCollections is not defined in the global cli options'); | ||
} | ||
workspace['cli']['schematicCollections'] = __spreadArray(__spreadArray([], __read(workspace['cli']['schematicCollections']), false), [ | ||
'@ngrx/schematics', | ||
], false); | ||
host.overwrite(path, JSON.stringify(workspace, null, 2)); | ||
} | ||
function setAsDefaultSchematics() { | ||
var cli = { | ||
defaultCollection: '@ngrx/schematics' | ||
}; | ||
function updateWorkspaceCli() { | ||
return function (host) { | ||
updateWorkspaceCli(host, cli); | ||
updateSchematicCollections(host); | ||
return host; | ||
}; | ||
} | ||
function default_1(options) { | ||
function default_1() { | ||
return function (host, context) { | ||
return (0, schematics_1.chain)([ | ||
options && options.defaultCollection ? setAsDefaultSchematics() : (0, schematics_1.noop)(), | ||
])(host, context); | ||
return (0, schematics_1.chain)([updateWorkspaceCli()])(host, context); | ||
}; | ||
@@ -37,0 +51,0 @@ } |
@@ -6,12 +6,4 @@ { | ||
"type": "object", | ||
"properties": { | ||
"defaultCollection": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Use @ngrx/schematics as the default collection", | ||
"x-prompt": "Do you want to use @ngrx/schematics as the default collection?", | ||
"alias": "d" | ||
} | ||
}, | ||
"properties": {}, | ||
"required": [] | ||
} |
"use strict"; | ||
exports.__esModule = true; | ||
exports.exportReactiveComponentModule = exports.importReactiveComponentModule = exports.migrateToNgrxPush = void 0; | ||
exports.exportPushModule = exports.importPushModule = exports.migrateToNgrxPush = void 0; | ||
var ts = require("typescript"); | ||
@@ -8,6 +8,6 @@ var schematics_1 = require("@angular-devkit/schematics"); | ||
var ASYNC_REGEXP = /\| {0,}async/g; | ||
var REACTIVE_MODULE = 'ReactiveComponentModule'; | ||
var PUSH_MODULE = 'PushModule'; | ||
var COMPONENT_MODULE = '@ngrx/component'; | ||
var reactiveModuleToFind = function (node) { | ||
return ts.isIdentifier(node) && node.text === REACTIVE_MODULE; | ||
var pushModuleToFind = function (node) { | ||
return ts.isIdentifier(node) && node.text === PUSH_MODULE; | ||
}; | ||
@@ -34,13 +34,13 @@ var ngModulesToFind = function (node) { | ||
exports.migrateToNgrxPush = migrateToNgrxPush; | ||
function importReactiveComponentModule() { | ||
function importPushModule() { | ||
return function (host) { | ||
(0, schematics_core_1.visitTSSourceFiles)(host, function (sourceFile) { | ||
var hasCommonModuleOrBrowserModule = false; | ||
var hasReactiveComponentModule = false; | ||
var hasPushModule = false; | ||
(0, schematics_core_1.visitNgModuleImports)(sourceFile, function (_, importNodes) { | ||
hasCommonModuleOrBrowserModule = importNodes.some(ngModulesToFind); | ||
hasReactiveComponentModule = importNodes.some(reactiveModuleToFind); | ||
hasPushModule = importNodes.some(pushModuleToFind); | ||
}); | ||
if (hasCommonModuleOrBrowserModule && !hasReactiveComponentModule) { | ||
var changes = (0, schematics_core_1.addImportToModule)(sourceFile, sourceFile.fileName, REACTIVE_MODULE, COMPONENT_MODULE); | ||
if (hasCommonModuleOrBrowserModule && !hasPushModule) { | ||
var changes = (0, schematics_core_1.addImportToModule)(sourceFile, sourceFile.fileName, PUSH_MODULE, COMPONENT_MODULE); | ||
(0, schematics_core_1.commitChanges)(host, sourceFile.fileName, changes); | ||
@@ -51,14 +51,14 @@ } | ||
} | ||
exports.importReactiveComponentModule = importReactiveComponentModule; | ||
function exportReactiveComponentModule() { | ||
exports.importPushModule = importPushModule; | ||
function exportPushModule() { | ||
return function (host) { | ||
(0, schematics_core_1.visitTSSourceFiles)(host, function (sourceFile) { | ||
var hasCommonModuleOrBrowserModule = false; | ||
var hasReactiveComponentModule = false; | ||
var hasPushModule = false; | ||
(0, schematics_core_1.visitNgModuleExports)(sourceFile, function (_, exportNodes) { | ||
hasCommonModuleOrBrowserModule = exportNodes.some(ngModulesToFind); | ||
hasReactiveComponentModule = exportNodes.some(reactiveModuleToFind); | ||
hasPushModule = exportNodes.some(pushModuleToFind); | ||
}); | ||
if (hasCommonModuleOrBrowserModule && !hasReactiveComponentModule) { | ||
var changes = (0, schematics_core_1.addExportToModule)(sourceFile, sourceFile.fileName, REACTIVE_MODULE, COMPONENT_MODULE); | ||
if (hasCommonModuleOrBrowserModule && !hasPushModule) { | ||
var changes = (0, schematics_core_1.addExportToModule)(sourceFile, sourceFile.fileName, PUSH_MODULE, COMPONENT_MODULE); | ||
(0, schematics_core_1.commitChanges)(host, sourceFile.fileName, changes); | ||
@@ -69,11 +69,7 @@ } | ||
} | ||
exports.exportReactiveComponentModule = exportReactiveComponentModule; | ||
exports.exportPushModule = exportPushModule; | ||
function default_1() { | ||
return (0, schematics_1.chain)([ | ||
migrateToNgrxPush(), | ||
importReactiveComponentModule(), | ||
exportReactiveComponentModule(), | ||
]); | ||
return (0, schematics_1.chain)([migrateToNgrxPush(), importPushModule(), exportPushModule()]); | ||
} | ||
exports["default"] = default_1; | ||
//# sourceMappingURL=index.js.map |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3712
360626