@necord/schematics 1.3.5 → 1.3.7

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Alexey Filippov
3
+ Copyright (c) 2022-2025 Alexey Filippov
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.command = void 0;
3
+ exports.command = command;
4
4
  const common_1 = require("../common");
5
5
  const command_type_enum_1 = require("./command-type.enum");
6
6
  class CommandSchematicFactory extends common_1.CommonSchematicFactory {
@@ -24,4 +24,3 @@ function command(options) {
24
24
  const commandFactory = new CommandSchematicFactory();
25
25
  return commandFactory.create(options);
26
26
  }
27
- exports.command = command;
@@ -28,21 +28,21 @@ class CommonSchematicFactory {
28
28
  }
29
29
  create(options) {
30
30
  options = this.transform(options);
31
- return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_1.mergeWith)(this.generate(options)), this.addDeclarationToModule(options), (0, schematics_2.mergeSourceRoot)(options)]));
31
+ return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_2.mergeSourceRoot)(options), this.addDeclarationToModule(options), (0, schematics_1.mergeWith)(this.generate(options))]));
32
32
  }
33
33
  generate(options) {
34
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, path_1.join)(this.templatePath)), [
35
- options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
36
- (0, schematics_1.applyTemplates)({
37
- ...core_1.strings,
38
- ...options,
39
- lowercase: (str) => str.toLowerCase()
40
- }),
41
- (0, schematics_1.move)(options.path ?? '')
42
- ])(context);
34
+ return (context) => {
35
+ var _a;
36
+ return (0, schematics_1.apply)((0, schematics_1.url)((0, path_1.join)(this.templatePath)), [
37
+ options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
38
+ (0, schematics_1.applyTemplates)(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { lowercase: (str) => str.toLowerCase() })),
39
+ (0, schematics_1.move)((_a = options.path) !== null && _a !== void 0 ? _a : '')
40
+ ])(context);
41
+ };
43
42
  }
