Skip to content

Commit ac9de5f

Browse files
committed
feat: Bundle CSS file separately.(Project perfect)
1 parent 821823b commit ac9de5f

File tree

5 files changed

+15
-42
lines changed

5 files changed

+15
-42
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
node_modules/
33
example-dist/
44
dist/
5+
lib/
6+
react/
57
npm-debug.log*
68
yarn-debug.log*
79
yarn-error.log*
810
test/e2e/reports
911
selenium-debug.log
10-
react/
1112

1213
# Editor directories and files
1314
.idea

.travis.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ stages:
1313
- lint
1414
- name: gh_pages
1515
if: branch = master
16-
- name: github_release
17-
if: branch = master
1816

1917
jobs:
2018
include:
2119
- stage: lint
2220
script: npm run lint
2321
- stage: gh_pages
24-
script: npm run build
22+
script: npm run build:example
2523
after_script:
2624
- git clone -b gh-pages "https://${GH_TOKEN}@${GH_REF}" gh-pages
2725
- rm -r gh-pages/*
@@ -32,20 +30,6 @@ jobs:
3230
- git add .
3331
- git commit -m "update gh-pages"
3432
- git push --quiet "https://${GH_TOKEN}@${GH_REF}" gh-pages:gh-pages
35-
- stage: github_release
36-
script: echo "Deploying to GitHub releases ..."
37-
deploy:
38-
provider: releases
39-
api_key: ${GH_TOKEN}
40-
skip_cleanup: true
41-
on:
42-
tags: true
43-
# - stage: npm_release
44-
# script: echo "Deploying to npm releases ..."
45-
# deploy:
46-
# provider: npm
47-
# email: ""
48-
# api_key: ""
4933

5034
# branches:
5135
# only:

build/webpack.prod.conf.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
1010
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
1111
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
1212

13-
const isDist = !!process.env.DIST_ENV
14-
const distPath = '../dist'
13+
const isExampleEnv = process.env.EXAMPLE_ENV
14+
const distPath = '../lib'
1515

1616
const env = process.env.NODE_ENV === 'testing'
1717
? require('../config/test.env')
@@ -36,18 +36,10 @@ const webpackConfig = merge(baseWebpackConfig, {
3636
new webpack.DefinePlugin({
3737
'process.env': env
3838
}),
39-
new CopyWebpackPlugin({
40-
patterns: [
41-
{
42-
from: path.resolve(__dirname, '../README.md'),
43-
to: isDist ? path.resolve(__dirname, distPath) : config.build.assetsRoot
44-
}
45-
],
46-
}),
4739
]
4840
})
4941

50-
if (isDist) {
42+
if (!isExampleEnv) {
5143
webpackConfig.entry = {
5244
'vue-json-pretty': './src/index.js'
5345
}
@@ -70,14 +62,6 @@ if (isDist) {
7062
safe: true
7163
}
7264
}),
73-
new CopyWebpackPlugin({
74-
patterns: [
75-
{
76-
from: path.resolve(__dirname, '../package.json'),
77-
to: path.resolve(__dirname, distPath)
78-
}
79-
],
80-
}),
8165
)
8266
} else {
8367
webpackConfig.optimization = {

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "vue-json-pretty",
3-
"version": "1.6.7",
3+
"version": "1.7.0-rc.2",
44
"description": "A JSON tree view component that is easy to use and also supports data selection.",
55
"author": "leezng <[email protected]>",
6-
"main": "vue-json-pretty.js",
6+
"main": "lib/vue-json-pretty.js",
77
"scripts": {
88
"dev": "node build/dev-server.js",
99
"build": "node build/build.js",
10-
"dist": "cross-env DIST_ENV=true node build/build.js",
10+
"build:example": "cross-env EXAMPLE_ENV=true node build/build.js",
1111
"e2e": "node test/e2e/runner.js",
1212
"test": "npm run e2e",
1313
"lint": "eslint --ext .js,.vue src test/e2e/specs"
@@ -80,7 +80,10 @@
8080
"browserslist": [
8181
"> 1%",
8282
"last 5 versions",
83-
"not ie <= 10"
83+
"not ie <= 11"
84+
],
85+
"files": [
86+
"lib"
8487
],
8588
"dependencies": {}
8689
}

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import pkg from '../package.json';
12
import App from './components/app.vue'
23
import './assets/less/index.less'
34

45
export default Object.assign({}, App, {
5-
version: '1.6.7'
6+
version: pkg.version
67
})

0 commit comments

Comments
 (0)