-
Notifications
You must be signed in to change notification settings - Fork 950
Convert core to use rollup for bundling. #1037
Conversation
Really nice work. Few comments, the biggest one is to export both es5 and es6 code to npm. (see comments below) Reviewed 39 of 40 files at r1. package.json, line 6 at r1 (raw file):
Since we now also export es6, add the "module" and "jsnext:main" fields with the value of "dist/index" (no extension). These fields are used when you export es6 js, while the "main" field is reserved for es5. See /~https://github.com/d3/d3/blob/master/package.json#L21 Also we should produce both es5 and es6 (see other comment in tsconfig.json). We should export es6 in package.json, line 28 at r1 (raw file):
use package.json, line 33 at r1 (raw file):
remove tsify rollup.config.js, line 1 at r1 (raw file):
add license tsconfig.json, line 3 at r1 (raw file):
I think we need to export both es5 and es6, otherwise we require all node users to use typescript or babel in the toolchain. To confirm my worry, do the following exercise: Build the npm package as tgz file and start a new node project with scripts/build-npm.sh, line 23 at r1 (raw file):
double check that scripts/build_and_lint_all, line 33 at r1 (raw file):
Since there are no more subfolders, remove this script entirely and call Comments from Reviewable |
Review status: 35 of 43 files reviewed at latest revision, 7 unresolved discussions, some commit checks pending. package.json, line 6 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Removed ES6 entirely. package.json, line 28 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. package.json, line 33 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. tsconfig.json, line 3 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Now just exporting ES5. Unfortunately rollup needs to use ES2015 in tsconfig as a target, and doesn't allow you to specify a tsconfig. This means this tsconfig relates specifically to rollup, and the tsconfig-package.json refers to the one which we will use to generate the ES5 build. And just to respond to you, what I did was link this package from layers and run all their unit tests. scripts/build-npm.sh, line 23 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Yep double checked that. scripts/build_and_lint_all, line 33 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. Comments from Reviewable |
cc myself. |
Review status: 33 of 43 files reviewed at latest revision, 7 unresolved discussions, some commit checks pending. package.json, line 6 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
I added ES6 back beacuse rollup chokes when dependents are using commonjs modules (from union package I couldn't bundle this). It's now shipping to dist-es6 and I added a "jsnext:main" and "module" field. Rollup now nicely bundles everything. Comments from Reviewable |
Review status: 33 of 43 files reviewed at latest revision, 7 unresolved discussions, all commit checks successful. rollup.config.js, line 1 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. tsconfig.json, line 3 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Shipping es6 again. Default tsconfig is es6, tsconfig-es5 is for the es5 build. Comments from Reviewable |
BREAKING "tfl" => "tf" for es5 bundle users. This change does the following: - Update core version to 0.11.0 which has the es6 build. - Convert to rollup for bundling. Remove browserify. - Use "extend: true" to extend a global "tf" object. There is now no "tfc". - Ship es6 in a dist-es6 folder as well as es5. - Remove models. They don't build anymore nor are they useful. We'll keep the KNN image classifier around and not unit test it just so we have the code. I'll remove this at some point in the future. This PR goes along with: tensorflow/tfjs-core#1037 tensorflow/tfjs#301 I tested with yalc across all packages, and eventually all the way to the mobilenet example in tfjs-example and everything seems to work. Using the bundles I've also used the code on the homepage to train a simple layers model (tested both union and including layers and core independently). Hosted bundles here: https://storage.googleapis.com/dljs-test/rollup/tf.js https://storage.googleapis.com/dljs-test/rollup/tf.min.js https://storage.googleapis.com/dljs-test/rollup/tf-core.js https://storage.googleapis.com/dljs-test/rollup/tf-core.min.js https://storage.googleapis.com/dljs-test/rollup/tf-layers.js https://storage.googleapis.com/dljs-test/rollup/tf-layers.min.js
This change does the following: - Convert to rollup for bundling. Remove browserify. - Use "extend: true" to extend a global "tf" object. There is now no "tfc". - Ship es6 in a dist-es6 folder as well as es5. - Remove models. They don't build anymore nor are they useful. We'll keep the KNN image classifier around and not unit test it just so we have the code. I'll remove this at some point in the future. This PR goes along with: tensorflow/tfjs-layers#191 tensorflow/tfjs-core#1037 I tested with yalc across all packages, and eventually all the way to the mobilenet example in tfjs-example and everything seems to work. Using the bundles I've also used the code on the homepage to train a simple layers model (tested both union and including layers and core independently). Hosted bundles here: https://storage.googleapis.com/dljs-test/rollup/tf.js https://storage.googleapis.com/dljs-test/rollup/tf.min.js https://storage.googleapis.com/dljs-test/rollup/tf-core.js https://storage.googleapis.com/dljs-test/rollup/tf-core.min.js https://storage.googleapis.com/dljs-test/rollup/tf-layers.js https://storage.googleapis.com/dljs-test/rollup/tf-layers.min.js
Before I move forward with this change on the other repos I'd like feedback here.
This change does the following:
This PR goes along with:
tensorflow/tfjs-layers#191
tensorflow/tfjs#301
I tested with yalc across all packages, and eventually all the way to the mobilenet example in tfjs-example and everything seems to work. Using the bundles I've also used the code on the homepage to train a simple layers model (tested both union and including layers and core independently).
Hosted bundles here:
https://storage.googleapis.com/dljs-test/rollup/tf.js
https://storage.googleapis.com/dljs-test/rollup/tf.min.js
https://storage.googleapis.com/dljs-test/rollup/tf-core.js
https://storage.googleapis.com/dljs-test/rollup/tf-core.min.js
https://storage.googleapis.com/dljs-test/rollup/tf-layers.js
https://storage.googleapis.com/dljs-test/rollup/tf-layers.min.js
This change is