Skip to content

feat: add lib and es6 bundles, use closure compiler, remove gulp #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ba51883
chore(karma): move karma config to config/karma and update to use web…
frederickfogerty Jul 9, 2018
3f19eba
chore(build): use webpack rather than browserify
frederickfogerty Jul 9, 2018
68cdfb4
chore: use npm scripts rather than gulp
frederickfogerty Jul 9, 2018
69afaf9
fix: update source to work with google closure compiler
frederickfogerty Jul 9, 2018
4c77487
chore: update various things to new build tool
frederickfogerty Jul 9, 2018
7ac5701
Sync with Prettier
prettierci-commits Jul 9, 2018
1a42d60
feat: add browserslist to show what browsers are supported and to hel…
frederickfogerty Jul 10, 2018
168426f
chore(build-js): don't run closure on test files
frederickfogerty Jul 10, 2018
5a58385
Merge branch 'fred/use-webpack' of https://github.com/imgix/drift int…
frederickfogerty Jul 10, 2018
0aa962a
docs(contributing): update build references to npm rather than gulp
frederickfogerty Jul 10, 2018
5f19fa0
chore: remove reference to gulp in bower
frederickfogerty Jul 10, 2018
6a5c4ea
chore(karma): add comments
frederickfogerty Jul 10, 2018
a58c622
fix(travis): fix config file (tabs -> spaces)
frederickfogerty Jul 10, 2018
17a3097
chore: remove phantomjs and other deps
frederickfogerty Jul 10, 2018
8bf7357
chore: remove more deps
frederickfogerty Jul 10, 2018
1d1286c
feat(travis): upgrade to node 10
frederickfogerty Jul 10, 2018
340c24c
chore(karma): update ci karma config
frederickfogerty Jul 10, 2018
d346485
chore(webpack): remove unused dependencies
frederickfogerty Jul 16, 2018
ae352e7
chore(bower): update ignored files
frederickfogerty Jul 16, 2018
846f151
chore(CONTRIBUTING): fix tab alignment
frederickfogerty Jul 16, 2018
3ea92a0
Merge branch 'fred/use-webpack' of https://github.com/imgix/drift int…
frederickfogerty Jul 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"presets": ["es2015", "stage-0"]
"presets": [["env", { "modules": false }]],
"plugins": [],
"env": {
"commonjs": {
"presets": ["env"]
},
"test": {
"presets": ["env"]
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### PLACE CUSTOM IGNORES HERE
lib
es



Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
CHANGELOG.md
package.json
bower.json
es
lib
dist
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: node_js
node_js:
- '4'
- '10'
install:
- npm install
script:
- gulp build-ci
- npm run build
- npm run test:ci
# See https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements
env:
- CXX=g++-4.8
Expand Down
17 changes: 8 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,11 @@ license your work under the same license as that used by the project.
## Code Conventions

1. Make all changes to files under `./src`, **not** `./dist`.
2. Use [Gulp](#gulp) to build the JavaScript files.
3. Use [Prettier](https://prettier.io/) for code formatting. Code will automatically be formatted upon submitting a PR.
2. Use [Prettier](https://prettier.io/) for code formatting. Code will automatically be formatted upon submitting a PR.

<a name="gulp"></a>
<a name="npm-scripts"></a>

### Using ES6 and Gulp
### Using ES6 and NPM scripts

To install all development dependencies, in the project's root directory, run

Expand All @@ -158,13 +157,13 @@ npm install
Once you're configured, building the JavaScript from the command line is easy:

```
gulp # build Drift from source
gulp watch # watch for changes and build automatically, testing with PhantomJS
gulp test-local # run the test against local browsers only (Chrome, Safari, Firefox)
gulp test-full # run the test suite against all supported browsers (using SauceLabs)
npm run build # build Drift from source
npm run build:watch # watch for changes and build automatically
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Handsome tab spacing is broken here

npm run test:watch # watch for changes and test automatically
npm run test:local # run the test against local browsers only (Chrome, Safari, Firefox)
```

Please note: in order to run tests in-browser (with `gulp test-local`), Chrome and Firefox should be installed locally. If you want to run `gulp test-full`, `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` must be defined in your shell.
Please note: in order to run tests in-browser (with `npm run test:local`), Chrome and Firefox should be installed locally.

### Cutting a release

Expand Down
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.2.2",
"description": "Easily add \"zoom on hover\" functionality to your site's images. Lightweight, no-dependency JavaScript.",
"main": [
"dist/Drift.js",
"dist/Drift.min.js",
"dist/drift-basic.css"
],
"authors": [
Expand All @@ -25,7 +25,6 @@
"src",
"test",
"CONTRIBUTING.md",
"gulpfile.js",
"index.html",
"karmaConfig.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the files in this list need updating

"package.json"
Expand Down
1 change: 1 addition & 0 deletions config/karma/karma-ci.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("./karma.config").ci;
1 change: 1 addition & 0 deletions config/karma/karma-local.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("./karma.config").local;
131 changes: 131 additions & 0 deletions config/karma/karma.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
const webpackConfig = require("../../webpack.config");

const webpackConfigAugmented = {
...webpackConfig,
module: {
...webpackConfig.module,
rules: [
// ...webpackConfig.module.rules,
{
test: /(\.jsx|\.js)$/,
loader: "babel-loader",
exclude: /(node_modules|bower_components)/
}
]
}
};

const baseConfig = {
frameworks: ["jasmine"],
files: [
{ pattern: "../../src/**/*.js", included: false, served: false, watched: false },
{ pattern: "../../test/**/test*.js", watched: false }
],
preprocessors: {
"../../src/**/*.js": ["webpack"],
"../../test/**/*.js": ["webpack"]
},
webpack: webpackConfigAugmented,
webpackMiddleware: {
stats: "errors-only"
},
concurrency: 5,
captureTimeout: 90000,
browserConnectTimeout: 3000,
browserNoActivityTimeout: 15000
};

const stringConfig = JSON.stringify(baseConfig);

/**
* Local testing - Chrome and FF, headlessly
*/

const localConfig = karmaConfig => {
const config = {
...baseConfig,
browsers: ["ChromeHeadless", "FirefoxHeadless"],
customLaunchers: {
FirefoxHeadless: {
base: "Firefox",
flags: ["-headless"]
}
}
};

karmaConfig.set(config);
};

/**
* CI testing - Chrome, Firefox
*/

const ciConfig = karmaConfig => {
const config = {
...baseConfig,
browsers: ["ChromeTravis", "FirefoxHeadless"],
customLaunchers: {
ChromeTravis: {
base: "ChromeHeadless",
flags: ["--no-sandbox"]
},
FirefoxHeadless: {
base: "Firefox",
flags: ["-headless"]
}
},
client: {
mocha: {
timeout: 20000 // 20 seconds
}
}
};

karmaConfig.set(config);
};

/**
* SauceLabs configuration - not supported
*/

var fullConfig = JSON.parse(stringConfig);
fullConfig.reporters = ["progress", "saucelabs"];
fullConfig.saucelabs = { testName: "Drift Tests" };
fullConfig.browsers = [
"sl_chrome",
"sl_safari_9",
"sl_safari_8",
"sl_firefox_42",
"sl_firefox_41",
"sl_ie_11",
"sl_ie_10",
"sl_ios_9",
"sl_ios_8",
"sl_android_5",
"sl_android_4"
];
fullConfig.customLaunchers = {
sl_chrome: { base: "SauceLabs", browserName: "Chrome" },
sl_safari_9: { base: "SauceLabs", browserName: "Safari", version: 9 },
sl_safari_8: { base: "SauceLabs", browserName: "Safari", version: 8 },
sl_firefox_42: { base: "SauceLabs", browserName: "Firefox", version: 42 },
sl_firefox_41: { base: "SauceLabs", browserName: "Firefox", version: 41 },
sl_ie_11: {
base: "SauceLabs",
browserName: "Internet Explorer",
version: "11"
},
sl_ie_10: {
base: "SauceLabs",
browserName: "Internet Explorer",
version: "10"
},
sl_ios_9: { base: "SauceLabs", browserName: "iPhone", version: "9.2" },
sl_ios_8: { base: "SauceLabs", browserName: "iPhone", version: "8.4" },
sl_android_5: { base: "SauceLabs", browserName: "Android", version: "5.1" },
sl_android_4: { base: "SauceLabs", browserName: "Android", version: "4.4" }
};

exports.local = localConfig;
exports.ci = ciConfig;
exports.full = karmaConfig => karmaConfig.set(fullConfig);
102 changes: 0 additions & 102 deletions gulpfile.js

This file was deleted.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ <h1>Drift Demo</h1>
</div>
</div>

<script src="dist/Drift.js"></script>
<script src="dist/Drift.min.js"></script>
<script>
new Drift(document.querySelector('.drift-demo-trigger'), {
paneContainer: document.querySelector('.detail'),
Expand Down
Loading