Commit Graph

31 Commits

Author SHA1 Message Date
jjspace 09a719b8fb
run prettier v3 2024-09-20 11:24:24 -04:00
Sanjeet Suhag aaf6bd8a5c Adds engine and widgets workspaces 2022-11-01 15:39:57 -04:00
Gabby Getz 16a9c80d41 Fix up build output names and apps 2022-05-27 15:27:47 -04:00
Gabby Getz 355dd42838 Updated build process 2022-05-24 08:54:14 -04:00
Gabby Getz f8c351ddb7 Copy jasmine files 2022-04-14 09:29:00 -04:00
Gabby Getz a0400260ba Add browser runner 2022-04-13 10:24:27 -04:00
Eli Bogomolny 7fa0d1c1ce Delete files 2022-03-09 15:58:41 -05:00
Frederic Junod 241a27edf8 Update prettier to version ^2.1.1 2020-08-28 10:15:42 +02:00
Matthew Amato 2fd0e8f7e4 Format all code with prettier 2020-04-16 20:31:36 -04:00
Matthew Amato 4741df604b Remove import.meta.url usage
import.meta.url is only at stage 3 of the standards and tools like webpack
and babel do not have good support. Not all browser do either.  I ran into
problems just trying to update the cesium-webpack-example because of it
and Edge won't even part JS code with import.meta.url in it.

This PR removes import.meta.url usage and just does a little extra work
so that all of our developer setups properly set CESIUM_BASE_URL. Most ES6
development setups would require setting CESIUM_BASE_URL anyway, so this
doesn't change much of anything for our end users.

Folks using combined versions of Cesium.js are unaffected.

I also tightened up our regex for `getBaseUrlFromCesiumScript` because
Cesium.js is always named Cesium.js if it is available, which wasn't the
case years ago when this code was written.  This should prevent accidental
detection of the wrong script, for example `CesiumViewer.js` would get
selected as a false positive.  This type of check is only valid for
non-ES6 module usage anyway, since there is no `script` tag inserter for
individual ES6 modules.

Fixes #8251 You can now load Cesium Viewer unbuilt in Edge (but it takes
forever)
2019-10-24 13:59:10 -04:00
Matthew Amato aabd27a760 Migrate Cesium to ES6 Modules
See https://github.com/AnalyticalGraphicsInc/cesium/pull/8224 for details.

eslint
There are a handful of new .eslintrc.json files, mostly to identify the files that are still AMD modules (Sandcastle/Workers). These are needed because you can't change the parser type with a comment directive (since the parser is the thing reading the file). We can finally detect unusued modules! So those have all been cleaned up as well.

requirejs -> rollup & clean-css
requirejs, almond, and karma-requirejs have all been removed. We now use rollup for building and minifying (via uglify) JS code and clean-css for css. These changes are fairly straight-forward and just involve calling rollup instead of requirejs in the build process.

Overall build time is significantly faster. CI is ~11 minutes compared to ~17 in master. Running makeZipFile on my machine takes 69 seconds compared to 112 seconds in master. There's probably plenty of room for additional optimization here too.

We wrote an published a small npm module, rollup-plugin-strip-pragma, for stripping the requirejs pragmas we use out of the release builds. This is maintained in the Tools/rollup-plugin-strip-pragma directory.

As for what we produce. The built version of Cesium is now a UMD module. So it should work anywhere that hasn't made the jump to ES6 yet. For users that were already using the "legacy" combined/minified approach, nothing changes.

One awesome thing about roll-up is that it compiles all of the workers at once and automatically detects shared codes and generates separate bundles under the hood. This means the size of our worker modules shrink dramatically and Cesium itself will load them much faster. The total minified/gzipped size of all workers in master is 2.6 MB compared to 225 KB in this branch! This should be most noticeable on demos like Geometry & Appearances which load lots of workers for the various geometry typs.

roll-up is also used to build Cesium Viewer, which is now an ES6 app.

