Giter Site home page Giter Site logo

imodeljs-samples's Introduction

iTwin.js

Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.

iTwin.js is an open source platform for creating, querying, modifying, and displaying Infrastructure Digital Twins.

If you have questions, or wish to contribute to iTwin.js, see our Contributing guide.

About this Repository

Build status

This repository is a monorepo that holds the source code to multiple iTwin.js npm packages. It is built using Rush.

See rush.json for the complete list of packages and Versioning.md for package and API versioning policies.

Each package has its own node_modules directory that contains symbolic links to common dependencies managed by Rush.

Prerequisites

  • Git
  • Node: an installation of the latest security patch of Node 20. The Node installation also includes the npm package manager.
  • Rush: to install npm install -g @microsoft/rush
  • TypeScript: this is listed as a devDependency, so if you're building it from source, you will get it with rush install.
  • Visual Studio Code: an optional dependency, but the repository structure is optimized for its use

See supported platforms for further information.

Build Instructions

  1. Clone repository (first time) with git clone or pull updates to the repository (subsequent times) with git pull
  2. Install dependencies: rush install
  3. Clean: rush clean
  4. Build source: rush build
  5. Run tests: rush cover

The -v option for rush is short for --verbose which results in a more verbose command.

The above commands iterate and perform their action against each package in the monorepo.

If you get an error similar to the following, it means that the repo has stopped making use of an npm package that was used in the past.

[Error: ENOENT: no such file or directory, stat '/.../itwinjs-core/test-apps/display-test-app/node_modules/@bentley/react-scripts']

To fix this build error, you should completely remove the node_modules directory that is referenced in the error with rush purge, and then rerun rush install.

For incremental builds, the rush build command can be used to only build packages that have changes versus rush rebuild which always rebuilds all packages.

Note: It is a good idea to rush install after each git pull as dependencies may have changed.

Source Code Edit Workflow

  1. Make source code changes on a new Git branch
  2. Ensure unit tests pass when run locally: rush cover
  3. Ensure linting passes when run locally: rush lint
  4. Locally commit changes: git commit (or use the Visual Studio Code user interface)
  5. Repeat steps 1-4 until ready to push changes
  6. Check for API signature changes: rush extract-api. This will update the signature files, located in common/api. Note: before doing this, first do the following:
    • Be sure that your branch is up to date with the target branch (i.e. git merge origin/master)
    • Cleanup your build output: rush clean
    • Rebuild the project: rush build
  7. Review any diffs to the API signature files in the common/api directory to ensure they are compatible with the intended release of the package.
    • If any differences are in packages not modified on this branch, revert the changes before committing.
  8. Add changelog entry (which could potentially cover several commits): rush change
  9. Follow prompts to enter a change description or press ENTER if the change does not warrant a changelog entry. If multiple packages have changed, multiple sets of prompts will be presented. If the changes are only to non-published packages (like display-test-app), then rush change will indicate that a changelog entry is not needed.
  10. Completing the rush change prompts will cause new changelog entry JSON files to be created.
  11. Add and commit the changelog JSON files and any API signature updates.
  12. Publish changes on the branch and open a pull request.

If using the command line, steps 8 through 11 above can be completed in one step by running rushchange.bat from the imodeljs root directory. Only use rushchange.bat if none of the changes require a changelog entry.

Note: The CI build will break if changes are pushed without running rush change and rush extract-api (if the API was changed). The fix will be to complete steps 6 through 11.

Here is a sample changelog to demonstrate the level of detail expected.

Updating dependencies/devDependencies on packages within the monorepo

The version numbers of internal dependencies should not be manually edited. These will be automatically updated by the overall version bump workflow. Note that the packages are published by CI builds only.

Updating dependencies/devDependencies on packages external to monorepo

Use these instructions to update dependencies and devDependencies on external packages (ones that live outside of this monorepo).

  1. Edit the appropriate package.json file to update the semantic version range
  2. Run rush check to make sure that you are specifying consistent versions across the repository
  3. Run rush update to make sure the newer version of the module specified in #1 is installed

Other NPM Scripts

  1. Build TypeDoc documentation for all packages: rush docs
  2. Build TypeDoc documentation for a single package: cd core\backend and then npm run docs

imodeljs-samples's People

Contributors

baoton avatar calebmshafer avatar imodeljs-admin avatar josh-schifter avatar williamkbentley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imodeljs-samples's Issues

