Skip to content
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

chore: update packages #1977

Merged
merged 2 commits into from
Jul 28, 2023
Merged

Conversation

mgermerie
Copy link
Contributor

@mgermerie mgermerie commented Jan 4, 2023

Description

Update the following packages (the checked packages' changelog was watched and eventual new features / breaking changes were applied) :

  • @babel/cli ^7.17.10 → ^7.22.5
  • @babel/plugin-proposal-nullish-coalescing-operator ^7.17.12 → ^7.18.6
  • @babel/plugin-transform-runtime ^7.18.0 → ^7.22.5
  • @babel/preset-env ^7.18.0 → ^7.22.5
  • @babel/register ^7.17.7 → ^7.22.5
  • @loaders.gl/las ^3.2.3 → ^3.4.4
  • @mapbox/mapbox-gl-style-spec ^13.24.0 → ^13.28.0
  • @tmcw/togeojson ^5.1.3 → ^5.6.2
  • babel-loader ^8.2.5 → ^9.1.2
  • babel-plugin-module-resolver ^4.1.0 → ^5.0.0
  • chalk ^5.0.1 → ^5.2.0
  • chart.js ^3.7.1 → ^4.3.0
  • conventional-changelog-cli ^2.2.2 → ^3.0.0
  • core-js ^3.22.6 → ^3.31.0
  • earcut ^2.2.3 → ^2.2.4
  • eslint ^8.16.0 → ^8.41.0
  • eslint-plugin-import ^2.26.0 → ^2.27.5
  • eslint-webpack-plugin ^3.1.1 → ^4.0.1
  • grunt ^1.5.3 → ^1.6.1
  • https-proxy-agent ^5.0.1 → ^7.0.0
  • jsdoc ^3.6.10 → ^4.0.2
  • marked ^4.0.16 → ^5.0.4
  • mocha ^10.0.0 → ^10.2.0
  • proj4 ^2.8.0 → ^2.9.0
  • regenerator-runtime ^0.13.9 → ^0.13.11
  • replace-in-file ^6.3.2 → ^7.0.1
  • shpjs ^4.0.2 → ^4.0.4
  • three 0.146.0 → 0.154.0
  • webpack ^5.72.1 → ^5.87.0
  • webpack-cli ^4.9.2 → ^5.1.4
  • webpack-dev-server ^4.9.0 → ^4.15.1

Updates skipped for now :

  • @tweenjs/tween.js ^18.6.4 → ^20.0.3
  • node-fetch ^2.6.7 → ^3.3.1
  • puppeteer ^19.4.0 → ^20.5.0

TODO :

  • The patching of GLTFLoader has to be updated because of mrdoob/three.js@773bb2e in thee r153. → done in 4fad733
  • THREE.RGBFormat has been deprecated since r137. It was removed in r153 (in mrdoob/three.js@88e8954). It has to be updated in GLTFLoader and in LegacyGLTFLoader (here). → done in 4fad733
  • since mrdoob/three.js@b8e8482 in r149 of three, some properties in camel case need to be replaced with upper case. → done in 4fad733
  • THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry in mrdoob/three.js@5acd8ce. → done in 4fad733
  • https-proxy-agent import has changed and it needs the real URL class, not the mocked one in bootstrap.jsdone in a632611
  • Update DracoLoader files in examples. → need to update gltf folder
  • webpack now displays more errors over the view, including fetch errors. → Changed settings in webpack.config.
  • The imports of Collada loader needs fixing in Collada example : the threejs ColladaLoader only exists in .jsm since r148. → Temporary fix done. Need to find a more suitable solution in the future
  • For some reason, updating puppeteer to 20.5.0 fails. I shall investigate this. → Will do it in another PR.
  • Error when running unit tests whith @twennjs/tween.js import due to tween update. → Will update tween in another PR.

Note :

Changes on threejs renderer output ColorSpace in r152 make some objects appear brighter.

@mgermerie mgermerie marked this pull request as draft January 4, 2023 15:10
@gchoqueux
Copy link
Contributor

@mgermerie beware of node-fetch #1725

Could you check the change logs of dependencies to apply new features in itowns?

@mgermerie
Copy link
Contributor Author

@mgermerie beware of node-fetch #1725

Could you check the change logs of dependencies to apply new features in itowns?

Yep, I'll check that and remove node-fetch update 👍

@mgermerie mgermerie closed this Jun 1, 2023
@mgermerie mgermerie reopened this Jun 1, 2023
@mgermerie mgermerie force-pushed the chore/update-packages branch 15 times, most recently from 760811f to 243d618 Compare June 5, 2023 11:22
@mgermerie mgermerie force-pushed the chore/update-packages branch 3 times, most recently from acc20d6 to 6a3834d Compare June 19, 2023 11:03
@mgermerie mgermerie marked this pull request as ready for review June 19, 2023 11:15
Copy link
Contributor

@jailln jailln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only two minor comments, otherwise it's good for me. Should we open an issue for the two remaining packages?

I have tested the LegacyGLTFLoader with a 3D Tiles that has a gltf in version 1.0 and it works.

@@ -41,7 +41,7 @@ ThreeLoader.getThreeJsLoader = function getThreeJsLoader(format) {
const deferredPromise = defer();
// eslint-disable-next-line no-undef
THREE = itowns.THREE;
loadScriptAsync('https://cdn.rawgit.com/mrdoob/three.js/r' + itowns.THREE.REVISION + '/examples/js/loaders/' + format + 'Loader.js')
loadScriptAsync('https://cdn.rawgit.com/mrdoob/three.js/r147/examples/js/loaders/' + format + 'Loader.js')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment at the beginning of the file explaining that it gets loaders of three version 147 please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you remove the dynamic loading?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because since r147, the examples/js folder is no longer. loaders are now in the form of js modules which can't be loaded that way. I tried to fix this in the Collada example (since it is the only one to use ThreeLoader) but we would need to be able to use import statements inside the examples, which did not work for some reason. I will open an issue on this specific point but as it is only for Collada, I figured we could have this temporary fix just to allow updating three for the moment.

Copy link
Contributor

@gchoqueux gchoqueux Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you use examples/jsm instead of examples/js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Collada loader in jsm uses import statements which cannot be used outside modules. ThreeLoader does not load loaders as modules. ThreeLoader needs to be removed in my opinion, since it is only used to load collada loader in a way that is no longer supported by three (loading js scripts directly). Instead, we could refactor all the examples to use import statement (like what is done here for instance). It would be closer to what users do, since importing iTowns and every other dependency with a <script> tag is not verry npm and webpack friendly. This would however take a bit of time to work on and would further delay threejs update, hence the temporary solution I suggest here.

Copy link
Contributor

@gchoqueux gchoqueux Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this example, bellow, works but it needs to add three when the site is deployed

<script type="importmap">
    {
        "imports": {
            "three": "../node_modules/three/build/three.module.js",
            "three/addons/": "../node_modules/three/examples/jsm/"
        }
    }
</script>

<script type="module">

    import { ColladaLoader } from 'three/addons/loaders/ColladaLoader.js';

    // ---------- CREATE A GlobeView FOR SUPPORTING DATA VISUALIZATION : ----------

    // Define camera initial position
    const placement = {
        coord: new itowns.Coordinates('EPSG:4326', 4.21655, 44.84415),
        range: 500,
        heading: 180,
        tilt: 60,
    };

    // `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
    const viewerDiv = document.getElementById('viewerDiv');

    // Create a GlobeView
    const view = new itowns.GlobeView(viewerDiv, placement);

    // Setup loading screen and debug menu
    setupLoadingScreen(viewerDiv, view);
    const debugMenu = new GuiTools('menuDiv', view);



    // ---------- DISPLAY CONTEXTUAL DATA : ----------

    // Display ortho-images
    itowns.Fetcher.json('./layers/JSONLayers/Ortho.json')
        .then(function _(config) {
            config.source = new itowns.WMTSSource(config.source);
            view.addLayer(
                new itowns.ColorLayer('Ortho', config),
            ).then(debugMenu.addLayerGUI.bind(debugMenu));
        });

    // Display elevation data
    function addElevationLayerFromConfig(config) {
        config.source = new itowns.WMTSSource(config.source);
        view.addLayer(
            new itowns.ElevationLayer(config.id, config),
        ).then(debugMenu.addLayerGUI.bind(debugMenu));
    }
    itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json')
        .then(addElevationLayerFromConfig);
    itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json')
        .then(addElevationLayerFromConfig);

    const loadingManager = new itowns.THREE.LoadingManager();
    const colladaLoader = new ColladaLoader(loadingManager);

    const url = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/models/collada/building.dae';

    const fn = (collada) => {
        const model = collada.scene;

        // building coordinate
        const coord = new itowns.Coordinates(
            'EPSG:4326', 4.2165, 44.844, 1417,
        );

        model.position.copy(coord.as(view.referenceCrs));
        // align up vector with geodesic normal
        model.lookAt(model.position.clone().add(coord.geodesicNormal));
        // user rotate building to align with ortho image
        model.rotateZ(-Math.PI * 0.2);
        model.scale.set(1.2, 1.2, 1.2);

        // update coordinate of the mesh
        model.updateMatrixWorld();

        view.scene.add(model);
        view.notifyChange();
    };

    colladaLoader.load(url, fn);
</script>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the example suggestion. I used it in #2151. As the static import was merged in #2127 and is thus in the master branch, I think we can merge this PR to benefit the packages updates and fix the static import in another PR. WDYT @jailln and @gchoqueux ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok for me

webpack.config.js Show resolved Hide resolved
config/threeExamples.mjs Outdated Show resolved Hide resolved
@@ -41,7 +41,7 @@ ThreeLoader.getThreeJsLoader = function getThreeJsLoader(format) {
const deferredPromise = defer();
// eslint-disable-next-line no-undef
THREE = itowns.THREE;
loadScriptAsync('https://cdn.rawgit.com/mrdoob/three.js/r' + itowns.THREE.REVISION + '/examples/js/loaders/' + format + 'Loader.js')
loadScriptAsync('https://cdn.rawgit.com/mrdoob/three.js/r147/examples/js/loaders/' + format + 'Loader.js')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you remove the dynamic loading?

webpack.config.js Show resolved Hide resolved
@gchoqueux
Copy link
Contributor

@mgermerie Coud you update #1725 with the new issues?

@gchoqueux
Copy link
Contributor

could add HttpsProxyAgent in 2 Source with https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/3DTiles/lyon1_with_surface_type_2018/tileset.json?

There's fetching issue

@jailln jailln mentioned this pull request Jun 29, 2023
@mgermerie
Copy link
Contributor Author

could add HttpsProxyAgent in 2 Source with https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/3DTiles/lyon1_with_surface_type_2018/tileset.json?

There's fetching issue

Do you mean like that : 41be30d ?

@gchoqueux
Copy link
Contributor

Do you mean like that : 41be30d ?

yes

@gchoqueux
Copy link
Contributor

could you update THREE to r154

@mgermerie
Copy link
Contributor Author

could you update THREE to r154

done

@mgermerie mgermerie force-pushed the chore/update-packages branch 7 times, most recently from 3a9ff9a to 3cf0298 Compare July 12, 2023 14:36
@mgermerie mgermerie force-pushed the chore/update-packages branch 2 times, most recently from ab10ff8 to 9476db9 Compare July 20, 2023 09:52
@mgermerie mgermerie force-pushed the chore/update-packages branch 2 times, most recently from d414dba to e611ec2 Compare July 20, 2023 13:25
@mgermerie mgermerie merged commit 85c9b78 into iTowns:master Jul 28, 2023
6 checks passed
@mgermerie mgermerie deleted the chore/update-packages branch July 28, 2023 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants