-
-
Notifications
You must be signed in to change notification settings - Fork 236
Consolidate: Pass baseDir & includeDir as options #1225
Conversation
src/plugins/ConsolidatePlugin.ts
Outdated
| this.engine = options.engine; | ||
| this.extension = options.extension || `.${options.engine}`; | ||
| this.useDefault = (options.useDefault !== undefined) ? options.useDefault : true; | ||
| this.basedir = (options.basedir !== undefined) ? options.basedir : file.context.homeDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file variable does not exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nchanged said that it was...
so idk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't initialize it in the constructor. It has to be done on each file
src/plugins/ConsolidatePlugin.ts
Outdated
| this.engine = options.engine; | ||
| this.extension = options.extension || `.${options.engine}`; | ||
| this.useDefault = (options.useDefault !== undefined) ? options.useDefault : true; | ||
| this.basedir = (options.basedir !== undefined) ? options.basedir : file.context.homeDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't initialize it in the constructor. It has to be done on each file
src/plugins/ConsolidatePlugin.ts
Outdated
| filename: 'base', | ||
| basedir: file.context.homeDir, | ||
| includeDir: file.context.homeDir | ||
| filename: 'base' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where did the rest of the options go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was just like useDefault
src/plugins/ConsolidatePlugin.ts
Outdated
| file.contents = await consolidate[this.engine].render(file.contents, { | ||
| cache: false, | ||
| filename: 'base' | ||
| filename: 'base',; basedir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove ; basedir;
src/plugins/ConsolidatePlugin.ts
Outdated
| this.engine = options.engine; | ||
| this.extension = options.extension || `.${options.engine}`; | ||
| this.useDefault = (options.useDefault !== undefined) ? options.useDefault : true; | ||
| this.basedir = (options.basedir !== undefined) ? options.basedir : file.context.homeDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed if you plan on referencing it in transform
src/plugins/ConsolidatePlugin.ts
Outdated
| this.extension = options.extension || `.${options.engine}`; | ||
| this.useDefault = (options.useDefault !== undefined) ? options.useDefault : true; | ||
| this.basedir = (options.basedir !== undefined) ? options.basedir : file.context.homeDir; | ||
| this.includeDir = (options.includeDir !== undefined) ? options.includeDir : file.context.homeDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed if you plan on referencing it in transform
src/plugins/ConsolidatePlugin.ts
Outdated
| filename: 'base' | ||
| filename: 'base',; basedir; | ||
| basedir: (options.basedir !== undefined) ? options.basedir : file.context.homeDir; | ||
| includeDir: (options.includeDir !== undefined) ? options.includeDir : file.context.homeDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options should be this
basedir: (this.basedir !== undefined) ? this.basedir : file.context.homeDir;
same for include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'm tired I didn't sleep I code wrong..
src/plugins/ConsolidatePlugin.ts
Outdated
| filename: 'base', | ||
| basedir: file.context.homeDir, | ||
| includeDir: file.context.homeDir | ||
| basedir: this.basedir || file.context.homeDir, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where do you assign basedir? it's not in the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like its optional so should be fine. I am fussy, could we capitalise the D in basedir as well for consistency 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's capitlise it ! 😄
src/plugins/ConsolidatePlugin.ts
Outdated
| filename: 'base', | ||
| basedir: file.context.homeDir, | ||
| includeDir: file.context.homeDir | ||
| basedir: (this.basedir !== undefined) ? this.basedir : file.context.homeDir, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.baseDir is never defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eh? it is ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it's not
src/plugins/ConsolidatePlugin.ts
Outdated
| filename: 'base', | ||
| basedir: file.context.homeDir, | ||
| includeDir: file.context.homeDir | ||
| basedir: (this.basedir !== undefined) ? this.basedir : file.context.homeDir, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it's not
src/plugins/ConsolidatePlugin.ts
Outdated
| this.engine = options.engine; | ||
| this.extension = options.extension || `.${options.engine}`; | ||
| this.useDefault = (options.useDefault !== undefined) ? options.useDefault : true; | ||
| this.basedir = options.basedir || file.context.homeDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file is undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you reviewed an old commit...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and it's defined.
see here:
fuse-box/src/plugins/ConsolidatePlugin.ts
Line 57 in fc3017e
| basedir: file.context.homeDir, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added tests and everything's fine.
Can you merge it ?
Camelcase is everywhere... right ? 🎨
To make sure everything's okay.
|
Looking good! Can you update the doc please? After that, I will merge it |
|
@nchanged Docs added :) |
Fix issue #1114