Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Commit

Permalink
convert to standard
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Miller committed Feb 9, 2017
1 parent 5a911f7 commit 12a7163
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 54 deletions.
48 changes: 8 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,57 +1,25 @@
#
# Binaries.
#

DUO = node_modules/.bin/duo
ESLINT = node_modules/.bin/eslint
UGLIFYJS = node_modules/.bin/uglifyjs

#
# Files.
#

SRC = $(wildcard lib/*.js)

#
# Chore tasks.
#

# Install node dependencies.
node_modules: package.json $(wildcard node_modules/*/package.json)
@npm install
@touch node_modules
node_modules: package.json
npm install
touch $@

# Remove temporary/built files.
clean:
rm -rf *.log analytics.js analytics.min.js
.PHONY: clean

# Remove temporary/built files and vendor dependencies.
distclean: clean
rm -rf components node_modules
.PHONY: distclean

#
# Build tasks.
#

# Build analytics.js.
analytics.js: node_modules $(SRC) package.json
@$(DUO) --stdout --standalone analytics lib/index.js > $@
./node_modules/.bin/duo --stdout --standalone analytics lib/index.js > $@

# Build minified analytics.js.
analytics.min.js: analytics.js
@$(UGLIFYJS) $< --output $@
./node_modules/.bin/uglifyjs $< --output $@

# Build shortcut.
build: analytics.min.js
.PHONY: build

#
# Test tasks.
#

# Lint JavaScript source.
lint: node_modules
@$(ESLINT) $(SRC)
.PHONY: lint
./node_modules/.bin/standard

.PHONY: clean distclean build lint
20 changes: 10 additions & 10 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@
/**
* Analytics.js
*
* (C) 2015 Segment.io Inc.
* (C) 2017 Segment Inc.
*/

var analytics = require('segmentio/analytics.js-core');
var Integrations = require('./integrations');
var each = require('each');
var analytics = require('segmentio/analytics.js-core')
var Integrations = require('./integrations')
var each = require('each')

/**
* Expose the `analytics` singleton.
*/

module.exports = exports = analytics;
module.exports = exports = analytics

/**
* Expose require.
*/

analytics.require = require;
analytics.require = require

/**
* Expose `VERSION`.
*/

exports.VERSION = require('../bower.json').version;
exports.VERSION = require('../bower.json').version

/**
* Add integrations.
*/

each(Integrations, function(name, Integration) {
analytics.use(Integration);
});
each(Integrations, function (name, Integration) {
analytics.use(Integration)
})
4 changes: 2 additions & 2 deletions lib/integrations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint quote-props: 0 */
'use strict';
'use strict'

module.exports = {
'adroll': require('analytics.js-integration-adroll'),
Expand Down Expand Up @@ -89,4 +89,4 @@ module.exports = {
'woopra': require('analytics.js-integration-woopra'),
'wootric': require('analytics.js-integration-wootric'),
'yandex-metrica': require('analytics.js-integration-yandex-metrica')
};
}
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@
"dependencies": {},
"devDependencies": {
"duo": "^0.12.0",
"eslint": "0.x",
"eslint-config-segment": "^1.0.7",
"standard": "^8.6.0",
"uglify-js": ">= 1.3.4"
},
"standard": {
"ignore": [
"analytics.js",
"analytics.min.js"
]
}
}

0 comments on commit 12a7163

Please sign in to comment.