44
43
  addDeclarationToModule(options) {
45
44
  return (tree) => {
45
+ var _a;
46
46
  options.module = new schematics_2.ModuleFinder(tree).find({
47
47
  name: options.name,
48
48
  path: options.path
@@ -51,7 +51,7 @@ class CommonSchematicFactory {
51
51
  return tree;
52
52
  }
53
53
  const rawContent = tree.read(options.module);
54
- const content = rawContent?.toString() ?? '';
54
+ const content = (_a = rawContent === null || rawContent === void 0 ? void 0 : rawContent.toString()) !== null && _a !== void 0 ? _a : '';
55
55
  const declarator = new schematics_2.ModuleDeclarator();
56
56
  tree.overwrite(options.module, declarator.declare(content, options));
57
57
  return tree;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.component = void 0;
3
+ exports.component = component;
4
4
  const common_1 = require("../common");
5
5
  const component_type_enum_1 = require("./component-type.enum");
6
6
  class ComponentSchematicFactory extends common_1.CommonSchematicFactory {
@@ -24,4 +24,3 @@ function component(options) {
24
24
  const commandFactory = new ComponentSchematicFactory();
25
25
  return commandFactory.create(options);
26
26
  }
27
- exports.component = component;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.contextMenu = void 0;
3
+ exports.contextMenu = contextMenu;
4
4
  const common_1 = require("../common");
5
5
  const context_menu_type_enum_1 = require("./context-menu-type.enum");
6
6
  class ContextMenuSchematicFactory extends common_1.CommonSchematicFactory {
@@ -24,4 +24,3 @@ function contextMenu(options) {
24
24
  const contextMenuFactory = new ContextMenuSchematicFactory();
25
25
  return contextMenuFactory.create(options);
26
26
  }
27
- exports.contextMenu = contextMenu;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modal = void 0;
3
+ exports.modal = modal;
4
4
  const common_1 = require("../common");
5
5
  class ModalSchematicFactory extends common_1.CommonSchematicFactory {
6
6
  constructor() {
@@ -15,4 +15,3 @@ function modal(options) {
15
15
  const modalFactory = new ModalSchematicFactory();
16
16
  return modalFactory.create(options);
17
17
  }
18
- exports.modal = modal;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@necord/schematics",
3
3
  "description": "A collection of schematics for Necord projects with NestJS",
4
- "version": "1.3.5",
4
+ "version": "1.3.7",
5
5
  "scripts": {
6
- "build": "rimraf -rf dist && tsc -p tsconfig.json",
6
+ "build": "rimraf -rf dist && tsc -p tsconfig.build.json",
7
7
  "postbuild": "npm run copy:collection && npm run copy:lib",
8
8
  "copy:collection": "copyfiles --up 1 src/collection.json dist && copyfiles --up 1 src/**/schema.json dist",
9
9
  "copy:lib": "copyfiles --up 1 src/**/files/**/* dist",
@@ -11,9 +11,9 @@
11
11
  "publish:npm": "release-it",
12
12
  "prepublish:dev": "npm run build",
13
13
  "publish:dev": "npm publish --access public --tag dev",
14
- "prepare": "husky install .github/husky",
14
+ "prepare": "husky",
15
15
  "format": "prettier --write \"src/**/*.ts\"",
16
- "lint": "eslint --ignore-path .gitignore {integration,src}/**/*.ts",
16
+ "lint": "eslint --ignore-pattern .gitignore {integration,src}/**/*.ts",
17
17
  "test": "jest"
18
18
  },
19
19
  "schematics": "./dist/collection.json",
@@ -38,28 +38,30 @@
38
38
  "necord"
39
39
  ],
40
40
  "dependencies": {
41
- "@angular-devkit/core": "16.2.8",
42
- "@angular-devkit/schematics": "16.2.8",
43
- "@nestjs/schematics": "10.0.3",
41
+ "@nestjs/schematics": "11.0.0",
44
42
  "rxjs": "7.8.1"
45
43
  },
46
44
  "devDependencies": {
47
- "@commitlint/cli": "18.2.0",
48
- "@commitlint/config-angular": "18.1.0",
49
- "@types/jest": "29.5.7",
50
- "@types/node": "20.8.10",
51
- "@typescript-eslint/eslint-plugin": "6.9.1",
52
- "@typescript-eslint/parser": "6.9.1",
45
+ "@commitlint/cli": "19.6.1",
46
+ "@commitlint/config-angular": "19.7.0",
47
+ "@eslint/eslintrc": "^3.2.0",
48
+ "@eslint/js": "^9.18.0",
49
+ "@types/jest": "^29.5.14",
50
+ "@types/node": "22.10.7",
53
51
  "copyfiles": "2.4.1",
54
- "eslint": "8.52.0",
55
- "eslint-config-prettier": "9.0.0",
56
- "eslint-plugin-import": "2.29.0",
57
- "husky": "8.0.3",
58
- "prettier": "3.0.3",
59
- "release-it": "16.2.1",
60
- "rimraf": "5.0.5",
61
- "ts-jest": "29.1.1",
62
- "typescript": "5.2.2"
52
+ "eslint": "^9.18.0",
53
+ "eslint-config-prettier": "10.0.1",
54
+ "eslint-plugin-import": "^2.31.0",
55
+ "eslint-plugin-prettier": "^5.2.3",
56
+ "globals": "^15.14.0",
57
+ "husky": "9.1.7",
58
+ "jest": "^29.7.0",
59
+ "prettier": "3.4.2",
60
+ "release-it": "18.1.1",
61
+ "rimraf": "6.0.1",
62
+ "ts-jest": "^29.2.5",
63
+ "typescript": "5.7.3",
64
+ "typescript-eslint": "^8.21.0"
63
65
  },
64
66
  "repository": {
65
67
  "type": "git",
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_test_1 = require("node:test");
4
- const testing_1 = require("@angular-devkit/schematics/testing");
5
- const path_1 = require("path");
6
- const command_type_enum_1 = require("./command-type.enum");
7
- (0, node_test_1.describe)('Command Factory', () => {
8
- const runner = new testing_1.SchematicTestRunner('.', (0, path_1.join)(process.cwd(), 'src/collection.json'));
9
- it('should generate a text command', async () => {
10
- const options = {
11
- name: 'Text',
12
- flat: false,
13
- sourceRoot: '',
14
- spec: false,
15
- strategy: command_type_enum_1.CommandType.TEXT_COMMAND
16
- };
17
- const tree = await runner.runSchematicAsync('command', options).toPromise();
18
- expect(tree.files).toEqual(['/text/text.commands.ts']);
19
- });
20
- it('should generate a slash command', async () => {
21
- const options = {
22
- name: 'Slash',
23
- flat: false,
24
- sourceRoot: '',
25
- spec: false,
26
- strategy: command_type_enum_1.CommandType.SLASH_COMMAND
27
- };
28
- const tree = await runner.runSchematicAsync('command', options).toPromise();
29
- expect(tree.files).toEqual(['/slash/slash.commands.ts']);
30
- });
31
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_test_1 = require("node:test");
4
- const testing_1 = require("@angular-devkit/schematics/testing");
5
- const path_1 = require("path");
6
- const component_type_enum_1 = require("./component-type.enum");
7
- (0, node_test_1.describe)('Component Factory', () => {
8
- const runner = new testing_1.SchematicTestRunner('.', (0, path_1.join)(process.cwd(), 'src/collection.json'));
9
- it('should generate button', async () => {
10
- const options = {
11
- name: 'Button',
12
- flat: false,
13
- sourceRoot: '',
14
- spec: false,
15
- strategy: component_type_enum_1.ComponentType.Button
16
- };
17
- const tree = await runner.runSchematicAsync('component', options).toPromise();
18
- expect(tree.files).toEqual(['/button/button.components.ts']);
19
- });
20
- it('should generate select', async () => {
21
- const options = {
22
- name: 'Select',
23
- flat: false,
24
- sourceRoot: '',
25
- spec: false,
26
- strategy: component_type_enum_1.ComponentType.Select
27
- };
28
- const tree = await runner.runSchematicAsync('component', options).toPromise();
29
- expect(tree.files).toEqual(['/select/select.components.ts']);
30
- });
31
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_test_1 = require("node:test");
4
- const testing_1 = require("@angular-devkit/schematics/testing");
5
- const path_1 = require("path");
6
- const context_menu_type_enum_1 = require("./context-menu-type.enum");
7
- (0, node_test_1.describe)('Context Menu Factory', () => {
8
- const runner = new testing_1.SchematicTestRunner('.', (0, path_1.join)(process.cwd(), 'src/collection.json'));
9
- it('should generate a message context menu', async () => {
10
- const options = {
11
- name: 'Message',
12
- flat: false,
13
- sourceRoot: '',
14
- spec: false,
15
- strategy: context_menu_type_enum_1.ContextMenuType.Message
16
- };
17
- const tree = await runner.runSchematicAsync('context-menu', options).toPromise();
18
- expect(tree.files).toEqual(['/message/message.commands.ts']);
19
- });
20
- it('should generate a user context menu', async () => {
21
- const options = {
22
- name: 'User',
23
- flat: false,
24
- sourceRoot: '',
25
- spec: false,
26
- strategy: context_menu_type_enum_1.ContextMenuType.User
27
- };
28
- const tree = await runner.runSchematicAsync('context-menu', options).toPromise();
29
- expect(tree.files).toEqual(['/user/user.commands.ts']);
30
- });
31
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_test_1 = require("node:test");
4
- const testing_1 = require("@angular-devkit/schematics/testing");
5
- const path_1 = require("path");
6
- (0, node_test_1.describe)('Modal Factory', () => {
7
- const runner = new testing_1.SchematicTestRunner('.', (0, path_1.join)(process.cwd(), 'src/collection.json'));
8
- it('should generate a modal', async () => {
9
- const options = {
10
- name: 'Modal',
11
- flat: false,
12
- sourceRoot: '',
13
- spec: false
14
- };
15
- const tree = await runner.runSchematicAsync('modal', options).toPromise();
16
- expect(tree.files).toEqual(['/modal/modal.modals.ts']);
17
- });
18
- });