New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EDTR: TypeScript support. #1838
Conversation
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.
beautiful! love it!
think there's one output config line that looks like it still needs deleting.
going to approve now assuming the above will be fixed
config/webpack.common.js
Outdated
@@ -138,7 +124,6 @@ const config = [ | |||
module: moduleConfigWithJsRules, | |||
output: { | |||
filename: '[name].[chunkhash].dist.js', |
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.
should this be removed too?
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.
Yes, absolutely, thx.
Just heard of TypeScript today, and it sounds like our jam. But let's not forget to document these changes both for our own reference (including the client-side Ludites like me who think we're basically moving back to client-side Java applets), and also for 3rd party devs who may not be familiar with TypeScript or our usage of it. We don't need to give a tutorial on TypeScript of course, but IMO we should state why we're using it, give some links to docs on how to learn more, and make sure someone who's new to TypeScript can still setup EE from source and run it locally. |
Sure, is this location appropriate for this purpose: https://github.com/eventespresso/event-espresso-core/tree/master/docs/AA--Javascript-in-EE ? |
@@ -21,7 +23,7 @@ const DropDownMenu = ( { | |||
tooltipPosition = 'top left', | |||
index = 0, | |||
...otherProps | |||
} ) => { | |||
} : PropTypes.InferProps<typeof DropDownMenu.propTypes> ) => { |
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 going to conflict with my branch that changes the folder structure...
although I might have to rework that branch to avoid having a gazillion broken unit tests { : \
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.
Not a problem.
the power of sublime merge will help me 🛠️
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.
🤘 Yeah I think somewhere in there. But I'm not sure if it's best to add a new file, or new folder of files, or just update existing files. I suppose it kinda depends on the nature of the changes. |
eea5a5f
to
780f060
Compare
0d0fdb1
to
fef3704
Compare
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.
awesome!
think there's one spot that's still referencing the bin
folder that needs to be updated
const enhancedConfig = config | ||
.map( enhance ) | ||
.map( addLoaders ); |
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.
very nice 👍
const common = require( './webpack.common.js' ); | ||
const webpack = require( 'webpack' ); | ||
const miniExtract = require( 'mini-css-extract-plugin' ); | ||
const wpi18nExtractor = require( './bin/i18n-map-extractor.js' ); | ||
const wpi18nExtractor = require( '../bin/i18n-map-extractor.js' ); |
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.
bin
folder got renamed no?
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.
Not yet, I moved only asset-dependency-maps.js
from ./bin
directory for now, because this file was related to webpack configs.
Didn't wanted to pollute PR's diff with too many changes.
If you want, I can move the other files and references from ./bin
to ./config
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.
ahh ok, what you have done is fine.
Ideally we should move all config files into the new config folder you created, but that can happen in another PR.
I don't understand why that bin
folder was created considering it does not contain any binary files !?!?
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.
Maybe bin
from trash bin/can
🤔
## Static type checking with `TypeScript`. | ||
|
||
TypeScript compilation is integrated into build process via webpack, through TS loaders. This means that we don't have to run any additional scripts. By running usual webpack-related scripts all TS compilation will be done automatically. | ||
|
||
Since we already have some codebase written in JS, in `tsconfig.json` the option `allowJs` has been set to `true`. This will enable us to make an incremental adoption of TypeScript. | ||
|
||
Related external reading: | ||
|
||
- [React & Webpack](https://www.typescriptlang.org/docs/handbook/react-&-webpack.html) | ||
- [Migrating from JavaScript](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html) |
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.
good stuff 💯
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.
👌
const ASSETS = 'assets'; | ||
|
||
const assetsManifestOutputPath = path.resolve( ASSETS, 'dist/build-manifest.json' ); | ||
const assetsPath = `./${ ASSETS }/ZZZ/`; |
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.
Added const here for consistency, but I am not 💯 happy with how readability ended :)
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.
oh ha ha ya we don't want to keep that as all of the new EDTR replacement files will still be in /assets/src/
the ZZZ
folder was just a way to keep all of the existing logic untouched and out of the way while we refactor everything
Implements this issue: #1836