Skip to content

Commit

Permalink
Remove the code to copy dependencies to dist/data/modules
Browse files Browse the repository at this point in the history
(re: #1482, closes: #1561)

This was added to support running Rapid in a sandox environment, see #1482.
However it made our published package too big, so we need to remove it, see #1561.

I created https://github.com/rapideditor/rapid-standalone
for anyone that actually needs a version of Rapid that works this way.
  • Loading branch information
bhousel committed Sep 16, 2024
1 parent 597d026 commit 4dce34e
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 242 deletions.
30 changes: 28 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ git push origin main
```


### Update and tag `release` branch
### Update `release` branch

The `release` branch checks in the contents of `/dist` too, this makes it suitable for deployment.
It's basically a copy of `main` but with one additional commit appended to it.
Expand All @@ -67,7 +67,8 @@ git commit -m 'Check in build'
git push origin -f release
```

Sanity check:
#### Sanity checks

- At this point, our GitHub deploy action should notice that a commit was pushed to the release branch.
- You can check the status of the action to see where the release got deployed:
https://github.com/facebook/Rapid/actions/workflows/deploy.yml
Expand All @@ -76,6 +77,25 @@ Sanity check:
- If something looks wrong, you can still go back to `main` and push more commits, then remake the `release` branch as above.


#### Dry run

Confirm that publish will work, and that it won't be >150 MB.
If it is too large, the JSDelivr CDN will not serve it. See Rapid#1561

```bash
npm publish --dry-run
```

Typically you should see something like this:
```
npm notice package size: 24.5 MB
npm notice unpacked size: 94.8 MB
```
(someday: can we automate this check?)


#### Tag and Publish

The point of no return, tag and publish:
```bash
git tag "$VERSION"
Expand Down Expand Up @@ -116,6 +136,12 @@ curl 'https://purge.jsdelivr.net/npm/@rapideditor/rapid@2/dist/rapid.js'
curl 'https://purge.jsdelivr.net/npm/@rapideditor/rapid@2/dist/rapid.min.js'
```

### Update rapid-standalone

See https://github.com/rapideditor/rapid-standalone
After publishing a new version of Rapid, you should also refresh and publish a new version of that project too.


### Notify Partners

Notify anyone who uses Rapid that there is a new release.
Expand Down
97 changes: 51 additions & 46 deletions modules/core/AssetSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,17 @@ export class AssetSystem extends AbstractSystem {
this.id = 'assets';
this.dependencies = new Set();

//
// Rapid's asset map contains all of the data files that we may need to load.
// The data files are identified by keys, and are organized by origin.
// 'local' - will only load assets from the local folder.
// 'latest' - may load latest assets from a CDN which match the expected semantic version
// 'local' - will only load assets from the local folder.
//
// Important: To use 'local', you'll need to have installed a version of Rapid
// that has all of these dependencies copied into `/dist/data/modules/`.
// See https://github.com/rapideditor/rapid-standalone if this is what you need.
//
this.sources = {
local: {
'address_formats': 'data/address_formats.min.json',
'imagery': 'data/imagery.min.json',
'intro_graph': 'data/intro_graph.min.json',
'intro_rapid_graph': 'data/intro_rapid_graph.min.json',
'languages': 'data/languages.min.json',
'locales': 'data/locales.min.json',
'phone_formats': 'data/phone_formats.min.json',
'qa_data': 'data/qa_data.min.json',
'shortcuts': 'data/shortcuts.min.json',
'tagging_preset_overrides': 'data/preset_overrides.min.json',
'territory_languages': 'data/territory_languages.min.json',
'wayback': 'data/wayback.min.json',

'mapillary_js': 'data/modules/mapillary-js/mapillary.js', // note no .min
'mapillary_css': 'data/modules/mapillary-js/mapillary.css', // note no .min

'maplibre_js': 'data/modules/maplibre-gl/maplibre-gl.js', // note no .min
'maplibre_css': 'data/modules/maplibre-gl/maplibre-gl.css', // note no .min

'nsi_data': 'data/modules/name-suggestion-index/nsi.min.json',
'nsi_dissolved': 'data/modules/name-suggestion-index/dissolved.min.json',
'nsi_features': 'data/modules/name-suggestion-index/featureCollection.min.json',
'nsi_generics': 'data/modules/name-suggestion-index/genericWords.min.json',
'nsi_presets': 'data/modules/name-suggestion-index/presets/nsi-id-presets.min.json',
'nsi_replacements': 'data/modules/name-suggestion-index/replacements.min.json',
'nsi_trees': 'data/modules/name-suggestion-index/trees.min.json',

'oci_defaults': 'data/modules/osm-community-index/defaults.min.json',
'oci_features': 'data/modules/osm-community-index/featureCollection.min.json',
'oci_resources': 'data/modules/osm-community-index/resources.min.json',

'pannellum_js': 'data/modules/pannellum/pannellum.js', // note no .min
'pannellum_css': 'data/modules/pannellum/pannellum.css', // note no .min

'tagging_deprecated': 'data/modules/id-tagging-schema/deprecated.min.json',
'tagging_discarded': 'data/modules/id-tagging-schema/discarded.min.json',
'tagging_preset_categories': 'data/modules/id-tagging-schema/preset_categories.min.json',
'tagging_preset_defaults': 'data/modules/id-tagging-schema/preset_defaults.min.json',
'tagging_preset_fields': 'data/modules/id-tagging-schema/fields.min.json',
'tagging_preset_presets': 'data/modules/id-tagging-schema/presets.min.json',

'wmf_sitematrix': 'data/modules/wmf-sitematrix/wikipedia.min.json'
},

latest: {
'address_formats': 'data/address_formats.min.json',
'imagery': 'data/imagery.min.json',
Expand Down Expand Up @@ -114,6 +74,51 @@ export class AssetSystem extends AbstractSystem {
'tagging_preset_presets': 'https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@6.6/dist/presets.min.json',

'wmf_sitematrix': 'https://cdn.jsdelivr.net/npm/wmf-sitematrix@0.1/wikipedia.min.json'
},

local: {
'address_formats': 'data/address_formats.min.json',
'imagery': 'data/imagery.min.json',
'intro_graph': 'data/intro_graph.min.json',
'intro_rapid_graph': 'data/intro_rapid_graph.min.json',
'languages': 'data/languages.min.json',
'locales': 'data/locales.min.json',
'phone_formats': 'data/phone_formats.min.json',
'qa_data': 'data/qa_data.min.json',
'shortcuts': 'data/shortcuts.min.json',
'tagging_preset_overrides': 'data/preset_overrides.min.json',
'territory_languages': 'data/territory_languages.min.json',
'wayback': 'data/wayback.min.json',

'mapillary_js': 'data/modules/mapillary-js/mapillary.js', // note no .min
'mapillary_css': 'data/modules/mapillary-js/mapillary.css', // note no .min

'maplibre_js': 'data/modules/maplibre-gl/maplibre-gl.js', // note no .min
'maplibre_css': 'data/modules/maplibre-gl/maplibre-gl.css', // note no .min

'nsi_data': 'data/modules/name-suggestion-index/nsi.min.json',
'nsi_dissolved': 'data/modules/name-suggestion-index/dissolved.min.json',
'nsi_features': 'data/modules/name-suggestion-index/featureCollection.min.json',
'nsi_generics': 'data/modules/name-suggestion-index/genericWords.min.json',
'nsi_presets': 'data/modules/name-suggestion-index/presets/nsi-id-presets.min.json',
'nsi_replacements': 'data/modules/name-suggestion-index/replacements.min.json',
'nsi_trees': 'data/modules/name-suggestion-index/trees.min.json',

'oci_defaults': 'data/modules/osm-community-index/defaults.min.json',
'oci_features': 'data/modules/osm-community-index/featureCollection.min.json',
'oci_resources': 'data/modules/osm-community-index/resources.min.json',

'pannellum_js': 'data/modules/pannellum/pannellum.js', // note no .min
'pannellum_css': 'data/modules/pannellum/pannellum.css', // note no .min

'tagging_deprecated': 'data/modules/id-tagging-schema/deprecated.min.json',
'tagging_discarded': 'data/modules/id-tagging-schema/discarded.min.json',
'tagging_preset_categories': 'data/modules/id-tagging-schema/preset_categories.min.json',
'tagging_preset_defaults': 'data/modules/id-tagging-schema/preset_defaults.min.json',
'tagging_preset_fields': 'data/modules/id-tagging-schema/fields.min.json',
'tagging_preset_presets': 'data/modules/id-tagging-schema/presets.min.json',

'wmf_sitematrix': 'data/modules/wmf-sitematrix/wikipedia.min.json'
}
};

Expand Down
Loading

0 comments on commit 4dce34e

Please sign in to comment.