Invalid iModelToken for PRC operation request

Hi,
when I try to open the offline iModel, there will be an error message:

image

"imjs_offline_imodel" has been defined in config. json.
"imjs_offline_imodel" : "assets/sample_documents/04_Plant.i.ibim"
How can I solve this?

Regards,

He

How can i connect imodel with Angular app?

I am using angular 7 and tried to convert basic-viewport-app to the angular app. Somehow I'm able to build it. while running the project, I got some errors related to the environment file.

I'm using npm run start:servers to run my project, setup is pretty much the same just I have replaced react with the angular project.

I'm not much familiar with Reactjs to trying to get this sample working in Angular.

If there is some sample app in Angular related to imodeljs, please share the link that can help to resolve my issue.

Error logs:

[email protected] start:servers C:\Users\jay\Documents\workspace\imodeljs-samples\interactive-app\basic-angular-app
env-cmd ./lib/webresources/config.json run-p "start:webserver" "start:backend"

Error: Unable to locate env file at default locations (./.env,./.env.js,./.env.json)
at getEnvFile (C:\Users\jay\Documents\workspace\imodeljs-samples\interactive-app\basic-angular-app\node_modules\env-cmd\dist\get-env-vars.js:34:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start:servers: env-cmd ./lib/webresources/config.json run-p "start:webserver" "start:backend"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start:servers script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jay\AppData\Roaming\npm-cache_logs\2019-12-06T12_36_09_203Z-debug.log

Please help me to resolve this issue.

404 Not Found: @bentley/[email protected]

npm install errors on MacOS 10.14.5 with node 10.15.1.

> node ./installNativePlatform.js

(node:11417) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() to increase limit
npm install --no-save @bentley/[email protected]
/Documents/Hackathons/Infrahack/simple-viewer-app/node_modules/@bentley/imodeljs-native/installNativePlatform.js:40
      throw error;
      ^

Error: Command failed: npm install --no-save @bentley/[email protected]
npm ERR! code E404
npm ERR! 404 Not Found: @bentley/[email protected]

npm ERR! A complete log of this run can be found in:
npm ERR!     /.npm/_logs/2019-05-17T08_55_48_793Z-debug.log

    at ChildProcess.exithandler (child_process.js:294:12)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Socket.stream.socket.on (internal/child_process.js:389:11)
    at Socket.emit (events.js:189:13)
    at Pipe._handle.close (net.js:600:12)

Storing Logger

How we store logger in text file?
Any document/refrences

'localhost:3000 says Project with name "<Name of iModel>" does not exist'

I have the simple viewer app running on localhost. Once I have clicked on 'Open Sample iModel', I get message 'localhost:3000 says Project with name "" does not exist'. I believe its me not setting imjs_test_imodel and imjs_test_project correctly. I've tried a number of times trying different syntax and then rebuilding the app, only to get the same stumbling block. No doubt its me but any advice greatly appreciated. Copy of .env.local below:

-----------------------------------------------------------------------------------------------------------

Project and iModel (REQUIRED)

Must un-comment the lines below and set these variables before testing - create a new project and

iModel with the developer registration procedure here - https://git.io/fx8YP

-----------------------------------------------------------------------------------------------------------

Set this to the name of the sample iModel

imjs_test_imodel="via-model"

(Optional) Set this to the name of the sample project. Defaults to name of the iModel.

imjs_test_project="via-model"

(Optional) Un-comment to use general-purpose-backend. Default value is 0 = local backend

imjs_backend=1

-----------------------------------------------------------------------------------------------------------

Client registration (RECOMMENDED but OPTIONAL)

Must set these variables before deployment, but the supplied defaults can be used for testing on localhost.

Create a client registration using the procedure here - https://git.io/fx8YP (Developer registration). For the purpose

of running this sample on localhost, ensure your registration includes http://localhost:3000/signin-oidc as a

valid redirect URI.

-----------------------------------------------------------------------------------------------------------

Set this to the registered clientId

Note: "imodeljs-spa-samples-2686" is setup to work with the (default) localhost redirect URI below

imjs_browser_test_client_id="imodeljs-spa-samples-2686"

Use this client id when running electron app

imjs_electron_test_client_id="imodeljs-electron-samples"

Set this to be the registered redirect URI

Note: "http://localhost:3000/signin-callback" is setup to work with the (default) web clientId above

imjs_browser_test_redirect_uri="http://localhost:3000/signin-callback.html"

Set this to be the registered post signout redirect URI

imjs_browser_test_post_signout_redirect_uri="http://localhost:3000/"

This redirect uri is set up to be used with the electron clientId above

imjs_electron_test_redirect_uri="http://localhost:3000/signin-callback"

Set this to be the scopes of services the application needs to access

Note: The default value set above ensures the minimal working of the application

imjs_browser_test_scope="openid email profile organization imodelhub context-registry-service:read-only product-settings-service general-purpose-imodeljs-backend imodeljs-router urlps-third-party"

Property imjs_offline_imodel does not exists.

When I open http://localhost:3000/
I see link: Work Offline? having passed on this exile click "Open Sample iModel" button,
have dialog box: "Property imjs_offline_imodel does not exists."

Tell me how to open the model offline? is it possible that the name in my server folder is a file in imodel 2.0 format

Failed node ./common/scripts/install-run-rush update

 WARN  Fetching pkgs.dev.azure.com/@bentley/imodeljs-native/1.14.1 failed!
 ERROR  sha512-Xy+3RJmh+ovq6/ntcf9WEUi8dGExaRf5cdZM4Eo7kPCPARJruw/sQIP/+/N18Y4Kf/o9j+G1VIsZHK3pqMtJPQ== integrity checksum failed when using sha512: wanted sha512-Xy+3RJmh+ovq6/ntcf9WEUi8dGExaRf5cdZM4Eo7kPCPARJruw/sQIP/+/N18Y4Kf/o9j+G1VIsZHK3pqMtJPQ== but got sha512-+yBBlRj6Z1+4AiLsVdK3tkZOSGIVcByMt4Zg4UnlhRNyt1jCpxh3Hjf7V2tJ+p0oAC+qa5rpQMI72FMMWoJ9cQ==. (11214 bytes)

How can I edit the nodes displayed by the Tree component?

I'm trying to work with the tree component of the viewer currently, and there doesn't seem to be a way to selectively edit which nodes are displayed by the rendering function. Even when working with a base Tree rather than a simple tree all the helpful properties are either private or read only. Is there a way to do this with imodeljs/simple viewer app tools, or should I scrap using the Tree format and transition to a different way to display the data altogether?

Firefox sign-in callback issue

I recently deployed an interactive app from the samples repo.
My deployment worked fine in chrome, but firefox was getting stuck in the sign-in callback step:

image

This is because signin-callback.html uses a link rel=”import” that’s not supported in Firefox.

The workaround is the replace the contents of the signin-callback.html with the following:

  <script type="text/javascript" src="v0.0.0/runtime.js"></script>
  <script type="text/javascript" src="v1.9.0/IModelJsLoader.js" data-imjsversions='{"main":"0.0.0","bentleyjs-core":"1.9.0","geometry-core":"1.9.0","imodeljs-clients":"1.9.0","imodeljs-common":"1.9.0","imodeljs-frontend":"1.9.0","imodeljs-i18n":"1.9.0","imodeljs-quantity":"1.9.0","ui-components":"1.9.0","ui-abstract":"1.9.0","ui-core":"1.9.0","presentation-components":"1.9.0","presentation-frontend":"1.9.0","presentation-common":"1.9.0","inspire-tree":"5.0.2","lodash":"4.17.15","react":"16.12.0","react-dnd":"5.0.0","react-dnd-html5-backend":"5.0.1","react-dom":"16.12.0","react-redux":"5.1.2","redux":"4.0.4"}'></script>

A permanent fix is still in the works.

update README.md for imodeljs-samples

Update the README.md file so it does not indicate the user to :
Configure your app using the value you obtained from the registration process. In the specific sample subfolder, edit src/config.json to refer to the project.
It should refer to the combined configs (configuration.ts + config.json) under the .env.local in the app root directory.

iModelHub Name for iModel is incorrect

For some reason I need to name my iModel the original name of my project in order for it to work. The project gets renamed to a random string. The Bentley iModel Hub shows the wrong name for the iModel. Naming is inconsistent throughout Projectwise as well.

"imjs_test_project" : "Test Project - 127839040", // Set this to the name of the sample project
"imjs_test_imodel" : "Test Project" // Set this to the name of the sample iModel

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.