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

Commit

Permalink
v3.0.0 - Rebuild scrollNav to use native JavaScript
Browse files Browse the repository at this point in the history
Replaced jQuery with native JS and removed all production dependencies
(development does require deps). Reduced the number of user options to simplify
the API and reduced the amount of DOM manipulation to reduce likelihood of
browser bugs. Includes a full set of test suites for all modules (unless
noted).
  • Loading branch information
jimmynotjim committed Dec 23, 2018
1 parent 9ad1ed0 commit 3c27263
Show file tree
Hide file tree
Showing 91 changed files with 16,245 additions and 15,523 deletions.
1 change: 1 addition & 0 deletions .eslintignore
@@ -0,0 +1 @@
test/coverage
21 changes: 21 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,21 @@
{
"env": {
"browser": true,
"es6": true
},
"plugins": ["prettier"],
"extends": ["eslint:recommended", "prettier"],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2017
},
"globals": {
"module": false
},
"rules": {
"prettier/prettier": "error",
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single"],
"semi": ["error", "always"]
}
}
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -6,3 +6,6 @@
/node_modules/
npm-debug.log
bower_components

## Test Coverage Files
test/coverage/
10 changes: 10 additions & 0 deletions .jestrc.json
@@ -0,0 +1,10 @@
{
"collectCoverage": true,
"coverageDirectory": "test/coverage",
"collectCoverageFrom": ["src/**/*.js"],
"coveragePathIgnorePatterns": ["/node_modules", "/src/scrollNav.v2-7-3.js"],
"transform": {
"^.+\\.js$": "<rootDir>/jest.transform.js"
},
"setupFiles": ["<rootDir>/jest.setup.js"]
}
14 changes: 0 additions & 14 deletions .jshintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .prettierrc.json
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
11 changes: 6 additions & 5 deletions .travis.yml
@@ -1,7 +1,8 @@
language: node_js
node_js:
- 0.10
before_script:
- npm install -g grunt-cli
- npm install semver
- npm install util
- "8"
- "10"
install:
- npm install
- npm install codecov
- codecov
20 changes: 15 additions & 5 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,16 @@ And constructed with these guidelines:

For more information on semantic versioning, please visit http://semver.org/.

## v3.0.0 - December 22, 2018

