Skip to content
This repository was archived by the owner on Oct 19, 2019. It is now read-only.

Commit 3e48ddb

Browse files
committed
feat(plugin): rxloop loading plugin
1 parent d38f519 commit 3e48ddb

12 files changed

Lines changed: 4837 additions & 71 deletions

File tree

.babelrc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"targets": {
7+
"browsers": [
8+
"ie >= 11"
9+
]
10+
},
11+
"exclude": ["transform-async-to-generator", "transform-regenerator"],
12+
"modules": false,
13+
"loose": true
14+
}
15+
]
16+
],
17+
"plugins": [
18+
"transform-object-rest-spread"
19+
],
20+
"env": {
21+
"commonjs": {
22+
"presets": [
23+
[
24+
"env",
25+
{
26+
"loose": true
27+
}
28+
]
29+
]
30+
}
31+
}
32+
}

.gitignore

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,7 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
32-
# Compiled binary addons (https://nodejs.org/api/addons.html)
33-
build/Release
34-
35-
# Dependency directories
36-
node_modules/
37-
jspm_packages/
38-
39-
# TypeScript v1 declaration files
40-
typings/
41-
42-
# Optional npm cache directory
43-
.npm
44-
45-
# Optional eslint cache
46-
.eslintcache
47-
48-
# Optional REPL history
49-
.node_repl_history
50-
51-
# Output of 'npm pack'
52-
*.tgz
53-
54-
# Yarn Integrity file
55-
.yarn-integrity
56-
57-
# dotenv environment variables file
58-
.env
59-
60-
# next.js build output
61-
.next
1+
node_modules
2+
package-lock.json
3+
.DS_Store
4+
lib
5+
es
6+
dist
7+
coverage

CHANGELOG.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
<a name="0.0.0"></a>
2-
# 0.0.0 (2018-08-27)
3-
4-
5-
6-
<a name="0.0.0"></a>
7-
# 0.0.0 (2018-08-27)
8-
9-
10-

README-zh_CN.md

Whitespace-only changes.

index.d.ts

Whitespace-only changes.

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
testURL: 'http://localhost/',
3+
testMatch: ['**/?*.(spec|test|e2e).(j|t)s?(x)']
4+
};

package.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "@rxloop/loading",
3+
"version": "0.0.0",
4+
"description": "rxloop loading plugin.",
5+
"scripts": {
6+
"lint": "echo 'lint'",
7+
"test": "cross-env BABEL_ENV=commonjs jest",
8+
"test:cov": "npm test -- --coverage",
9+
"format": "prettier --write \"{src,test}/**/*.js\"",
10+
"clean": "rimraf lib dist es",
11+
"build:commonjs": "cross-env NODE_ENV=cjs rollup -c -o lib/rxloop-core.js",
12+
"build:es": "cross-env BABEL_ENV=es NODE_ENV=es rollup -c -o es/rxloop-core.js",
13+
"build:umd": "cross-env BABEL_ENV=es NODE_ENV=development rollup -c -o dist/rxloop-core.js",
14+
"build:umd:min": "cross-env BABEL_ENV=es NODE_ENV=production rollup -c -o dist/rxloop-core.min.js",
15+
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min",
16+
"prepublishOnly": "conventional-changelog -p angular -r 2 -i CHANGELOG.md -s",
17+
"release": "/bin/bash scripts/release.sh"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "git@github.com:TalkingData/rxloop-loading.git"
22+
},
23+
"keywords": [
24+
"rxjs",
25+
"model",
26+
"react",
27+
"vue",
28+
"angular",
29+
"rxloop"
30+
],
31+
"author": "wxnet <wxnet2013@gmail.com> (https://github.com/wxnet2013)",
32+
"license": "MIT",
33+
"bugs": {
34+
"url": "https://github.com/TalkingData/rxloop-loading/issues"
35+
},
36+
"homepage": "https://talkingdata.github.io/rxloop-loading",
37+
"dependencies": {},
38+
"peerDependencies": {
39+
"@rxloop/core": "^0.8.1-0",
40+
"rxjs": "^6.0.0-0"
41+
},
42+
"devDependencies": {
43+
"@rxloop/core": "^0.8.1",
44+
"babel-cli": "^6.26.0",
45+
"babel-core": "^6.26.2",
46+
"babel-jest": "^22.4.3",
47+
"babel-loader": "^7.1.4",
48+
"babel-plugin-external-helpers": "^6.22.0",
49+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
50+
"babel-preset-env": "^1.6.1",
51+
"babel-register": "^6.26.0",
52+
"conventional-changelog-cli": "^2.0.5",
53+
"cross-env": "^5.1.4",
54+
"jest": "^22.4.3",
55+
"prettier": "^1.12.1",
56+
"rimraf": "^2.6.2",
57+
"rollup": "^0.58.2",
58+
"rollup-plugin-babel": "^3.0.4",
59+
"rollup-plugin-commonjs": "^9.1.3",
60+
"rollup-plugin-node-resolve": "^3.3.0",
61+
"rollup-plugin-replace": "^2.0.0",
62+
"rollup-plugin-uglify": "^3.0.0",
63+
"rxjs": "^6.0.0"
64+
},
65+
"main": "lib/rxloop-loading.js",
66+
"module": "es/rxloop-loading.js",
67+
"typings": "./index.d.ts",
68+
"files": [
69+
"dist",
70+
"lib",
71+
"es",
72+
"src",
73+
"index.d.ts"
74+
]
75+
}

