@depup/angular-devkit__schematics-cli 21.2.2-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/bin/schematics.d.ts +15 -0
  4. package/bin/schematics.js +513 -0
  5. package/bin/schematics.js.map +1 -0
  6. package/blank/factory.d.ts +10 -0
  7. package/blank/factory.js +83 -0
  8. package/blank/factory.js.map +1 -0
  9. package/blank/project-files/.gitignore.template +19 -0
  10. package/blank/project-files/.npmignore.template +4 -0
  11. package/blank/project-files/README.md +28 -0
  12. package/blank/project-files/package.json +25 -0
  13. package/blank/project-files/src/collection.json +4 -0
  14. package/blank/project-files/tsconfig.json +24 -0
  15. package/blank/schema.d.ts +24 -0
  16. package/blank/schema.js +16 -0
  17. package/blank/schema.js.map +1 -0
  18. package/blank/schema.json +27 -0
  19. package/blank/schematic-files/src/__name@dasherize__/index.ts.template +10 -0
  20. package/blank/schematic-files/src/__name@dasherize__/index_spec.ts.template +14 -0
  21. package/changes.json +10 -0
  22. package/collection.json +14 -0
  23. package/package.json +60 -0
  24. package/schematic/factory.d.ts +10 -0
  25. package/schematic/factory.js +36 -0
  26. package/schematic/factory.js.map +1 -0
  27. package/schematic/files/.gitignore.template +18 -0
  28. package/schematic/files/.npmignore.template +3 -0
  29. package/schematic/files/README.md +28 -0
  30. package/schematic/files/package.json +25 -0
  31. package/schematic/files/src/collection.json +36 -0
  32. package/schematic/files/src/my-full-schematic/files/test2 +6 -0
  33. package/schematic/files/src/my-full-schematic/files/test__INDEX__ +2 -0
  34. package/schematic/files/src/my-full-schematic/index.ts +53 -0
  35. package/schematic/files/src/my-full-schematic/index_spec.ts +24 -0
  36. package/schematic/files/src/my-full-schematic/schema.json +16 -0
  37. package/schematic/files/src/my-other-schematic/index.ts +27 -0
  38. package/schematic/files/src/my-other-schematic/index_spec.ts +14 -0
  39. package/schematic/files/src/my-schematic/index.ts +26 -0
  40. package/schematic/files/src/my-schematic/index_spec.ts +14 -0
  41. package/schematic/files/tsconfig.json +23 -0
  42. package/schematic/schema.d.ts +24 -0
  43. package/schematic/schema.js +16 -0
  44. package/schematic/schema.js.map +1 -0
  45. package/schematic/schema.json +23 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "MyFullSchematicsSchema",
