Primeiro commit do projeto Angular
This commit is contained in:
node_modules/@schematics/angular/pipe/files/__name@dasherize____typeSeparator__pipe.spec.ts.template
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { <%= classify(name) %>Pipe } from './<%= dasherize(name) %><%= typeSeparator %>pipe';
|
||||
|
||||
describe('<%= classify(name) %>Pipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new <%= classify(name) %>Pipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: '<%= camelize(name) %>',<% if(!standalone) {%>
|
||||
standalone: false,<%}%>
|
||||
})
|
||||
export class <%= classify(name) %>Pipe implements PipeTransform {
|
||||
|
||||
transform(value: unknown, ...args: unknown[]): unknown {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @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.dev/license
|
||||
*/
|
||||
import { RuleFactory } from '@angular-devkit/schematics';
|
||||
import { Schema as PipeOptions } from './schema';
|
||||
declare const pipeSchematic: RuleFactory<PipeOptions>;
|
||||
export default pipeSchematic;
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
"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.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const add_declaration_to_ng_module_1 = require("../utility/add-declaration-to-ng-module");
|
||||
const find_module_1 = require("../utility/find-module");
|
||||
const generate_from_files_1 = require("../utility/generate-from-files");
|
||||
const parse_name_1 = require("../utility/parse-name");
|
||||
const project_1 = require("../utility/project");
|
||||
const validation_1 = require("../utility/validation");
|
||||
const workspace_1 = require("../utility/workspace");
|
||||
const pipeSchematic = (0, project_1.createProjectSchematic)(async (options, { tree }) => {
|
||||
options.path ??= await (0, workspace_1.createDefaultPath)(tree, options.project);
|
||||
options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
|
||||
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
||||
options.name = parsedPath.name;
|
||||
options.path = parsedPath.path;
|
||||
(0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
|
||||
return (0, schematics_1.chain)([
|
||||
(0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
|
||||
type: 'pipe',
|
||||
...options,
|
||||
}),
|
||||
(0, generate_from_files_1.generateFromFiles)(options),
|
||||
]);
|
||||
});
|
||||
exports.default = pipeSchematic;
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,2DAAyE;AACzE,0FAAmF;AACnF,wDAA+D;AAC/D,wEAAmE;AACnE,sDAAkD;AAClD,gDAA4D;AAC5D,sDAA0D;AAC1D,oDAAyD;AAGzD,MAAM,aAAa,GAA6B,IAAA,gCAAsB,EACpE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;IAC1B,OAAO,CAAC,IAAI,KAAK,MAAM,IAAA,6BAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,OAAO,CAAC,MAAM,GAAG,IAAA,mCAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,IAAA,sBAAS,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC/B,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC/B,IAAA,8BAAiB,EAAC,oBAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAElD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,uDAAwB,EAAC;YACvB,IAAI,EAAE,MAAM;YACZ,GAAG,OAAO;SACX,CAAC;QACF,IAAA,uCAAiB,EAAC,OAAO,CAAC;KAC3B,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,kBAAe,aAAa,CAAC"}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Creates a new pipe in your project. Pipes are used to transform data for display in
|
||||
* templates. They take input values and apply a specific transformation, such as formatting
|
||||
* dates, currency, or filtering arrays. This schematic generates the necessary files and
|
||||
* boilerplate code for a new pipe.
|
||||
*/
|
||||
export type Schema = {
|
||||
/**
|
||||
* Automatically export the pipe from the specified NgModule, making it accessible to other
|
||||
* modules in the application.
|
||||
*/
|
||||
export?: boolean;
|
||||
/**
|
||||
* Creates the new pipe files at the top level of the current project. If set to false, a
|
||||
* new folder with the pipe's name will be created to contain the files.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* Specify the NgModule where the pipe should be declared. If not provided, the CLI will
|
||||
* attempt to find the closest NgModule in the pipe's path.
|
||||
*/
|
||||
module?: string;
|
||||
/**
|
||||
* The name for the new pipe. This will be used to create the pipe's class and spec files
|
||||
* (e.g., `my-pipe.pipe.ts` and `my-pipe.pipe.spec.ts`).
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The path where the pipe files should be created, relative to the workspace root. If not
|
||||
* provided, the pipe will be created in the current directory.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The name of the project where the pipe should be created. If not specified, the CLI will
|
||||
* determine the project from the current directory.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* Do not automatically import the new pipe into its closest NgModule.
|
||||
*/
|
||||
skipImport?: boolean;
|
||||
/**
|
||||
* Prevent the generation of a unit test file `spec.ts` for the new pipe.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
/**
|
||||
* Generate a standalone pipe. Standalone pipes are self-contained and don't need to be
|
||||
* declared in an NgModule. They can be used independently or imported directly into other
|
||||
* standalone components, directives, or pipes.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
/**
|
||||
* The separator character to use before the type within the generated file's name. For
|
||||
* example, if you set the option to `.`, the file will be named `example.pipe.ts`.
|
||||
*/
|
||||
typeSeparator?: TypeSeparator;
|
||||
};
|
||||
/**
|
||||
* The separator character to use before the type within the generated file's name. For
|
||||
* example, if you set the option to `.`, the file will be named `example.pipe.ts`.
|
||||
*/
|
||||
export declare enum TypeSeparator {
|
||||
Empty = "-",
|
||||
TypeSeparator = "."
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TypeSeparator = void 0;
|
||||
/**
|
||||
* The separator character to use before the type within the generated file's name. For
|
||||
* example, if you set the option to `.`, the file will be named `example.pipe.ts`.
|
||||
*/
|
||||
var TypeSeparator;
|
||||
(function (TypeSeparator) {
|
||||
TypeSeparator["Empty"] = "-";
|
||||
TypeSeparator["TypeSeparator"] = ".";
|
||||
})(TypeSeparator || (exports.TypeSeparator = TypeSeparator = {}));
|
||||
//# sourceMappingURL=schema.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";AACA,mFAAmF;AACnF,oFAAoF;;;AA4DpF;;;GAGG;AACH,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,4BAAW,CAAA;IACX,oCAAmB,CAAA;AACvB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "SchematicsAngularPipe",
|
||||
"title": "Angular Pipe Options Schema",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Creates a new pipe in your project. Pipes are used to transform data for display in templates. They take input values and apply a specific transformation, such as formatting dates, currency, or filtering arrays. This schematic generates the necessary files and boilerplate code for a new pipe.",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name for the new pipe. This will be used to create the pipe's class and spec files (e.g., `my-pipe.pipe.ts` and `my-pipe.pipe.spec.ts`).",
|
||||
"$default": {
|
||||
"$source": "argv",
|
||||
"index": 0
|
||||
},
|
||||
"x-prompt": "What name would you like to use for the pipe?"
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"format": "path",
|
||||
"$default": {
|
||||
"$source": "workingDirectory"
|
||||
},
|
||||
"description": "The path where the pipe files should be created, relative to the workspace root. If not provided, the pipe will be created in the current directory.",
|
||||
"visible": false
|
||||
},
|
||||
"project": {
|
||||
"type": "string",
|
||||
"description": "The name of the project where the pipe should be created. If not specified, the CLI will determine the project from the current directory.",
|
||||
"$default": {
|
||||
"$source": "projectName"
|
||||
}
|
||||
},
|
||||
"flat": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Creates the new pipe files at the top level of the current project. If set to false, a new folder with the pipe's name will be created to contain the files."
|
||||
},
|
||||
"skipTests": {
|
||||
"type": "boolean",
|
||||
"description": "Prevent the generation of a unit test file `spec.ts` for the new pipe.",
|
||||
"default": false
|
||||
},
|
||||
"skipImport": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Do not automatically import the new pipe into its closest NgModule."
|
||||
},
|
||||
"standalone": {
|
||||
"description": "Generate a standalone pipe. Standalone pipes are self-contained and don't need to be declared in an NgModule. They can be used independently or imported directly into other standalone components, directives, or pipes.",
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-user-analytics": "ep.ng_standalone"
|
||||
},
|
||||
"module": {
|
||||
"type": "string",
|
||||
"description": "Specify the NgModule where the pipe should be declared. If not provided, the CLI will attempt to find the closest NgModule in the pipe's path.",
|
||||
"alias": "m"
|
||||
},
|
||||
"export": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Automatically export the pipe from the specified NgModule, making it accessible to other modules in the application."
|
||||
},
|
||||
"typeSeparator": {
|
||||
"type": "string",
|
||||
"default": "-",
|
||||
"enum": ["-", "."],
|
||||
"description": "The separator character to use before the type within the generated file's name. For example, if you set the option to `.`, the file will be named `example.pipe.ts`."
|
||||
}
|
||||
},
|
||||
"required": ["name", "project"]
|
||||
}
|
||||
Reference in New Issue
Block a user