rollup.config.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import nodeResolve from 'rollup-plugin-node-resolve'
2+
import babel from 'rollup-plugin-babel'
3+
import replace from 'rollup-plugin-replace'
4+
import uglify from 'rollup-plugin-uglify'
5+
import commonjs from 'rollup-plugin-commonjs'
6+
7+
const env = process.env.NODE_ENV
8+
const config = {
9+
input: 'src/index.js',
10+
plugins: []
11+
}
12+
13+
if (env === 'es' || env === 'cjs') {
14+
config.output = { format: env, indent: false }
15+
config.external = []
16+
config.plugins.push(
17+
babel({
18+
plugins: ['external-helpers'],
19+
})
20+
)
21+
}
22+
23+
if (env === 'development' || env === 'production') {
24+
config.output = { format: 'umd', name: 'rxloopLoading', indent: false }
25+
config.plugins.push(
26+
nodeResolve({
27+
jsnext: true
28+
}),
29+
commonjs(),
30+
babel({
31+
exclude: 'node_modules/**',
32+
plugins: ['external-helpers'],
33+
}),
34+
replace({
35+
'process.env.NODE_ENV': JSON.stringify(env)
36+
})
37+
)
38+
}
39+
40+
if (env === 'production') {
41+
config.plugins.push(
42+
uglify({
43+
compress: {
44+
pure_getters: true,
45+
unsafe: true,
46+
unsafe_comps: true,
47+
warnings: false
48+
}
49+
})
50+
)
51+
}
52+
53+
export default config

scripts/release.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
echo "Select a option to release (input a serial number):"
4+
echo
5+
6+
select VERSION in patch minor major "Specific Version"
7+
do
8+
echo
9+
if [[ $REPLY =~ ^[1-4]$ ]]; then
10+
if [[ $REPLY == 4 ]]; then
11+
read -p "Enter a specific version: " -r VERSION
12+
echo
13+
if [[ -z $REPLY ]]; then
14+
VERSION=$REPLY
15+
fi
16+
fi
17+
18+
read -p "Release $VERSION - are you sure? (y/n) " -n 1 -r
19+
echo
20+
21+
if [[ $REPLY =~ ^[Yy]$ || -z $REPLY ]]; then
22+
# pre release task
23+
npm run lint
24+
npm run test
25+
npm run clean
26+
npm run build
27+
28+
# bump version
29+
npm version $VERSION
30+
NEW_VERSION=$(node -p "require('./package.json').version")
31+
echo Releasing ${NEW_VERSION} ...
32+
33+
# npm release
34+
npm whoami
35+
npm publish --access public
36+
echo "✅ Released to npm."
37+
38+
# github release
39+
git add CHANGELOG.md
40+
git commit -m "chore: changelog"
41+
git push
42+
git tag -a v${NEW_VERSION} -m "version $NEW_VERSION"
43+
git push origin v${NEW_VERSION}
44+
echo "✅ Released to Github."
45+
else
46+
echo Cancelled
47+
fi
48+
break
49+
else
50+
echo Invalid \"${REPLY}\"
51+
echo "To continue, please input a serial number(1-4) of an option."
52+
echo
53+
fi
54+
done

0 commit comments

Comments
 (0)