logo

Thông báo

Icon
Error

Chia sẻ
Tùy chọn
Xem
Xem bài viết cuối
Offline admin  
#1 Đã gửi : 06/06/2017 lúc 01:45:07(UTC)
admin

Danh hiệu: Administration

Chức danh:

Nhóm: Administrators
Gia nhập: 23-07-2013(UTC)
Bài viết: 6,117
Man
Viet Nam
Đến từ: Vietnam

Cảm ơn: 10 lần
Được cảm ơn: 2 lần trong 2 bài viết

Prerequisites:

  • Install Node.js on your system. Building Cesium requires Node 4.x or newer.

Cesium uses npm modules for development, so after syncing, you need to run npm install from the Cesium root directory:

npm install

Once all modules have been installed, run npm run build to actually build the code:

npm run build

Cesium ships with a simple HTTP server for testing, run npm start after building to use it:

npm start

Then browse to http://localhost:8080/. The landing page includes apps and tools commonly used during development, including:

Cesium can be used in two different ways. Cesium can be either a set of modules using Asynchronous Module Definition (AMD), or it can be built as one combined file containing all modules. The basics:

  • npm run build will build AMD Cesium. This also builds Cesium Viewer and Sandcastle.
  • npm run minifyRelease creates the built version of Cesium. This also builds Hello World.

Read the complete list of build scripts below for more details.

By default, the server only allows connections from your local machine. To allow connections from other machines, pass the --public option to npm. Note the extra -- is intentional and required by npm.

npm start -- --public

The development server has a few other options as well, which you can see by pasing the --help parameter:

npm start -- --help

While you can use the editor of your choice to develop Cesium, certain files, such as glsl and new tests, require that the build task be executed in order for the changes to take effect. You can use the build-watch script to have this happen automatically.

Build Scripts

Cesium uses gulp for build tasks, but they are all abstracted away by npm run scripts.

Specify the target(s) at the command line:

npm run [target-name]

Here's the full set of scripts and what they do.

  • Build scripts -- build and package the source code and documentation
    • build - A fast, developer-oriented build that prepares the source tree for use as standard Asynchronous Module Definition (AMD) modules, suitable for running tests and most examples (some Sandcastle examples require running combine). Run this when a GLSL shader is changed since the .glsl file is converted to a .js file with a string for the GLSL source. This runs automatically when saving files in Eclipse.
    • build-watch - A never-ending task that watches your file system for changes to Cesium and runs build on the source code as needed.
    • combine - Runs build, plus the the RequireJS optimizer to combine Cesium and the Almond AMD loader to produce all-in-one files in the Build/Cesium directory that exposes the entire Cesium API attached to a single global Cesium object. This version is useful if you don't want to use the modules directly with a standard AMD loader.
    • minify - Runs combine, plus minifies Cesium.js using UglifyJS2 for a smaller deployable file.
    • combineRelease - Runs combine, plus uses the optimizer to remove debugging code that validates function input and throws DeveloperErrors. The removed sections are marked with //>>includeStart('debug', pragmas.debug);blocks in the code.
    • minifyRelease - Runs minify, and removes debugging code.
    • requirejs - Used internally by the build system and can not be called directly.
    • buildApps - Builds the example applications (such as Cesium Viewer) to produce self-contained, minified, deployable versions in the Build directory.
    • generateDocumentation - Generates HTML documentation in Build/Documentation using JSDoc 3. More details here.
    • release - A full release build that creates a shippable product, including building apps and generating documentation.
    • makeZipFile - Builds a zip file containing all release files. This includes the source tree (suitable for use from an AMD-aware application), plus the combined and minified Cesium.js files, the generated documentation, the test suite, and the example applications (in both built and source form).
  • Utility scripts -- code coverage, static code analysis, and other utilities
    • instrumentForCoverage - Runs JSCoverage on the source tree to allow running tests with coverage information. Use the link in index.html. Currently Windows only.
    • eslint - Runs ESLint, a static code analysis tool, on the entire source tree.
    • eslint-watch - A never-ending task that watches your file system for changes to Cesium and runs ESLint on any changed source files.
    • clean - Removes all generated build artifacts.
    • cloc - Runs CLOC to count the lines of code on the Source and Specs directories. This requires Perl to execute.
    • sortRequires - Alphabetically sorts the list of required modules in every js file. It also makes sure that the top of every source file uses the same formatting.
  • Testing scripts -- build and run the unit tests
    • test - Runs all tests with Karma using the default browser specified in the Karma config file.
    • test-all - Runs all tests with Karma using all browsers installed on the current system.
    • test-non-webgl - Runs only non-WebGL tests.
    • test-webgl - Runs only WebGL tests.
    • test-webgl-stub - Runs all tests using the WebGL stub, which WebGL calls a noop and ignores related test expectations.
    • test-webgl-validation - Runs all tests with Karma and enables low-level WebGL validation.
    • test-release - Runs all tests on the minified release version of built Cesium.
  • Deployment scripts
    • deploy-s3 - Deploys the built cesium files, the npm package, and the zip file to Amazon S3. This requires having credentials set up for the S3 bucket to which you are deploying.
    • deploy-status - Set the deployment statuses in GitHub, for use with Travis.
    • deploy-set-version - Sets the version of package.json, for use with Travis.

Error : 

You can check that by running server with .listen(8081); and then curl http://localhost:8081 from another terminal.

Assuming that your app.js or server.js already contains following:

Mã:
app.configure(function(){
    app.set('port', process.env.PORT || 3000);
    ...
});

=> Set port in file app.js or server.js and rebuild again before starting

Ai đang xem chủ đề này?
OceanSpiders 2.0
Di chuyển  
Bạn không thể tạo chủ đề mới trong diễn đàn này.
Bạn không thể trả lời chủ đề trong diễn đàn này.
Bạn không thể xóa bài của bạn trong diễn đàn này.
Bạn không thể sửa bài của bạn trong diễn đàn này.
Bạn không thể tạo bình chọn trong diễn đàn này.
Bạn không thể bỏ phiếu bình chọn trong diễn đàn này.

| Cung cấp bởi YAF.NET 2.2.4.14 | YAF.NET © 2003-2021, Yet Another Forum.NET
Thời gian xử lý trang này hết 0.323 giây.