Skip to content

Commit

Permalink
Merge pull request #4 from grnwood/master
Browse files Browse the repository at this point in the history
Cartridge updates from DWRE Certification (in progress)
  • Loading branch information
rikterbeek authored Dec 5, 2016
2 parents bc685f2 + fdf6108 commit 12f280c
Show file tree
Hide file tree
Showing 1,465 changed files with 159,863 additions and 773 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Salesforce Commerce Cloud (formerly Demandware)
# demandware
demandware
14 changes: 14 additions & 0 deletions cartridges/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
node_modules
*.log
*.swp
*.map
.idea/
dw.json
demo_data_no_hires_images.zip
Thumbs.db
app_storefront_core/cartridge/static/*/css/style.css
app_storefront_core/cartridge/static/*/js/app.js
test/application/pageObjects/testData/parsedData.txt
test/reports/*.xml
coverage
104 changes: 104 additions & 0 deletions cartridges/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Welcome to the SiteGenesis Repository

Please note that `master` is under active development, so please use with caution.
Check out our tagged versions if you'd like more stable, tested releases. We recommend starting any new project based off the latest [tag](https://bitbucket.org/demandware/sitegenesis#tags), and never from the HEAD of the `master` branch!

# Purpose

The goals of this repository are:

* To provide earlier access to Demandware developers as platform releases are pushed to the sandboxes
* To provide 'git' access to the code so that you can cherry pick specific fixes (or even merge entire releases!) into your code lines
* To provide the community a vehicle for submitting code changes via git's 'pull request' mechanism
* To allow community members to share (un-tested) code branches with each other.

License and Attribution Guide is available at https://xchange.demandware.com/docs/DOC-29638.

Important installation note: if you merely import the code for this site without importing the data, you will most likely see a "broken" footer. The 15.4 footer uses some new content assets. We recommend exporting your current site, importing the site data from the `demo_data_no_hires_images` directory and then re-import your custom data.

A detailed submission guideline is posted on XChange (https://xchange.demandware.com/docs/DOC-21927).

Thank you for your submissions and your thoughts on the best way to utilize this resource.

# Shared Content Site
One of the new features as of SiteGenesis 14.8 is the ability to demonstrate the use of the Shared Content facility built into Demandware. To enable this capability, the content library in Site Genesis has been rebuilt as a "shared library". In order to demonstrate the power of this feature, we have created a new site which shares this library with Site Genesis. The new site, called "SiteGenesisCollections". You can download the cartrdige which contains this new site from https://bitbucket.org/demandware/sitegenesis-content-sharing


# Test Automation

Please read the README.md file in the test directory, but essentially, we have a series of application and unit tests that are runnable from the commandline using either 'grunt' or 'gulp'. The README.md in the test directory will guide in installing and running the tools that you need for executing these tests.

Please note: the tests that we are offering is not a complete, fixed set of tests. This is a living directory which we will continue to add to as our team is able. We also encourage any reader of this document to use these tests as a model and to enhance this capability by adding their own tests.

# How to Use
## Build tools
Starting with 15.1, SiteGenesis supports both [gulp](http://gulpjs.com) and [Grunt](http://gruntjs.com) as build tools.

### Getting started
- Pull down the latest copy of SiteGenesis. If you're reading this doc, it is likely that you already have a version of SG with the build tool config.
- `cd` into the `sitegenesis` directory.
- Install node modules:
```sh
$ npm install
```
This assumes that you already have `npm` installed on your command line. If not, please [install node](http://nodejs.org/download/) first.
If you encounter an error, please try and address that first, either by Googling or [contacting us](mailto:[email protected]).
- Install either `gulp` or `grunt` (see below).

#### gulp
Install gulp globally
```sh
$ npm install -g gulp
```

#### grunt
Install the grunt command line tools
```sh
$ npm install -g grunt-cli
```

Now that you have gulp (or grunt) and its dependencies installed, you can start using it in your workflow.


### SCSS
Before authoring SCSS, make sure to check out the README in the `app_storefront_core/cartridge/scss` directory.

#### `gulp css`
This task does 2 things:
- Compile `.scss` code into `.css`
- [Auto-prefix](https://github.com/ai/autoprefixer) for vendor prefixes

This task is also run automatically on any `.scss` file change by using the `gulp watch` task.

The equivalent task for grunt, `grunt css`, is also available.

### JS
Before authoring JS, make sure to checkout the README in `app_storefront_core/cartridge/js` directory.

The new modular JavaScript architecture relies on [browserify](https://github.com/substack/node-browserify) to compile JS code written in CommonJS standard.

#### `gulp js`

Compile JS modules in the `js` directory into `static/default/js` directory. The entry point for browserify is `app_storefront_core/cartridge/js/app.js`, and the bundled js is output to `app_storefront_core/cartridge/static/default/js/app.js`.

This task is also run automatically on any `.js` file change by using the `gulp watch` task.

The equivalent task for grunt, `grunt js`, is also available.

#### `gulp jscs` and `gulp jshint`
Run code format and style validators. New code must not have any errors reported before being accepted.

The equivalent tasks for grunt, `grunt jscs` and `grunt jshint`, are also available.

### Watching
To make the development process easier, running `gulp` on the command line will run the default task and automatically watch any changes in both `scss` and `js` code to run the right compilers.

For JavaScript, when watching is happening, [watchify](https://github.com/substack/watchify) is used instead of browserify for faster bundling by taking advantage of caching.

The equivalent default task for grunt, `grunt`, is also available.

### Sourcemaps
For sourcemaps support, run `gulp` or `grunt` in development mode by specificying `type` flag, i.e. `:; gulp --sourcemaps`.

We only support external sourcemaps because Eclipse tend to crash with inline sourcemaps.
As a result, if you're using Grunt, sourcemaps is only available when the build steps are run explicitly, i.e. `grunt js --sourcemaps`. Sourcemaps is not enabled during `watch` mode.
17 changes: 17 additions & 0 deletions cartridges/app_storefront_controllers/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app_storefront_controllers</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.demandware.studio.core.beehiveElementBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.demandware.studio.core.beehiveNature</nature>
</natures>
</projectDescription>
14 changes: 14 additions & 0 deletions cartridges/app_storefront_controllers/.tern-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ecmaVersion": 5,
"plugins": {
"guess-types": {

},
"outline": {

},
"demandware": {

}
}
}
7 changes: 7 additions & 0 deletions cartridges/app_storefront_controllers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Welcome to Next Generation SiteGenesis

This SiteGenesis is now fully standard Javascript compliant using the new [Controllers]{@tutorial Controllers} concept to handle incoming requests. The controllers integrate nicely into a completely redesigned MVC concept which also includes [Models]{@tutorial Models} and [Views]{@tutorial Views}. All scripts are [Common JS modules](http://www.commonjs.org) with defined and documented exports to avoid polluting the global namespace.

This documentation is meant to serve as a reference to quickly lookup supported functionality and is fully based on the documentation inside the code. You can continue to maintain these [JSDoc comments](http://usejsdoc.org/) to generate a similar documentation for your own project.

Enjoy!
151 changes: 151 additions & 0 deletions cartridges/app_storefront_controllers/cartridge/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"env": {
"commonjs": true,
"es6": true
},
"globals": {
"dw": true,
"customer": true,
"session": true,
"request": true,
"response": true,
"empty": true,
"PIPELET_ERROR": true,
"PIPELET_NEXT": true
},
"extends": "eslint:recommended",
"rules": {
"arrow-body-style": 2,
"arrow-parens": 2,
"arrow-spacing": 2,
"block-scoped-var": 0,
"block-spacing": [
2,
"never"
],
"brace-style": 0,
"callback-return": 0,
"camelcase": [
2,
{
"properties": "never"
}
],
"comma-style": [
2,
"last"
],
"computed-property-spacing": [
2,
"never"
],
"consistent-this": 0,
"default-case": 0,
"dot-location": [
2,
"property"
],
"dot-notation": [
2,
{
"allowKeywords": true
}
],
"eol-last": 0,
"func-style": 0,
"global-require": 0,
"guard-for-in": 0,
"handle-callback-err": 2,
"indent": [2, 4, { "SwitchCase": 1 }],
"key-spacing": 2,
/*"keyword-spacing": [
2,
{
"after": true,
"before": true
}
],*/
"linebreak-style": [
2,
"unix"
],
"max-depth": 0,
"max-params": 0,
"no-alert": 2,
"no-bitwise": 0,
"no-caller": 0,
"no-continue": 0,
"no-extra-bind": 2,
"no-inner-declarations": [
2,
"functions"
],
"no-invalid-this": 0,
"no-lonely-if": 0,
"no-multi-str": 2,
"no-multiple-empty-lines": 0,
"no-new": 0,
"no-plusplus": 0,
"no-process-env": 2,
"no-return-assign": 2,
"no-spaced-func": 2,
// "no-unmodified-loop-condition": 2,
"no-unneeded-ternary": [
2,
{
"defaultAssignment": true
}
],
"no-unused-expressions": 2,
"no-useless-call": 0,
"object-curly-spacing": [
2,
"never"
],
"operator-assignment": [
2,
"always"
],
"prefer-const": 0,
"prefer-spread": 0,
"quotes": [
2,
"single"
],
"radix": [
2,
"as-needed"
],
"semi-spacing": [
2,
{
"after": true,
"before": false
}
],
// "sort-imports": 2,
"sort-vars": 0,
"space-after-keywords": [
2,
"always"
],
"space-before-keywords": [
2,
"always"
],
"space-in-parens": [
2,
"never"
],
"space-unary-ops": [
2,
{
"nonwords": false,
"words": false
}
],
"strict": 0,
"wrap-regex": 0,
"yoda": 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## cartridge.properties for cartridge app_storefront_controllers
#Thu Apr 16 15:12:03 CEST 2015
demandware.cartridges.app_storefront_controllers.multipleLanguageStorefront=true
demandware.cartridges.app_storefront_controllers.id=app_storefront_controllers
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

/**
* Controller that reports to the Salesforce Commerce Cloud A/B test engine when a customer starts
* checkout in the storefront. This event is recorded only for the purposes of updating A/B test statistics and
* does not affect the basket. This controller does not ordinarily need to be customized.
*
* @module controllers/ABTestEvent
*/

/* Script Modules */
var app = require('~/cartridge/scripts/app');
var guard = require('~/cartridge/scripts/guard');

/**
* Gets a CartModel object that wraps a Basket object. Registers a "start checkout" event for the specified basket.
* This event is tracked for A/B test statistics but otherwise has no effect on the basket.
* The system registers at most one checkout per basket per session.
*/
function startCheckout() {
var cart = app.getModel('Cart').get();

if (cart) {
cart.object.startCheckout();
app.getView().render('util/reporting/reporting');
} else {
app.getView().render('util/reporting/reporting');
}
}

/*
* Module exports
*/

/*
* Web exposed methods
*/
/**
* Registers the 'start checkout' event for A/B testing.
* You must use GET to access the function via URL.
* @see module:controllers/ABTestEvent~startCheckout
*/
exports.StartCheckout = guard.ensure(['get'], startCheckout);
Loading

0 comments on commit 12f280c

Please sign in to comment.