Skip to content

Commit

Permalink
chore: jswork scope
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed Nov 22, 2020
1 parent bdab6e7 commit 3f856d7
Show file tree
Hide file tree
Showing 17 changed files with 124 additions and 135 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ package-lock.json
.DS_Store
.idea
.vscode

# vscode localhistory
.history
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ jest.config.js
LICENSE.txt
Rakefile
.vscode
.release-it.json
docs

# vscode localhistory
.history
.release-it.json
17 changes: 17 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"git": {
"requireCleanWorkingDir": false
},
"hooks": {
"after:init": [
"npm run test",
"t2k"
],
"after:bump": [
"npm run build"
]
},
"github": {
"release": true
}
}
5 changes: 0 additions & 5 deletions Gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 afei <1290657123@qq.com>
Copyright (c) 2020 afei <1290657123@qq.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# next-local-forage
> LocalForage for next.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```bash
npm install -S @feizheng/next-local-forage
npm install -S @jswork/next-local-forage
```

## apis
Expand All @@ -20,8 +25,23 @@ npm install -S @feizheng/next-local-forage

## usage
```js
import NxLocalForage from '@feizheng/next-local-forage';
import NxLocalForage from '@jswork/next-local-forage';
```

## resources
- https://localforage.docschina.org/

## license
Code released under [the MIT license](https://github.com/afeiship/next-local-forage/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/next-local-forage
[version-url]: https://npmjs.org/package/@jswork/next-local-forage

[license-image]: https://img.shields.io/npm/l/@jswork/next-local-forage
[license-url]: https://github.com/afeiship/next-local-forage/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-local-forage
[size-url]: https://github.com/afeiship/next-local-forage/blob/master/dist/next-local-forage.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/next-local-forage
[download-url]: https://www.npmjs.com/package/@jswork/next-local-forage
4 changes: 0 additions & 4 deletions Rakefile

This file was deleted.

8 changes: 2 additions & 6 deletions __tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
(function() {
var nx = require('@feizheng/next-js-core2');
var NxLocalForage = require('../src/next-local-forage');
const NxLocalForage = require('../src');

describe('NxLocalForage.methods', function() {
test('init', function() {
var data = {
key: 1,
value: 2
};
const data = { key: 1, value: 2 };
expect(!!data).toBe(true);
});
});
Expand Down
7 changes: 2 additions & 5 deletions build/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
const gulp = require('gulp');
const saveLicense = require('uglify-save-license');
const $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'gulp.*', 'del', '@feizheng/gulp-*']
pattern: ['gulp-*', 'gulp.*', 'del', '@jswork/gulp-*']
});