Version 3 is a complete re-write of scrollnav to move the project away from
jQuery, update to the latest es6 features, and remove all production
dependencies. This update also removes a number of user options to simplify
the API and reduces the amount of DOM manipulation to reduce likelihood of
browser bugs. Includes a full set of test suites for all modules (unless
noted). Please read through the [readme](https://github.com/jimmynotjim/scrollNav/blob/master/README.md) for further
details.

## v2.7.3 - March 19, 2018

* Added BEM-style active classes
Expand Down Expand Up @@ -50,13 +60,13 @@ For more information on semantic versioning, please visit http://semver.org/.

## v2.3.0 - October 9, 2014

* Updated min Node to 0.10.*
* Updated min Node to 0.10.\*
* Updated all Node plugins to latest

## v2.2.0 - March 14, 2014

* Added option to change the classname used throughout the plugin.
* Updated jQuery dep to 1.9.*
* Updated jQuery dep to 1.9.\*

## v2.1.1 - December 13, 2013

Expand All @@ -67,7 +77,7 @@ Added `scrollNav` namespace to event listeners to avoid crashing in to user defi
v2.1 adds support for public methods, a new destroy method, custom callbacks for init, render and destroy, and small bugfixes.

* Reorganized core to allow for new public methods
* Added destroy method to core to allow for breaking down the plugin and it's dom * changes
* Added destroy method to core to allow for breaking down the plugin and it's dom \* changes
* Added the option to add callback functions to init, render and destroy
* Squashed a bug when wrapping sub-sections in their div
* Updated core init in test for easier reuse
Expand All @@ -83,7 +93,7 @@ Double releasing to include changelog and readme updates in Bower. One day I'll
Bugfixes for the following:

* package.json now includes semver: Ooops, sorry
* Moved jQuery dependency from package.json to bower.json and updated jQuery dep to v1.8.*
* Moved jQuery dependency from package.json to bower.json and updated jQuery dep to v1.8.\*
* Removed unneeded build dirs from bower install
* Updated gitignore to ignore bower_components

Expand All @@ -100,7 +110,7 @@ v2 is a complete re-write of scrollNav and includes better code organization, ne
* Added option to change insertion target.
* Added Bower support for easy project dependency management.
* Updated the class names of scrollNav elements to follow BEM conventions.
* Updated existing settings option naming for the following (*this may break your current setups*):
* Updated existing settings option naming for the following (_this may break your current setups_):
* `titleText` -> `headlineText`
* `location` -> `insertLocation`

Expand Down
113 changes: 93 additions & 20 deletions CONTRIBUTING.md
@@ -1,31 +1,104 @@
# Contributing
# Contributing Guideline

## Important notes
Please don't edit files in the `dist` subdirectory as they are generated via Grunt. You'll find source code in the `src` subdirectory!
Thanks for contributing to scrollNav. Without you and the Open Source community
this project wouldn't be possible. Before you get started, please familiarize
yourself with the project and its standards.

## Issue Reports

If you're looking for a way to contribute to this project, your best bet is
to [start with the current issues][1]. Whether it's a new feature you'd like
added, a bug you've found, or a question about using the plugin, there's always
a chance you're not alone. Take a look through both the open and closed issues
before creating a new one yourself.

### Improvements/features

Before working on a new feature please submit an issue suggesting the feature
and ensure that it is greenlighted. I'd hate for you to spend your time
building a new feature that doesn't fit the project's scope or intentions.

### Bugs

Before submitting a bug report, please create a reproducable test, either as a
failing unit test on your own fork, or by forking the starter demo from Codepen
and adjusting as necessary. It's a whole lot easier to address issues if I can
understand the situation. If it's not obvious what's broken in your demo,
include step-by-step instructions on how to reproduce the problem within the
issue description.

## Pull Requests

You've found a bug or had a feature greenlighted and you're ready to dig in and
get to work. Congrats! This project was built and continues to improve from
direct contributions from folks like you. Before you get too far, please be
sure to read through and understand the steps below.

### Important notes

Please don't edit files in the `dist` subdirectory as they are generated via
NPM script. You'll find source code in the `src` subdirectory.

### Code style
Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.**

### PhantomJS
While Grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers.
This project utilizes [Prettier][11] to ensure a consistent code style. Write
your changes however you prefer but be sure to run `npm run format` prior to
submitting a Pull Request. Don't worry about making a lot of small commits,
your changes will be squashed within Github when the Pull Request is merged.

### Testing

This project uses [Jest][12] for its unit tests. Prior to submitting a
Pull Request, please ensure new functionality is tested and adjustments to
previous functionality continue to pass. A failing test is better than no
test at all and gives me a place to start reviewing.

## Modifying the code
First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed.
Additionally, it's a good idea to ensure your changes work in actual browsers.
Including a demo on [Codepen][13] is a great way to ensure your changes are
reviewed and merged in a timely manner. I've [created a base Pen][2] for you
to fork and edit.

Test that Grunt's CLI is installed by running `grunt --version`. If the command isn't found, run `npm install -g grunt-cli`. For more information about installing Grunt, see the [getting started guide](http://gruntjs.com/getting-started).
### Modifying the code

First, ensure that you are working with [Node.js][14] version 8 or later and
[npm][15] version 5 or later. Older versions of Node are supported but it's
best to work with the Long Term Support (LTS), currently version 8.

1. Fork and clone the repo.
1. Run `npm install` to install all dependencies (including Grunt).
1. Run `grunt` to grunt this project.
1. Run `npm install` to install the development dependencies.
1. Create a new branch that's appropriately named. Please don't work directly
in your `master` branch, it makes testing locally difficult.
1. Add failing tests for the change you want to make in the `test/tests`
directory. Run `npm test` to see the tests fail.
1. Edit the source files in the `src` directory.
1. Run `npm test` to see if the tests pass. Repeat steps 2-4 until done.
1. Run `npm run build` to generate the transpiled files in the `dist`
directory.
1. Update the documentation to reflect any changes in functionality.
1. Commit and push your the branch to Github.
1. Navigate to your branch on Github and then to the
`dist/scrollNav.min.js` file.
1. Select the "Raw" button and copy the file URL.
1. Fork the starter demo in Codepen and then click settings.
1. Under "Add External Scripts/Pens" replace the existing
`dist/scrollNav.min.js` file URL with your raw file URL.
1. Test the interactions and ensure your intended changes work as expected.
1. Submit a Pull Request making sure to write a descriptive comment and
include your forked Codepen URL.

**Note: If none of this makes sense, it's ok. Any contribution is a useful one,
even if it's not accepted. Please feel free to reach out to me to ask for help
or clarification, I'm [@jimmynotim on Twitter][21].**

To view all available build tasks run `npm run` without any arguments.

Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken.
[1]: https://github.com/jimmynotjim/scrollNav/issues
[2]: https://codepen.io/jimmynotjim/pen/OZKeyd

## Submitting pull requests
[11]: https://prettier.io/
[12]: https://facebook.github.io/jest/
[13]: https://codepen.io/
[14]: http://nodejs.org/
[15]: http://npmjs.org/

1. Create a new branch, please don't work in your `master` branch directly.
1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail.
1. Fix stuff.
1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done.
1. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere.
1. Update the documentation to reflect any changes.
1. Push to your fork and submit a pull request.
[21]: https://twitter.com/jimmynotjim

0 comments on commit 3c27263

Please sign in to comment.