Skip to content

Commit

Permalink
chore(deps): update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Aug 31, 2020
1 parent 014c4a0 commit 277d5cb
Show file tree
Hide file tree
Showing 5 changed files with 7,147 additions and 4,452 deletions.
12 changes: 6 additions & 6 deletions lib/file-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ class FileUtilities {
// Removes excluded files
_.remove(
files,
file =>
!FileExclusions.every(excludeFile => !_.includes(file, excludeFile))
(file) =>
!FileExclusions.every((excludeFile) => !_.includes(file, excludeFile))
);

return _.map(files, file => {
return _.map(files, (file) => {
let src = path.relative(path.join(templatePath, basePath), file);
const basename = path.basename(src);
const dirname = path.dirname(src);
Expand Down Expand Up @@ -169,7 +169,7 @@ class FileUtilities {
static filterFiles(files, patterns) {
const filter = ignore().add(patterns);
return files.filter(
file => !filter.ignores(path.relative(file.base || '', file.dest))
(file) => !filter.ignores(path.relative(file.base || '', file.dest))
);
}

Expand All @@ -185,14 +185,14 @@ class FileUtilities {
endIndex = actionIndex;
}

return name.substring(prefix.length, endIndex).split('+');
return name.slice(prefix.length, endIndex).split('+');
}

return [];
}

static _checkConditions(conditions, context, rules) {
return conditions.every(condition => {
return conditions.every((condition) => {
if (!rules[condition]) {
throw new Error(`Invalid condition: ${condition}`);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/file-utilities.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('FileUtilities', () => {
const rules = {
a: () => true,
b: () => false,
c: props => props.in
c: (props) => props.in
};

it('should throw if a condition does not exists', () => {
Expand Down
54 changes: 27 additions & 27 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class CoreGenerator extends Generator {
}

return class extends CoreGenerator {
constructor(args, opts) {
super(args, opts, options.options, options.prompts);
constructor(args, generatorOptions) {
super(args, generatorOptions, options.options, options.prompts);
global[SharedStorageKey].instances++;

if (options.type === 'server' || options.type === 'fullstack') {
Expand All @@ -59,7 +59,7 @@ class CoreGenerator extends Generator {
this._prefixRules =
options.prefixRules || CoreGenerator.defaultPrefixRules;

if (opts.tools) {
if (generatorOptions.tools) {
const ignoreFile = path.join(options.baseDir, '.toolsignore');
if (options.toolsFilter) {
// Use filter patterns provided via options
Expand All @@ -71,7 +71,7 @@ class CoreGenerator extends Generator {

// Core methods
const proto = Object.getPrototypeOf(this);
['prompting', 'writing'].forEach(method => {
['prompting', 'writing'].forEach((method) => {
proto[method] = super[method];
});

Expand All @@ -80,9 +80,9 @@ class CoreGenerator extends Generator {
if (generatorBase) {
Object.getOwnPropertyNames(generatorBase.prototype)
.filter(
method => method.charAt(0) !== '_' && method !== 'constructor'
(method) => method.charAt(0) !== '_' && method !== 'constructor'
)
.forEach(method => {
.forEach((method) => {
proto[method] = generatorBase.prototype[method];
});
}
Expand All @@ -96,19 +96,19 @@ class CoreGenerator extends Generator {
*/
static get defaultPrefixRules() {
return {
web: props => props.target.includes('web'),
cordova: props => props.target.includes('cordova'),
electron: props => props.target.includes('electron'),
pwa: props => Boolean(props.pwa),
bootstrap: props => props.ui === 'bootstrap',
ionic: props => props.ui === 'ionic',
material: props => props.ui === 'material',
raw: props => props.ui === 'raw',
universal: props => Boolean(props.universal),
auth: props => Boolean(props.auth),
ios: props => props.mobile && props.mobile.includes('ios'),
android: props => props.mobile && props.mobile.includes('android'),
windows: props => props.mobile && props.mobile.includes('windows')
web: (props) => props.target.includes('web'),
cordova: (props) => props.target.includes('cordova'),
electron: (props) => props.target.includes('electron'),
pwa: (props) => Boolean(props.pwa),
bootstrap: (props) => props.ui === 'bootstrap',
ionic: (props) => props.ui === 'ionic',
material: (props) => props.ui === 'material',
raw: (props) => props.ui === 'raw',
universal: (props) => Boolean(props.universal),
auth: (props) => Boolean(props.auth),
ios: (props) => props.mobile && props.mobile.includes('ios'),
android: (props) => props.mobile && props.mobile.includes('android'),
windows: (props) => props.mobile && props.mobile.includes('windows')
};
}

Expand All @@ -129,8 +129,8 @@ class CoreGenerator extends Generator {
_.defaults(global[SharedStorageKey].props, props);
}

constructor(args, opts, options, prompts) {
super(args, opts);
constructor(args, generatorOptions, options, prompts) {
super(args, generatorOptions);
options = options || [];
prompts = prompts || [];

Expand All @@ -152,7 +152,7 @@ class CoreGenerator extends Generator {
},
{
name: 'packageManager',
type: value => {
type: (value) => {
if (value !== 'yarn' && value !== 'npm') {
console.error(
'Invalid package manager: can be either "yarn" or "npm"'
Expand All @@ -176,7 +176,7 @@ class CoreGenerator extends Generator {
]);

// Add given options
options.forEach(option => {
options.forEach((option) => {
this.option(option.name, {
type:
typeof option.type === 'function' ? option.type : global[option.type],
Expand Down Expand Up @@ -238,7 +238,7 @@ class CoreGenerator extends Generator {
this.props = this.config.get('props') || {};
}

const processProps = props => {
const processProps = (props) => {
props.appName =
this.sharedProps.appName ||
this.props.appName ||
Expand All @@ -258,7 +258,7 @@ class CoreGenerator extends Generator {
try {
const props = require(path.resolve(this.options.automate));
processProps(props);
} catch (error) {
} catch {
this.log(chalk.red(`Error: Cannot load "${this.options.automate}"`));
// eslint-disable-next-line unicorn/no-process-exit
process.exit(-1);
Expand All @@ -271,7 +271,7 @@ class CoreGenerator extends Generator {
}

// Remove prompts for already defined properties
_.remove(this._prompts, p => this.props[p.name] !== undefined);
_.remove(this._prompts, (p) => this.props[p.name] !== undefined);

const props = await this.prompt(this._prompts);
processProps(props);
Expand Down Expand Up @@ -333,7 +333,7 @@ class CoreGenerator extends Generator {
files = FileUtilities.filterFiles(files, this._toolsFilter);
}

files.forEach(file =>
files.forEach((file) =>
FileUtilities.writeFile(this, file, this._prefixRules)
);
}
Expand Down
Loading

0 comments on commit 277d5cb

Please sign in to comment.