Open digitalsadhu opened 5 years ago
We also need to handle fallbacks for ex IE11 here. Do we imagine having references to that in the assets.json
file or do we base that on convention?
I was thinking convention and that the publish command would just automatically create such a bundle as part of the publish process. We could make it a configurable field with a smart default though?
We should by default create integrity hashes and store these in the asset.json file: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
👍
Workflow
Several commands are presented to manipulate global assets and import maps and a publish command is used to publish a podlets assets to the server (making use of globally published assets in the process)
Example:
react
react
at^16
Metafile
The assets.json file.
Each project needs to have an assets.json file to describe various parameters such as org, app and version. An assets.json file might perhaps look something like the following:
global publish
This command takes the name and version of a package on npm, downloads it, creates a bundle of it that is esm compatible if necessary and then uploads it to the cdn
example:
asset-pipe global publish react@16.8.6
After running the above example, an esm compatible version of react 16.8.6 will be available at
/finn/react/16.8.6
global alias|tag
This command configures 302 redirects.
example:
asset-pipe global alias react@16.8.6 ^1
After running the above example,
/finn/react/^1
will redirect to/finn/react/16.8.6
global map
This command can be used to manipulate the global import map file that is used in the publish command (described below)
example:
asset-pipe global map react react@^1
After running the command above, all bare import references to react will point to the CDN at
<cdn>/finn/react/^1
publish
This command can be used to create a local bundle of assets with bare imports replaced based on a global import map file and then uploaded to the cdn
example:
asset-pipe publish
After running the command above, the local assets will be available on the cdn at
<cdn>/finn/<app name>/<version>