From c842d27fde639e3fd5709db99c261a7d59647c8d Mon Sep 17 00:00:00 2001 From: Aaron Judd Date: Thu, 3 Nov 2016 16:11:35 -0700 Subject: [PATCH] release 0.17.1 (#1529) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added babelrc and stage-2 preset (#1329) * Meteor 1.4.1.1 (#1331) * METEOR@1.4.1.1 - METEOR@1.4.1.1 - updated Meteor packages, collections2 * version 0.15.2 * move plugin loader from startup to reaction-cli (#1332) * preserve custom profile fields in Accounts.onCreateUser (#1335) * copy deprecated cfs:gridfs to local and update npm deps (#1336) * rounding of total to negate fractions of cents * updated version - release 0.15.3 * Josh acceptance test setup user permissions (#1315) * First round setting up acceptance test capabilities * webdriver working * adding meteor ignore file structure * create tests directory * adding png to gitignore * element maps * More progress on functional test setup * fixed assert * using dot notation * adding chai to dev packages * Begin adding acceptance testing instructions to readme * Simple login test complete * Adding to readme about failed tests screenshots * adding stuff * Core permissions acceptance test * more fixes * went off the deep end. added some low hanging fruit tests * enabling all passing tests for now * fixed userAddress call * removing docs from main readme * linting for config fixed * more cleanup * additional cleanup * using chrome instead of firefox now since ff is borked * adding refund test * a couple more refund tests w/ a couple fixes Will add more assertions later for these tests. * adding new tests to runner * argh * remove screenshot * remove ignore of all .png * updated package.json * updated reaction.json.example * finishing up PR * lint cleanup * temp workaround for missing product in store * A couple locator changes - commented out broken stripe tests * persistent profile language (#1338) * allow multiple languages in Translations - allow array to pass multiple languages in addition to shopLanguage. * updated i18next and Translation load order * remove session handling from i18n - remove “language” session - rely on Meteor.user updates (stored lang in profile) - update i18nchooser helpers to insert user profile lang into selected element class * retain language on anonymous user registration * check admin before setting lang — don’t set lang on initial admin * updated accounts.js - cleanup checks * Josh test speed increase #1347 (#1355) * turning verbosity off when running tests by default * Removing sleeps/pauses when I can * flaky test fix * #1347 cut runtime down by nearly 50% This is still just running synchronously. As tests grows we will need to look into running tests in parallel, however this might require some infrastructure in place, i.e. a hosted QA environment. An environment that can handle the load of 5-10 tests hitting it at a time. * only build Docker image on master/development (#1359) * only build Docker image on master/development * chmod +x * fix CI script typos * load default user from env (#1369) resolves #1368 * remove duplicate translation * remove duplicate translations * Shipping 1320 (#1357) * disabled ranges - TODO ranges are not functional yet. * update shipping form methods * remove settings from registry * update swal version - updated sweetAlert2 version * export Import, Fixture - export Fixture independently of Import - refactor Import.shipping to use a modified key - refactor load-data to use Fixture * updated Shipping schema * updated shipping method names - breaking change: shipping method names updated to follow convention of Reaction `updateShippingMethods` becomes `shipping/methods/update`. - adds `shipping/provider/remove` method * add missing import * convert info logging to debug * updated form methods - update form methods - add SWAL2 confirmations * add handling to cart rates - if `handling` has data add `handling` to `rate`. * updated cartTransforms - updated to use own methods and parse float to ensure consistent results. * move shipping from included to core like taxes, the core will include flat rates and the ui handling for additional shipping methods, which will be added to included - in the form of `shipping-shippo` etc. * remove card cursor:pointer (#1384) Resolves #1309 * Product Search (#1350) * Mock Search Files * Mock Search Files * Remove addProduct method * Remove Fixtures to remove mystery Shop * Super limited, even for a fake search * Don't overwrite the descriptions on first run * Larger data set for testing * Don't log unless we are actually adding Search Products * A simple weighted product search * Split out plug ins into "search" and "searchEngine" plugs. * Improve product title search, add search settings panel * Add in variant search * Add more options for weighting. Make the settings panel better. * Add tags to results and search on description * Rename plugin to be consistent with others * Add example config file * New test data with "show store" model with tags * Simple product subscription that returns products and facets (tags) for a searchterm * Only return ids and names of tags (we will eventually only return ids, but names for readability for now) * Filter by tags * We only need one plugin since our decoupling is provided by the use of a publication * Rename plugin * Using Mongo full-text search rather than regex search * Using Mongo full-text search rather than regex search * alphabetize base-style imports * Add in hooks to keep PS collection updated * Move build/rebuild functions into module * New settings for fields and weights * New settings for fields and weights * add in hooks * New settings for fields and weights * Build PS collection dynamically based on configuration * Add in vendor to list of possible fields * initial push of search UI * Move collections to lib so that clients can subscribe * Add shopId to required fields * Move collections to global collections * Use ProductSearch collection on the client side * Filter tags by hashtags in ProductSearch results * Populate template with search results * Product search results sorted by score in Ascending order * Move (re)building search collections to job queue * Handle form with a method so that we can rebuild collection or index when settings change * Queue job to rebuild indexes when weights have changed * Don't run search hooks when ProductSearch collection has not been defined * Add Order search * Namespace product settings * Don't run hooks when under test * Add missing "shopId" field * More fixes to make OrderSearch collection configurable. * Ensure index when inserting product records * testing larger datasets * Make function names less ridiculously long * Pass results without relying on the product already existing in the subscription * Don't add a bunch of products for testing by default * style cleanup * style cleanup * style cleanup * Add handle to product search collection * Clarify log statement * Ensure but don't drop collections when creating an OrderSearch record * No longer build productResults on the client * Cleanup and add `maxResults` * Cleanup settings form * Don't queue search collection jobs when under test * Search result tests * Add price to results. Make results different based upon logged-in status * Add tests for non-published products not showing up for anonymous users * Add tests for non-published products not showing up for anonymous users * Add account search, jobs, etc. * Change account search to not use text search * ui initial push * conflict temporary fix * move style into less * i18n for search * added delay on fadeout to feign smoother transition * sped up tag color transitions * componentize search results content * componentize search results grid * style updates for search modal * get media to show in searchGrid * updated id date for searchGridIcons * Use hashtags not hastags * Change order search to use a regular query plus tests * removed console.log * fixed typo * switched content order * commit of admin buttons (currently not functional) * Add support for text indexes in other supported languages * Make order search results case-insensitive * close button classes * removed outline from nav * removed additional media from search We only need to show one picture in search, for now at least * updated text * added search clear * style updates * Delete all existing records when rebuilding account search * Remove startup test files * Also remove test data files * Make logging less chatty * Allow for transformations outside of the ProductSearch method * convert tags to flexbox * style updates * adding scroll tag container * clean-up of development comments * LESS cleanup * style cleanup * style updates * 96% width input & tags formerly 80% * move some styling from search.less to navbar.less * cleanup & i18n * remove errant button * changed tag active color to ban-active * Add documentation around "supported language" as suggested by CR * added i18n to search * changed search tags to use btn classes * disable currently unused admin controls * rtl support * rtl style adjustments * Exclude anonymous users from accounts publication (#1390) * Exclude anonymous users from accounts publication when logged in as admin * NPM imports first * update deprecated _.pluck - Patch _.pluck = _.map in lodash 4.x - resolves issue introduced in #1390 * metafields -> details for client visibility (#1397) * metafields -> details for client visibility * metafields -> details * Search UI updates (#1410) * add margin-bottom to hovered product for better visibility on last product * removed font-size from .btn.flat * created react flatButton created a new react button component so we aren’t just if/elseing our way through a different type of button to get what we need. * adjustment for #1402 - added overflow toggle on body * removed font size from btn-round * allow ESC to exit modal even when not focused on input * Release 0.16.0 (#1413) * updated README.md * update to v0.16.0 * conflict fixes * updated versions * Better email (#1367) * convert email sending to use Nodemailer * add getShopSettings and getPackageSettings helpers * replace all Meteor accounts-password email methods * remove old email api * rewrite mail config methods to use nodemailer-wellknown * create emails collection for longer term log storage * add mail service to shop mail settings schema * refactor email sending job to use new API * add Meteor methods for email API * add email publication for logs page * build new email dashboard UI plugin for using new API * remove old Blaze email settings * fix alerts arg checks when callback is missing * add new FieldGroup and Loading React components * default theme cleanup * fix variables import order in default theme * dependencies updates * clean up job queue workers * update eslint config for more React details * fix custom email config * fix type handling for email config port * remove email dashboard nav tabs component until needed * add saving state and better error handling to email settings * change email status route name * remove deprecated mail config hook * add unblock to email config verify method * add host/port to conditions for custom email config check * move email methods to base of methods dir * package updates * fix comment typo * update dockerignore to reflect new location * default vals for mail host/port not needed in registry entry * fix optional email save when settings are invalid * fix email settings save button state after errors * don’t run email settings verify method if settings are missing * add log when new email settings are saved * npm updates * fix text overflow in email config panel * fix type checking on email port setting * fix syntax * i18n-ify all new email components * fix sweetalert promise * fix 118n prop * remove password from logs * force immediate retry of email job * add new column in email log table for action buttons * remove unnecessary braces * fix missing email port in UI * package updates * restore searching for email templates from the database * clean up imports method * Check if billing address exists (#1386) Prevents exception if there is no billing address * Hide user menu (#1387) Hide user menu after clicking on any link, including "add product" * Make close button work on tag nav bar in mobile mode (#1393) * Prevent no image being found if no image has priority 0. `"metadata.priority": 0` filter will fail to find an image if none has priority 0, so sort is used instead. (#1392) * Try to prevent inline alert pile (#1391) * updated pull approve to version 2 See: http://docs.pullapprove.com/ and https://blog.pullapprove.com/pullapprove-github-code-review-43761a64ea9a #.enx67rp3f * updated .pullapprove.yml * updated negative reject value * updated reset_on_push * updated pullapprove.yml * update pullapprove.yml -ARRGHHH! * package.json update for nodemailer * Install binary non-npm version of phantomjs. reactioncommerce/reaction#1325 (#1419) * add timeout to taxes tests (#1421) * Renamed field_group to fieldGroup to be consistent with other files (#1417) * Fixes #1337 (#1449) * ro-translation (#1441) * publish authorize-net on npm under @reactioncommerce org (#1451) * Issue/1452 (#1453) * Fixes #1337 * Fixes #1452 * Prevent error in `cartPayerName` helper if buyer name contains non-latin characters. The latter are not accepted by payment gateways, resulting the error in the payment form. (#1432) * PDP Revisions and Revised (#1356) * Initial start for handling product revisions Changes to products / variants are diverted to a draft in the "Revisions" collection. Calling publish updates original products with revision data. * Product visibility and draft reactivity restored Allow products publication to be notified of updates if a revision changes. Expand product visibility to variants. Allow product visibility toggle to be toggled for revisions. * Cleanups and added ability to mark products as deleted * Publishing and diffs Added diffs. Added diff UI. Added publish component. Added translations for react components. * Added ability to publish multiple top level products Draft and publishing now woks from the product grid for one or many products. Clean up. * Fix show diffs toggle * tag create / remove are now properly directed to a revision. * Fixed bug preventing metadata from revision updating Fixed bug that prevented revision updating all together. * Added some tests for product handle and revisions fixed issue causing tests to not run at all. * updated lodash dependencies - should resolve failing test * updating tests for product revisions * Updated more product tests. Updated some catalog implementations to work with revision control. * Fixing more tests * Fixing even more product tests. Adding tests for revisions along with fixing broken tests. * Removing some test expects as they have no chance of every being true * PDP react start of an overhaul of PDP page to fix many outlying bugs and upgrade it to better support revision control and display of revision content. * Variant and edit component updates Added variant list container. Added variant component, updated variant list to use component. Added EditContainer component which provides an edit button based on passed in props to child component. * added child variants to variant list * Added tooltips, cart button and revision object handling * React product detail page updates Metadata for product detail page. Cleaning up react tag components. Cleaning up old react components to be used on new product detail page. * Added tags component to PDP * Updated CSS classes for react PDP media gallery * UI updates for varaints Added visibility buttons to variants and child variants Added currency helpers. Added inventory alerts to varaints * Cleanup of price formatting Price formatting was moved to currency.js. Removing functionality from the helpers file. Fixed only implementation on formatMoney with module. * Provide translation updated to product detail container * React based social component * Added pinterest button Removed generic social button. Other cleanup. * Edit buttons for everything Added edit buttons to all fields, tags, and metadata. Added component for product field. Edit buttons can now display status based on edited field. * product detail editing improvements Auto hide edit button for product fields that remain unchanged. Fixed editing behavior for multiline textfield. * removed template tag * product admin form react Add a new product admin form for managing the react version of the product detail page. * metadata management and style updates Add and remove metadata now works. Updated styles for metafields. * Adding WIP react tag list editor * React product detail page is now primary other various cleanup of PropTypes, and console logs * Remove git ignored config file * Updated textfield className handling * Add ability to define multiple fields on edit button for diffs * Product social container how handles change notifications properly * Selectable variant and child variant Added ability to prevent default action for edit container edit button click. Added functionality to show action view for editing a variant. * Cleanup product detail tags and metadata. Edit buttons for both product tags and metadata now open the ProductAdmin view in the side panel. * React based inline alert components and containers * React based drag and drop. Top variants are now draggable and sortable. Tags are now draggable and sortable. Added DragDropProvider to create a reusable dnd-core instance for react components. Added container container component for sortable items. * Create, update and remove tag functionality added. * Update style of customer facing metadata component Style of the non-editable, customer-facing metadata component now appears like a table, similar in style to the editable counterpart. * Move media gallery to core ui components * removed unused component * Media gallery upload and remove * Media gallery drag and drop sortable * Updated registry entries and media gallery Added registry entries for new product detail page. Disable registry entries for old product detail page. Fixed bug causing crash with Media Gallery and undefined variables. * Fixed erroneous display of edit buttons with permissions * Switch media gallery for ul to div * Fixed exception caused by undefined data * Add publish controls to product admin * Updated publishing workflow. Publishing a product revision now properly sets it as "published" and will allow a new draft revision to be made for any new edits after that point. This allows a history of published changes to be stored. * Updated package.json with react-dnd and react-dropzone dependencies. * Tag updates - Fixes issues related to creating new tags - Fixes issues related to updating existing tags - Fixes issue where duplicated tags are added - Adds ability to exculde tags from suggestions - Adds new midifier for hashtags in product revision update hook - Updated styling of editable tags. Edidatbe tags in admin view are now full width - Removed dead code from revision hooks * Updated some references to lodash isArray to use built in Array.isArray * Fixed broken multi-file uploads for media gallery. Cleanup of unused code. * Added add button to add images using the file picker. * Fixed missing card titled for product admin * Renamed classname to match file name. * Added card group component. * Updated product admin with card group component * Updated product admin fields to be multiline * Updated metadata component Removed local state from metadata component. Parent container should handle all updates to state. Other various cleanup. * Fix broken tag test Skip publish test, revisit its usefulness later * Re-Enabled and updated product publication tests. updated publication collector package. * clean up product publication tests * Fixed slowdown caused by social buttons. Added helper to create settings for social buttons. * Fix tag submit on enter key * Updated tags Fixed issues with drag and drop re-ordering. Fixed drag handle; now only the handle is draggable instead of the entire tag. Sortable item no longer auto wraps elements, instead passes helpers functions to composed component. * Updated drag-n-drop for variants Drag and drop now only allowed if user has edit permissions. cleanup. * Updated media drag-n-drop Drag and drop is now enabled only if the media item is editable. Drag preview now shows up properly. * Update meta field styles and RTL styles * Add metadata (details) placeholders with translations * Load and display child variant media. * Fixed issues causing suggestions to change on arrow key input * Add placeholder for tag input * Updated media gallery uploader placeholder display In edit mode, media gallery now only placeholder item in the first slot, until a media item is uploaded. * space-out social buttons * add link type button * Add basic ability to change product handle manually * Added button toggle text, and fixed translation issues * Product delete callback * ensure product handle is always slug-ified * Removed duplicated delete function Replaced native confirm with a custom alert. * removed console.log * Fix for incorrect product handle being applied to grid items * Props and PropType fixes * Translation component updates. Added i18nKeys for visibility status * Add settings panel for revision control settings * Allow disable of revision control system. Disables collection hooks and product / products publications. * Cleanup and removed unused props. Added parentTag to other callbacks in tags component * Tooltip plugin cleanup * Added ability to disable new product detail page alongside revision control * More css selector specificity * Enable / disable publish controls * Publish revision control enabled status to users. This will allow the old / new PDP pages to be visible non admin users if revision control is enabled / disabled. * Fix legacy PDP media gallery styles. Moved new media gallery styles to a more appropriate place. * Added media gallery hover When enabled, hovering over images in the media gallery will replace the first image with the hovered media item. This effect is most visible on the new product detail page. * Fix safari flex box bug with icon button. Cleanup. * Add max width to PDP container. * Force add icon index file * removed console log in sortableItem * moved revision logging level to debug * Fixed bug that caused any change to a variant to toggle visibility Removed special handling of visibility from the collection hook. Added missing visibility toggle to edit container. * Load media for social buttons * Removed logging statement * Added badge for deleted variants * Fix weird variant selection behavior * Fix for undefined FB reference and cleanup * Fix for broken tests due to revision control on / off state * Updated react-autosuggest to 6.0.4 Updated instances of react-autosuggest to use new API * Fixed typo on visibility button tooltip Fixed issue with button tooltips not being translated if passed as a string. * Clicking a variant while action view is open will now focus it for editing. * Fixed typo in CSS classname * Fixed classname typo * Fix errors caused by change event attached to file upload input * Added ability to restore product variants from trash Top variants, and child variants can now be undeleted, while still in an unpublished draft. Fixed issue with variantForm not being reactively updated when variant was changed. * Don't delete media when variant is deleted. Changed because products are not deleted, only sent to trash. Leaving the media reference is important if you ever want to restore that item from the trash. * Adds ability to restore a deleted product for current draft * Updated alert confirm to SWAL * Fixed issues causing incorrect revision to be displayed for top variant * remove security group from pull approve - we will add back later… * update for 0.17.0 * Don't try to add user to OrderSearch when user doesn't exist (#1460) * Skip adding emails when user doesn't exist * Remove README that's no longer relevant * Set submitting state to handle error case correctly (#1461) * Docker build improvements (#1468) * clean up unused or unnecessary build deps * install all npm deps in first Meteor build step * create new base Docker image for better build caching * install MongoDB in container and use it if no external MONGO_URL is found * move deps versions to Dockerfile only for easier maintenance * fix custom package file script * add build script for full Docker build of base and app * fix lodash/camelcase import that was breaking the production build * npm updates * update CircleCI scripts to use new Docker build * Updated publish controls UX and fixing issues (#1473) * Updated publish controls UX and fixing issues - Fix bug causing error in console when publishing nothing. - Disabled the publish button if there is nothing to publish. - Added alert toasts for successful and unsuccessful publish. - Publish controls now properly finds relevant revisions. * Fixed typo * Fixed typo in comment * Fixed controlled component issue with input (#1469) * Loading 1455 (#1471) * Updated loader component to be consistent with other spinners Added loader for PDP container. Added a basic circular progress component. Removed domkit package. Replaced loader with already available spinner component through CSS. * Renamed loading.jsx to loading.js. JSX extension is unnecessary. * METEOR@1.4.1.2 * Added placeholders product fields (#1472) * Fixed bug that caused visibility button to not save a change. (#1477) * Fixed bug that caused visibility button to not save a change. * Address issue where visibility icon button could only be used once per draft revision * Fix product grid visibility button toggle inconsistencies. * Added comment for legacy publish functionality * Fix visibility toggle for product grid item * Removed tooltip from visibility button (#1479) * browserstack example (#1409) * beginning of getting browserstack working * More configs for browserstack * runner has been moved * creating test suite helper * fixes and moving some stuff around * More fixes. Allow the user to pick and choose what test suites to run. This will make it easier for the user if they are switching test runners frequently. I didn’t like adding all the tests in one array per configuration. This fixes that. Also allows the user to pick and choose what test suites apply to them. * lint fix * Adding reporter for tests, changed admin email, adding npm scripts for running tests * Allow Allure reporting to be optional * Primer for switching login/checkout tests to register/checkout * Login tests, are now register tests This also removes the dependency to having to create a user prior to running * Adding reporting to browserstack conf Also, added npm script for opening report. Another thing I noticed, browserstack tunnel sometimes hangs. So added process killer. * Updating test descriptions * lint fix * updating npm package * Addresses login test with hardcoded user assertion * This allows the user to use dynamic ids in tests * updated login test to pass local * updated test packages * updated from development - use REACTION_USER/AUTH if available. * updated versions * updated user data * Select products not flagged as deleted (#1489) * Selected products not flagged as deleted * Select all products not flagged as deleted * Add nul to second selector * fix order context in orderListSummary (#1493) * Publish 1490 (#1499) * Added a publish alert to the PDP page Updated alert component to support child components * Added toolbar for publish controls * Updated publish controls and product toolbar Added ability to change visibility of product from toolbar. Added better controls for switching view context. Added dropdown component. Updated menu components. Various other fixes. * Added ability to discard draft changes * Cleanup * Added ability to disable menu items * Cleanup * added ability to discard changes added ability to trigger a delete for relevant documents * Removed delete and visibility buttons from product detail form * Hide edit buttons when view as query param is "customer" * clean up * Cleanup * Renamed Product Settings to Product Details Removed commented code in registry entry for product-variant * Hide toolbar for non admin users. Cleanup eslint issues. * Ensure view "as" query param is preserved on route change * Added icons to menu items * Hide tooltip when button is disabled * Fixed type in callback * add ability to pass in original documents as a default * Added styles for disabled menu items Improved spacing divider in menu * add react-addons-create-fragment * fixed typo * Account & Order Search (#1494) * Change `userIsInRole` to `hasPermission` * initial commit * initial commit * i18n updates * breaking templates into smaller files * breaking LESS into smaller files * importing new templates * push for collaboration * i18n updates * file organization * helper functions for orders and accounts * focus input when changing search type * Make email search case-insensitive * push for visibility * update account & order results to tables * removed old accountGrid * Build account search using required fields and transformations * testing "fixed-data-table" * Merge branch 'development' into ek-search-accounts-orders # Conflicts: # imports/plugins/core/ui/client/components/index.js * Make order build dynamic as well (unfinished) * Use transformations for orders and accounts * Add exact search by _id, regex search by name, and match by "cleaned" phone * Refactor to eliminate duplicated code * Merge branch 'development' into ek-search-accounts-orders # Conflicts: # package.json * update table to react-component * updated fields for account resutls * field name correction * updated admin search permissions * renamed LESS files * Search for lastname/firstname in profile subfield * Fix error when profile is null * fixed propTypes error * added new fields to order results * i18n Updates * new search results * style updates * i18n updates * updates to account search * new permissions for search types * file cleanup * file cleanup * file cleanup * add order date to results * added style for shipping status * removed billing status from results display * Handle results when profile is null * add click to orderID shippingStatus panel orderID now goes to the order status / shippingInfo panel on click * fixes for PR comments * Wildcard search on emails in accounts/orders * Don't log so much * Add phone to Account Search * Simple migrations * Configure migrations not to log * Change subdir name to versions so we don't have stuff in migrations/migrations * Integrate migration logging with Reaction logging * Move files into core * Cleanup packages a little * Add a down method * Rename directory * Rename subdirectory * Correct import * fixed hardcoded shop urlSlug * remove unneeded props * accountSearch with user management * Re-namespace Migrations as Versions * killed unused prop * Re-re-structure migrations * Add README with warning about changing API * update migration nstantiation - Run before, not on startup, so that options take affect before Collections are declared. * remove unused lodash * update import order * New Email Template for Order Confirmation (#1501) * confirmation email for orders 95% ready. pushing for access on another machine. * updated media / image code * fix discounts data * localizing social images * update image handling * fixed store logo * update import order * removed un-needed dataForOrderEmail key * added babel-plugin-lodash * fixed single quotes * remove old "new.html" file * [WIP] Updated Translations (#1495) * LingoHub Update :rocket: Manual push by LingoHub User: Aaron Judd. Project: reaction Made with :heart: by https://lingohub.com * LingoHub Update :rocket: Manual push by LingoHub User: Aaron Judd. Project: reaction Made with :heart: by https://lingohub.com * Remove _README.md - remove out of date _README * restore missing rtl * add default en ltr - add default to see if lingo populates through other files. * disable non active default languages - disable languages that are without translators * updated en.json Fix Grammar * cleanup merge - remove deprecated files * remove duplicate key * review cleanup (#1509) * review cleanup - add i18n phrase for Tag in Use - add i18next to tag Alerts - fix typo in edItContainers - updated import order for styleguide adherance - comment WIP debug code for visibility button * add email, revisions dashboard phrases * make circleci target repo configurable using env var (#1517) - use DOCKER_NAMESPACE env var to identify target repo defaults to reactioncommerce if not set. example: when no env var set target-repo = reactioncommerce/base:latest when DOCKER_NAMESPACE set to frankg target-repo = frankg/base:latest * v0.17.1 - METEOR@1.4.1.3 updated - sweetalert2 - react-taco-table - react-autosuggest - country-data * fix typo (#1511) - last review cleanup item * Change "Delete" to "Archive" in PDP (#1513) * Change dropdown value * Change labels and value * Add archive translations * Use archive translations * Use archive action * Change badge title * Change confirmation dialog * Add archived messages * Remove deleteThisProduct key * Change to Archive for variants as well * I18n translations (#1514) * LingoHub Update :rocket: Manual push by LingoHub User: Aaron Judd. Project: reaction Made with :heart: by https://lingohub.com * LingoHub Update :rocket: Manual push by LingoHub User: Aaron Judd. Project: reaction Made with :heart: by https://lingohub.com * use i18next.dir to determine language direction - Resolves #1510 - Use `i18next.dir()` to determine language direction. * deprecate languageDirection * Fixes #1524 - Type Error thrown by empty addressBook (#1525) * Fixes #1524 Error was caused by `fieldData.addressBook` existing as an empty array, this checks to make sure that `addressBook[0]` exists before looking for the `fullName` prop. * fix camelcase typo that was breaking tests. * Actually fix typo in addressBook. Previous commit is what happens when you have two editor windows open with similar files open. * only register routes for enabled packages (#1526) * METEOR@1.4.2 * do not use revisions if the package is disabled (#1527) * When building an accountsearch collection, actually build it. (#1532) * Docker security updates (#1541) * Node 4.6.1 * fix custom package file script * refactor Docker build to run app as a non-root user * add a delay option to the Docker entrypoint * cleanup the cleanup scripts, remove app source after build is done * don’t install mongos if mongo install happens in container * update container port in docker-compose example file * remove unused script from CI * LingoHub Update :rocket: (#1547) Manual push by LingoHub User: Aaron Judd. Project: reaction Made with :heart: by https://lingohub.com * Fixes #1537 - Alerts throwing error (#1538) * Fixes #1537 - Alerts throwing error * catch errors thrown with lodash noop See https://github.com/limonte/sweetalert2/issues/177 * Don't blind catch sweet alert errors. * Placeholders + i18n for variant form fields (#1542) * Fix Public / Private update when discarding changes (#1543) * Switch to observe, instead of observe changes Fixes issue with some PDP UI elements not updating after changes have been discarded. * Remove debug comments * Move revision settings to catalog (#1544) * Move revision settings to catalog Added a package in core for catalog. Added settings panel for catalog. Updated registry entries for revisions to appear in catalog settings panel. Updated UI for registry settings card. * added key for i18n * fix port in CircleCI docker-compose test (#1549) * add missing labels (#1550) - emailSettingsLabel - catalogSettingsLabel will get moved to packages in 0.18 --- .meteor/packages | 44 +- .meteor/release | 2 +- .meteor/versions | 150 +-- .reaction/docker/base.dockerfile | 38 +- .reaction/docker/docker-compose.test.yml | 2 +- .reaction/docker/scripts/build-meteor.sh | 27 +- .reaction/docker/scripts/build-packages.sh | 2 +- .reaction/docker/scripts/entrypoint.sh | 38 +- .reaction/docker/scripts/install-deps.sh | 34 +- .reaction/docker/scripts/install-meteor.sh | 7 +- .reaction/docker/scripts/install-mongo.sh | 8 +- .reaction/docker/scripts/install-phantom.sh | 6 +- .../docker/scripts/post-build-cleanup.sh | 21 +- .../docker/scripts/post-install-cleanup.sh | 7 +- circle.yml | 29 +- client/modules/i18n/startup.js | 5 +- client/modules/router/main.js | 2 +- docker-compose.yml | 2 +- imports/plugins/core/catalog/client/index.js | 2 + .../catalog/client/templates/settings.html | 19 + .../core/catalog/client/templates/settings.js | 53 ++ imports/plugins/core/catalog/register.js | 27 + .../templates/layout/alerts/reactionAlerts.js | 10 + .../client/components/publishControls.js | 10 +- .../revisions/client/components/settings.js | 50 +- .../client/containers/publishContainer.js | 2 +- .../core/revisions/lib/api/revisions.js | 2 +- imports/plugins/core/revisions/register.js | 18 +- .../ui/client/containers/tagListContainer.js | 2 +- .../client/components/childVariant.js | 2 +- .../client/components/productDetail.js | 2 +- .../client/components/variant.js | 2 +- .../containers/productDetailContainer.js | 4 +- .../products/productDetail/productDetail.js | 4 +- .../variants/variantForm/childVariant.html | 4 +- .../variants/variantForm/childVariant.js | 4 +- .../variants/variantForm/variantForm.html | 24 +- .../variants/variantForm/variantForm.js | 4 +- .../products/productGrid/controls.html | 4 +- .../server/methods/searchcollections.js | 11 +- .../server/methods/transformations.js | 3 +- lib/api/products.js | 12 +- package.json | 14 +- private/data/i18n/ar.json | 57 +- private/data/i18n/bg.json | 2 +- private/data/i18n/cs.json | 2 +- private/data/i18n/de.json | 58 +- private/data/i18n/el.json | 2 +- private/data/i18n/en.json | 15 +- private/data/i18n/es.json | 58 +- private/data/i18n/fr.json | 58 +- private/data/i18n/he.json | 57 +- private/data/i18n/hr.json | 2 +- private/data/i18n/hu.json | 2 +- private/data/i18n/it.json | 2 +- private/data/i18n/my.json | 2 +- private/data/i18n/nb.json | 2 +- private/data/i18n/nl.json | 2 +- private/data/i18n/pl.json | 2 +- private/data/i18n/pt.json | 896 +++++++++++++++++- private/data/i18n/ro.json | 58 +- private/data/i18n/ru.json | 58 +- private/data/i18n/sl.json | 2 +- private/data/i18n/sv.json | 2 +- private/data/i18n/tr.json | 2 +- private/data/i18n/vi.json | 2 +- private/data/i18n/zh.json | 58 +- server/publications/collections/product.js | 20 +- server/publications/collections/products.js | 30 +- server/startup/registry/catalog.js | 30 - server/startup/registry/index.js | 2 - 71 files changed, 1776 insertions(+), 420 deletions(-) create mode 100644 imports/plugins/core/catalog/client/index.js create mode 100644 imports/plugins/core/catalog/client/templates/settings.html create mode 100644 imports/plugins/core/catalog/client/templates/settings.js create mode 100644 imports/plugins/core/catalog/register.js delete mode 100644 server/startup/registry/catalog.js diff --git a/.meteor/packages b/.meteor/packages index 9df6d6e8758..fff98875a3a 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -10,38 +10,38 @@ meteor-base@1.0.4 # Packages every Meteor app needs to have mobile-experience@1.0.4 # Packages for a great mobile UX blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views -es5-shim@4.6.14_1 # ECMAScript 5 compatibility for older browsers. -ecmascript@0.5.8_1 # Enable ECMAScript2015+ syntax in app code +es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers. +ecmascript@0.5.9 # Enable ECMAScript2015+ syntax in app code audit-argument-checks@1.0.7 # ensure meteor method argument validation browser-policy@1.0.9 # security-related policies enforced by newer browsers juliancwirko:postcss # CSS post-processing plugin (replaces standard-minifier-css) -standard-minifier-js@1.2.0_1 # a minifier plugin used for Meteor apps by default -session@1.1.6 # ReactiveDict whose contents are preserved across Hot Code Push -tracker@1.1.0 # Meteor transparent reactive programming library -mongo@1.1.12_1 +standard-minifier-js@1.2.1 # a minifier plugin used for Meteor apps by default +session@1.1.7 # ReactiveDict whose contents are preserved across Hot Code Push +tracker@1.1.1 # Meteor transparent reactive programming library +mongo@1.1.14 random@1.0.10 -reactive-var@1.0.10 +reactive-var@1.0.11 reactive-dict@1.1.8 -check@1.2.3 -http@1.2.9_1 -ddp-rate-limiter@1.0.5 -underscore@1.0.9 -logging@1.1.15_1 -reload@1.1.10 -ejson@1.0.12 -less@2.7.5_1 -service-configuration@1.0.10 +check@1.2.4 +http@1.2.10 +ddp-rate-limiter@1.0.6 +underscore@1.0.10 +logging@1.1.16 +reload@1.1.11 +ejson@1.0.13 +less@2.7.6 +service-configuration@1.0.11 amplify mdg:validated-method shell-server@0.2.1 # Meteor Auth Packages -accounts-base@1.2.11 -accounts-password@1.3.0 -accounts-facebook@1.0.10 -accounts-google@1.0.10 -accounts-twitter@1.1.11 -oauth-encryption@1.2.0 +accounts-base@1.2.14 +accounts-password@1.3.1 +accounts-facebook@1.0.11 +accounts-google@1.0.11 +accounts-twitter@1.1.12 +oauth-encryption@1.2.1 # accounts-github # accounts-weibo # accounts-oauth diff --git a/.meteor/release b/.meteor/release index 2631a23310e..c26084673d3 100644 --- a/.meteor/release +++ b/.meteor/release @@ -1 +1 @@ -METEOR@1.4.1.2 +METEOR@1.4.2 diff --git a/.meteor/versions b/.meteor/versions index 0b3afb09c72..e43518af313 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -1,9 +1,9 @@ -accounts-base@1.2.12_1 -accounts-facebook@1.0.10 -accounts-google@1.0.10 -accounts-oauth@1.1.13 -accounts-password@1.3.0 -accounts-twitter@1.1.11 +accounts-base@1.2.14 +accounts-facebook@1.0.11 +accounts-google@1.0.11 +accounts-oauth@1.1.14 +accounts-password@1.3.1 +accounts-twitter@1.1.12 alanning:roles@1.2.15 aldeed:autoform@5.8.1 aldeed:collection2@2.10.0 @@ -15,22 +15,22 @@ aldeed:template-extension@4.0.0 allow-deny@1.0.5 amplify@1.0.0 audit-argument-checks@1.0.7 -autoupdate@1.3.11 -babel-compiler@6.9.1_1 -babel-runtime@0.1.11_1 -base64@1.0.9 -binary-heap@1.0.9 +autoupdate@1.3.12 +babel-compiler@6.13.0 +babel-runtime@0.1.12 +base64@1.0.10 +binary-heap@1.0.10 blaze@2.1.9 blaze-html-templates@1.0.5 blaze-tools@1.0.10 -boilerplate-generator@1.0.10 +boilerplate-generator@1.0.11 browser-policy@1.0.9 -browser-policy-common@1.0.10 -browser-policy-content@1.0.11 -browser-policy-framing@1.0.11 -caching-compiler@1.1.7_1 +browser-policy-common@1.0.11 +browser-policy-content@1.0.12 +browser-policy-framing@1.0.12 +caching-compiler@1.1.8 caching-html-compiler@1.0.7 -callback-hook@1.0.9 +callback-hook@1.0.10 cfs:access-point@0.1.49 cfs:base-package@0.0.30 cfs:collection@0.5.5 @@ -51,53 +51,53 @@ cfs:tempstore@0.1.5 cfs:ui@0.1.3 cfs:upload-http@0.0.20 cfs:worker@0.1.4 -check@1.2.3 +check@1.2.4 chuangbo:cookie@1.1.0 -coffeescript@1.2.4_2 +coffeescript@1.11.1_2 dburles:factory@1.1.0 ddp@1.2.5 -ddp-client@1.3.1_1 -ddp-common@1.2.6 -ddp-rate-limiter@1.0.5 -ddp-server@1.3.10_1 +ddp-client@1.3.2 +ddp-common@1.2.7 +ddp-rate-limiter@1.0.6 +ddp-server@1.3.11 deps@1.0.12 -diff-sequence@1.0.6 +diff-sequence@1.0.7 dispatch:mocha@0.0.9 -ecmascript@0.5.8_1 -ecmascript-runtime@0.3.14_1 -ejson@1.0.12 -email@1.1.17_1 -es5-shim@4.6.14_1 -facebook@1.2.9 -fastclick@1.0.12 -geojson-utils@1.0.9 -google@1.1.14 +ecmascript@0.5.9 +ecmascript-runtime@0.3.15 +ejson@1.0.13 +email@1.1.18 +es5-shim@4.6.15 +facebook@1.2.10 +fastclick@1.0.13 +geojson-utils@1.0.10 +google@1.1.15 hot-code-push@1.0.4 html-tools@1.0.11 htmljs@1.0.11 -http@1.2.9_1 -id-map@1.0.8 +http@1.2.10 +id-map@1.0.9 jeremy:stripe@1.6.0 -johanbrook:publication-collector@1.0.2 +johanbrook:publication-collector@1.0.3 jparker:crypto-core@0.1.0 jparker:crypto-md5@0.1.1 jparker:gravatar@0.5.1 -jquery@1.11.9 +jquery@1.11.10 juliancwirko:postcss@1.1.1 juliancwirko:s-alert@3.2.0 juliancwirko:s-alert-stackslide@3.1.3 kadira:blaze-layout@2.3.0 kadira:dochead@1.5.0 kadira:flow-router-ssr@3.13.0 -launch-screen@1.0.12 -less@2.7.5_1 +launch-screen@1.1.0 +less@2.7.6 livedata@1.0.18 -localstorage@1.0.11 -logging@1.1.15_1 +localstorage@1.0.12 +logging@1.1.16 matb33:collection-hooks@0.8.4 mdg:validated-method@1.1.0 mdg:validation-error@0.5.1 -meteor@1.2.17_1 +meteor@1.6.0 meteor-base@1.0.4 meteorhacks:fast-render@2.16.0 meteorhacks:inject-data@2.0.0 @@ -105,62 +105,62 @@ meteorhacks:meteorx@1.4.1 meteorhacks:picker@1.0.3 meteorhacks:ssr@2.2.0 meteorhacks:subs-manager@1.6.4 -minifier-css@1.2.14_1 -minifier-js@1.2.14_1 -minimongo@1.0.17 +minifier-css@1.2.15 +minifier-js@1.2.15 +minimongo@1.0.18 mobile-experience@1.0.4 -mobile-status-bar@1.0.12 -modules@0.7.6_1 -modules-runtime@0.7.6_1 -momentjs:moment@2.15.1 -mongo@1.1.12_5 -mongo-id@1.0.5 +mobile-status-bar@1.0.13 +modules@0.7.7 +modules-runtime@0.7.7 +momentjs:moment@2.15.2 +mongo@1.1.14 +mongo-id@1.0.6 mongo-livedata@1.0.12 mrt:later@1.6.1 -npm-bcrypt@0.9.1_1 -npm-mongo@2.2.10_1 -oauth@1.1.11 -oauth-encryption@1.2.0 -oauth1@1.1.10 -oauth2@1.1.10 -observe-sequence@1.0.13 +npm-bcrypt@0.9.2 +npm-mongo@2.2.11_2 +oauth@1.1.12 +oauth-encryption@1.2.1 +oauth1@1.1.11 +oauth2@1.1.11 +observe-sequence@1.0.14 ongoworks:security@2.0.1 -ordered-dict@1.0.8 +ordered-dict@1.0.9 percolate:migrations@0.9.8 practicalmeteor:chai@2.1.0_1 practicalmeteor:mocha-core@1.0.1 practicalmeteor:sinon@1.14.1_2 -promise@0.8.7 +promise@0.8.8 raix:eventemitter@0.1.3 raix:ui-dropped-event@0.0.7 random@1.0.10 -rate-limit@1.0.5 +rate-limit@1.0.6 react-meteor-data@0.2.9 reactive-dict@1.1.8 -reactive-var@1.0.10 -reload@1.1.10 -retry@1.0.8 +reactive-var@1.0.11 +reload@1.1.11 +retry@1.0.9 risul:moment-timezone@0.5.0_5 -routepolicy@1.0.11 -service-configuration@1.0.10 -session@1.1.6 -sha@1.0.8 +routepolicy@1.0.12 +service-configuration@1.0.11 +session@1.1.7 +sha@1.0.9 shell-server@0.2.1 spacebars@1.0.13 spacebars-compiler@1.0.13 -srp@1.0.9 -standard-minifier-js@1.2.0_1 +srp@1.0.10 +standard-minifier-js@1.2.1 templating@1.2.15 templating-compiler@1.2.15 templating-runtime@1.2.15 templating-tools@1.0.5 tmeasday:check-npm-versions@0.3.1 tmeasday:publish-counts@0.8.0 -tracker@1.1.0 -twitter@1.1.12 +tracker@1.1.1 +twitter@1.1.13 ui@1.0.12 -underscore@1.0.9 -url@1.0.10 +underscore@1.0.10 +url@1.0.11 vsivsi:job-collection@1.4.0 -webapp@1.3.11_1 +webapp@1.3.12 webapp-hashing@1.0.9 diff --git a/.reaction/docker/base.dockerfile b/.reaction/docker/base.dockerfile index 5dc6bca608f..93a48b342e9 100644 --- a/.reaction/docker/base.dockerfile +++ b/.reaction/docker/base.dockerfile @@ -1,16 +1,19 @@ FROM debian:jessie MAINTAINER Reaction Commerce -ENV NODE_VERSION "4.6.0" +RUN groupadd -r node && useradd -m -g node node + +ENV NODE_VERSION 4.6.1 +ENV GOSU_VERSION 1.9 # Install MongoDB -ENV INSTALL_MONGO "true" -ENV MONGO_VERSION "3.2.10" -ENV MONGO_MAJOR "3.2" +ENV INSTALL_MONGO true +ENV MONGO_VERSION 3.2.10 +ENV MONGO_MAJOR 3.2 # Install PhantomJS -ENV INSTALL_PHANTOMJS "true" -ENV PHANTOM_VERSION "2.1.1" +ENV INSTALL_PHANTOMJS true +ENV PHANTOM_VERSION 2.1.1 # build directories ENV APP_SOURCE_DIR "/opt/reaction/src" @@ -22,28 +25,27 @@ COPY .reaction/docker/scripts $BUILD_SCRIPTS_DIR RUN chmod -R +x $BUILD_SCRIPTS_DIR # install base dependencies and clean up -RUN cd $BUILD_SCRIPTS_DIR && \ - bash $BUILD_SCRIPTS_DIR/install-deps.sh && \ - bash $BUILD_SCRIPTS_DIR/install-node.sh && \ - bash $BUILD_SCRIPTS_DIR/install-mongo.sh && \ - bash $BUILD_SCRIPTS_DIR/install-phantom.sh && \ - bash $BUILD_SCRIPTS_DIR/post-install-cleanup.sh +RUN bash $BUILD_SCRIPTS_DIR/install-deps.sh && \ + bash $BUILD_SCRIPTS_DIR/install-node.sh && \ + bash $BUILD_SCRIPTS_DIR/install-mongo.sh && \ + bash $BUILD_SCRIPTS_DIR/install-phantom.sh && \ + bash $BUILD_SCRIPTS_DIR/post-install-cleanup.sh # copy the app to the container ONBUILD COPY . $APP_SOURCE_DIR # install Meteor, build app, clean up -ONBUILD RUN cd $APP_SOURCE_DIR && \ - bash $BUILD_SCRIPTS_DIR/install-meteor.sh && \ +ONBUILD RUN bash $BUILD_SCRIPTS_DIR/install-meteor.sh && \ bash $BUILD_SCRIPTS_DIR/build-meteor.sh && \ bash $BUILD_SCRIPTS_DIR/post-build-cleanup.sh # set the default port that Node will listen on -ENV PORT 80 -EXPOSE 80 +# (can't be 80 because the process is run by a non-root user) +ENV PORT 3000 +EXPOSE 3000 WORKDIR $APP_BUNDLE_DIR/bundle # start the app -ENTRYPOINT ./entrypoint.sh -CMD [] +ENTRYPOINT ["./entrypoint.sh"] +CMD ["node", "main.js"] diff --git a/.reaction/docker/docker-compose.test.yml b/.reaction/docker/docker-compose.test.yml index f92adfffb66..8035672c043 100644 --- a/.reaction/docker/docker-compose.test.yml +++ b/.reaction/docker/docker-compose.test.yml @@ -5,7 +5,7 @@ reaction: links: - mongo ports: - - "80:80" + - "80:3000" environment: ROOT_URL: "http://localhost" MONGO_URL: "mongodb://mongo:27017/reaction" diff --git a/.reaction/docker/scripts/build-meteor.sh b/.reaction/docker/scripts/build-meteor.sh index f72e3f4ad19..fd57868b201 100755 --- a/.reaction/docker/scripts/build-meteor.sh +++ b/.reaction/docker/scripts/build-meteor.sh @@ -1,30 +1,35 @@ #!/bin/bash # -# builds a production meteor bundle directory +# builds a production meteor bundle # set -e -printf "\n[-] Building Meteor application...\n\n" - -: ${APP_BUNDLE_DIR:="/var/www"} -: ${BUILD_SCRIPTS_DIR:="/opt/reaction"} - cd $APP_SOURCE_DIR # Customize packages -bash $BUILD_SCRIPTS_DIR/build-packages.sh +$BUILD_SCRIPTS_DIR/build-packages.sh # Generate plugin import files -bash $BUILD_SCRIPTS_DIR/plugin-loader.sh +printf "\n[-] Running Reaction plugin loader...\n\n" +$BUILD_SCRIPTS_DIR/plugin-loader.sh # Install app deps +printf "\n[-] Running npm install...\n\n" meteor npm install -# build the source +# build the production bundle +printf "\n[-] Building Meteor application...\n\n" mkdir -p $APP_BUNDLE_DIR -meteor build --directory $APP_BUNDLE_DIR -cd $APP_BUNDLE_DIR/bundle/programs/server/ && meteor npm install --production +meteor build --unsafe-perm --directory $APP_BUNDLE_DIR + +# run npm install in bundle +printf "\n[-] Running npm install in server bundle...\n\n" +cd $APP_BUNDLE_DIR/bundle/programs/server/ +meteor npm install --production # put the entrypoint script in WORKDIR mv $BUILD_SCRIPTS_DIR/entrypoint.sh $APP_BUNDLE_DIR/bundle/entrypoint.sh + +# change ownership of the app to the node user +chown -R node:node $APP_BUNDLE_DIR diff --git a/.reaction/docker/scripts/build-packages.sh b/.reaction/docker/scripts/build-packages.sh index 92ca7baf540..294d0839fa0 100755 --- a/.reaction/docker/scripts/build-packages.sh +++ b/.reaction/docker/scripts/build-packages.sh @@ -7,5 +7,5 @@ if [ -f .reaction/docker/packages ]; then echo "[-] Using custom Meteor packages file..." - cp docker/packages .meteor/packages + cp .reaction/docker/packages .meteor/packages fi diff --git a/.reaction/docker/scripts/entrypoint.sh b/.reaction/docker/scripts/entrypoint.sh index da5ab9bc37b..80cff279e3b 100755 --- a/.reaction/docker/scripts/entrypoint.sh +++ b/.reaction/docker/scripts/entrypoint.sh @@ -7,17 +7,43 @@ # set -e -# start local mongodb if no external MONGO_URL was set + +# Set a delay to wait to start meteor container +if [[ $DELAY ]]; then + echo "Delaying startup for $DELAY seconds" + sleep $DELAY +fi + +# try to start local MongoDB if no external MONGO_URL was set if [[ "${MONGO_URL}" == *"127.0.0.1"* ]]; then if hash mongod 2>/dev/null; then - mkdir -p /data/db + mkdir -p /data/{db,configdb,logs} printf "\n[-] External MONGO_URL not found. Starting local MongoDB...\n\n" - mongod --storageEngine=wiredTiger --fork --logpath /var/log/mongodb.log + mongod --storageEngine=wiredTiger --fork --logpath /data/logs/mongodb.log else - echo "ERROR: Mongo not installed inside the container. Rebuild with INSTALL_MONGO=true" + echo "ERROR: Mongo not installed inside the container." + echo "Rebuild with INSTALL_MONGO=true or supply a MONGO_URL environment variable." exit 1 fi fi -# Run meteor -exec node ./main.js +if [ "${1:0:1}" = '-' ]; then + set -- node "$@" +fi + +# allow the container to be started with `--user` +if [ "$1" = "node" -a "$(id -u)" = "0" ]; then + chown -R node:node $APP_BUNDLE_DIR + exec gosu node "$BASH_SOURCE" "$@" +fi + +if [ "$1" = "node" ]; then + numa="numactl --interleave=all" + if $numa true &> /dev/null; then + set -- $numa "$@" + fi +fi + +# Start the app +echo "=> Starting Reaction on port $PORT..." +exec "$@" diff --git a/.reaction/docker/scripts/install-deps.sh b/.reaction/docker/scripts/install-deps.sh index 99444f82ba0..016aa92787d 100755 --- a/.reaction/docker/scripts/install-deps.sh +++ b/.reaction/docker/scripts/install-deps.sh @@ -2,9 +2,37 @@ set -e - printf "\n[-] Installing base OS dependencies...\n\n" -apt-get update -qq -y +apt-get update -y + +apt-get install -y --no-install-recommends \ + build-essential \ + bzip2 \ + ca-certificates \ + curl \ + graphicsmagick \ + numactl \ + python \ + wget + + +# Install gosu to build and run the app as a non-root user +# https://github.com/tianon/gosu +set -x + +dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" + +wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" +wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" + +export GNUPGHOME="$(mktemp -d)" + +gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 +gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu + +rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc + +chmod +x /usr/local/bin/gosu -apt-get install -qq -y --no-install-recommends curl ca-certificates bzip2 build-essential python graphicsmagick +gosu nobody true diff --git a/.reaction/docker/scripts/install-meteor.sh b/.reaction/docker/scripts/install-meteor.sh index d4e0e1896bf..521d98ddbe9 100755 --- a/.reaction/docker/scripts/install-meteor.sh +++ b/.reaction/docker/scripts/install-meteor.sh @@ -2,7 +2,10 @@ set -e -if [ "$DEV_BUILD" = "true" ]; then +if [ "$DEV_BUILD" = true ]; then + # if this is a devbuild, we don't have an app to check the .meteor/release file yet, + # so just install the latest version of Meteor + printf "\n[-] Installing the latest version of Meteor...\n\n" curl https://install.meteor.com/ | sh else # download installer script @@ -12,7 +15,7 @@ else METEOR_VERSION=$(head $APP_SOURCE_DIR/.meteor/release | cut -d "@" -f 2) # set the release version in the install script - sed -i "s/RELEASE=.*/RELEASE=\"$METEOR_VERSION\"/g" /tmp/install_meteor.sh + sed -i.bak "s/RELEASE=.*/RELEASE=\"$METEOR_VERSION\"/g" /tmp/install_meteor.sh # install printf "\n[-] Installing Meteor $METEOR_VERSION...\n\n" diff --git a/.reaction/docker/scripts/install-mongo.sh b/.reaction/docker/scripts/install-mongo.sh index bff619d6905..212f098184e 100644 --- a/.reaction/docker/scripts/install-mongo.sh +++ b/.reaction/docker/scripts/install-mongo.sh @@ -2,7 +2,7 @@ set -e -if [ "${INSTALL_MONGO}" = "true" ]; then +if [ "${INSTALL_MONGO}" = true ]; then printf "\n[-] Installing MongoDB ${MONGO_VERSION}...\n\n" @@ -17,11 +17,11 @@ if [ "${INSTALL_MONGO}" = "true" ]; then mongodb-org=$MONGO_VERSION \ mongodb-org-server=$MONGO_VERSION \ mongodb-org-shell=$MONGO_VERSION \ - mongodb-org-mongos=$MONGO_VERSION \ mongodb-org-tools=$MONGO_VERSION - rm -rf /var/lib/apt/lists/* - rm -rf /var/lib/mongodb + rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/mongodb + mv /etc/mongod.conf /etc/mongod.conf.orig fi diff --git a/.reaction/docker/scripts/install-phantom.sh b/.reaction/docker/scripts/install-phantom.sh index be4b1148e76..2bf5e09e904 100755 --- a/.reaction/docker/scripts/install-phantom.sh +++ b/.reaction/docker/scripts/install-phantom.sh @@ -2,7 +2,7 @@ set -e -if [ "${INSTALL_PHANTOMJS}" = "true" ]; then +if [ "${INSTALL_PHANTOMJS}" = true ]; then printf "\n[-] Installing Phantom.js...\n\n" @@ -19,7 +19,5 @@ if [ "${INSTALL_PHANTOMJS}" = "true" ]; then ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs - apt-get -y purge wget - - phantomjs -v + printf "\n[-] Successfully installed PhantomJS $(phantomjs -v)\n\n" fi diff --git a/.reaction/docker/scripts/post-build-cleanup.sh b/.reaction/docker/scripts/post-build-cleanup.sh index 99fc0e5073a..036a7cadecc 100755 --- a/.reaction/docker/scripts/post-build-cleanup.sh +++ b/.reaction/docker/scripts/post-build-cleanup.sh @@ -3,28 +3,23 @@ set -e printf "\n[-] Performing final cleanup...\n" +# get out of the src dir, so we can delete it +cd $APP_BUNDLE_DIR + # Clean out docs -rm -rf /usr/share/doc /usr/share/doc-base /usr/share/man /usr/share/locale /usr/share/zoneinfo +rm -rf /usr/share/{doc,doc-base,man,locale,zoneinfo} # Clean out package management dirs -rm -rf /var/lib/cache /var/lib/log +rm -rf /var/lib/{cache,log} # clean additional files created outside the source tree -rm -rf /root/.cache /root/.config /root/.local +rm -rf /root/{.cache,.config,.local,.npm,.cordova} rm -rf /tmp/* -# clean source tree -rm -rf $APP_SOURCE_DIR/packages/*/lib/bower -rm -rf $APP_SOURCE_DIR/packages/*/.git -rm -rf $APP_SOURCE_DIR/packages/*/.npm -rm -rf $APP_SOURCE_DIR/.meteor/local - -# clean additional files created outside the source tree -rm -rf /root/.npm /root/.cache /root/.config /root/.cordova /root/.local -rm -rf /tmp/* +# remove app source +rm -rf $APP_SOURCE_DIR # remove npm -npm cache clean rm -rf /opt/nodejs/bin/npm rm -rf /opt/nodejs/lib/node_modules/npm/ diff --git a/.reaction/docker/scripts/post-install-cleanup.sh b/.reaction/docker/scripts/post-install-cleanup.sh index dc3969eb76a..e5fd5c08330 100755 --- a/.reaction/docker/scripts/post-install-cleanup.sh +++ b/.reaction/docker/scripts/post-install-cleanup.sh @@ -4,15 +4,16 @@ set -e printf "\n[-] Performing post install cleanup...\n\n" # Clean out docs -rm -rf /usr/share/doc /usr/share/doc-base /usr/share/man /usr/share/locale /usr/share/zoneinfo +rm -rf /usr/share/{doc,doc-base,man,locale,zoneinfo} # Clean out package management dirs -rm -rf /var/lib/cache /var/lib/log +rm -rf /var/lib/{cache,log} # clean additional files created outside the source tree -rm -rf /root/.cache /root/.config /root/.local +rm -rf /root/{.cache,.config,.local} rm -rf /tmp/* # remove os dependencies +apt-get -y purge wget apt-get -y autoremove rm -rf /var/lib/apt/lists/* diff --git a/circle.yml b/circle.yml index d9782365e0b..8645be79cfc 100644 --- a/circle.yml +++ b/circle.yml @@ -12,7 +12,6 @@ dependencies: - "~/docker" override: - cd $HOME/reaction - - .reaction/scripts/clone-packages.sh - .reaction/docker/scripts/plugin-loader.sh test: @@ -26,20 +25,24 @@ deployment: prequel: branch: development commands: - - docker tag reactioncommerce/base:latest reactioncommerce/base:devel - - docker tag reactioncommerce/reaction:latest reactioncommerce/prequel:latest - - docker tag reactioncommerce/reaction:latest reactioncommerce/prequel:$CIRCLE_BUILD_NUM + - DOCKER_NAMESPACE=${DOCKER_NAMESPACE:-reactioncommerce} + - docker tag reactioncommerce/base:latest $DOCKER_NAMESPACE/base:devel + - docker tag reactioncommerce/reaction:latest $DOCKER_NAMESPACE/prequel:latest + - docker tag reactioncommerce/reaction:latest $DOCKER_NAMESPACE/prequel:$CIRCLE_BUILD_NUM - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - - docker push reactioncommerce/base:devel - - docker push reactioncommerce/prequel:$CIRCLE_BUILD_NUM - - docker push reactioncommerce/prequel:latest + - docker push $DOCKER_NAMESPACE/base:devel + - docker push $DOCKER_NAMESPACE/prequel:$CIRCLE_BUILD_NUM + - docker push $DOCKER_NAMESPACE/prequel:latest release: branch: master commands: - - docker tag reactioncommerce/base:latest reactioncommerce/base:$CIRCLE_BUILD_NUM - - docker tag reactioncommerce/reaction:latest reactioncommerce/reaction:$CIRCLE_BUILD_NUM + - DOCKER_NAMESPACE=${DOCKER_NAMESPACE:-reactioncommerce} + - docker tag reactioncommerce/base:latest $DOCKER_NAMESPACE/base:latest + - docker tag reactioncommerce/base:latest $DOCKER_NAMESPACE/base:$CIRCLE_BUILD_NUM + - docker tag reactioncommerce/reaction:latest $DOCKER_NAMESPACE/reaction:latest + - docker tag reactioncommerce/reaction:latest $DOCKER_NAMESPACE/reaction:$CIRCLE_BUILD_NUM - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - - docker push reactioncommerce/base:$CIRCLE_BUILD_NUM - - docker push reactioncommerce/base:latest - - docker push reactioncommerce/reaction:$CIRCLE_BUILD_NUM - - docker push reactioncommerce/reaction:latest + - docker push $DOCKER_NAMESPACE/base:$CIRCLE_BUILD_NUM + - docker push $DOCKER_NAMESPACE/base:latest + - docker push $DOCKER_NAMESPACE/reaction:$CIRCLE_BUILD_NUM + - docker push $DOCKER_NAMESPACE/reaction:latest diff --git a/client/modules/i18n/startup.js b/client/modules/i18n/startup.js index 26f01511883..8be073e69e8 100644 --- a/client/modules/i18n/startup.js +++ b/client/modules/i18n/startup.js @@ -55,6 +55,7 @@ Meteor.startup(() => { } }).fetch(); + // map reduce translations into i18next formatting const resources = translations.reduce(function (x, y) { const ns = Object.keys(y.translation)[0]; @@ -87,7 +88,7 @@ Meteor.startup(() => { // missingKeyHandler: function (lng, ns, key, fallbackValue) { // Meteor.call("i18n/addTranslation", lng, ns, key, fallbackValue); // } - }, (err, t) => { + }, () => { // someday this should work // see: https://github.com/aldeed/meteor-simple-schema/issues/494 for (const schema in _.omit(Schemas, "__esModule")) { @@ -105,7 +106,7 @@ Meteor.startup(() => { $elements = $("[data-i18n]").localize(); // apply language direction to html - if (t("languageDirection") === "rtl") { + if (i18next.dir(language) === "rtl") { return $("html").addClass("rtl"); } return $("html").removeClass("rtl"); diff --git a/client/modules/router/main.js b/client/modules/router/main.js index a8404548e4b..23d95dac86c 100644 --- a/client/modules/router/main.js +++ b/client/modules/router/main.js @@ -186,7 +186,7 @@ Router.initPackageRoutes = () => { for (const pkg of pkgs) { const newRoutes = []; // pkg registry - if (pkg.registry) { + if (pkg.registry && pkg.enabled) { const registry = Array.from(pkg.registry); for (const registryItem of registry) { // registryItems diff --git a/docker-compose.yml b/docker-compose.yml index 4dfce5ccab7..38a5244535e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ reaction: links: - mongo ports: - - "80:80" + - "80:3000" environment: ROOT_URL: "http://localhost" MONGO_URL: "mongodb://mongo:27017/reaction" diff --git a/imports/plugins/core/catalog/client/index.js b/imports/plugins/core/catalog/client/index.js new file mode 100644 index 00000000000..6427c1c1c56 --- /dev/null +++ b/imports/plugins/core/catalog/client/index.js @@ -0,0 +1,2 @@ +import "./templates/settings.html"; +import "./templates/settings.js" diff --git a/imports/plugins/core/catalog/client/templates/settings.html b/imports/plugins/core/catalog/client/templates/settings.html new file mode 100644 index 00000000000..13eeb189f64 --- /dev/null +++ b/imports/plugins/core/catalog/client/templates/settings.html @@ -0,0 +1,19 @@ + diff --git a/imports/plugins/core/catalog/client/templates/settings.js b/imports/plugins/core/catalog/client/templates/settings.js new file mode 100644 index 00000000000..f74084b0c3e --- /dev/null +++ b/imports/plugins/core/catalog/client/templates/settings.js @@ -0,0 +1,53 @@ +import { Packages } from "/lib/collections"; + +Template.catalogSettings.helpers({ + // + // check if this package setting is enabled + // + checked(pkg) { + let enabled; + const pkgData = Packages.findOne(pkg.packageId); + const setting = pkg.name.split("/").splice(-1); + + if (pkgData && pkgData.settings) { + if (pkgData.settings[setting]) { + enabled = pkgData.settings[setting].enabled; + } + } + return enabled === true ? "checked" : ""; + }, + // + // Template helper to add a hidden class if the condition is false + // + shown(pkg) { + let enabled; + const pkgData = Packages.findOne(pkg.packageId); + const setting = pkg.name.split("/").splice(-1); + + if (pkgData && pkgData.settings) { + if (pkgData.settings[setting]) { + enabled = pkgData.settings[setting].enabled; + } + } + + return enabled !== true ? "hidden" : ""; + } +}); + +Template.catalogSettings.events({ + /** + * taxSettings settings update enabled status for tax service on change + * @param {event} event jQuery Event + * @return {void} + */ + "change input[name=enabled]": (event) => { + const name = event.target.value; + const packageId = event.target.getAttribute("data-id"); + const fields = [{ + property: "enabled", + value: event.target.checked + }]; + + Meteor.call("registry/update", packageId, name, fields); + } +}); diff --git a/imports/plugins/core/catalog/register.js b/imports/plugins/core/catalog/register.js new file mode 100644 index 00000000000..65610c8a905 --- /dev/null +++ b/imports/plugins/core/catalog/register.js @@ -0,0 +1,27 @@ +import { Reaction } from "/server/api"; + +Reaction.registerPackage({ + label: "Catalog", + name: "reaction-catalog", + icon: "fa fa-archive", + autoEnable: true, + settings: { + name: "Catalog" + }, + registry: [ + { + provides: "dashboard", + label: "Catalog", + description: "Product catalog", + icon: "fa fa-archive", + priority: 2, + container: "core" + }, + { + label: "Catalog Settings", + name: "catalog/settings", + provides: "settings", + template: "catalogSettings" + } + ] +}); diff --git a/imports/plugins/core/layout/client/templates/layout/alerts/reactionAlerts.js b/imports/plugins/core/layout/client/templates/layout/alerts/reactionAlerts.js index 82c26e24937..9d992c7c33a 100644 --- a/imports/plugins/core/layout/client/templates/layout/alerts/reactionAlerts.js +++ b/imports/plugins/core/layout/client/templates/layout/alerts/reactionAlerts.js @@ -70,6 +70,11 @@ Object.assign(Alerts, { if (isConfirm === true && typeof messageOrCallback === "function") { messageOrCallback(isConfirm); } + }).catch(function (err) { + if (err === "cancel" || err === "overlay" || err === "timer") { + return undefined; // Silence error + } + throw err; }); } @@ -85,6 +90,11 @@ Object.assign(Alerts, { if (isConfirm === true && typeof callback === "function") { callback(isConfirm); } + }).catch(function (err) { + if (err === "cancel" || err === "overlay" || err === "timer") { + return undefined; // Silence error + } + throw err; }); }, diff --git a/imports/plugins/core/revisions/client/components/publishControls.js b/imports/plugins/core/revisions/client/components/publishControls.js index c5b46e47440..1f6a35b15c5 100644 --- a/imports/plugins/core/revisions/client/components/publishControls.js +++ b/imports/plugins/core/revisions/client/components/publishControls.js @@ -157,10 +157,10 @@ class PublishControls extends Component { if (this.props.revisions[0].documentData.isDeleted) { return (