4
+ "title": "My Full Schematics Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "index": {
8
+ "type": "number",
9
+ "default": 1
10
+ },
11
+ "name": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": ["name"]
16
+ }
@@ -0,0 +1,27 @@
1
+ import { Rule, SchematicContext, Tree, chain, schematic } from '@angular-devkit/schematics';
2
+
3
+ // A factory is a RuleFactory. It takes the options that might have been coming from the command
4
+ // line or another schematic. These can be defined in a schema.json, which will validate
5
+ export default function (options: any): Rule {
6
+ // The chain rule allows us to chain multiple rules and apply them one after the other.
7
+ return chain([
8
+ (tree: Tree, context: SchematicContext) => {
9
+ // Show the options for this Schematics.
10
+ context.logger.info('My Other Schematic: ' + JSON.stringify(options));
11
+
12
+ // Create a single file. Since this tree is not branched, we are working in the
13
+ // same staging area as the other schematic, and as such cannot create the same
14
+ // file twice.
15
+ tree.create('hola', 'mundo');
16
+ },
17
+ // The schematic Rule calls the schematic from the same collection, with the options
18
+ // passed in. Please note that if the schematic has a schema, the options will be
19
+ // validated and could throw, e.g. if a required option is missing.
20
+ schematic('my-schematic', { option: true }),
21
+ (tree: Tree) => {
22
+ // But since we're working off the same staging area, we can move the file created
23
+ // by the schematic above.
24
+ tree.rename('hello', 'allo');
25
+ },
26
+ ]);
27
+ }
@@ -0,0 +1,14 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
3
+ import * as path from 'path';
4
+
5
+ const collectionPath = path.join(__dirname, '../collection.json');
6
+
7
+ describe('my-other-schematic', () => {
8
+ it('works', async () => {
9
+ const runner = new SchematicTestRunner('schematics', collectionPath);
10
+ const tree = await runner.runSchematic('my-other-schematic', {}, Tree.empty());
11
+
12
+ expect(tree.files.sort()).toEqual(['/allo', '/hola']);
13
+ });
14
+ });
@@ -0,0 +1,26 @@
1
+ import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2
+
3
+ // You don't have to export the function as default. You can also have more than one rule factory
4
+ // per file.
5
+ export function mySchematic(options: any): Rule {
6
+ return (tree: Tree, context: SchematicContext) => {
7
+ // Show the options for this Schematics.
8
+ // The logging here is at the discretion of the tooling. It can be ignored or only showing
9
+ // info/warnings/errors. If you use console.log() there is not guarantee it will be
10
+ // propagated to a user in any way (for example, an IDE running this schematic might
11
+ // have a logging window but no support for console.log).
12
+ context.logger.info('My Schematic: ' + JSON.stringify(options));
13
+
14
+ // Create a single file. This is the simplest example of transforming the tree.
15
+ // If a file with that name already exists, the generation will NOT fail until the tool
16
+ // is trying to commit this to disk. This is because we allow you to work on what is
17
+ // called a "staging" area, and only finalize those changes when the schematics is
18
+ // done. This allows you to create files without having to verify if they exist
19
+ // already, then rename them later. Templating works in a similar fashion.
20
+ tree.create('hello', 'world');
21
+
22
+ // At the end, you can either return a Tree (that will be used), or an observable of a
23
+ // Tree (if you have some asynchronous tasks).
24
+ return tree;
25
+ };
26
+ }
@@ -0,0 +1,14 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
3
+ import * as path from 'path';
4
+
5
+ const collectionPath = path.join(__dirname, '../collection.json');
6
+
7
+ describe('my-schematic', () => {
8
+ it('works', async () => {
9
+ const runner = new SchematicTestRunner('schematics', collectionPath);
10
+ const tree = await runner.runSchematic('my-schematic', {}, Tree.empty());
11
+
12
+ expect(tree.files).toEqual(['/hello']);
13
+ });
14
+ });
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "tsconfig",
4
+ "lib": ["es2018", "dom"],
5
+ "module": "commonjs",
6
+ "moduleResolution": "node",
7
+ "noEmitOnError": true,
8
+ "noFallthroughCasesInSwitch": true,
9
+ "noImplicitAny": true,
10
+ "noImplicitThis": true,
11
+ "noUnusedParameters": true,
12
+ "noUnusedLocals": true,
13
+ "rootDir": "src/",
14
+ "skipDefaultLibCheck": true,
15
+ "skipLibCheck": true,
16
+ "sourceMap": true,
17
+ "strictNullChecks": true,
18
+ "target": "es6",
19
+ "types": ["jasmine", "node"]
20
+ },
21
+ "include": ["src/**/*"],
22
+ "exclude": ["src/*/files/**/*"]
23
+ }
@@ -0,0 +1,24 @@
1
+ export type Schema = {
2
+ /**
3
+ * Author for the new schematic.
4
+ */
5
+ author?: string;
6
+ /**
7
+ * The package name for the new schematic.
8
+ */
9
+ name: string;
10
+ /**
11
+ * The package manager used to install dependencies.
12
+ */
13
+ packageManager?: PackageManager;
14
+ [property: string]: any;
15
+ };
16
+ /**
17
+ * The package manager used to install dependencies.
18
+ */
19
+ export declare enum PackageManager {
20
+ Bun = "bun",
21
+ Npm = "npm",
22
+ Pnpm = "pnpm",
23
+ Yarn = "yarn"
24
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
3
+ // CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.PackageManager = void 0;
6
+ /**
7
+ * The package manager used to install dependencies.
8
+ */
9
+ var PackageManager;
10
+ (function (PackageManager) {
11
+ PackageManager["Bun"] = "bun";
12
+ PackageManager["Npm"] = "npm";
13
+ PackageManager["Pnpm"] = "pnpm";
14
+ PackageManager["Yarn"] = "yarn";
15
+ })(PackageManager || (exports.PackageManager = PackageManager = {}));
16
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";AACA,mFAAmF;AACnF,oFAAoF;;;AAkBpF;;GAEG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,6BAAW,CAAA;IACX,6BAAW,CAAA;IACX,+BAAa,CAAA;IACb,+BAAa,CAAA;AACjB,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB"}
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "SchematicsSchematicSchema",
4
+ "title": "Schematic Options Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "The package name for the new schematic."
10
+ },
11
+ "author": {
12
+ "type": "string",
13
+ "description": "Author for the new schematic."
14
+ },
15
+ "packageManager": {
16
+ "description": "The package manager used to install dependencies.",
17
+ "type": "string",
18
+ "enum": ["npm", "yarn", "pnpm", "bun"],
19
+ "default": "npm"
20
+ }
21
+ },
22
+ "required": ["name"]
23
+ }