We use clean-css via gulp and it is also a straightforward change from requirejs that requires no special mention.

Workers
While the spec allows for ES6 Web Workers, no browser actually supports them yet. That means we needed a way to get our workers into non-ES6 form. Thankfully, roll-up can generate AMD modules, which means we now have a build step to compile our Worker source code back into AMD and use the existing TaskProcessor to load and execute them. This build step is part of the standard build task and is called createWorkers. During development, these "built" workers are un-optimized so you can still debug them and read the code.

Since there is a build step, that means if you are changing code that affects a worker, you need to re-run build, or you can use the build-watch task to do it automatically.

The ES6 versions of Worker code has moved into Source/WorkersES6 and we build the workers into their "old home" of Source/Workers. cesiumWorkerBootstrapper and transferTypedArrayTest which were already non-AMD ES5 scripts remain living in the Workers directory.

Surprisingly little was changed about TaskProcessor or the worker system in general, especially considering that I thought this would be one of the major hurdles.

ThirdParty
A lot of our ThirdParty either already had a hand-written wrapper for AMD (which I updated to ES6) or had UMD which created problems when importing the same code in both Node and the browser. I basically had to update the wrapper of every third-party library to fix these problems. In some cases I updated the library version itself (Autolinker, topojson). Nothing to be too concerned about, but future clean-up would be using npm versions of these libraries and auto-generating the wrappers as needed so we don't hand-edit things.

Sandcastle
Sandcastle is eternal and manages to live another day in it's ancient requirejs/dojo 1.x form. Sandcastle now automatically uses the ES6 version of Cesium if it is available and fallsback to the ES5 unminified version if it is now. The built version of Sandcastle always uses CesiumUnminified, just like master. This means Sandcastle still works in IE11 if you run the combine step first (or use the relase zip)

