Skip to content

Commit

Permalink
fix(schematics): always use / when creating full path
Browse files Browse the repository at this point in the history
Closes #109
  • Loading branch information
vsavkin committed Nov 27, 2017
1 parent 7fd7594 commit 11e6c05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
15 changes: 7 additions & 8 deletions packages/schematics/src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ import {
branchAndMerge,
chain,
externalSchematic,
filter,
MergeStrategy,
mergeWith,
move,
noop,
Rule,
template,
Tree,
url,
MergeStrategy,
filter,
noop
url
} from '@angular-devkit/schematics';
import { Schema } from './schema';
import * as stringUtils from '@schematics/angular/strings';
import { addImportToModule, insert, toFileName } from '@nrwl/schematics';
import * as path from 'path';
import * as ts from 'typescript';
import { addBootstrapToModule } from '@schematics/angular/utility/ast-utils';
import { insertImport } from '@schematics/angular/utility/route-utils';
import { serializeJson, addApp } from '../utility/fileutils';
import { addApp, serializeJson } from '../utility/fileutils';
import { addImportToTestBed } from '../utility/ast-utils';

function addBootstrap(path: string): Rule {
Expand Down Expand Up @@ -143,7 +142,7 @@ export default function(schema: Schema): Rule {
apply(url('./component-files'), [
options.inlineTemplate ? filter(path => !path.endsWith('.html')) : noop(),
template({ ...options, tmpl: '' }),
move(path.join(fullPath(options), 'app'))
move(`${fullPath(options)}/app`)
]),
MergeStrategy.Overwrite
),
Expand All @@ -155,5 +154,5 @@ export default function(schema: Schema): Rule {
}

function fullPath(options: Schema) {
return path.join('apps', options.name, options.sourceDir);
return `apps/${options.name}/${options.sourceDir}`;
}
7 changes: 3 additions & 4 deletions packages/schematics/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ function updateTsLint(schema: Schema): Rule {

export default function(schema: Schema): Rule {
const options = { ...schema, name: toFileName(schema.name) };
const fullPath = path.join('libs', toFileName(options.name), options.sourceDir);
const moduleFileName = `${toFileName(schema.name)}.module`;
const modulePath = path.join(fullPath, `${moduleFileName}.ts`);
const indexFile = path.join('libs', toFileName(options.name), 'index.ts');
const modulePath = `${fullPath(schema)}/${moduleFileName}.ts`;
const indexFile = `libs/${toFileName(options.name)}/index.ts`;

if (schema.routing && schema.nomodule) {
throw new Error(`nomodule and routing cannot be used together`);
Expand Down Expand Up @@ -165,5 +164,5 @@ export default function(schema: Schema): Rule {
}

function fullPath(options: Schema) {
return path.join('libs', options.name, options.sourceDir);
return `libs/${toFileName(options.name)}/${options.sourceDir}`;
}

0 comments on commit 11e6c05

Please sign in to comment.