Skip to content

Commit

Permalink
feat: rollup打包
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahim-Chan committed Aug 14, 2020
1 parent b72ccee commit 892de4d
Show file tree
Hide file tree
Showing 19 changed files with 301 additions and 71 deletions.
12 changes: 9 additions & 3 deletions config/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import scss from 'rollup-plugin-scss'
import NodePath from 'path'
import RollupJson from '@rollup/plugin-json'
import scss from 'rollup-plugin-scss'
import RollupNodeResolve from '@rollup/plugin-node-resolve'
import RollupCommonjs from '@rollup/plugin-commonjs'
import RollupTypescript from 'rollup-plugin-typescript2'
import postcss from 'rollup-plugin-postcss'
import RollupCopy from 'rollup-plugin-copy'
import Package from '../package.json'

Expand Down Expand Up @@ -34,7 +35,7 @@ export default {
{
file: resolveFile(Package.browser),
format: 'umd',
name: 'taro-listview',
name: 'taro-ui',
sourcemap: true,
globals: {
react: 'React',
Expand All @@ -43,8 +44,14 @@ export default {
}
}
],
cssModules: true,
external: externalPackages,
plugins: [
postcss({
extract: false,
modules: true,
use: ['sass'],
}),
RollupNodeResolve({
customResolveOptions: {
moduleDirectory: 'node_modules'
Expand All @@ -57,7 +64,6 @@ export default {
RollupTypescript({
tsconfig: resolveFile('tsconfig.rollup.json')
}),
scss(),
RollupCopy({
targets: [
{
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taro-listview",
"version": "1.4.3",
"version": "1.4.9",
"description": "listView pullDownRefresh and skeleton",
"templateInfo": {
"name": "default",
Expand All @@ -16,13 +16,13 @@
"dist",
"@types"
],
"browser": "dist/index.umd.js",
"source": "src/index.ts",
"types": "./@types/index.d.ts",
"main": "dist/index.js",
"main:h5": "dist/h5/index.js",
"browser": "dist/index.umd.js",
"module": "dist/index.esm.js",
"scripts": {
"build": "yarn run build:rollup",
"commit": "git-cz",
"build:weapp": "taro build --type weapp",
"build:swan": "taro build --type swan",
Expand All @@ -38,7 +38,6 @@
"dev:tt": "npm run build:tt -- --watch",
"dev:h5": "npm run build:h5 -- --watch",
"dev:rn": "npm run build:rn -- --watch",
"build": "yarn run build:rollup",
"build:lib": "tsc --project ./tsconfig.build.json",
"build:rollup": "rollup --config ./config/rollup.config.js",
"copy": "node ./scripts/build.js",
Expand All @@ -48,19 +47,21 @@
},
"author": "rahim <chenrixi93@gmail.com>",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
"registry": "http://152.136.203.150:4873"
},
"repository": {
"type": "git",
"url": "git@github.com:Rahim-Chan/taro-listView.git"
},
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.11.2",
"classnames": "^2.2.6",
"qs": "^6.7.0"
},
"devDependencies": {
"@babel/runtime": "^7.7.7",
"@babel/core": "^7.11.1",
"@babel/polyfill": "^7.10.4",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
Expand Down Expand Up @@ -97,10 +98,13 @@
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-react-hooks": "^1.6.1",
"eslint-plugin-taro": "1.3.34",
"parcel": "^2.0.0-beta.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"rollup": "^2.3.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-postcss": "^3.1.5",
"rollup-plugin-scss": "^2.5.0",
"rollup-plugin-typescript2": "^0.27.0",
"rollup-plugin-visualizer": "^4.0.2",
Expand Down
8 changes: 6 additions & 2 deletions project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@
"urlCheck": false,
"es6": false,
"postcss": false,
"preloadBackgroundData": false,
"minified": false,
"newFeature": true,
"coverView": true,
"autoAudits": false,
"coverView": true,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"useCompilerModule": false
},
"compileType": "miniprogram",
"simulatorType": "wechat",
Expand Down
2 changes: 1 addition & 1 deletion src/components/list-view/block.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {Component} from 'react';
import Taro from '@tarojs/taro';
import {View} from '@tarojs/components';
import './block.scss'
import '../../style/components/list-view/block.scss'
import storage from "../../utils/storage";
import tools from "./tool";

Expand Down
4 changes: 2 additions & 2 deletions src/components/list-view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import tools from "./tool";
import ResultPage from "../result-page";
import { initialProps, initialState } from "./init";
// eslint-disable-next-line no-unused-vars
import { minGetMore } from "utils/utils";
import { minGetMore } from "../../utils/utils";
import { Indicator, Launch, State, Props } from "./type";
import "./index.scss";
import '../../style/components/list-view/index.scss'

class ListView extends Component<Props, State> {
// eslint-disable-next-line react/sort-comp
Expand Down
2 changes: 1 addition & 1 deletion src/components/loading/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { View } from '@tarojs/components';
import './index.scss';
import '../../style/components/loading/index.scss'

interface PagePros {
color?: any;
Expand Down
6 changes: 2 additions & 4 deletions src/components/result-page/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { Component } from 'react';
import { Image, View } from '@tarojs/components';
import './index.scss';
import { View } from '@tarojs/components';
import '../../style/components/result-page/index.scss'

const emptyImg = require("./assets/empty.png");
interface PagePros {
renderError?: JSX.Element;
renderEmpty?: JSX.Element;
Expand Down Expand Up @@ -38,7 +37,6 @@ class Page extends Component<PagePros> {
{/* default blank page */}
{showEmptyText && (
<View className='noContentTips'>
<Image src={emptyImg} className='emptyBanner' />
{emptyText}
</View>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/skeleton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import Taro from '@tarojs/taro';
import { View } from '@tarojs/components';
import './index.scss';
import '../../style/components/skeleton/index.scss'

interface Props extends React.Props<any> {
isLoaded: boolean;
Expand Down
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Taro from '@tarojs/taro'
// import Taro from '@tarojs/taro'
import ListView from './components/list-view';

Taro.initPxTransform({ designWidth: 750,
deviceRatio: {
"640": 1.17,
"750": 1,
"828": 0.905
}});
// Taro.initPxTransform({ designWidth: 750,
// deviceRatio: {
// "640": 1.17,
// "750": 1,
// "828": 0.905
// }});

export { default as Skeleton } from './components/skeleton/index';
export { default as ListView } from './components/list-view';
Expand Down
11 changes: 11 additions & 0 deletions src/style/components/list-view/block.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.blockLoad {
animation: op 500ms ease;
}
@keyframes op {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
91 changes: 91 additions & 0 deletions src/style/components/list-view/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.animateEase {
transition: transform ease 300ms;
}
.downLoadingStyle {
overflow: hidden;
}
.scrollView {
position: relative;
width: 100%;
}
.autoHeight {
height: 100%;
}
.bodyView {
position: relative;
overflow: visible;
will-change: transform;
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
}
.containView {
position: relative;
}

.unNeedBlock {
opacity: 0;
visibility: hidden;
}
.pullDownBlock {
left: 0;
width: 100%;
overflow: hidden;
font-size: 28px;
display: flex;
align-items: flex-end;
.tip {
display: flex;
justify-content: center;
color: #999999;
bottom: 30px;
left: 0;
width: 100%;
text-align: center;

}
}

.loading, .loaded {
text-align: center;
font-size: 24px;
padding: 12px;
//animation: loading infinite 1000ms ease;
}
.loaded {
color: #e6e6e6;
}
.errorPage {
text-align: center;
padding: 40px;
.button {
border-radius: 10px;
margin-top: 10px;
display: inline-block;
border: 1px solid cornflowerblue;
color: cornflowerblue;
padding: 10px;
}
}
.noContentTips {
display: flex;
padding: 100px 20px 20px;
text-align: center;
flex-direction: column;
.emptyBanner {
width: 250px;
height: 170px;
display: inline-block;
margin: 0 auto 20px;
}
}
@keyframes loading {
from {
transform: rotate(0turn);
}
to {
transform: rotate(1turn);
}
}
.hide {
visibility: hidden;
}
51 changes: 51 additions & 0 deletions src/style/components/loading/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@keyframes lds-rolling {
0% {
-webkit-transform: translate(-50%, -50%) rotate(0deg);
transform: translate(-50%, -50%) rotate(0deg);
}
100% {
-webkit-transform: translate(-50%, -50%) rotate(360deg);
transform: translate(-50%, -50%) rotate(360deg);
}
}
@-webkit-keyframes lds-rolling {
0% {
-webkit-transform: translate(-50%, -50%) rotate(0deg);
transform: translate(-50%, -50%) rotate(0deg);
}
100% {
-webkit-transform: translate(-50%, -50%) rotate(360deg);
transform: translate(-50%, -50%) rotate(360deg);
}
}
.loading-box {
display: inline-block;
margin-bottom: -8px;
}
.lds-rolling {
position: relative;
}
.lds-rolling .circle {
position: absolute;
width: 30px;
height: 30px;
border: 4px solid #667baf;
border-top-color: transparent !important;
border-radius: 50%;
}
.circle{
-webkit-animation: lds-rolling 1s linear infinite;
animation: lds-rolling 1s linear infinite;
top: 40px;
left: 40px;
}
.lds-rolling {
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.lds-rolling {
width: 80px !important;
height: 80px !important;
-webkit-transform: translate(-100px, -100px) scale(1) translate(100px, 100px);
transform: translate(-100px, -100px) scale(1) translate(100px, 100px);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 892de4d

Please sign in to comment.