|
|
@ -1,10 +1,15 @@ |
|
|
const path = require('path'); |
|
|
import path from 'path'; |
|
|
const Generator = require('yeoman-generator'); |
|
|
import Generator from "yeoman-generator"; |
|
|
const mkdirp = require('mkdirp'); |
|
|
import mkdirp from "mkdirp"; |
|
|
|
|
|
import {fileURLToPath} from 'url'; |
|
|
|
|
|
import {capitalize} from "../../helpers.js"; |
|
|
|
|
|
|
|
|
|
|
|
const __filename = fileURLToPath(import.meta.url); |
|
|
|
|
|
const __dirname = path.dirname(__filename); |
|
|
|
|
|
|
|
|
const baseDir = path.join(__dirname, '../../'); |
|
|
const baseDir = path.join(__dirname, '../../'); |
|
|
|
|
|
|
|
|
module.exports = class extends Generator { |
|
|
export default class extends Generator { |
|
|
async prompting() { |
|
|
async prompting() { |
|
|
this.data = await this.prompt([ |
|
|
this.data = await this.prompt([ |
|
|
{ |
|
|
{ |
|
|
@ -143,20 +148,4 @@ module.exports = class extends Generator { |
|
|
data |
|
|
data |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// TODO: Same function is located in "/helpers.js" file. Find a way to remove cjs files.
|
|
|
|
|
|
export function capitalize(str) { |
|
|
|
|
|
if (typeof str !== 'string') { |
|
|
|
|
|
return ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return str |
|
|
|
|
|
.toLowerCase() |
|
|
|
|
|
.split(/[ -_]/g) |
|
|
|
|
|
.filter((word) => !!word) |
|
|
|
|
|
.map((word) => { |
|
|
|
|
|
return word.charAt(0).toUpperCase() + word.slice(1); |
|
|
|
|
|
}) |
|
|
|
|
|
.join(' '); |
|
|
|
|
|
} |
|
|
} |