-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* schematics(feature): support scully.conf.js * schematics(js): add config for projectRoot
- Loading branch information
1 parent
0bf2a11
commit ddfea57
Showing
11 changed files
with
103 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export interface Schema { | ||
name: string; | ||
slug?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export interface Schema { | ||
name: string; | ||
path?: string; | ||
slug?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
interface Data { | ||
name: string; | ||
type: string; | ||
slug: string; | ||
} | ||
|
||
export function addRouteToScullyConfig(scullyConfigJs: string, data: Data) { | ||
const addRoute = `\n '/${data.name}/:${data.slug}': { | ||
type: '${data.type}' | ||
},`; | ||
let output; | ||
if (+scullyConfigJs.search(/routes: \{/g) > 0) { | ||
const position = +scullyConfigJs.search(/routes: \{/g) + 'routes: {'.length; | ||
output = [scullyConfigJs.slice(0, position), addRoute, scullyConfigJs.slice(position)].join(''); | ||
} else if (+scullyConfigJs.search(/routes:\{/g) > 0) { | ||
const position = +scullyConfigJs.search(/routes:\{/g) + 'routes:{'.length; | ||
output = [scullyConfigJs.slice(0, position), addRoute, scullyConfigJs.slice(position)].join(''); | ||
} else { | ||
console.log('Scully can\'t found the scully.config.js'); | ||
return scullyConfigJs; | ||
} | ||
return output; | ||
} | ||
|
||
/* | ||
function needComa(fullText: string, matchs: string[]) { | ||
let matchers = ''; | ||
matchs.forEach((m, i) => { | ||
let pipe = '|'; | ||
if (i === 0 || i === match.length) { | ||
pipe = ''; | ||
} | ||
matchers += `m${pipe}`; | ||
}); | ||
const match = `\(([^()]*(${matchers})[^()]*)\)`; | ||
// @ts-ignore | ||
if (fullText.search(match).toString !== '-1') { | ||
return ','; | ||
} | ||
return ''; | ||
} | ||
*/ |