gulp.task('scripts', function() {
return gulp
.src('src/*.js')
.pipe($.sourcemaps.init())
.pipe($.feizheng.pkgHeader())
.pipe($.sourcemaps.write('.'))
.pipe($.jswork.pkgHeader())
.pipe(gulp.dest('dist'))
.pipe($.size({ title: '[ default size ]:' }))
.pipe($.ignore('*.js.map'))
.pipe($.uglify({ output: { comments: saveLicense } }))
.pipe($.rename({ extname: '.min.js' }))
.pipe(gulp.dest('dist'))
Expand Down
50 changes: 24 additions & 26 deletions dist/next-local-forage.js → dist/index.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
/*!
* name: @feizheng/next-local-forage
* name: @jswork/next-local-forage
* description: LocalForage for next.
* url: https://github.com/afeiship/next-local-forage
* version: 1.0.1
* date: 2020-03-20 17:38:16
* homepage: https://github.com/afeiship/next-local-forage
* version: 1.0.0
* date: 2020-11-22 16:10:19
* license: MIT
*/

(function() {
(function () {
var global = global || this || window || Function('return this')();
var nx = global.nx || require('@feizheng/next-js-core2');
var nx = global.nx || require('@jswork/next');
var localforage = global.localforage || require('localforage');

var NxLocalForage = nx.declare('nx.LocalForage', {
methods: {
init: function(inOptions) {
init: function (inOptions) {
this.options = inOptions;
this.store = localforage.createInstance(this.options);
},
config: function(inOptions) {
config: function (inOptions) {
nx.mix(this.options, inOptions);
this.store.config(this.options);
},
destroy: function() {
destroy: function () {
return localforage.createInstance(this.options);
},
set: function(inKey, inValue) {
set: function (inKey, inValue) {
return this.store.setItem(inKey, inValue);
},
sets: function(inObject) {
sets: function (inObject) {
var promises = [];
nx.forIn(
inObject,
function(key, value) {
function (key, value) {
promises.push(this.set(key, value));
},
this
);
return Promise.all(promises);
},
get: function(inKey) {
get: function (inKey) {
return this.store.getItem(inKey);
},
gets: function() {
gets: function () {
var self = this;
return new Promise(function(resolve, reject) {
self.keys().then(function(keys) {
return new Promise(function (resolve, reject) {
self.keys().then(function (keys) {
var reslves = [];
var rejects = [];
keys.map(function(key) {
keys.map(function (key) {
self
.get(key)
.then(function(res) {
.then(function (res) {
reslves.push(res);
})
.catch(function(err) {
.catch(function (err) {
rejects(err);
});
});
Expand All @@ -64,19 +64,19 @@
});
});
},
del: function(inKey) {
del: function (inKey) {
return this.store.removeItem(inKey);
},
dels: function(inKeys) {
var promises = inKeys.map(function(key) {
dels: function (inKeys) {
var promises = inKeys.map(function (key) {
return this.del(key);
}, this);
return Promise.all(promises);
},
clear: function() {
clear: function () {
return this.store.clear();
},
keys: function() {
keys: function () {
return this.store.keys();
}
}
Expand All @@ -86,5 +86,3 @@
module.exports = NxLocalForage;
}
})();

//# sourceMappingURL=next-local-forage.js.map
9 changes: 9 additions & 0 deletions dist/index.min.js

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

1 change: 0 additions & 1 deletion dist/next-local-forage.js.map

This file was deleted.

9 changes: 0 additions & 9 deletions dist/next-local-forage.min.js

This file was deleted.

24 changes: 0 additions & 24 deletions docs/index.html

This file was deleted.

37 changes: 18 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@feizheng/next-local-forage",
"version": "1.0.1",
"name": "@jswork/next-local-forage",
"version": "1.0.0",
"description": "LocalForage for next.",
"homepage": "https://github.com/afeiship/next-local-forage",
"author": {
Expand All @@ -9,34 +9,33 @@
},
"scripts": {
"build": "gulp",
"start": "node server.js",
"test": "jest"
"test": "jest",
"release": "release-it"
},
"main": "dist/next-local-forage.js",
"main": "dist/index.js",
"license": "MIT",
"devDependencies": {
"@feizheng/gulp-pkg-header": "^1.0.2",
"@feizheng/rake-git": "^1.2.1",
"del": "^5.1.0",
"express": "^4.17.1",
"@jswork/gulp-pkg-header": "^1.0.2",
"@jswork/next": "^1.0.2",
"del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-debug": "^4.0.0",
"gulp-ignore": "^3.0.0",
"gulp-load-plugins": "^2.0.2",
"gulp-load-plugins": "^2.0.5",
"gulp-rename": "^2.0.0",
"gulp-size": "^3.0.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-uglify": "^3.0.2",
"jest": "^25.1.0",
"uglify-save-license": "^0.4.1",
"yargs": "^15.1.0"
},
"dependencies": {
"@feizheng/next-js-core2": "^2.4.1",
"localforage": "^1.7.3"
"jest": "^26.6.3",
"release-it": "^14.2.1",
"uglify-js": "3.11.6",
"uglify-save-license": "^0.4.1"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
"access": "public",
"registry": "https://registry.npmjs.org"
},
"dependencies": {
"localforage": "^1.9.0"
}
}
13 changes: 0 additions & 13 deletions server.js

This file was deleted.

0 comments on commit 3f856d7

Please sign in to comment.