Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit ea7ee43

Browse files
committed
remove skipProvide, comment with todo for module option
1 parent 75480b2 commit ea7ee43

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

packages/schematics/angular/service/index.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,38 @@ import {
2121
} from '@angular-devkit/schematics';
2222
import * as stringUtils from '../strings';
2323

24-
import * as ts from 'typescript';
24+
// import * as ts from 'typescript';
2525
import 'rxjs/add/operator/merge';
26-
import {findModule, buildRelativePath} from '../utility/find-module';
27-
import {addProviderToModule} from '../utility/ast-utils';
28-
import {InsertChange} from '../utility/change';
26+
// import {findModule, buildRelativePath} from '../utility/find-module';
27+
// import {addProviderToModule} from '../utility/ast-utils';
28+
// import {InsertChange} from '../utility/change';
2929

3030
function addProviderToNgModule(options: any): Rule {
3131
return (host: Tree) => {
32-
if (options.skipProvide) {
32+
if (!options.module) {
3333
return host;
3434
}
3535

36-
const modulePath = findModule(host, options.sourceDir + '/' + options.path);
37-
38-
const sourceText = host.read(modulePath) !.toString('utf-8');
39-
const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
40-
41-
const servicePath = `/${options.sourceDir}/${options.path}/`
42-
+ (options.flat ? '' : stringUtils.dasherize(options.name) + '/')
43-
+ stringUtils.dasherize(options.name)
44-
+ '.service';
45-
const relativePath = buildRelativePath(modulePath, servicePath);
46-
const changes = addProviderToModule(source, modulePath,
47-
stringUtils.classify(`${options.name}Service`),
48-
relativePath);
49-
const recorder = host.beginUpdate(modulePath);
50-
for (const change of changes) {
51-
if (change instanceof InsertChange) {
52-
recorder.insertLeft(change.pos, change.toAdd);
53-
}
54-
}
55-
host.commitUpdate(recorder);
36+
// TODO: Add option support for module path
37+
// let modulePath = '';
38+
// const sourceText = host.read(modulePath) !.toString('utf-8');
39+
// const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
40+
//
41+
// const servicePath = `/${options.sourceDir}/${options.path}/`
42+
// + (options.flat ? '' : stringUtils.dasherize(options.name) + '/')
43+
// + stringUtils.dasherize(options.name)
44+
// + '.service';
45+
// const relativePath = buildRelativePath(modulePath, servicePath);
46+
// const changes = addProviderToModule(source, modulePath,
47+
// stringUtils.classify(`${options.name}Service`),
48+
// relativePath);
49+
// const recorder = host.beginUpdate(modulePath);
50+
// for (const change of changes) {
51+
// if (change instanceof InsertChange) {
52+
// recorder.insertLeft(change.pos, change.toAdd);
53+
// }
54+
// }
55+
// host.commitUpdate(recorder);
5656

5757
return host;
5858
};

packages/schematics/angular/service/schema.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
"default": true,
2626
"description": "Specifies if a spec file is generated."
2727
},
28-
"skipProvide": {
29-
"type": "boolean",
30-
"default": false,
31-
"description": "Allows for skipping the module provide."
32-
},
3328
"module": {
3429
"type": "string",
3530
"default": "",

0 commit comments

Comments
 (0)