Skip to content

Commit

Permalink
Merge pull request #44 from salesforce-ux/internal-build
Browse files Browse the repository at this point in the history
Internal build
  • Loading branch information
aputinski committed Oct 14, 2015
2 parents d05f798 + 9284647 commit ffaf8da
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/.generated
/.www
/scripts/deploy
/scripts-internal
/git_modules
/node_modules
/public
Expand Down
5 changes: 2 additions & 3 deletions app_modules/site/browser/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,12 @@ window.LIGHTNING_DESIGN_SYSTEM = {
*
*/
userType: function() {
// there will be no usertype in dev
// DEFAULT_USER_TYPE is provided by webpack in "compile.js"
return globals.userType(document.cookie) || DEFAULT_USER_TYPE;
return DEFAULT_USER_TYPE;
},

isExternalUser: function(){
return this.userType() !== 'internal';
return this.userType() === 'external';
},

isMobile: function() {
Expand Down
9 changes: 1 addition & 8 deletions app_modules/site/preferences/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ import _ from 'lodash';
/**
* Defaults that will be merged in to both user types
*/
let defaults = {

};
let defaults = {};

export default {

dev: _.defaults({
role: 'regular',
status: 'all'
}, defaults),

internal: _.defaults({
role: 'aura',
status: 'dev-ready'
Expand Down
6 changes: 5 additions & 1 deletion app_modules/site/preferences/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import _ from 'lodash';
import { EventEmitter } from 'events';
import { DefaultsStrategy } from './strategies';
import PrefsDefaults from './defaults';
import minimist from 'minimist';

const argv = minimist(process.argv.slice(2));
const isInternal = argv.internal === true;

const emitter = new EventEmitter();
emitter.setMaxListeners(20);
Expand All @@ -38,7 +42,7 @@ const statuses = [
/**
* Default set of preferences before the browser loads
*/
let prefs = PrefsDefaults.internal;
let prefs = isInternal ? PrefsDefaults.internal : PrefsDefaults.external;

/**
* Default strategy before the browser loads
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"deep-diff": "0.3.2",
"eslint": "1.3.1",
"eslint-loader": "1.0.0",
"fs-extra": "^0.24.0",
"gdm": "0.0.9",
"glob": "5.0.14",
"glob-watcher": "2.0.0",
Expand Down
8 changes: 5 additions & 3 deletions scripts/helpers/version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var path = require('path')
var packagePath = path.resolve(process.cwd(), 'package.json')
console.log(require(packagePath).version)
var path = require('path');
var packagePath = path.resolve(process.cwd(), 'package.json');
var version = require(packagePath).version;
console.log(version);
module.exports = version;
8 changes: 7 additions & 1 deletion scripts/npm/prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ export GIT_VERSION=`node scripts/helpers/version.js`
echo "SLDS version: <$GIT_VERSION>"

npm run lint
./node_modules/.bin/babel-node scripts/build.js --prod

if [[ X"$INTERNAL_BRANCHES" == *X"$TRAVIS_BRANCH"* ]]; then
echo "--prod --internal"
./node_modules/.bin/babel-node scripts/build.js --prod --internal
else
echo "--prod"
./node_modules/.bin/babel-node scripts/build.js --prod
fi
2 changes: 1 addition & 1 deletion scripts/tasks/site/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const webpackConfig = {
},
plugins: [
new webpack.DefinePlugin({
DEFAULT_USER_TYPE: JSON.stringify(isInternal ? 'internal' : 'dev')
DEFAULT_USER_TYPE: JSON.stringify(isInternal ? 'internal' : 'external')
})
],
cache: {},
Expand Down
4 changes: 2 additions & 2 deletions scripts/travis/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set -e

if [ -n "$DEPLOY_SCRIPTS_REPO" ]; then
rm -rf scripts-internal
git clone $DEPLOY_SCRIPTS_REPO scripts-internal
scripts-internal/deploy/heroku-ci.sh
git clone $DEPLOY_SCRIPTS_REPO -b server-refactor scripts-internal
./node_modules/.bin/babel-node scripts-internal/deploy/heroku-ci.js
fi

0 comments on commit ffaf8da

Please sign in to comment.