From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@schematics/angular/application/index.js | 297 +++++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/@schematics/angular/application/index.js (limited to 'sandbox/testAppNevena/Front/node_modules/@schematics/angular/application/index.js') diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/application/index.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/application/index.js new file mode 100644 index 00000000..c4c61b05 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/application/index.js @@ -0,0 +1,297 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("@angular-devkit/core"); +const schematics_1 = require("@angular-devkit/schematics"); +const tasks_1 = require("@angular-devkit/schematics/tasks"); +const dependencies_1 = require("../utility/dependencies"); +const latest_versions_1 = require("../utility/latest-versions"); +const paths_1 = require("../utility/paths"); +const workspace_1 = require("../utility/workspace"); +const workspace_models_1 = require("../utility/workspace-models"); +const schema_1 = require("./schema"); +function addDependenciesToPackageJson(options) { + return (host, context) => { + [ + { + type: dependencies_1.NodeDependencyType.Dev, + name: '@angular/compiler-cli', + version: latest_versions_1.latestVersions.Angular, + }, + { + type: dependencies_1.NodeDependencyType.Dev, + name: '@angular-devkit/build-angular', + version: latest_versions_1.latestVersions.DevkitBuildAngular, + }, + { + type: dependencies_1.NodeDependencyType.Dev, + name: 'typescript', + version: latest_versions_1.latestVersions['typescript'], + }, + ].forEach((dependency) => (0, dependencies_1.addPackageJsonDependency)(host, dependency)); + if (!options.skipInstall) { + context.addTask(new tasks_1.NodePackageInstallTask()); + } + return host; + }; +} +function addAppToWorkspaceFile(options, appDir, folderName) { + var _a, _b; + let projectRoot = appDir; + if (projectRoot) { + projectRoot += '/'; + } + const schematics = {}; + if (options.inlineTemplate || + options.inlineStyle || + options.minimal || + options.style !== schema_1.Style.Css) { + const componentSchematicsOptions = {}; + if ((_a = options.inlineTemplate) !== null && _a !== void 0 ? _a : options.minimal) { + componentSchematicsOptions.inlineTemplate = true; + } + if ((_b = options.inlineStyle) !== null && _b !== void 0 ? _b : options.minimal) { + componentSchematicsOptions.inlineStyle = true; + } + if (options.style && options.style !== schema_1.Style.Css) { + componentSchematicsOptions.style = options.style; + } + schematics['@schematics/angular:component'] = componentSchematicsOptions; + } + if (options.skipTests || options.minimal) { + const schematicsWithTests = [ + 'class', + 'component', + 'directive', + 'guard', + 'interceptor', + 'pipe', + 'resolver', + 'service', + ]; + schematicsWithTests.forEach((type) => { + if (!(`@schematics/angular:${type}` in schematics)) { + schematics[`@schematics/angular:${type}`] = {}; + } + schematics[`@schematics/angular:${type}`].skipTests = true; + }); + } + if (options.strict) { + if (!('@schematics/angular:application' in schematics)) { + schematics['@schematics/angular:application'] = {}; + } + schematics['@schematics/angular:application'].strict = true; + } + const sourceRoot = (0, core_1.join)((0, core_1.normalize)(projectRoot), 'src'); + let budgets = []; + if (options.strict) { + budgets = [ + { + type: 'initial', + maximumWarning: '500kb', + maximumError: '1mb', + }, + { + type: 'anyComponentStyle', + maximumWarning: '2kb', + maximumError: '4kb', + }, + ]; + } + else { + budgets = [ + { + type: 'initial', + maximumWarning: '2mb', + maximumError: '5mb', + }, + { + type: 'anyComponentStyle', + maximumWarning: '6kb', + maximumError: '10kb', + }, + ]; + } + const inlineStyleLanguage = (options === null || options === void 0 ? void 0 : options.style) !== schema_1.Style.Css ? options.style : undefined; + const project = { + root: (0, core_1.normalize)(projectRoot), + sourceRoot, + projectType: workspace_models_1.ProjectType.Application, + prefix: options.prefix || 'app', + schematics, + targets: { + build: { + builder: workspace_models_1.Builders.Browser, + defaultConfiguration: 'production', + options: { + outputPath: `dist/${folderName}`, + index: `${sourceRoot}/index.html`, + main: `${sourceRoot}/main.ts`, + polyfills: `${sourceRoot}/polyfills.ts`, + tsConfig: `${projectRoot}tsconfig.app.json`, + inlineStyleLanguage, + assets: [`${sourceRoot}/favicon.ico`, `${sourceRoot}/assets`], + styles: [`${sourceRoot}/styles.${options.style}`], + scripts: [], + }, + configurations: { + production: { + budgets, + fileReplacements: [ + { + replace: `${sourceRoot}/environments/environment.ts`, + with: `${sourceRoot}/environments/environment.prod.ts`, + }, + ], + outputHashing: 'all', + }, + development: { + buildOptimizer: false, + optimization: false, + vendorChunk: true, + extractLicenses: false, + sourceMap: true, + namedChunks: true, + }, + }, + }, + serve: { + builder: workspace_models_1.Builders.DevServer, + defaultConfiguration: 'development', + options: {}, + configurations: { + production: { + browserTarget: `${options.name}:build:production`, + }, + development: { + browserTarget: `${options.name}:build:development`, + }, + }, + }, + 'extract-i18n': { + builder: workspace_models_1.Builders.ExtractI18n, + options: { + browserTarget: `${options.name}:build`, + }, + }, + test: options.minimal + ? undefined + : { + builder: workspace_models_1.Builders.Karma, + options: { + main: `${sourceRoot}/test.ts`, + polyfills: `${sourceRoot}/polyfills.ts`, + tsConfig: `${projectRoot}tsconfig.spec.json`, + karmaConfig: `${projectRoot}karma.conf.js`, + inlineStyleLanguage, + assets: [`${sourceRoot}/favicon.ico`, `${sourceRoot}/assets`], + styles: [`${sourceRoot}/styles.${options.style}`], + scripts: [], + }, + }, + }, + }; + return (0, workspace_1.updateWorkspace)((workspace) => { + if (workspace.projects.size === 0) { + workspace.extensions.defaultProject = options.name; + } + workspace.projects.add({ + name: options.name, + ...project, + }); + }); +} +function minimalPathFilter(path) { + const toRemoveList = /(test.ts|tsconfig.spec.json|karma.conf.js).template$/; + return !toRemoveList.test(path); +} +function default_1(options) { + return async (host) => { + var _a, _b; + const appRootSelector = `${options.prefix}-root`; + const componentOptions = !options.minimal + ? { + inlineStyle: options.inlineStyle, + inlineTemplate: options.inlineTemplate, + skipTests: options.skipTests, + style: options.style, + viewEncapsulation: options.viewEncapsulation, + } + : { + inlineStyle: (_a = options.inlineStyle) !== null && _a !== void 0 ? _a : true, + inlineTemplate: (_b = options.inlineTemplate) !== null && _b !== void 0 ? _b : true, + skipTests: true, + style: options.style, + viewEncapsulation: options.viewEncapsulation, + }; + const workspace = await (0, workspace_1.getWorkspace)(host); + const newProjectRoot = workspace.extensions.newProjectRoot || ''; + const isRootApp = options.projectRoot !== undefined; + // If scoped project (i.e. "@foo/bar"), convert dir to "foo/bar". + let folderName = options.name.startsWith('@') ? options.name.substr(1) : options.name; + if (/[A-Z]/.test(folderName)) { + folderName = core_1.strings.dasherize(folderName); + } + const appDir = isRootApp + ? (0, core_1.normalize)(options.projectRoot || '') + : (0, core_1.join)((0, core_1.normalize)(newProjectRoot), folderName); + const sourceDir = `${appDir}/src/app`; + return (0, schematics_1.chain)([ + addAppToWorkspaceFile(options, appDir, folderName), + (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [ + options.minimal ? (0, schematics_1.filter)(minimalPathFilter) : (0, schematics_1.noop)(), + (0, schematics_1.applyTemplates)({ + utils: core_1.strings, + ...options, + relativePathToWorkspaceRoot: (0, paths_1.relativePathToWorkspaceRoot)(appDir), + appName: options.name, + isRootApp, + folderName, + }), + (0, schematics_1.move)(appDir), + ]), schematics_1.MergeStrategy.Overwrite), + (0, schematics_1.schematic)('module', { + name: 'app', + commonModule: false, + flat: true, + routing: options.routing, + routingScope: 'Root', + path: sourceDir, + project: options.name, + }), + (0, schematics_1.schematic)('component', { + name: 'app', + selector: appRootSelector, + flat: true, + path: sourceDir, + skipImport: true, + project: options.name, + ...componentOptions, + }), + (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./other-files'), [ + options.strict ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => path !== '/package.json.template'), + componentOptions.inlineTemplate + ? (0, schematics_1.filter)((path) => !path.endsWith('.html.template')) + : (0, schematics_1.noop)(), + componentOptions.skipTests + ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) + : (0, schematics_1.noop)(), + (0, schematics_1.applyTemplates)({ + utils: core_1.strings, + ...options, + selector: appRootSelector, + ...componentOptions, + }), + (0, schematics_1.move)(sourceDir), + ]), schematics_1.MergeStrategy.Overwrite), + options.skipPackageJson ? (0, schematics_1.noop)() : addDependenciesToPackageJson(options), + ]); + }; +} +exports.default = default_1; -- cgit v1.2.3