2011-01-25 18:59:31 +01:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
2011-01-30 01:10:05 +01:00
|
|
|
$package_spec = array(
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
'javelin.pkg.js' => array(
|
|
|
|
'javelin-util',
|
|
|
|
'javelin-install',
|
|
|
|
'javelin-event',
|
|
|
|
'javelin-stratcom',
|
|
|
|
'javelin-behavior',
|
2012-11-21 03:01:25 +01:00
|
|
|
'javelin-resource',
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
'javelin-request',
|
|
|
|
'javelin-vector',
|
|
|
|
'javelin-dom',
|
|
|
|
'javelin-json',
|
|
|
|
'javelin-uri',
|
2012-11-21 03:01:25 +01:00
|
|
|
'javelin-workflow',
|
|
|
|
'javelin-mask',
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
'javelin-typeahead',
|
|
|
|
'javelin-typeahead-normalizer',
|
|
|
|
'javelin-typeahead-source',
|
|
|
|
'javelin-typeahead-preloaded-source',
|
|
|
|
'javelin-typeahead-ondemand-source',
|
|
|
|
'javelin-tokenizer',
|
2013-05-19 02:12:42 +02:00
|
|
|
'javelin-history',
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
),
|
2011-12-19 18:06:09 +01:00
|
|
|
'core.pkg.js' => array(
|
2012-11-21 03:01:25 +01:00
|
|
|
'javelin-behavior-aphront-basic-tokenizer',
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
'javelin-behavior-workflow',
|
2011-05-28 20:36:00 +02:00
|
|
|
'javelin-behavior-aphront-form-disable-on-submit',
|
|
|
|
'phabricator-keyboard-shortcut-manager',
|
|
|
|
'phabricator-keyboard-shortcut',
|
|
|
|
'javelin-behavior-phabricator-keyboard-shortcuts',
|
2011-12-19 18:06:09 +01:00
|
|
|
'javelin-behavior-refresh-csrf',
|
|
|
|
'javelin-behavior-phabricator-watch-anchor',
|
2012-03-02 02:23:00 +01:00
|
|
|
'javelin-behavior-phabricator-autofocus',
|
|
|
|
'phabricator-menu-item',
|
|
|
|
'phabricator-dropdown-menu',
|
2013-04-24 02:19:44 +02:00
|
|
|
'phabricator-phtize',
|
2012-04-17 02:51:30 +02:00
|
|
|
'javelin-behavior-phabricator-oncopy',
|
|
|
|
'phabricator-tooltip',
|
|
|
|
'javelin-behavior-phabricator-tooltips',
|
|
|
|
'phabricator-prefab',
|
2012-11-21 03:01:25 +01:00
|
|
|
'javelin-behavior-device',
|
|
|
|
'javelin-behavior-toggle-class',
|
|
|
|
'javelin-behavior-lightbox-attachments',
|
|
|
|
'phabricator-busy',
|
|
|
|
'javelin-aphlict',
|
|
|
|
'phabricator-notification',
|
|
|
|
'javelin-behavior-aphlict-listen',
|
|
|
|
'javelin-behavior-phabricator-search-typeahead',
|
|
|
|
'javelin-behavior-konami',
|
|
|
|
'javelin-behavior-aphlict-dropdown',
|
2013-03-01 03:58:00 +01:00
|
|
|
'javelin-behavior-history-install',
|
Add support for device swipe events
Summary:
Ref T2700. Allow JS to listen for swipes on devices.
There are a bunch of tricky cases here and I probably didn't get them all totally right, but this interaction broadly looks like this:
- We implement gesture recognition for the mouse in device modes (narrow browser), and for touch events from an actual device.
- The sigil `touchable` indicates that a node wants to react to touch events.
- When the user touches a `touchable` node, we start listening for moves. They might be tapping/clicking (in which case we don't care), but they might also be gesturing.
- Once the user moves their finger/pointer far enough away from the tap origin, we recognize it as a gesture. I hardcoded this at 20px; I wasn't able to find any "official" Apple value, but 20px seems like a common default.
- At this point, we look at where their finger has moved.
- If they moved it mostly up/down, we interpret the gesture as "scroll" and just stop listening. The device does its own thing.
- However, if they moved it mostly left/right, we interpret it as a "swipe". We start killing the moves so the device doesn't scroll.
- Once we've recognized that a gesture is underway, we send a "gesture.swipe.start" event and then "gesture.swipe.move" events for every move.
- When the user ends the gesture, we send "gesture.swipe.end".
- If the user cancels the gesture (currently, only by tapping with a second finger), we send "gesture.swipe.cancel".
- Gesture events have raw position data and some convenience fields.
Test Plan:
Wrote UI example and used it from the Desktop, iPhone simulator, and a real iphone.
- The code always seems to get "scroll" vs "swipe" correct (i.e., consistent with my intentions).
- The threshold feels pretty good to me.
- Tapping with a second finger cancels the action.
Reviewers: chad, btrahan
Reviewed By: chad
CC: aran
Maniphest Tasks: T2700
Differential Revision: https://secure.phabricator.com/D5308
2013-03-09 22:53:15 +01:00
|
|
|
'javelin-behavior-phabricator-gesture',
|
2012-11-21 03:01:25 +01:00
|
|
|
|
|
|
|
'javelin-behavior-phabricator-active-nav',
|
|
|
|
'javelin-behavior-phabricator-nav',
|
|
|
|
'javelin-behavior-phabricator-remarkup-assist',
|
|
|
|
'phabricator-textareautils',
|
|
|
|
'phabricator-file-upload',
|
Modernize file uploads
Summary:
Modernizes file uploads. In particular:
- Adds a mobile menu, with an "Upload File" item.
- Adds crumbs to the list view, detail view and upload view.
- Adds "Upload File" action to crumbs.
- Moves upload file to a separate page.
- Removes the combined upload file + recent files page.
- Makes upload file use a normal file control by default (works on mobile).
- Home page, file list and file upload page are now global drop targets which accept files dropped anywhere on them. Dragging a file into the window shows a mask and an instructional message.
- User education on this is a little weak but I think that's a big can of worms?
- Fixes a bug where dropping multiple files into a Remarkup text area produced bad results (resolves T2190).
T879 is related, although it's specifically about Maniphest. I've declined to make global drop targets yet there because there are multiple drop targets on the page with different meanings. That UI needs updating in general.
@chad, do we have an "upload" icon (counterpart to "download")?
Test Plan: Uploaded files in Maniphest, Differential, Files, and from Home. Dragged and dropped multiple files into Differential. Used crumbs, mobile.
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2190
Differential Revision: https://secure.phabricator.com/D4200
2012-12-17 01:34:01 +01:00
|
|
|
'javelin-behavior-global-drag-and-drop',
|
2013-02-17 15:37:02 +01:00
|
|
|
'javelin-behavior-phabricator-reveal-content',
|
2013-05-19 02:12:42 +02:00
|
|
|
'phabricator-hovercard',
|
|
|
|
'javelin-behavior-phabricator-hovercards',
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
),
|
2011-01-30 01:10:05 +01:00
|
|
|
'core.pkg.css' => array(
|
|
|
|
'phabricator-core-css',
|
2012-12-30 18:30:21 +01:00
|
|
|
'phabricator-zindex-css',
|
2013-06-13 03:23:35 +02:00
|
|
|
'phui-button-css',
|
2011-01-30 01:10:05 +01:00
|
|
|
'phabricator-standard-page-view',
|
|
|
|
'aphront-dialog-view-css',
|
2013-08-26 20:53:11 +02:00
|
|
|
'phui-form-view-css',
|
2011-01-30 01:10:05 +01:00
|
|
|
'aphront-panel-view-css',
|
|
|
|
'aphront-table-view-css',
|
|
|
|
'aphront-tokenizer-control-css',
|
|
|
|
'aphront-typeahead-control-css',
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
'aphront-list-filter-view-css',
|
2011-01-30 01:10:05 +01:00
|
|
|
|
2012-03-02 02:23:00 +01:00
|
|
|
'phabricator-jump-nav',
|
2011-02-05 02:53:14 +01:00
|
|
|
|
|
|
|
'phabricator-remarkup-css',
|
|
|
|
'syntax-highlighting-css',
|
2012-03-02 02:23:00 +01:00
|
|
|
'aphront-pager-view-css',
|
|
|
|
'phabricator-transaction-view-css',
|
2012-04-17 02:51:30 +02:00
|
|
|
'aphront-tooltip-css',
|
|
|
|
'phabricator-flag-css',
|
|
|
|
'aphront-error-view-css',
|
2012-12-07 22:53:24 +01:00
|
|
|
|
Add action icons to object list views
Summary:
We have a few interfaces where add "Edit", "Delete" or some other action to a list. Currently, this happens via icons, but these are cumbersome and weird, are inconsistent, can't be workflow'd, are hard to hit on desktops and virtually impossible to hit on mobile, and generally just feel iffy to me. Prominent examples are Projects and Flags. I'd like to try adding an "edit" action to Maniphest (to provide quick edit from list views, basically). It looks like some of Releeph would benefit here, as well.
Instead, provide first-class actions:
{F42978}
They produce targets which my meaty ham-fists can plausibly hit on mobile, too:
{F42979}
(We could do some kind of swipe-to-expose thing eventually, but I think putting them by default is OK?)
Test Plan: Added UIExamples. Checked desktop/mobile.
Reviewers: chad, btrahan, edward
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D5890
2013-05-10 21:57:01 +02:00
|
|
|
'sprite-icons-css',
|
2012-12-07 22:53:24 +01:00
|
|
|
'sprite-gradient-css',
|
|
|
|
'sprite-menu-css',
|
|
|
|
'sprite-apps-large-css',
|
|
|
|
|
2012-11-21 03:01:25 +01:00
|
|
|
'phabricator-main-menu-view',
|
|
|
|
'phabricator-notification-css',
|
|
|
|
'phabricator-notification-menu-css',
|
|
|
|
'lightbox-attachment-css',
|
2013-09-17 18:12:37 +02:00
|
|
|
'phui-header-view-css',
|
2012-11-21 03:01:25 +01:00
|
|
|
'phabricator-filetree-view-css',
|
|
|
|
'phabricator-nav-view-css',
|
2012-12-07 22:53:24 +01:00
|
|
|
'phabricator-side-menu-view-css',
|
|
|
|
'phabricator-crumbs-view-css',
|
2013-09-09 23:14:34 +02:00
|
|
|
'phui-object-item-list-view-css',
|
Modernize file uploads
Summary:
Modernizes file uploads. In particular:
- Adds a mobile menu, with an "Upload File" item.
- Adds crumbs to the list view, detail view and upload view.
- Adds "Upload File" action to crumbs.
- Moves upload file to a separate page.
- Removes the combined upload file + recent files page.
- Makes upload file use a normal file control by default (works on mobile).
- Home page, file list and file upload page are now global drop targets which accept files dropped anywhere on them. Dragging a file into the window shows a mask and an instructional message.
- User education on this is a little weak but I think that's a big can of worms?
- Fixes a bug where dropping multiple files into a Remarkup text area produced bad results (resolves T2190).
T879 is related, although it's specifically about Maniphest. I've declined to make global drop targets yet there because there are multiple drop targets on the page with different meanings. That UI needs updating in general.
@chad, do we have an "upload" icon (counterpart to "download")?
Test Plan: Uploaded files in Maniphest, Differential, Files, and from Home. Dragged and dropped multiple files into Differential. Used crumbs, mobile.
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2190
Differential Revision: https://secure.phabricator.com/D4200
2012-12-17 01:34:01 +01:00
|
|
|
'global-drag-and-drop-css',
|
2013-06-13 03:23:35 +02:00
|
|
|
'phui-spacing-css',
|
2013-05-19 02:12:42 +02:00
|
|
|
'phui-form-css',
|
|
|
|
'phui-icon-view-css',
|
2012-12-07 22:53:24 +01:00
|
|
|
|
2013-05-19 02:12:42 +02:00
|
|
|
'phabricator-application-launch-view-css',
|
|
|
|
'phabricator-action-list-view-css',
|
|
|
|
'phabricator-property-list-view-css',
|
|
|
|
'phabricator-tag-view-css',
|
2011-01-30 01:10:05 +01:00
|
|
|
),
|
|
|
|
'differential.pkg.css' => array(
|
|
|
|
'differential-core-view-css',
|
|
|
|
'differential-changeset-view-css',
|
2012-05-01 19:15:56 +02:00
|
|
|
'differential-results-table-css',
|
2011-01-30 01:10:05 +01:00
|
|
|
'differential-revision-history-css',
|
2012-08-20 23:05:46 +02:00
|
|
|
'differential-revision-list-css',
|
2011-01-30 01:10:05 +01:00
|
|
|
'differential-table-of-contents-css',
|
2011-02-05 02:53:14 +01:00
|
|
|
'differential-revision-comment-css',
|
|
|
|
'differential-revision-add-comment-css',
|
|
|
|
'differential-revision-comment-list-css',
|
2011-12-19 18:06:09 +01:00
|
|
|
'phabricator-object-selector-css',
|
|
|
|
'phabricator-content-source-view-css',
|
|
|
|
'differential-local-commits-view-css',
|
2012-04-17 02:51:30 +02:00
|
|
|
'inline-comment-summary-css',
|
2011-02-05 02:53:14 +01:00
|
|
|
),
|
|
|
|
'differential.pkg.js' => array(
|
2011-12-19 18:06:09 +01:00
|
|
|
'phabricator-drag-and-drop-file-upload',
|
|
|
|
'phabricator-shaped-request',
|
|
|
|
|
2011-02-05 02:53:14 +01:00
|
|
|
'javelin-behavior-differential-feedback-preview',
|
|
|
|
'javelin-behavior-differential-edit-inline-comments',
|
|
|
|
'javelin-behavior-differential-populate',
|
|
|
|
'javelin-behavior-differential-show-more',
|
|
|
|
'javelin-behavior-differential-diff-radios',
|
2011-12-19 18:06:09 +01:00
|
|
|
'javelin-behavior-differential-accept-with-errors',
|
|
|
|
'javelin-behavior-differential-comment-jump',
|
|
|
|
'javelin-behavior-differential-add-reviewers-and-ccs',
|
|
|
|
'javelin-behavior-differential-keyboard-navigation',
|
|
|
|
'javelin-behavior-aphront-drag-and-drop-textarea',
|
|
|
|
'javelin-behavior-phabricator-object-selector',
|
2012-04-17 02:51:30 +02:00
|
|
|
'javelin-behavior-repository-crossreference',
|
2013-03-05 23:31:20 +01:00
|
|
|
'javelin-behavior-load-blame',
|
2011-12-19 18:06:09 +01:00
|
|
|
|
|
|
|
'differential-inline-comment-editor',
|
2012-03-02 02:23:00 +01:00
|
|
|
'javelin-behavior-differential-dropdown-menus',
|
2012-11-21 03:01:25 +01:00
|
|
|
'javelin-behavior-differential-toggle-files',
|
|
|
|
'javelin-behavior-differential-user-select',
|
2011-01-30 01:10:05 +01:00
|
|
|
),
|
2011-03-14 04:15:24 +01:00
|
|
|
'diffusion.pkg.css' => array(
|
|
|
|
'diffusion-commit-view-css',
|
2012-04-17 02:51:30 +02:00
|
|
|
'diffusion-icons-css',
|
|
|
|
),
|
|
|
|
'diffusion.pkg.js' => array(
|
|
|
|
'javelin-behavior-diffusion-pull-lastmodified',
|
|
|
|
'javelin-behavior-diffusion-commit-graph',
|
|
|
|
'javelin-behavior-audit-preview',
|
2011-03-14 04:15:24 +01:00
|
|
|
),
|
2012-03-02 02:23:00 +01:00
|
|
|
'maniphest.pkg.css' => array(
|
|
|
|
'maniphest-task-summary-css',
|
2012-04-17 02:51:30 +02:00
|
|
|
'phabricator-project-tag-css',
|
2012-03-02 02:23:00 +01:00
|
|
|
),
|
|
|
|
'maniphest.pkg.js' => array(
|
|
|
|
'javelin-behavior-maniphest-batch-selector',
|
|
|
|
'javelin-behavior-maniphest-transaction-controls',
|
|
|
|
'javelin-behavior-maniphest-transaction-preview',
|
|
|
|
'javelin-behavior-maniphest-transaction-expand',
|
2012-04-17 02:51:30 +02:00
|
|
|
'javelin-behavior-maniphest-subpriority-editor',
|
2012-03-02 02:23:00 +01:00
|
|
|
),
|
2012-11-21 03:01:25 +01:00
|
|
|
'darkconsole.pkg.js' => array(
|
|
|
|
'javelin-behavior-dark-console',
|
|
|
|
'javelin-behavior-error-log',
|
|
|
|
),
|
2011-01-30 01:10:05 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2011-01-25 18:59:31 +01:00
|
|
|
require_once dirname(__FILE__).'/__init_script__.php';
|
|
|
|
|
2012-06-01 01:04:10 +02:00
|
|
|
$args = new PhutilArgumentParser($argv);
|
|
|
|
$args->setTagline('map static resources');
|
|
|
|
$args->setSynopsis(
|
|
|
|
"**celerity_mapper.php** [--output __path__] [--with-custom] <webroot>");
|
|
|
|
$args->parse(
|
|
|
|
array(
|
|
|
|
array(
|
|
|
|
'name' => 'output',
|
|
|
|
'param' => 'path',
|
|
|
|
'default' => '../src/__celerity_resource_map__.php',
|
|
|
|
'help' => "Set the path for resource map. It is usually useful for ".
|
|
|
|
"'celerity.resource-path' configuration.",
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'with-custom',
|
|
|
|
'help' => 'Include resources in <webroot>/rsrc/custom/.',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'webroot',
|
|
|
|
'wildcard' => true,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$root = $args->getArg('webroot');
|
|
|
|
if (count($root) != 1 || !is_dir(reset($root))) {
|
|
|
|
$args->printHelpAndExit();
|
2011-01-25 18:59:31 +01:00
|
|
|
}
|
2012-06-01 01:04:10 +02:00
|
|
|
$root = Filesystem::resolvePath(reset($root));
|
2011-01-25 18:59:31 +01:00
|
|
|
|
2012-06-01 01:04:10 +02:00
|
|
|
$celerity_path = Filesystem::resolvePath($args->getArg('output'), $root);
|
|
|
|
$with_custom = $args->getArg('with-custom');
|
2011-01-25 18:59:31 +01:00
|
|
|
|
Use Celerity to version all static resources
Summary:
We don't use versioned URIs for images, so when they change users may get old versions.
This was a particular issue with the recent logo change, which several users reported cache-related issues from.
Instead, use Celerity to manage image URI versions in addition to CSS/JS.
This is complicated, because we need to rewrite image URIs inside of CSS, which means the hash of a CSS file has to be derived from the current image data. Otherwise, when we updated an image the CSS wouldn't update, so we wouldn't be any better off.
So basically we:
- Find all the "raw" files, and put them into the map.
- Find all the CSS/JS, perform content-altering transformations on it (i.e., not minification) based on the partial map, and then put it into the map based on transformed hashes.
(If we wanted, we could now do CSS variables or whatever for "free", more or less.)
Test Plan:
- Regenerated celerity map, browsed site, verified images generated with versioned URIs.
- Moved "blue" flag image over "green" flag image, regenerated map, verified "green" flag image and the associated CSS changed hashes.
- Added transformation unit tests; ran unit tests.
Reviewers: btrahan, vrana, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1073
Differential Revision: https://secure.phabricator.com/D2146
2012-04-08 19:07:51 +02:00
|
|
|
$resource_hash = PhabricatorEnv::getEnvConfig('celerity.resource-hash');
|
|
|
|
$runtime_map = array();
|
|
|
|
|
|
|
|
echo "Finding raw static resources...\n";
|
2012-06-01 01:04:10 +02:00
|
|
|
$finder = id(new FileFinder($root))
|
Use Celerity to version all static resources
Summary:
We don't use versioned URIs for images, so when they change users may get old versions.
This was a particular issue with the recent logo change, which several users reported cache-related issues from.
Instead, use Celerity to manage image URI versions in addition to CSS/JS.
This is complicated, because we need to rewrite image URIs inside of CSS, which means the hash of a CSS file has to be derived from the current image data. Otherwise, when we updated an image the CSS wouldn't update, so we wouldn't be any better off.
So basically we:
- Find all the "raw" files, and put them into the map.
- Find all the CSS/JS, perform content-altering transformations on it (i.e., not minification) based on the partial map, and then put it into the map based on transformed hashes.
(If we wanted, we could now do CSS variables or whatever for "free", more or less.)
Test Plan:
- Regenerated celerity map, browsed site, verified images generated with versioned URIs.
- Moved "blue" flag image over "green" flag image, regenerated map, verified "green" flag image and the associated CSS changed hashes.
- Added transformation unit tests; ran unit tests.
Reviewers: btrahan, vrana, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1073
Differential Revision: https://secure.phabricator.com/D2146
2012-04-08 19:07:51 +02:00
|
|
|
->withType('f')
|
|
|
|
->withSuffix('png')
|
|
|
|
->withSuffix('jpg')
|
|
|
|
->withSuffix('gif')
|
|
|
|
->withSuffix('swf')
|
|
|
|
->withFollowSymlinks(true)
|
2012-06-01 01:04:10 +02:00
|
|
|
->setGenerateChecksums(true);
|
|
|
|
if (!$with_custom) {
|
|
|
|
$finder->excludePath('./rsrc/custom');
|
|
|
|
}
|
|
|
|
$raw_files = $finder->find();
|
Use Celerity to version all static resources
Summary:
We don't use versioned URIs for images, so when they change users may get old versions.
This was a particular issue with the recent logo change, which several users reported cache-related issues from.
Instead, use Celerity to manage image URI versions in addition to CSS/JS.
This is complicated, because we need to rewrite image URIs inside of CSS, which means the hash of a CSS file has to be derived from the current image data. Otherwise, when we updated an image the CSS wouldn't update, so we wouldn't be any better off.
So basically we:
- Find all the "raw" files, and put them into the map.
- Find all the CSS/JS, perform content-altering transformations on it (i.e., not minification) based on the partial map, and then put it into the map based on transformed hashes.
(If we wanted, we could now do CSS variables or whatever for "free", more or less.)
Test Plan:
- Regenerated celerity map, browsed site, verified images generated with versioned URIs.
- Moved "blue" flag image over "green" flag image, regenerated map, verified "green" flag image and the associated CSS changed hashes.
- Added transformation unit tests; ran unit tests.
Reviewers: btrahan, vrana, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1073
Differential Revision: https://secure.phabricator.com/D2146
2012-04-08 19:07:51 +02:00
|
|
|
|
|
|
|
echo "Processing ".count($raw_files)." files";
|
|
|
|
foreach ($raw_files as $path => $hash) {
|
|
|
|
echo ".";
|
|
|
|
$path = '/'.Filesystem::readablePath($path, $root);
|
|
|
|
$type = CelerityResourceTransformer::getResourceType($path);
|
|
|
|
|
|
|
|
$hash = md5($hash.$path.$resource_hash);
|
|
|
|
$uri = '/res/'.substr($hash, 0, 8).$path;
|
|
|
|
|
|
|
|
$runtime_map[$path] = array(
|
|
|
|
'hash' => $hash,
|
|
|
|
'uri' => $uri,
|
|
|
|
'disk' => $path,
|
|
|
|
'type' => $type,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
$xformer = id(new CelerityResourceTransformer())
|
|
|
|
->setMinify(false)
|
|
|
|
->setRawResourceMap($runtime_map);
|
|
|
|
|
|
|
|
echo "Finding transformable static resources...\n";
|
2012-06-01 01:04:10 +02:00
|
|
|
$finder = id(new FileFinder($root))
|
2011-01-25 18:59:31 +01:00
|
|
|
->withType('f')
|
|
|
|
->withSuffix('js')
|
|
|
|
->withSuffix('css')
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
->withFollowSymlinks(true)
|
2012-06-01 01:04:10 +02:00
|
|
|
->setGenerateChecksums(true);
|
|
|
|
if (!$with_custom) {
|
|
|
|
$finder->excludePath('./rsrc/custom');
|
|
|
|
}
|
|
|
|
$files = $finder->find();
|
2011-01-25 18:59:31 +01:00
|
|
|
|
|
|
|
echo "Processing ".count($files)." files";
|
|
|
|
|
|
|
|
$file_map = array();
|
Use Celerity to version all static resources
Summary:
We don't use versioned URIs for images, so when they change users may get old versions.
This was a particular issue with the recent logo change, which several users reported cache-related issues from.
Instead, use Celerity to manage image URI versions in addition to CSS/JS.
This is complicated, because we need to rewrite image URIs inside of CSS, which means the hash of a CSS file has to be derived from the current image data. Otherwise, when we updated an image the CSS wouldn't update, so we wouldn't be any better off.
So basically we:
- Find all the "raw" files, and put them into the map.
- Find all the CSS/JS, perform content-altering transformations on it (i.e., not minification) based on the partial map, and then put it into the map based on transformed hashes.
(If we wanted, we could now do CSS variables or whatever for "free", more or less.)
Test Plan:
- Regenerated celerity map, browsed site, verified images generated with versioned URIs.
- Moved "blue" flag image over "green" flag image, regenerated map, verified "green" flag image and the associated CSS changed hashes.
- Added transformation unit tests; ran unit tests.
Reviewers: btrahan, vrana, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1073
Differential Revision: https://secure.phabricator.com/D2146
2012-04-08 19:07:51 +02:00
|
|
|
foreach ($files as $path => $raw_hash) {
|
2011-01-25 18:59:31 +01:00
|
|
|
echo ".";
|
Use Celerity to version all static resources
Summary:
We don't use versioned URIs for images, so when they change users may get old versions.
This was a particular issue with the recent logo change, which several users reported cache-related issues from.
Instead, use Celerity to manage image URI versions in addition to CSS/JS.
This is complicated, because we need to rewrite image URIs inside of CSS, which means the hash of a CSS file has to be derived from the current image data. Otherwise, when we updated an image the CSS wouldn't update, so we wouldn't be any better off.
So basically we:
- Find all the "raw" files, and put them into the map.
- Find all the CSS/JS, perform content-altering transformations on it (i.e., not minification) based on the partial map, and then put it into the map based on transformed hashes.
(If we wanted, we could now do CSS variables or whatever for "free", more or less.)
Test Plan:
- Regenerated celerity map, browsed site, verified images generated with versioned URIs.
- Moved "blue" flag image over "green" flag image, regenerated map, verified "green" flag image and the associated CSS changed hashes.
- Added transformation unit tests; ran unit tests.
Reviewers: btrahan, vrana, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1073
Differential Revision: https://secure.phabricator.com/D2146
2012-04-08 19:07:51 +02:00
|
|
|
$path = '/'.Filesystem::readablePath($path, $root);
|
|
|
|
$data = Filesystem::readFile($root.$path);
|
|
|
|
|
|
|
|
$data = $xformer->transformResource($path, $data);
|
|
|
|
$hash = md5($data);
|
|
|
|
$hash = md5($hash.$path.$resource_hash);
|
|
|
|
|
|
|
|
$file_map[$path] = array(
|
|
|
|
'hash' => $hash,
|
2011-01-25 18:59:31 +01:00
|
|
|
'disk' => $path,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
echo "\n";
|
|
|
|
|
2011-11-22 20:36:57 +01:00
|
|
|
$resource_graph = array();
|
2011-01-30 01:10:05 +01:00
|
|
|
$hash_map = array();
|
|
|
|
|
2011-01-25 18:59:31 +01:00
|
|
|
$parser = new PhutilDocblockParser();
|
|
|
|
foreach ($file_map as $path => $info) {
|
Use Celerity to version all static resources
Summary:
We don't use versioned URIs for images, so when they change users may get old versions.
This was a particular issue with the recent logo change, which several users reported cache-related issues from.
Instead, use Celerity to manage image URI versions in addition to CSS/JS.
This is complicated, because we need to rewrite image URIs inside of CSS, which means the hash of a CSS file has to be derived from the current image data. Otherwise, when we updated an image the CSS wouldn't update, so we wouldn't be any better off.
So basically we:
- Find all the "raw" files, and put them into the map.
- Find all the CSS/JS, perform content-altering transformations on it (i.e., not minification) based on the partial map, and then put it into the map based on transformed hashes.
(If we wanted, we could now do CSS variables or whatever for "free", more or less.)
Test Plan:
- Regenerated celerity map, browsed site, verified images generated with versioned URIs.
- Moved "blue" flag image over "green" flag image, regenerated map, verified "green" flag image and the associated CSS changed hashes.
- Added transformation unit tests; ran unit tests.
Reviewers: btrahan, vrana, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1073
Differential Revision: https://secure.phabricator.com/D2146
2012-04-08 19:07:51 +02:00
|
|
|
$type = CelerityResourceTransformer::getResourceType($path);
|
|
|
|
|
|
|
|
$data = Filesystem::readFile($root.$info['disk']);
|
2011-01-25 18:59:31 +01:00
|
|
|
$matches = array();
|
|
|
|
$ok = preg_match('@/[*][*].*?[*]/@s', $data, $matches);
|
|
|
|
if (!$ok) {
|
|
|
|
throw new Exception(
|
|
|
|
"File {$path} does not have a header doc comment. Encode dependency ".
|
|
|
|
"data in a header docblock.");
|
|
|
|
}
|
2011-03-14 04:15:24 +01:00
|
|
|
|
2011-01-25 18:59:31 +01:00
|
|
|
list($description, $metadata) = $parser->parse($matches[0]);
|
2011-03-14 04:15:24 +01:00
|
|
|
|
2011-01-25 18:59:31 +01:00
|
|
|
$provides = preg_split('/\s+/', trim(idx($metadata, 'provides')));
|
|
|
|
$requires = preg_split('/\s+/', trim(idx($metadata, 'requires')));
|
|
|
|
$provides = array_filter($provides);
|
|
|
|
$requires = array_filter($requires);
|
2011-03-14 04:15:24 +01:00
|
|
|
|
2012-03-14 08:24:06 +01:00
|
|
|
if (!$provides) {
|
|
|
|
// Tests and documentation-only JS is permitted to @provide no targets.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
if (count($provides) > 1) {
|
2011-01-25 18:59:31 +01:00
|
|
|
throw new Exception(
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-04 00:11:55 +02:00
|
|
|
"File {$path} must @provide at most one Celerity target.");
|
2011-01-25 18:59:31 +01:00
|
|
|
}
|
2011-03-14 04:15:24 +01:00
|
|
|
|
2011-01-25 18:59:31 +01:00
|
|
|
$provides = reset($provides);
|
|
|
|
|
2011-01-30 01:10:05 +01:00
|
|
|
$uri = '/res/'.substr($info['hash'], 0, 8).$path;
|
2011-03-14 04:15:24 +01:00
|
|
|
|
2011-01-30 01:10:05 +01:00
|
|
|
$hash_map[$provides] = $info['hash'];
|
2011-03-14 04:15:24 +01:00
|
|
|
|
2011-11-22 20:36:57 +01:00
|
|
|
$resource_graph[$provides] = $requires;
|
|
|
|
|
2011-01-25 18:59:31 +01:00
|
|
|
$runtime_map[$provides] = array(
|
2011-01-30 01:10:05 +01:00
|
|
|
'uri' => $uri,
|
2011-01-25 18:59:31 +01:00
|
|
|
'type' => $type,
|
|
|
|
'requires' => $requires,
|
2011-01-30 01:10:05 +01:00
|
|
|
'disk' => $path,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-11-22 20:36:57 +01:00
|
|
|
$celerity_resource_graph = new CelerityResourceGraph();
|
|
|
|
$celerity_resource_graph->addNodes($resource_graph);
|
|
|
|
$celerity_resource_graph->setResourceGraph($resource_graph);
|
|
|
|
$celerity_resource_graph->loadGraph();
|
|
|
|
|
|
|
|
foreach ($resource_graph as $provides => $requires) {
|
|
|
|
$cycle = $celerity_resource_graph->detectCycles($provides);
|
|
|
|
if ($cycle) {
|
|
|
|
throw new Exception(
|
|
|
|
"Cycle detected in resource graph: ". implode($cycle, " => ")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-30 01:10:05 +01:00
|
|
|
$package_map = array();
|
|
|
|
foreach ($package_spec as $name => $package) {
|
|
|
|
$hashes = array();
|
2011-01-30 01:16:09 +01:00
|
|
|
$type = null;
|
2011-01-30 01:10:05 +01:00
|
|
|
foreach ($package as $symbol) {
|
|
|
|
if (empty($hash_map[$symbol])) {
|
|
|
|
throw new Exception(
|
|
|
|
"Package specification for '{$name}' includes '{$symbol}', but that ".
|
|
|
|
"symbol is not defined anywhere.");
|
|
|
|
}
|
2011-01-30 01:16:09 +01:00
|
|
|
if ($type === null) {
|
|
|
|
$type = $runtime_map[$symbol]['type'];
|
|
|
|
} else {
|
|
|
|
$ntype = $runtime_map[$symbol]['type'];
|
|
|
|
if ($type !== $ntype) {
|
|
|
|
throw new Exception(
|
|
|
|
"Package specification for '{$name}' mixes resources of type ".
|
|
|
|
"'{$type}' with resources of type '{$ntype}'. Each package may only ".
|
|
|
|
"contain one type of resource.");
|
|
|
|
}
|
|
|
|
}
|
2011-01-30 01:10:05 +01:00
|
|
|
$hashes[] = $symbol.':'.$hash_map[$symbol];
|
|
|
|
}
|
|
|
|
$key = substr(md5(implode("\n", $hashes)), 0, 8);
|
|
|
|
$package_map['packages'][$key] = array(
|
|
|
|
'name' => $name,
|
|
|
|
'symbols' => $package,
|
|
|
|
'uri' => '/res/pkg/'.$key.'/'.$name,
|
2011-01-30 01:16:09 +01:00
|
|
|
'type' => $type,
|
2011-01-25 18:59:31 +01:00
|
|
|
);
|
2011-01-30 01:10:05 +01:00
|
|
|
foreach ($package as $symbol) {
|
|
|
|
$package_map['reverse'][$symbol] = $key;
|
|
|
|
}
|
2011-01-25 18:59:31 +01:00
|
|
|
}
|
2011-03-14 04:15:24 +01:00
|
|
|
|
2011-05-03 19:45:45 +02:00
|
|
|
ksort($runtime_map);
|
2011-01-25 18:59:31 +01:00
|
|
|
$runtime_map = var_export($runtime_map, true);
|
|
|
|
$runtime_map = preg_replace('/\s+$/m', '', $runtime_map);
|
|
|
|
$runtime_map = preg_replace('/array \(/', 'array(', $runtime_map);
|
|
|
|
|
2012-03-15 06:42:30 +01:00
|
|
|
$package_map['packages'] = isort($package_map['packages'], 'name');
|
2011-05-03 19:45:45 +02:00
|
|
|
ksort($package_map['reverse']);
|
2011-01-30 01:10:05 +01:00
|
|
|
$package_map = var_export($package_map, true);
|
2011-08-04 07:16:44 +02:00
|
|
|
$package_map = preg_replace('/\s+$/m', '', $package_map);
|
2011-01-30 01:10:05 +01:00
|
|
|
$package_map = preg_replace('/array \(/', 'array(', $package_map);
|
|
|
|
|
2011-11-28 20:03:00 +01:00
|
|
|
$generated = '@'.'generated';
|
2011-01-25 18:59:31 +01:00
|
|
|
$resource_map = <<<EOFILE
|
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is automatically generated. Use 'celerity_mapper.php' to rebuild
|
|
|
|
* it.
|
2011-11-28 20:03:00 +01:00
|
|
|
* {$generated}
|
2011-01-25 18:59:31 +01:00
|
|
|
*/
|
|
|
|
|
2011-08-04 07:16:44 +02:00
|
|
|
celerity_register_resource_map({$runtime_map}, {$package_map});
|
2011-01-25 18:59:31 +01:00
|
|
|
|
|
|
|
EOFILE;
|
|
|
|
|
|
|
|
echo "Writing map...\n";
|
2012-06-01 01:04:10 +02:00
|
|
|
Filesystem::writeFile($celerity_path, $resource_map);
|
2011-03-14 04:15:24 +01:00
|
|
|
echo "Done.\n";
|