Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
* File name changed from "SwiperAnimation" to "swiper-animation";
* Supported es module;
  • Loading branch information
cycjimmy committed Jul 26, 2019
1 parent 79d3102 commit a478f13
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ test
.travis.yml

# project
src
dist
static
yarn.lock
webpack.config.js

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const mySwiper4 = new Swiper('.swiper-container', {
</div>

<script src="swiper.min.js"></script>
<script src="SwiperAnimation.min.js"></script>
<script src="swiper-animation.min.js"></script>
<script>
// use swiper 3.x
var swiperAnimation = new SwiperAnimation();
Expand Down Expand Up @@ -141,6 +141,8 @@ const mySwiper4 = new Swiper('.swiper-container', {
## CDN
To use via a CDN include this in your HTML:
```text
<script src="https://cdn.jsdelivr.net/npm/swiper-animation@1/build/SwiperAnimation.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/swiper-animation@2/build/swiper-animation.min.js"></script>
```

## Earlier Version
* [1.x](https://github.com/cycdpo/swiper-animation/tree/1.x)
2 changes: 1 addition & 1 deletion build/SwiperAnimation.js → build/swiper-animation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* swiper-animation v1.4.0
* swiper-animation v2.0.0
* Homepage: https://github.com/cycdpo/swiper-animation#readme
* Released under the MIT License.
*/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "swiper-animation",
"version": "1.4.0",
"version": "2.0.0",
"description": "Easier way to run animations on swiper.",
"main": "build/SwiperAnimation.min.js",
"main": "build/swiper-animation.min.js",
"module": "src/index.js",
"scripts": {
"test": "jest",
"start": "cross-env NODE_ENV=development webpack --display-modules --display-reasons --display-error-details --watch --color",
Expand Down
10 changes: 3 additions & 7 deletions test/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import SwiperAnimation from '../build/SwiperAnimation.min';
import Swiper from 'swiper';

const
wrapper = document.createElement('div')
;
const wrapper = document.createElement('div');

wrapper.style.width = '400px';
wrapper.style.height = '300px';
Expand All @@ -19,15 +17,13 @@ wrapper.innerHTML = `
</div>
`;

let mySwiper = new Swiper(wrapper);
const mySwiper = new Swiper(wrapper);

// mock onInit
let
swiperAnimation = new SwiperAnimation().init(mySwiper);
const swiperAnimation = new SwiperAnimation().init(mySwiper);

swiperAnimation._cache();


describe('default spec', () => {
test('default test', () => {
expect(swiperAnimation.swiper).toBe(mySwiper);
Expand Down
13 changes: 5 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var
const
path = require('path')
, webpack = require('webpack')
, packageJson = require('./package.json')
Expand All @@ -10,12 +10,12 @@ var
, {CleanWebpackPlugin} = require('clean-webpack-plugin')
;

var
const
IS_DEVELOPMENT = process.env.NODE_ENV === 'development'
, IS_PRODUCTION = process.env.NODE_ENV === 'production'
;

var config = {
const config = {
mode: 'none',
entry: path.resolve('src', 'index.js'),

Expand All @@ -24,8 +24,8 @@ var config = {
? path.resolve('dist')
: path.resolve('build'),
filename: IS_PRODUCTION
? 'SwiperAnimation.min.js'
: 'SwiperAnimation.js',
? packageJson.name + '.min.js'
: packageJson.name + '.js',
library: 'SwiperAnimation',
libraryTarget: 'umd',
libraryExport: 'default'
Expand All @@ -48,9 +48,6 @@ var config = {
include: [
path.resolve('src'),
],
exclude: [
path.resolve('node_modules'),
],
loader: 'babel-loader'
},

Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6548,10 +6548,10 @@ regenerator-runtime@^0.11.0:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==

regenerator-runtime@^0.13.2:
version "0.13.2"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447"
integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==
regenerator-runtime@^0.13.3:
version "0.13.3"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5"
integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==

regenerator-transform@^0.14.0:
version "0.14.0"
Expand Down Expand Up @@ -8111,10 +8111,10 @@ webpack-sources@^1.1.0, webpack-sources@^1.3.0:
source-list-map "^2.0.0"
source-map "~0.6.1"

webpack@^4.36.1:
version "4.36.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.36.1.tgz#f546fda7a403a76faeaaa7196c50d12370ed18a9"
integrity sha512-Ej01/N9W8DVyhEpeQnbUdGvOECw0L46FxS12cCOs8gSK7bhUlrbHRnWkjiXckGlHjUrmL89kDpTRIkUk6Y+fKg==
webpack@^4.37.0:
version "4.37.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.37.0.tgz#3508ef10f7996612c2be6026076d89760f776f54"
integrity sha512-iJPPvL7XpbcbwOthbzpa2BSPlmGp8lGDokAj/LdWtK80rsPoPOdANSbDBf2GAVLKZD3GhCuQ/gGkgN9HWs0Keg==
dependencies:
"@webassemblyjs/ast" "1.8.5"
"@webassemblyjs/helper-module-context" "1.8.5"
Expand Down

0 comments on commit a478f13

Please sign in to comment.