Removed Cesium usage from Sandcastle proper, since it wasn't really needed
Generate a VERSION propertyin the gallery index since Cesium is no longer being included.
Remove requirejs from Sandcastle bucket
Update bucket to use the built version of Cesium if it is available by fallbackto the ES6 version during development.
Standalone.html was also updated
There's a bit of room for further clean-up here, but I think this gets us into master. I did not rename bucket-requirejs.html because I'm pretty sure it would break previously shared demos. We can put in some backwards compatible code later on if we want. (But I'd rather just see a full Sandcastle rewrite).

Specs
Specs are now all ES6, except for TestWorkers, which remain standard JS worker modules. This means you can no longer run the unbuilt unit tests in IE11. No changes for Chrome and Firefox.

Since the specs use ES6 modules and built Cesium is an ES5 UMD, I added a build-specs build step which generates a combined ES5 version of the specs which rely on Cesium as a global variable. We then inject these files into jasmine instead of the standard specs and everything works exactly as it did before. SpecRunner.html has been updated to inject the correct version of the script depending on the build/release query parameters.

The Specs must always use Cesium by importing Source/Cesium.js, this is so we can replace it with the built Cesium as describe above.

There's a bunch of room for clean-up here, such as unifying our two copies of jasmine into a single helper file, but I didn't want to start doing that clean-up as part of this already overly big PR. The important thing is that we can still test the built version and still test on IE/Edge as needed.

I also found and fixed two bugs that were causing failing unit tests, one in BingMapsImageryProviderSpec.js (which was overwriting createImage andnot setting it back) and ShadowVolumeAppearance.js (which had a module level caching bug). I think these may have been the cause of random CI failures in master as well, but only time will tell.

For coverage, we had to switch to karma-coverage-istanbul-instrumenter for native ES6 support, but that's it.

Finally, I updated appveryor to build Cesium and run the built tests under IE. We still don't fail the build for IE, but we should probably fix that if we want to keep it going.

NodeJS
When NODE_ENV is production, we now require in the minified CesiumJS directly, which works great because it's now a UMD module. Otherwise, we use the excellant esmpackage to load individual modules, it was a fairly straightforward swap from our old requirejs usage. We could probably drop esm too if we don't care about debugging or if we provie source maps at some point.
2019-10-03 11:51:23 -04:00
Matthew Amato 77d22e0c62 Update AMD loaders
Update `requirejs` from 2.1.9 to 2.1.20.
Update `almond` from 0.2.6 to 0.3.1.
2015-10-22 17:07:26 -04:00
Matthew Amato 72dcba6670 Remove remnants of Chrome Frame
Fixes #3065
2015-10-13 19:58:09 -04:00
Kevin Ring 9c4ed8033e Re-add OpenSans-related stuff. 2015-02-23 11:12:19 +11:00
Kevin Ring 2030cd0a2c Modify jasmine-html rather than supplying our own.
I'm torn on this, but I think it's the right approach.
2015-02-17 16:07:09 +11:00
Kevin Ring 3b18cca078 Don't lose parameters when focusing specs. 2015-02-17 15:52:45 +11:00
Kevin Ring 8368287a02 Add progress bar instead of billions of dots. 2015-02-11 16:59:09 +11:00
Kevin Ring 86ed166917 Remove redundant boot.js. 2015-02-11 16:08:24 +11:00
Kevin Ring 339be2c5e6 Rename SpecRunner-2.1.html to SpecRunner.html. 2015-02-11 16:05:57 +11:00
Scott Hunter b5ed11e863 Hook up pointer events. 2014-11-04 11:21:02 -05:00
Scott Hunter 2990551e08 Update RequireJS to 2.1.9. 2013-10-21 16:51:48 -04:00
Scott Hunter 4b32e4a3b9 Upgrade RequireJS to version 2.1.8, and Almond to 0.2.6. 2013-10-10 16:05:37 -04:00
Patrick Cozzi d0bf42def3 Merge pull request #845 from AnalyticalGraphicsInc/consistentFonts
Fix problems with font-based specs
2013-06-08 03:07:36 -07:00
Scott Hunter 713904bdfb Add a web font to use in specs, "Open Sans". 2013-06-07 16:52:41 -04:00
Scott Hunter f6d2a364af Upgrade RequireJS to version 2.1.6, and Almond to 0.2.5.
Also additionally include the minified version of require.js, useful for future builds.
2013-06-07 11:59:33 -04:00
Scott Hunter c0ab8ca7f1 Update ES5-shim library for running tests in IE. 2013-05-31 19:28:53 -04:00
Scott Hunter 806c01aa9c Upgrade RequireJS to 2.1.2, Almond to 0.2.3.
Minor changes along the way: any comments containing "(c)" or "copyright" are now assumed to be copyright comments and preserved in the minified output, so I changed a few comments that were unintentionally treated that way.  The build now copies the RequireJS optimized worker layer files into the Dojo-built output folder when building CesiumViewer, to reduce the modules requested by RequireJS inside the web worker to 1.  The glslToJavaScript task no longer checks file modification times, so that changing the minification setting now actually has an effect without a clean.
2013-01-03 11:07:39 -05:00
Kristian Calhoun c2a7b72bff Upgrade to Jasmine 1.3.1, report timings for suites and specs. 2012-12-20 13:32:13 -05:00
Kristian Calhoun c8c1b7d869 Merge 'origin/master' 2012-10-31 13:00:35 -04:00
Scott Hunter ed34c3820b Update to RequireJS 1.0.8, which includes UglifyJS 1.2.6 by default, meaning we don't need our own copy, and we don't the special Cesium.build.js to replace the version used, so we can just run r.js directly from Ant. 2012-04-26 16:04:05 -04:00
Scott Hunter c2105b7e72 Reorganize project. Move Cesium up one level, so now the root of the git repository is the root of the source tree, and the root of the Eclipse project. 2012-04-25 10:55:13 -04:00