diff --git a/schematics/scully/package-lock.json b/schematics/scully/package-lock.json index 1ab33ec32..9fc97afd9 100644 --- a/schematics/scully/package-lock.json +++ b/schematics/scully/package-lock.json @@ -1,6 +1,6 @@ { "name": "@scullyio/init", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/schematics/scully/package.json b/schematics/scully/package.json index 989d2d1ae..d6e866c61 100644 --- a/schematics/scully/package.json +++ b/schematics/scully/package.json @@ -1,6 +1,6 @@ { "name": "@scullyio/init", - "version": "0.0.4", + "version": "0.0.5", "description": "Add scully to your angular app", "repository": { "type": "GIT", diff --git a/schematics/scully/scullyio-init-0.0.5.tgz b/schematics/scully/scullyio-init-0.0.5.tgz new file mode 100644 index 000000000..f59e468d3 Binary files /dev/null and b/schematics/scully/scullyio-init-0.0.5.tgz differ diff --git a/schematics/scully/src/create-markdown/index.ts b/schematics/scully/src/create-markdown/index.ts index 63db1808b..633be8357 100644 --- a/schematics/scully/src/create-markdown/index.ts +++ b/schematics/scully/src/create-markdown/index.ts @@ -8,9 +8,10 @@ export default function(options: MyServiceSchema): Rule { try { options.name = options.name ? options.name : 'blog'; const name = options.name; + const nameD = strings.dasherize(options.name); const date = new Date(); const fullDay = `${date.getMonth() + 1}-${date.getDate()}-${date.getFullYear()}`; - const path = `./${name}/${fullDay}-${name}.md`; + const path = `./${nameD}/${fullDay}-${nameD}.md`; if (!host.exists(path)) { host.create(path, `--- title: This is the ${name} @@ -20,7 +21,7 @@ publish: false # Page ${name} example `); - context.logger.info(`✅ ${fullDay}-${name} file created`); + context.logger.info(`✅ ${fullDay}-${nameD} file created`); } let scullyJson; diff --git a/schematics/scully/src/utils/utils.ts b/schematics/scully/src/utils/utils.ts index 665adcf76..e7469a4f1 100644 --- a/schematics/scully/src/utils/utils.ts +++ b/schematics/scully/src/utils/utils.ts @@ -1,4 +1,5 @@ import {apply, forEach, mergeWith, Rule, SchematicContext, Source, Tree} from '@angular-devkit/schematics'; +import {strings} from '@angular-devkit/core'; interface Data { name: string; @@ -7,10 +8,10 @@ interface Data { } export function addRouteToScullyConfig(scullyConfigJs: string, data: Data) { - const addRoute = `\n '/${data.name}/:${data.slug}': { + const addRoute = `\n '/${strings.dasherize(data.name)}/:${data.slug}': { type: '${data.type}', ${data.slug}: { - folder: "./${data.name}" + folder: "./${strings.dasherize(data.name)}" } },`; let output;