jspm / project

Roadmap and management repo for the jspm project
161 stars 8 forks source link

[Generator feature request] Add a `flat` toggle to the UI #317

Open trusktr opened 10 months ago

trusktr commented 10 months ago

The CLI generator can generate a flat import map, but there's no option in the Generator ui at https://generator.jspm.io/#U2VhYGBkDM0rySzJSU1hcMgpzU3VT81JzU3NK3Ew0DM01DMAAFjZa1gjAA.

It would be really useful to have this option in the UI.

guybedford commented 10 months ago

The flatten operation is automatically called on all import maps generated on generator.jspm.io.

trusktr commented 10 months ago

I can't get Generator to generate anything right now for previous versions of Lume that worked before

I was expecting something like this

  {
    "imports": {
      "lume": "https://ga.jspm.io/npm:lume@0.3.0-alpha.28/dist/index.js"
    },
    "scopes": {
      "https://ga.jspm.io/": {
        "@lume/autolayout": "https://ga.jspm.io/npm:@lume/autolayout@0.10.1/dist/AutoLayout.js",
        "@lume/custom-attributes/dist/index.js": "https://ga.jspm.io/npm:@lume/custom-attributes@0.2.1/dist/index.js",
        "@lume/element": "https://ga.jspm.io/npm:@lume/element@0.10.1/dist/index.js",
        // ... etc ...
      }
    }
  }

to come out more like this after flattening:

  {
    "imports": {
      "lume": "https://ga.jspm.io/npm:lume@0.3.0-alpha.28/dist/index.js",
      "@lume/autolayout": "https://ga.jspm.io/npm:@lume/autolayout@0.10.1/dist/AutoLayout.js",
      "@lume/custom-attributes/dist/index.js": "https://ga.jspm.io/npm:@lume/custom-attributes@0.2.1/dist/index.js",
      "@lume/element": "https://ga.jspm.io/npm:@lume/element@0.10.1/dist/index.js",
      // ... etc ...
    },
  }

I'd like the simplest import maps when possible, like a basic one someone would write by hand. It is less cognitive overhead, especially for people new to web development with no experience with build tools or command lines.

I'm trying to make things easy here:

https://docs.lume.io/guide/install/?id=cdn-easiest

guybedford commented 10 months ago

If you really want this, define your dependencies as peerDependencies not dependencies....

trusktr commented 10 months ago

Yeah right! 😆

trusktr commented 10 months ago

For the use case, it was simple to add all the dependencies to the list to flatten it:

https://generator.jspm.io/#U2NhYGDhD80rySzJSU1hcMgpzU3VT81JzU3NK3Ew0DM01DNgSM5JLC6u1C3Oz8lMAYoZA4XAbN2sYgdDPQs9UzSufkZJbg4Ai1Yl4FkA