diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7053c49 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +[*.{js,jsx,ts,tsx,vue}] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/CHANGELOG.md b/CHANGELOG.md index 184c599..6c1404a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,26 +1,46 @@ ## 迭代日志 + +2021.01.14 + +- 新增 `@babel/plugin-proposal-object-rest-spread`, `@babel/plugin-proposal-optional-chaining`两个插件支持 ES2020 语法可选链, 展开符, 快来体验最新的语吧 + +e.g: + +```js +const test = { + a: 123 +} +console.log(test?.b) // 不会挂掉报错 +``` + 2019.06.01!! -* 支持配置注入script, 优势避免硬编码插入script,直接支持构建时插入script -[配置文件](https://github.com/BiYuqi/webpack-seed/blob/master/src/common/libs/scriptTags.js) -[本项目使用案例](https://github.com/BiYuqi/webpack-seed/blob/master/src/layout/base/headerBase/headerBase.ejs#L14) -2019.03.29 -* 变更基础模板位置from `src/component/` to `src/layout/base` +- 支持配置注入 script, 优势避免硬编码插入 script,直接支持构建时插入 script [配置文件](https://github.com/BiYuqi/webpack-seed/blob/master/src/common/libs/scriptTags.js) [本项目使用案例](https://github.com/BiYuqi/webpack-seed/blob/master/src/layout/base/headerBase/headerBase.ejs#L14) + + 2019.03.29 + +- 变更基础模板位置 from `src/component/` to `src/layout/base` + + 2019.02.06 + +- 新增命令行创建页面[README](./bin/README.md) + + 2018.10.22 + +- 增加个性化模板案例[layout-without-header-footer](https://github.com/BiYuqi/webpack-seed/tree/master/src/layout/layout-without-header-footer) + + 2018.10.21 + +- 增加模板片段支持,页面中可复用的 html 都可以抽离为 ejs 模板片段, 由 ejs-loader 进行编译 [模板](https://github.com/BiYuqi/webpack-seed/blob/master/src/templates/index.test.ejs) [使用](https://github.com/BiYuqi/webpack-seed/blob/master/src/views/index/index.js#L7) -2019.02.06 -* 新增命令行创建页面[README](./bin/README.md) + 2018.10.15 -2018.10.22 -* 增加个性化模板案例[layout-without-header-footer](https://github.com/BiYuqi/webpack-seed/tree/master/src/layout/layout-without-header-footer) +- 静态资源 vendor 文件夹分类,common 与 fixIe 这两个文件夹的文件都会被自动注入到页面引用; 使用者只需要配置[lib.js](https://github.com/BiYuqi/webpack-seed/blob/master/src/common/libs/libs.js)即可 -2018.10.21 -* 增加模板片段支持,页面中可复用的html都可以抽离为ejs模板片段, 由ejs-loader进行编译 [模板](https://github.com/BiYuqi/webpack-seed/blob/master/src/templates/index.test.ejs) [使用](https://github.com/BiYuqi/webpack-seed/blob/master/src/views/index/index.js#L7) + 2018.10.11 -2018.10.15 -* 静态资源vendor文件夹分类,common与fixIe 这两个文件夹的文件都会被自动注入到页面引用; 使用者只需要配置[lib.js](https://github.com/BiYuqi/webpack-seed/blob/master/src/common/libs/libs.js)即可 +- 单独抽离 css 样式问题修复 -2018.10.11 -* 单独抽离css样式问题修复 + 2018.10.07 -2018.10.07 -* 修改打包后js输出路径,原有js跟着页面文件夹打包后在一起, 现在统一打包到dist/js目录下, 理由是页面script 展示好看...属于优化项 \ No newline at end of file +- 修改打包后 js 输出路径,原有 js 跟着页面文件夹打包后在一起, 现在统一打包到 dist/js 目录下, 理由是页面 script 展示好看...属于优化项 diff --git a/README.md b/README.md index 51943c9..5ca4936 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ - Autoprefixer 自动补全 - 集成代码风格校验 Eslint - 内置字体图标库 500+, 开箱即用 -- 支持 ES6 编写源码,编译生成生产代码 +- 支持 ES6 编写源码,编译生成生产代码 `(最新支持可选链,展开操作符)` - 开发(生产)环境代码自动注入页面, 专注于开发 - 编译后的程序不依赖于外部的资源, 可自动替换线上资源地址 - 开箱即用的单元测试环境(当然了,测试用例还得您自己写) diff --git a/babel.config.js b/babel.config.js index 51f8b3f..ff85f15 100644 --- a/babel.config.js +++ b/babel.config.js @@ -10,5 +10,6 @@ module.exports = { corejs: 2 } ] - ] + ], + plugins: ['@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-optional-chaining'] } diff --git a/package.json b/package.json index a6f1e15..3d858d5 100644 --- a/package.json +++ b/package.json @@ -42,11 +42,13 @@ }, "homepage": "https://github.com/BiYuqi/webpack-seed#readme", "devDependencies": { - "@babel/core": "^7.9.0", - "@babel/preset-env": "^7.9.0", + "@babel/core": "^7.12.10", + "@babel/plugin-proposal-object-rest-spread": "^7.12.1", + "@babel/plugin-proposal-optional-chaining": "^7.12.7", + "@babel/preset-env": "^7.12.11", "autoprefixer": "^10.2.1", "babel-eslint": "^10.1.0", - "babel-loader": "^8.1.0", + "babel-loader": "^8.2.2", "chai": "^4.2.0", "chalk": "^4.1.0", "clean-webpack-plugin": "^0.1.19", @@ -77,7 +79,7 @@ "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^4.0.2", "lint-staged": "^10.0.8", - "mini-css-extract-plugin": "^0.4.3", + "mini-css-extract-plugin": "^0.9.0", "mocha": "^5.2.0", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss": "^8.2.4", diff --git a/src/components/README.md b/src/components/README.md index cd1435f..14b0680 100644 --- a/src/components/README.md +++ b/src/components/README.md @@ -1,3 +1,3 @@ ## Component? -Can store common component here. \ No newline at end of file +就是可以自定义一些 js 插件放到这里,比如 tab 组件, dialog 组件等用 js 来实现操作 dom 的公用组件. diff --git a/yarn.lock b/yarn.lock index 6de150e..db08db5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14,9 +14,9 @@ resolved "https://registry.npm.taobao.org/@babel/compat-data/download/@babel/compat-data-7.12.7.tgz#9329b4782a7d6bbd7eef57e11addf91ee3ef1e41" integrity sha1-kym0eCp9a71+71fhGt35HuPvHkE= -"@babel/core@^7.9.0": +"@babel/core@^7.12.10": version "7.12.10" - resolved "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.12.10.tgz?cache=0&sync_timestamp=1607569002613&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.12.10.tgz#b79a2e1b9f70ed3d84bbfb6d8c4ef825f606bccd" + resolved "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.12.10.tgz?cache=0&sync_timestamp=1607568968691&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.12.10.tgz#b79a2e1b9f70ed3d84bbfb6d8c4ef825f606bccd" integrity sha1-t5ouG59w7T2Eu/ttjE74JfYGvM0= dependencies: "@babel/code-frame" "^7.10.4" @@ -318,7 +318,7 @@ "@babel/plugin-proposal-object-rest-spread@^7.12.1": version "7.12.1" - resolved "https://registry.npm.taobao.org/@babel/plugin-proposal-object-rest-spread/download/@babel/plugin-proposal-object-rest-spread-7.12.1.tgz?cache=0&sync_timestamp=1602802329071&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-proposal-object-rest-spread%2Fdownload%2F%40babel%2Fplugin-proposal-object-rest-spread-7.12.1.tgz#def9bd03cea0f9b72283dac0ec22d289c7691069" + resolved "https://registry.npm.taobao.org/@babel/plugin-proposal-object-rest-spread/download/@babel/plugin-proposal-object-rest-spread-7.12.1.tgz#def9bd03cea0f9b72283dac0ec22d289c7691069" integrity sha1-3vm9A86g+bcig9rA7CLSicdpEGk= dependencies: "@babel/helper-plugin-utils" "^7.10.4" @@ -699,9 +699,9 @@ core-js "^2.6.5" regenerator-runtime "^0.13.4" -"@babel/preset-env@^7.9.0": +"@babel/preset-env@^7.12.11": version "7.12.11" - resolved "https://registry.npm.taobao.org/@babel/preset-env/download/@babel/preset-env-7.12.11.tgz?cache=0&sync_timestamp=1608076805354&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fpreset-env%2Fdownload%2F%40babel%2Fpreset-env-7.12.11.tgz#55d5f7981487365c93dbbc84507b1c7215e857f9" + resolved "https://registry.npm.taobao.org/@babel/preset-env/download/@babel/preset-env-7.12.11.tgz?cache=0&sync_timestamp=1608076881898&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fpreset-env%2Fdownload%2F%40babel%2Fpreset-env-7.12.11.tgz#55d5f7981487365c93dbbc84507b1c7215e857f9" integrity sha1-VdX3mBSHNlyT27yEUHscchXoV/k= dependencies: "@babel/compat-data" "^7.12.7" @@ -1381,9 +1381,9 @@ babel-eslint@^10.1.0: eslint-visitor-keys "^1.0.0" resolve "^1.12.0" -babel-loader@^8.1.0: +babel-loader@^8.2.2: version "8.2.2" - resolved "https://registry.npm.taobao.org/babel-loader/download/babel-loader-8.2.2.tgz#9363ce84c10c9a40e6c753748e1441b60c8a0b81" + resolved "https://registry.npm.taobao.org/babel-loader/download/babel-loader-8.2.2.tgz?cache=0&sync_timestamp=1606424647115&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-loader%2Fdownload%2Fbabel-loader-8.2.2.tgz#9363ce84c10c9a40e6c753748e1441b60c8a0b81" integrity sha1-k2POhMEMmkDmx1N0jhRBtgyKC4E= dependencies: find-cache-dir "^3.3.1" @@ -4811,6 +4811,11 @@ is-path-inside@^2.1.0: dependencies: path-is-inside "^1.0.2" +is-plain-obj@^1.0.0: + version "1.1.0" + resolved "https://registry.npm.taobao.org/is-plain-obj/download/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= + is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.npm.taobao.org/is-plain-object/download/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -5603,12 +5608,13 @@ mimic-fn@^2.1.0: resolved "https://registry.npm.taobao.org/mimic-fn/download/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs= -mini-css-extract-plugin@^0.4.3: - version "0.4.5" - resolved "https://registry.npm.taobao.org/mini-css-extract-plugin/download/mini-css-extract-plugin-0.4.5.tgz#c99e9e78d54f3fa775633aee5933aeaa4e80719a" - integrity sha1-yZ6eeNVPP6d1YzruWTOuqk6AcZo= +mini-css-extract-plugin@^0.9.0: + version "0.9.0" + resolved "https://registry.npm.taobao.org/mini-css-extract-plugin/download/mini-css-extract-plugin-0.9.0.tgz?cache=0&sync_timestamp=1610548193429&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmini-css-extract-plugin%2Fdownload%2Fmini-css-extract-plugin-0.9.0.tgz#47f2cf07aa165ab35733b1fc97d4c46c0564339e" + integrity sha1-R/LPB6oWWrNXM7H8l9TEbAVkM54= dependencies: loader-utils "^1.1.0" + normalize-url "1.9.1" schema-utils "^1.0.0" webpack-sources "^1.1.0" @@ -5905,6 +5911,16 @@ normalize-range@^0.1.2: resolved "https://registry.npm.taobao.org/normalize-range/download/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" integrity sha1-LRDAa9/TEuqXd2laTShDlFa3WUI= +normalize-url@1.9.1: + version "1.9.1" + resolved "https://registry.npm.taobao.org/normalize-url/download/normalize-url-1.9.1.tgz#2cc0d66b31ea23036458436e3620d85954c66c3c" + integrity sha1-LMDWazHqIwNkWENuNiDYWVTGbDw= + dependencies: + object-assign "^4.0.1" + prepend-http "^1.0.0" + query-string "^4.1.0" + sort-keys "^1.0.0" + normalize-url@^3.0.0: version "3.3.0" resolved "https://registry.npm.taobao.org/normalize-url/download/normalize-url-3.3.0.tgz?cache=0&sync_timestamp=1602432435724&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-url%2Fdownload%2Fnormalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" @@ -5941,7 +5957,7 @@ oauth-sign@~0.9.0: resolved "https://registry.npm.taobao.org/oauth-sign/download/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha1-R6ewFrqmi1+g7PPe4IqFxnmsZFU= -object-assign@^4.0.1, object-assign@^4.1.1: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.npm.taobao.org/object-assign/download/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -6866,6 +6882,11 @@ prelude-ls@~1.1.2: resolved "https://registry.npm.taobao.org/prelude-ls/download/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prepend-http@^1.0.0: + version "1.0.4" + resolved "https://registry.npm.taobao.org/prepend-http/download/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" + integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= + prettier-linter-helpers@^1.0.0: version "1.0.0" resolved "https://registry.npm.taobao.org/prettier-linter-helpers/download/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" @@ -7006,6 +7027,14 @@ qs@~6.5.2: resolved "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz?cache=0&sync_timestamp=1610598114155&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fqs%2Fdownload%2Fqs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha1-yzroBuh0BERYTvFUzo7pjUA/PjY= +query-string@^4.1.0: + version "4.3.4" + resolved "https://registry.npm.taobao.org/query-string/download/query-string-4.3.4.tgz?cache=0&sync_timestamp=1609312744587&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fquery-string%2Fdownload%2Fquery-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb" + integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s= + dependencies: + object-assign "^4.1.0" + strict-uri-encode "^1.0.0" + querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.npm.taobao.org/querystring-es3/download/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -7779,6 +7808,13 @@ sockjs@^0.3.21: uuid "^3.4.0" websocket-driver "^0.7.4" +sort-keys@^1.0.0: + version "1.1.2" + resolved "https://registry.npm.taobao.org/sort-keys/download/sort-keys-1.1.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsort-keys%2Fdownload%2Fsort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" + integrity sha1-RBttTTRnmPG05J6JIK37oOVD+a0= + dependencies: + is-plain-obj "^1.0.0" + source-list-map@^2.0.0: version "2.0.1" resolved "https://registry.npm.taobao.org/source-list-map/download/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" @@ -7980,6 +8016,11 @@ streamroller@0.7.0: mkdirp "^0.5.1" readable-stream "^2.3.0" +strict-uri-encode@^1.0.0: + version "1.1.0" + resolved "https://registry.npm.taobao.org/strict-uri-encode/download/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" + integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= + string-argv@0.3.1: version "0.3.1" resolved "https://registry.npm.taobao.org/string-argv/download/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da"