Skip to content

Commit

Permalink
feat: initaila
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed Mar 20, 2020
0 parents commit 33a43bc
Show file tree
Hide file tree
Showing 21 changed files with 454 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
bower_components
coverage
npm-debug.log
yarn.lock
Gemfile.lock
yarn-error.log
package-lock.json
.DS_Store
.idea
.vscode
17 changes: 17 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.idea
.DS_Store
**/npm-debug.log
**/node_modules
test
__tests__
src
build
gulpfile.js

.editorconfig
.prettierrc
Gemfile
jest.config.js
LICENSE.txt
Rakefile
.vscode
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
package-lock=false
40 changes: 40 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"trailingComma": "none",
"arrowParens": "always",
"printWidth": 100,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"overrides": [
{
"files": ["*.json", ".eslintrc", ".tslintrc", ".prettierrc", ".tern-project"],
"options": {
"parser": "json",
"tabWidth": 2
}
},
{
"files": "*.{css,sass,scss,less}",
"options": {
"parser": "postcss",
"tabWidth": 2
}
},
{
"files": "*.ts",
"options": {
"parser": "typescript"
}
},
{
"files": "*.md",
"options": {
"trailingComma": "none",
"tabWidth": 2,
"parser": "json"
}
}
]
}
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem 'fileutils'
gem 'sshkit'
gem 'semver'
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 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
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# next-local-forage
> LocalForage for next.
## installation
```bash
npm install -S @feizheng/next-local-forage
```

## apis
| api | params | description |
|-----|--------|---------------|
| get | - | desc balabala |

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

// code goes here:
```

## resources
- https://localforage.docschina.org/
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

Dir["./node_modules/@feizheng/rake-*/index.rake"].each do |task|
load task
end
14 changes: 14 additions & 0 deletions __tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(function() {
var nx = require('@feizheng/next-js-core2');
var NxLocalForage = require('../src/next-local-forage');

describe('NxLocalForage.methods', function() {
test('init', function() {
var data = {
key: 1,
value: 2
};
expect(!!data).toBe(true);
});
});
})();
13 changes: 13 additions & 0 deletions build/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(function() {
'use strict';

const gulp = require('gulp');
const $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'gulp.*', 'del']
});

//clean
gulp.task('clean', function() {
return $.del('dist');
});
})();
24 changes: 24 additions & 0 deletions build/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(function() {
'use strict';

const gulp = require('gulp');
const saveLicense = require('uglify-save-license');
const $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'gulp.*', 'del', '@feizheng/gulp-*']
});

gulp.task('scripts', function() {
return gulp
.src('src/*.js')
.pipe($.sourcemaps.init())
.pipe($.feizheng.pkgHeader())
.pipe($.sourcemaps.write('.'))
.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'))
.pipe($.size({ title: '[ minimize size ]:' }));
});
})();
85 changes: 85 additions & 0 deletions dist/next-local-forage.js

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

1 change: 1 addition & 0 deletions dist/next-local-forage.js.map

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

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

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

24 changes: 24 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>localforage</title>
<script src="/localforage/dist/localforage.js"></script>
<script src="/@feizheng/next-js-core2/dist/next-js-core2.js"></script>
<script src="/next-local-forage.js"></script>
</head>

<body>

<script>
localforage.config({ name: 'nxdb', storeName: 'kvs' })
localforage.setItem('key1', 'value1').then(res => {
console.log('res:', res);
})
</script>

</body>

</html>
13 changes: 13 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(function() {
'use strict';

const gulp = require('gulp');
const fs = require('fs');

//import
fs.readdirSync('./build').map(function(file) {
require('./build/' + file);
});

gulp.task('default', gulp.series(['clean', 'scripts']));
})();
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// https://jestjs.io/docs/en/configuration
module.exports = {
verbose: true,
testRegex: [/\.spec.js/],
//preset: "jest-puppeteer",
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
}
};
42 changes: 42 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@feizheng/next-local-forage",
"version": "1.0.0",
"description": "LocalForage for next.",
"homepage": "https://github.com/afeiship/next-local-forage",
"author": {
"name": "afei",
"email": "1290657123@qq.com"
},
"scripts": {
"build": "gulp",
"start": "node server.js",
"test": "jest"
},
"main": "dist/next-local-forage.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",
"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-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"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
}

0 comments on commit 33a43bc

Please sign in to comment.