@tmdjr/ngx-editor-js2 20.0.8 → 20.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmdjr/ngx-editor-js2",
3
- "version": "20.0.8",
3
+ "version": "20.0.10",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "peerDependencies": {
6
6
  "@angular/animations": "^20.0.4",
@@ -62,6 +62,7 @@ const optionalBlocks = {
62
62
  };
63
63
  function ngAdd(options) {
64
64
  return (tree, context) => __awaiter(this, void 0, void 0, function* () {
65
+ const rules = [];
65
66
  const blocks = options.blocks || [];
66
67
  blocks.forEach((block) => {
67
68
  const { package: pkg, peers } = optionalBlocks[block];
@@ -90,15 +91,14 @@ function ngAdd(options) {
90
91
  updateAppConfig(tree, blocks, context, sourceRoot);
91
92
  addCodeMirrorSetup(tree, blocks, context, sourceRoot);
92
93
  if (options.demo) {
93
- // Add demo files
94
- context.logger.info(' Adding demo AppComponent...');
95
- (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/demo'), [
96
- (0, schematics_1.applyTemplates)({}), // you can pass vars here if you want
97
- (0, schematics_1.move)('src/app'), // adjust this path if needed
98
- ]))(tree, context);
94
+ rules.push((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/demo'), [
95
+ (0, schematics_1.filter)(path => !tree.exists('src/app/' + path.split('/').pop())),
96
+ (0, schematics_1.applyTemplates)({}), // Pass in vars if you want
97
+ (0, schematics_1.move)('src/app'),
98
+ ])));
99
99
  }
100
100
  context.logger.info('✅ Installation setup complete.');
101
- return tree;
101
+ return (0, schematics_1.chain)(rules);
102
102
  });
103
103
  }
104
104
  function updateStylesScss(tree, blocks, context, sourceRoot) {
@@ -1,4 +1,15 @@
1
- import { apply, applyTemplates, mergeWith, move, Rule, SchematicContext, Tree, url } from '@angular-devkit/schematics';
1
+ import {
2
+ apply,
3
+ applyTemplates,
4
+ mergeWith,
5
+ move,
6
+ Rule,
7
+ chain,
8
+ SchematicContext,
9
+ Tree,
10
+ url,
11
+ filter,
12
+ } from '@angular-devkit/schematics';
2
13
  import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
3
14
  import {
4
15
  addPackageJsonDependency,
@@ -63,6 +74,7 @@ const optionalBlocks: Record<
63
74
 
64
75
  export function ngAdd(options: any): Rule {
65
76
  return async (tree: Tree, context: SchematicContext) => {
77
+ const rules: Rule[] = [];
66
78
  const blocks: string[] = options.blocks || [];
67
79
 
68
80
  blocks.forEach((block) => {
@@ -95,18 +107,19 @@ export function ngAdd(options: any): Rule {
95
107
  addCodeMirrorSetup(tree, blocks, context, sourceRoot);
96
108
 
97
109
  if (options.demo) {
98
- // Add demo files
99
- context.logger.info('✨ Adding demo AppComponent...');
100
- mergeWith(
101
- apply(url('./files/demo'), [
102
- applyTemplates({}), // you can pass vars here if you want
103
- move('src/app'), // adjust this path if needed
104
- ])
105
- )(tree, context);
110
+ rules.push(
111
+ mergeWith(
112
+ apply(url('./files/demo'), [
113
+ filter(path => !tree.exists('src/app/' + path.split('/').pop())),
114
+ applyTemplates({}), // Pass in vars if you want
115
+ move('src/app'),
116
+ ])
117
+ )
118
+ );
106
119
  }
107
120
 
108
121
  context.logger.info('✅ Installation setup complete.');
109
- return tree;
122
+ return chain(rules);
110
123
  };
111
124
  }
112
125