From f0586e50cce22ced9d24f4ef63b411a3db4aa75c Mon Sep 17 00:00:00 2001 From: xuegan Date: Tue, 20 Dec 2022 21:45:38 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dminiprogram=20project?= =?UTF-8?q?=20test=20=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 4 ++++ test/e2e/miniprogram-project/copyWebpackPlugin.sh | 10 ++++++++-- test/e2e/miniprogram-project/package.json | 11 ++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 753244718a..90e3ec9e3a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,6 +27,10 @@ jobs: test/e2e/plugin-project/node_modules packages/webpack-plugin/node_modules packages/core/node_modules + packages/store/node_modules + packages/pinia/node_modules + packages/fetch/node_modules + packages/utils/node_modules packages/api-proxy/node_modules key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} restore-keys: | diff --git a/test/e2e/miniprogram-project/copyWebpackPlugin.sh b/test/e2e/miniprogram-project/copyWebpackPlugin.sh index 46ca1928b4..950a82095e 100644 --- a/test/e2e/miniprogram-project/copyWebpackPlugin.sh +++ b/test/e2e/miniprogram-project/copyWebpackPlugin.sh @@ -1,7 +1,13 @@ echo "start copy webpackPlugin" -rm -rf ./node_modules/@mpxjs/webpack-plugin/lib +rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src -scp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ +cp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ +cp -r ../../../packages/utils/src/ ./node_modules/@mpxjs/utils/src/ +cp -r ../../../packages/store/src/ ./node_modules/@mpxjs/store/src/ +cp -r ../../../packages/pinia/src/ ./node_modules/@mpxjs/pinia/src/ +cp -r ../../../packages/core/src/ ./node_modules/@mpxjs/core/src/ +cp -r ../../../packages/fetch/src/ ./node_modules/@mpxjs/fetch/src/ +cp -r ../../../packages/api-proxy/src/ ./node_modules/@mpxjs/api-proxy/src/ echo "end copy webpackPlugin" diff --git a/test/e2e/miniprogram-project/package.json b/test/e2e/miniprogram-project/package.json index 86eb70131c..5e30e0eef4 100644 --- a/test/e2e/miniprogram-project/package.json +++ b/test/e2e/miniprogram-project/package.json @@ -23,10 +23,14 @@ "author": "xuegan ", "license": "ISC", "dependencies": { - "@mpxjs/api-proxy": "^2.7.1", "vue": "^2.6.10", "vue-i18n": "^8.15.3", - "@mpxjs/core": "^2.7.2" + "@mpxjs/api-proxy": "^2.8.0", + "@mpxjs/core": "^2.8.0", + "@mpxjs/fetch": "^2.8.0", + "@mpxjs/pinia": "^2.8.0", + "@mpxjs/store": "^2.8.0", + "@mpxjs/utils": "^2.8.0" }, "browserslist": [ "ios >= 9", @@ -39,7 +43,8 @@ "@babel/runtime-corejs3": "^7.10.4", "@mpxjs/miniprogram-simulate": "1.4.9", "@mpxjs/mpx-jest": "0.0.16", - "@mpxjs/webpack-plugin": "^2.7.2", + "@mpxjs/babel-plugin-inject-page-events": "^2.8.0", + "@mpxjs/webpack-plugin": "^2.8.0", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "babel-eslint": "^10.0.1", From 9b84a081188f18fca71ad395a528c1d4a1314e27 Mon Sep 17 00:00:00 2001 From: xuegan Date: Tue, 20 Dec 2022 21:56:41 +0800 Subject: [PATCH 02/14] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8De2e=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh | 10 ++++++++-- test/e2e/miniprogram-wxss-loader/package.json | 12 ++++++++---- test/e2e/plugin-project/copyWebpackPlugin.sh | 10 ++++++++-- test/e2e/plugin-project/package.json | 10 +++++++--- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh b/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh index 46ca1928b4..950a82095e 100644 --- a/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh +++ b/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh @@ -1,7 +1,13 @@ echo "start copy webpackPlugin" -rm -rf ./node_modules/@mpxjs/webpack-plugin/lib +rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src -scp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ +cp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ +cp -r ../../../packages/utils/src/ ./node_modules/@mpxjs/utils/src/ +cp -r ../../../packages/store/src/ ./node_modules/@mpxjs/store/src/ +cp -r ../../../packages/pinia/src/ ./node_modules/@mpxjs/pinia/src/ +cp -r ../../../packages/core/src/ ./node_modules/@mpxjs/core/src/ +cp -r ../../../packages/fetch/src/ ./node_modules/@mpxjs/fetch/src/ +cp -r ../../../packages/api-proxy/src/ ./node_modules/@mpxjs/api-proxy/src/ echo "end copy webpackPlugin" diff --git a/test/e2e/miniprogram-wxss-loader/package.json b/test/e2e/miniprogram-wxss-loader/package.json index 7fa4cedc20..b3f38947d5 100644 --- a/test/e2e/miniprogram-wxss-loader/package.json +++ b/test/e2e/miniprogram-wxss-loader/package.json @@ -25,10 +25,14 @@ "author": "octoberluobin ", "license": "ISC", "dependencies": { - "@mpxjs/api-proxy": "^2.7.1", - "@mpxjs/core": "^2.7.2", "vue": "^2.6.10", - "vue-i18n": "^8.15.3" + "vue-i18n": "^8.15.3", + "@mpxjs/api-proxy": "^2.8.0", + "@mpxjs/core": "^2.8.0", + "@mpxjs/fetch": "^2.8.0", + "@mpxjs/pinia": "^2.8.0", + "@mpxjs/store": "^2.8.0", + "@mpxjs/utils": "^2.8.0" }, "browserslist": [ "ios >= 9", @@ -41,7 +45,7 @@ "@babel/runtime-corejs3": "^7.10.4", "@mpxjs/miniprogram-simulate": "1.4.9", "@mpxjs/mpx-jest": "0.0.16", - "@mpxjs/webpack-plugin": "^2.7.55", + "@mpxjs/webpack-plugin": "^2.8.0", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "babel-eslint": "^10.0.1", diff --git a/test/e2e/plugin-project/copyWebpackPlugin.sh b/test/e2e/plugin-project/copyWebpackPlugin.sh index 46ca1928b4..950a82095e 100644 --- a/test/e2e/plugin-project/copyWebpackPlugin.sh +++ b/test/e2e/plugin-project/copyWebpackPlugin.sh @@ -1,7 +1,13 @@ echo "start copy webpackPlugin" -rm -rf ./node_modules/@mpxjs/webpack-plugin/lib +rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src -scp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ +cp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ +cp -r ../../../packages/utils/src/ ./node_modules/@mpxjs/utils/src/ +cp -r ../../../packages/store/src/ ./node_modules/@mpxjs/store/src/ +cp -r ../../../packages/pinia/src/ ./node_modules/@mpxjs/pinia/src/ +cp -r ../../../packages/core/src/ ./node_modules/@mpxjs/core/src/ +cp -r ../../../packages/fetch/src/ ./node_modules/@mpxjs/fetch/src/ +cp -r ../../../packages/api-proxy/src/ ./node_modules/@mpxjs/api-proxy/src/ echo "end copy webpackPlugin" diff --git a/test/e2e/plugin-project/package.json b/test/e2e/plugin-project/package.json index c458781bb3..7f86f93207 100644 --- a/test/e2e/plugin-project/package.json +++ b/test/e2e/plugin-project/package.json @@ -22,10 +22,14 @@ "author": "xuegan ", "license": "ISC", "dependencies": { - "@mpxjs/api-proxy": "^2.7.1", "vue": "^2.6.10", "vue-i18n": "^8.15.3", - "@mpxjs/core": "^2.7.2" + "@mpxjs/api-proxy": "^2.8.0", + "@mpxjs/core": "^2.8.0", + "@mpxjs/fetch": "^2.8.0", + "@mpxjs/pinia": "^2.8.0", + "@mpxjs/store": "^2.8.0", + "@mpxjs/utils": "^2.8.0" }, "browserslist": [ "ios >= 9", @@ -40,7 +44,7 @@ "@babel/runtime-corejs3": "^7.10.4", "@mpxjs/miniprogram-simulate": "1.4.9", "@mpxjs/mpx-jest": "0.0.16", - "@mpxjs/webpack-plugin": "^2.7.2", + "@mpxjs/webpack-plugin": "^2.8.0", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "autoprefixer": "^6.3.1", From d75a6e65ac6885b5652ff7224c63ea7b2302bfb0 Mon Sep 17 00:00:00 2001 From: xuegan Date: Wed, 8 Mar 2023 19:53:06 +0800 Subject: [PATCH 03/14] =?UTF-8?q?feat:=E8=B0=83=E6=95=B4copyPlugin?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/e2e/copyWebpackPlugin.sh | 0 test/e2e/miniprogram-project/copyWebpackPlugin.sh | 13 ------------- test/e2e/miniprogram-project/package.json | 5 +++-- .../miniprogram-wxss-loader/copyWebpackPlugin.sh | 13 ------------- test/e2e/plugin-project/copyWebpackPlugin.sh | 13 ------------- 5 files changed, 3 insertions(+), 41 deletions(-) create mode 100644 test/e2e/copyWebpackPlugin.sh delete mode 100644 test/e2e/miniprogram-project/copyWebpackPlugin.sh delete mode 100644 test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh delete mode 100644 test/e2e/plugin-project/copyWebpackPlugin.sh diff --git a/test/e2e/copyWebpackPlugin.sh b/test/e2e/copyWebpackPlugin.sh new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/e2e/miniprogram-project/copyWebpackPlugin.sh b/test/e2e/miniprogram-project/copyWebpackPlugin.sh deleted file mode 100644 index 950a82095e..0000000000 --- a/test/e2e/miniprogram-project/copyWebpackPlugin.sh +++ /dev/null @@ -1,13 +0,0 @@ -echo "start copy webpackPlugin" - -rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src - -cp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ -cp -r ../../../packages/utils/src/ ./node_modules/@mpxjs/utils/src/ -cp -r ../../../packages/store/src/ ./node_modules/@mpxjs/store/src/ -cp -r ../../../packages/pinia/src/ ./node_modules/@mpxjs/pinia/src/ -cp -r ../../../packages/core/src/ ./node_modules/@mpxjs/core/src/ -cp -r ../../../packages/fetch/src/ ./node_modules/@mpxjs/fetch/src/ -cp -r ../../../packages/api-proxy/src/ ./node_modules/@mpxjs/api-proxy/src/ - -echo "end copy webpackPlugin" diff --git a/test/e2e/miniprogram-project/package.json b/test/e2e/miniprogram-project/package.json index 5e30e0eef4..a1195b3c83 100644 --- a/test/e2e/miniprogram-project/package.json +++ b/test/e2e/miniprogram-project/package.json @@ -10,7 +10,7 @@ "build:dev": "node ./build/build.js", "watch:cross": "npm run watch --modes=wx,ali,web", "build:cross": "npm run build --modes=wx,ali,tt,swan", - "copyPlugin": "sh ./copyWebpackPlugin.sh", + "copyPlugin": "sh ../copyWebpackPlugin.sh", "watch:web:serve": "npx npm-run-all --parallel watch:web serve", "watch:web": "npm run watch --mode=web", "serve": "npx http-server dist/web", @@ -41,12 +41,13 @@ "@babel/plugin-transform-runtime": "^7.10.4", "@babel/preset-env": "^7.10.4", "@babel/runtime-corejs3": "^7.10.4", + "@mpxjs/babel-plugin-inject-page-events": "^2.8.0", "@mpxjs/miniprogram-simulate": "1.4.9", "@mpxjs/mpx-jest": "0.0.16", - "@mpxjs/babel-plugin-inject-page-events": "^2.8.0", "@mpxjs/webpack-plugin": "^2.8.0", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", + "async": "^3.2.4", "babel-eslint": "^10.0.1", "babel-jest": "^25.3.0", "babel-loader": "^8.1.0", diff --git a/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh b/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh deleted file mode 100644 index 950a82095e..0000000000 --- a/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh +++ /dev/null @@ -1,13 +0,0 @@ -echo "start copy webpackPlugin" - -rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src - -cp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ -cp -r ../../../packages/utils/src/ ./node_modules/@mpxjs/utils/src/ -cp -r ../../../packages/store/src/ ./node_modules/@mpxjs/store/src/ -cp -r ../../../packages/pinia/src/ ./node_modules/@mpxjs/pinia/src/ -cp -r ../../../packages/core/src/ ./node_modules/@mpxjs/core/src/ -cp -r ../../../packages/fetch/src/ ./node_modules/@mpxjs/fetch/src/ -cp -r ../../../packages/api-proxy/src/ ./node_modules/@mpxjs/api-proxy/src/ - -echo "end copy webpackPlugin" diff --git a/test/e2e/plugin-project/copyWebpackPlugin.sh b/test/e2e/plugin-project/copyWebpackPlugin.sh deleted file mode 100644 index 950a82095e..0000000000 --- a/test/e2e/plugin-project/copyWebpackPlugin.sh +++ /dev/null @@ -1,13 +0,0 @@ -echo "start copy webpackPlugin" - -rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src - -cp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ -cp -r ../../../packages/utils/src/ ./node_modules/@mpxjs/utils/src/ -cp -r ../../../packages/store/src/ ./node_modules/@mpxjs/store/src/ -cp -r ../../../packages/pinia/src/ ./node_modules/@mpxjs/pinia/src/ -cp -r ../../../packages/core/src/ ./node_modules/@mpxjs/core/src/ -cp -r ../../../packages/fetch/src/ ./node_modules/@mpxjs/fetch/src/ -cp -r ../../../packages/api-proxy/src/ ./node_modules/@mpxjs/api-proxy/src/ - -echo "end copy webpackPlugin" From b8dc0cd49164d98ccae723dae4a72210d3a840c6 Mon Sep 17 00:00:00 2001 From: xuegan Date: Wed, 8 Mar 2023 19:58:48 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E8=B0=83=E6=95=B4testyml=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 18 ++++++++---------- test/e2e/copyWebpackPlugin.sh | 14 ++++++++++++++ test/e2e/miniprogram-wxss-loader/package.json | 2 +- test/e2e/plugin-project/package.json | 2 +- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90e3ec9e3a..0c157032d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,13 +25,8 @@ jobs: node_modules test/e2e/miniprogram-project/node_modules test/e2e/plugin-project/node_modules - packages/webpack-plugin/node_modules - packages/core/node_modules - packages/store/node_modules - packages/pinia/node_modules - packages/fetch/node_modules - packages/utils/node_modules - packages/api-proxy/node_modules + test/e2e/miniprogram-wxss-loader/node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- @@ -40,10 +35,10 @@ jobs: - name: install deps if: steps.cache.outputs.cache-hit != 'true' - run: npm i && npm i --prefix test/e2e/miniprogram-project && npm i --prefix test/e2e/plugin-project && npx lerna bootstrap --no-ci + run: npm i && npm i --prefix test/e2e/miniprogram-project && npm i --prefix test/e2e/plugin-project && npm i --prefix test/e2e/miniprogram-wxss-loader && npx lerna bootstrap --no-ci - name: copy-webpack-plugin - run: npm run copyPlugin --prefix test/e2e/miniprogram-project && npm run copyPlugin --prefix test/e2e/plugin-project + run: npm run copyPlugin --prefix test/e2e/miniprogram-project && npm run copyPlugin --prefix test/e2e/plugin-project && npm run copyPlugin --prefix test/e2e/miniprogram-wxss-loader - name: build-miniprogram run: npm run build:cross --prefix test/e2e/miniprogram-project @@ -51,5 +46,8 @@ jobs: - name: build-plugin run: npm run build --prefix test/e2e/plugin-project + - name: build-wxss-loader + run: npm run build --prefix test/e2e/miniprogram-wxss-loader + - name: exec unit test - run: npm t && npm t --prefix test/e2e/miniprogram-project && npm t --prefix test/e2e/plugin-project + run: npm t && npm t --prefix test/e2e/miniprogram-project && npm t --prefix test/e2e/plugin-project && npm t --prefix test/e2e/miniprogram-wxss-loader diff --git a/test/e2e/copyWebpackPlugin.sh b/test/e2e/copyWebpackPlugin.sh index e69de29bb2..0cefe6a447 100644 --- a/test/e2e/copyWebpackPlugin.sh +++ b/test/e2e/copyWebpackPlugin.sh @@ -0,0 +1,14 @@ +echo "start copy webpackPlugin" + +rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src + + +cp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ +cp -r ../../../packages/utils/src/ ./node_modules/@mpxjs/utils/src/ +cp -r ../../../packages/store/src/ ./node_modules/@mpxjs/store/src/ +cp -r ../../../packages/pinia/src/ ./node_modules/@mpxjs/pinia/src/ +cp -r ../../../packages/core/src/ ./node_modules/@mpxjs/core/src/ +cp -r ../../../packages/fetch/src/ ./node_modules/@mpxjs/fetch/src/ +cp -r ../../../packages/api-proxy/src/ ./node_modules/@mpxjs/api-proxy/src/ + +echo "end copy webpackPlugin" diff --git a/test/e2e/miniprogram-wxss-loader/package.json b/test/e2e/miniprogram-wxss-loader/package.json index b3f38947d5..082eb06fad 100644 --- a/test/e2e/miniprogram-wxss-loader/package.json +++ b/test/e2e/miniprogram-wxss-loader/package.json @@ -12,7 +12,7 @@ "build:dev": "node ./build/build.js", "watch:cross": "npm run watch --modes=wx,ali,web", "build:cross": "npm run build --modes=wx,ali,tt,swan", - "copyPlugin": "sh ./copyWebpackPlugin.sh", + "copyPlugin": "sh ../copyWebpackPlugin.sh", "watch:web:serve": "npx npm-run-all --parallel watch:web serve", "watch:web": "npm run watch --mode=web", "serve": "npx http-server dist/web", diff --git a/test/e2e/plugin-project/package.json b/test/e2e/plugin-project/package.json index 7f86f93207..15629a5a06 100644 --- a/test/e2e/plugin-project/package.json +++ b/test/e2e/plugin-project/package.json @@ -8,7 +8,7 @@ "watch:prod": "node ./build/build.js -w -p", "build": "node ./build/build.js -p", "build:dev": "node ./build/build.js", - "copyPlugin": "sh ./copyWebpackPlugin.sh", + "copyPlugin": "sh ../copyWebpackPlugin.sh", "watch:cross": "npm run watch --modes=wx,ali,web", "build:cross": "npm run build --modes=wx,ali,web", "watch:web:serve": "npx npm-run-all --parallel watch:web serve", From 4de328a4b54f9ac7405020ead3874a1b3357f82a Mon Sep 17 00:00:00 2001 From: xuegan Date: Tue, 27 Feb 2024 17:38:46 +0800 Subject: [PATCH 05/14] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E9=AA=8C?= =?UTF-8?q?=E8=AF=81copyPlugin.sh=E8=84=9A=E6=9C=AC=E4=B8=AD=E7=9A=84copy?= =?UTF-8?q?=20packages=20=E6=96=87=E4=BB=B6=E5=A4=B9=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=AF=B9packages=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/e2e/copyWebpackPlugin.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/e2e/copyWebpackPlugin.sh b/test/e2e/copyWebpackPlugin.sh index 0cefe6a447..f4b31ff6ea 100644 --- a/test/e2e/copyWebpackPlugin.sh +++ b/test/e2e/copyWebpackPlugin.sh @@ -1,14 +1,8 @@ echo "start copy webpackPlugin" -rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src +#rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src -cp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/ -cp -r ../../../packages/utils/src/ ./node_modules/@mpxjs/utils/src/ -cp -r ../../../packages/store/src/ ./node_modules/@mpxjs/store/src/ -cp -r ../../../packages/pinia/src/ ./node_modules/@mpxjs/pinia/src/ -cp -r ../../../packages/core/src/ ./node_modules/@mpxjs/core/src/ -cp -r ../../../packages/fetch/src/ ./node_modules/@mpxjs/fetch/src/ -cp -r ../../../packages/api-proxy/src/ ./node_modules/@mpxjs/api-proxy/src/ +cp -r ../../../packages/* ./node_modules/@mpxjs/ echo "end copy webpackPlugin" From 272be0a8c670cdad9b1c8ba51fb40c88d90bbe26 Mon Sep 17 00:00:00 2001 From: xuegan Date: Thu, 29 Feb 2024 15:10:37 +0800 Subject: [PATCH 06/14] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4e2e=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 10 +- test/e2e/copyWebpackPlugin.sh | 3 - .../e2e/miniprogram-wxss-loader/.editorconfig | 9 - test/e2e/miniprogram-wxss-loader/.gitignore | 8 - test/e2e/miniprogram-wxss-loader/README.md | 71 ------- .../miniprogram-wxss-loader/babel.config.json | 33 ---- .../miniprogram-wxss-loader/build/build.js | 142 -------------- .../build/getPlugins.js | 106 ----------- .../miniprogram-wxss-loader/build/getRules.js | 132 ------------- .../build/getWebpackConf.js | 51 ----- .../build/package.json | 5 - .../miniprogram-wxss-loader/build/utils.js | 39 ---- .../build/webpack.base.conf.js | 43 ----- .../miniprogram-wxss-loader/config/index.js | 22 --- .../config/mpxLoader.conf.js | 3 - .../config/mpxPlugin.conf.js | 94 --------- .../config/package.json | 5 - .../config/user.conf.js | 22 --- test/e2e/miniprogram-wxss-loader/package.json | 100 ---------- .../miniprogram-wxss-loader/postcss.config.js | 5 - test/e2e/miniprogram-wxss-loader/src/app.mpx | 28 --- .../miniprogram-wxss-loader/src/index.html | 13 -- .../src/pages/index/index.mpx | 24 --- .../src/pages/once/index.mpx | 25 --- .../src/pages/other/index.mpx | 24 --- .../src/pages/scoped/index.mpx | 24 --- .../src/static/img/test.png | Bin 3842 -> 0 bytes .../src/styless/global.css | 3 - .../src/styless/global.less | 5 - .../src/utils/common.js | 2 - .../static/ali/mini.project.json | 3 - .../static/swan/project.swan.json | 14 -- .../static/tt/project.config.json | 11 -- .../static/wx/project.config.json | 16 -- .../test/index.spec.js | 178 ------------------ test/e2e/miniprogram-wxss-loader/test/util.js | 9 - 36 files changed, 3 insertions(+), 1279 deletions(-) delete mode 100644 test/e2e/miniprogram-wxss-loader/.editorconfig delete mode 100644 test/e2e/miniprogram-wxss-loader/.gitignore delete mode 100644 test/e2e/miniprogram-wxss-loader/README.md delete mode 100644 test/e2e/miniprogram-wxss-loader/babel.config.json delete mode 100644 test/e2e/miniprogram-wxss-loader/build/build.js delete mode 100644 test/e2e/miniprogram-wxss-loader/build/getPlugins.js delete mode 100644 test/e2e/miniprogram-wxss-loader/build/getRules.js delete mode 100644 test/e2e/miniprogram-wxss-loader/build/getWebpackConf.js delete mode 100644 test/e2e/miniprogram-wxss-loader/build/package.json delete mode 100644 test/e2e/miniprogram-wxss-loader/build/utils.js delete mode 100644 test/e2e/miniprogram-wxss-loader/build/webpack.base.conf.js delete mode 100644 test/e2e/miniprogram-wxss-loader/config/index.js delete mode 100644 test/e2e/miniprogram-wxss-loader/config/mpxLoader.conf.js delete mode 100644 test/e2e/miniprogram-wxss-loader/config/mpxPlugin.conf.js delete mode 100644 test/e2e/miniprogram-wxss-loader/config/package.json delete mode 100644 test/e2e/miniprogram-wxss-loader/config/user.conf.js delete mode 100644 test/e2e/miniprogram-wxss-loader/package.json delete mode 100644 test/e2e/miniprogram-wxss-loader/postcss.config.js delete mode 100644 test/e2e/miniprogram-wxss-loader/src/app.mpx delete mode 100644 test/e2e/miniprogram-wxss-loader/src/index.html delete mode 100644 test/e2e/miniprogram-wxss-loader/src/pages/index/index.mpx delete mode 100644 test/e2e/miniprogram-wxss-loader/src/pages/once/index.mpx delete mode 100644 test/e2e/miniprogram-wxss-loader/src/pages/other/index.mpx delete mode 100644 test/e2e/miniprogram-wxss-loader/src/pages/scoped/index.mpx delete mode 100644 test/e2e/miniprogram-wxss-loader/src/static/img/test.png delete mode 100644 test/e2e/miniprogram-wxss-loader/src/styless/global.css delete mode 100644 test/e2e/miniprogram-wxss-loader/src/styless/global.less delete mode 100644 test/e2e/miniprogram-wxss-loader/src/utils/common.js delete mode 100644 test/e2e/miniprogram-wxss-loader/static/ali/mini.project.json delete mode 100644 test/e2e/miniprogram-wxss-loader/static/swan/project.swan.json delete mode 100644 test/e2e/miniprogram-wxss-loader/static/tt/project.config.json delete mode 100644 test/e2e/miniprogram-wxss-loader/static/wx/project.config.json delete mode 100644 test/e2e/miniprogram-wxss-loader/test/index.spec.js delete mode 100644 test/e2e/miniprogram-wxss-loader/test/util.js diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1b91facf67..9b70e463c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,6 @@ jobs: node_modules test/e2e/miniprogram-project/node_modules test/e2e/plugin-project/node_modules - test/e2e/miniprogram-wxss-loader/node_modules key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} restore-keys: | @@ -35,10 +34,10 @@ jobs: - name: install deps if: steps.cache.outputs.cache-hit != 'true' - run: npm i && npm i --prefix test/e2e/miniprogram-project && npm i --prefix test/e2e/plugin-project && npm i --prefix test/e2e/miniprogram-wxss-loader && npx lerna bootstrap --no-ci + run: npm i && npm i --prefix test/e2e/miniprogram-project && npm i --prefix test/e2e/plugin-project && npx lerna bootstrap --no-ci - name: copy-webpack-plugin - run: npm run copyPlugin --prefix test/e2e/miniprogram-project && npm run copyPlugin --prefix test/e2e/plugin-project && npm run copyPlugin --prefix test/e2e/miniprogram-wxss-loader + run: npm run copyPlugin --prefix test/e2e/miniprogram-project && npm run copyPlugin --prefix test/e2e/plugin-project - name: build-miniprogram run: npm run build:cross --prefix test/e2e/miniprogram-project @@ -46,8 +45,5 @@ jobs: - name: build-plugin run: npm run build --prefix test/e2e/plugin-project - - name: build-wxss-loader - run: npm run build --prefix test/e2e/miniprogram-wxss-loader - - name: exec unit test - run: npm t && npm t --prefix test/e2e/miniprogram-project && npm t --prefix test/e2e/plugin-project && npm t --prefix test/e2e/miniprogram-wxss-loader + run: npm t && npm t --prefix test/e2e/miniprogram-project && npm t --prefix test/e2e/plugin-project diff --git a/test/e2e/copyWebpackPlugin.sh b/test/e2e/copyWebpackPlugin.sh index f4b31ff6ea..e43bec5767 100644 --- a/test/e2e/copyWebpackPlugin.sh +++ b/test/e2e/copyWebpackPlugin.sh @@ -1,8 +1,5 @@ echo "start copy webpackPlugin" -#rm -rf ./node_modules/@mpxjs/webpack-plugin/lib ./node_modules/@mpxjs/utils/src ./node_modules/@mpxjs/store/src ./node_modules/@mpxjs/pinia/src ./node_modules/@mpxjs/core/src ./node_modules/@mpxjs/fetch/src ./node_modules/@mpxjs/api-proxy/src - - cp -r ../../../packages/* ./node_modules/@mpxjs/ echo "end copy webpackPlugin" diff --git a/test/e2e/miniprogram-wxss-loader/.editorconfig b/test/e2e/miniprogram-wxss-loader/.editorconfig deleted file mode 100644 index 9d08a1a828..0000000000 --- a/test/e2e/miniprogram-wxss-loader/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/test/e2e/miniprogram-wxss-loader/.gitignore b/test/e2e/miniprogram-wxss-loader/.gitignore deleted file mode 100644 index 3c0fb7969d..0000000000 --- a/test/e2e/miniprogram-wxss-loader/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -.DS_Store -node_modules/ -npm-debug.log -.idea/ -deploy/ -output/ -dist/ -.vscode/ diff --git a/test/e2e/miniprogram-wxss-loader/README.md b/test/e2e/miniprogram-wxss-loader/README.md deleted file mode 100644 index 83dfa352d6..0000000000 --- a/test/e2e/miniprogram-wxss-loader/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# mpx-feature-unit-test - -> mpx feature unit test - -## Dev - -```bash -# install dep -npm i - -# for dev -npm run watch - -# for online -npm run build -``` - -npm script 规范 [build|watch]:[dev|prod]:[cross|web|none] - -build 默认 prod,watch 默认 dev。另单独提供了 build:dev 和 watch:prod,用于单次构建分析看未压缩代码分析问题和持续压缩代码便于大体积项目真机调试。 - -建议自行调整 cross 的目标。npm-run-all 是为了兼容 windows 下无法同时执行两个 npm script,若不需要转 web 平台,可考虑去掉。 - -## 样式复用使用说明: - -1. 要想通过样式预处理器跳过对 .less、.sass、.styl(us) 文件的处理,可以使用例如 `/*preCompileIgnore @import 'xx.less';*/` 语法跳过文件的预编译处理,会在最终的 wxss-loader 中进行处理。用法如下: - -```CSS - -``` - -```JS -// webpack配置以下less解析规则: - -{ -test: /\.less$/, -use: [ - MpxWebpackPlugin.wxssLoader({ - importLoaders: 1 // The option importLoaders allows you to configure how many loaders before wxss-loader should be applied to @imported resources and CSS modules/ICSS imports. - }), - 'less-loader' -] -} - -// 以上配置表示 global.less 文件在 wxss-loader 处理之前会先经过 less-loader 的处理再被 wxss-loader 处理。 - -// 例如: -{ -test: /\.less$/, -use: [ - MpxWebpackPlugin.wxssLoader({ - importLoaders: 2 // The option importLoaders allows you to configure how many loaders before wxss-loader should be applied to @imported resources and CSS modules/ICSS imports. - }), - 'postcss-loader', - 'less-loader' -] -} - -// 以上配置表示 global.less 文件在 wxss-loader 处理之前会先经过 less-loader 、postcss-loader 的处理再被 wxss-loader 处理。 - - -``` - - -通过以上的配置,最终会将导入的 global.less 文件分离成单独一个文件。 \ No newline at end of file diff --git a/test/e2e/miniprogram-wxss-loader/babel.config.json b/test/e2e/miniprogram-wxss-loader/babel.config.json deleted file mode 100644 index 58b76917fa..0000000000 --- a/test/e2e/miniprogram-wxss-loader/babel.config.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "presets": [ - [ - "@babel/env", - { - "modules": false, - "shippedProposals": true - } - ] - ], - "plugins": [ - [ - "@babel/transform-runtime", - { - "corejs": 3, - "version": "^7.10.4" - } - ] - ], - "sourceType": "unambiguous", - "env": { - "test": { - "presets": [ - [ - "@babel/env", - { - "shippedProposals": true - } - ] - ] - } - } -} diff --git a/test/e2e/miniprogram-wxss-loader/build/build.js b/test/e2e/miniprogram-wxss-loader/build/build.js deleted file mode 100644 index 1c2f278d98..0000000000 --- a/test/e2e/miniprogram-wxss-loader/build/build.js +++ /dev/null @@ -1,142 +0,0 @@ -const rm = require('rimraf') -const chalk = require('chalk') -const webpack = require('webpack') -const program = require('commander') -const { userConf, supportedModes } = require('../config/index') -const getWebpackConf = require('./getWebpackConf') -const { resolveDist, getRootPath } = require('./utils') -program - .option('-w, --watch', 'watch mode') - .option('-p, --production', 'production release') - .parse(process.argv) - -const env = process.env - -const modeStr = env.npm_config_mode || env.npm_config_modes || '' - -const report = env.npm_config_report - -const modes = modeStr.split(/[,|]/) - .map((mode) => { - const modeArr = mode.split(':') - if (supportedModes.includes(modeArr[0])) { - return { - mode: modeArr[0], - env: modeArr[1] - } - } - }).filter((item) => item) - -if (!modes.length) { - modes.push({ - mode: userConf.srcMode - }) -} - -// 开启子进程 -if (userConf.openChildProcess && modes.length > 1) { - let scriptType = '' - const isProduct = program.production - const isWatch = program.watch - if (!isProduct && isWatch) scriptType = 'watch' - if (isProduct && !isWatch) scriptType = 'build' - if (isProduct && isWatch) scriptType = 'watch:prod' - if (!isProduct && !isWatch) scriptType = 'build:dev' - - const spawn = require('child_process').spawn - while (modes.length > 1) { - const modeObj = modes.pop() - const modeAndEnv = modeObj.env ? `${modeObj.mode}:${modeObj.env}` : modeObj.mode - const ls = spawn('npm', ['run', scriptType, `--modes=${modeAndEnv}`, `--mode=${modeAndEnv}`], { stdio: 'inherit' }) - ls.on('close', (code) => { - process.exitCode = code - }) - } -} - -let webpackConfs = [] - -modes.forEach(({ mode, env }) => { - const options = Object.assign({}, userConf, { - mode, - env, - production: program.production, - watch: program.watch, - report, - subDir: (userConf.isPlugin || userConf.cloudFunc) ? 'miniprogram' : '' - }) - webpackConfs.push(getWebpackConf(options)) -}) - -if (userConf.isPlugin) { - // 目前支持的plugin构建平台 - modes.filter(({ mode }) => ['wx', 'ali'].includes(mode)).forEach(({ mode, env }) => { - const options = Object.assign({}, userConf, { - plugin: true, - mode, - env, - production: program.production, - watch: program.watch, - report, - subDir: 'plugin' - }) - webpackConfs.push(getWebpackConf(options)) - }) -} - -if (webpackConfs.length === 1) { - webpackConfs = webpackConfs[0] -} - - -try { - modes.forEach(({ mode, env }) => { - rm.sync(resolveDist(getRootPath(mode, env), '*')) - }) -} catch (e) { - console.error(e) - console.log('\n\n删除dist文件夹遇到了一些问题,如果遇到问题请手工删除dist重来\n\n') -} - -if (program.watch) { - webpack(webpackConfs).watch(undefined, callback) -} else { - webpack(webpackConfs, callback) -} - -function callback (err, stats) { - if (err) { - process.exitCode = 1 - return console.error(err) - } - if (Array.isArray(stats.stats)) { - stats.stats.forEach(item => { - console.log(item.compilation.name + '打包结果:') - process.stdout.write(item.toString({ - colors: true, - modules: false, - children: false, - chunks: false, - chunkModules: false, - entrypoints: false - }) + '\n\n') - }) - } else { - process.stdout.write(stats.toString({ - colors: true, - modules: false, - children: false, - chunks: false, - chunkModules: false, - entrypoints: false - }) + '\n\n') - } - - if (stats.hasErrors()) { - console.log(chalk.red(' Build failed with errors.\n')) - } else if (program.watch) { - console.log(chalk.cyan(` Build complete at ${new Date()}.\n Still watching...\n`)) - } else { - console.log(chalk.cyan(' Build complete.\n')) - } -} diff --git a/test/e2e/miniprogram-wxss-loader/build/getPlugins.js b/test/e2e/miniprogram-wxss-loader/build/getPlugins.js deleted file mode 100644 index 52994327ea..0000000000 --- a/test/e2e/miniprogram-wxss-loader/build/getPlugins.js +++ /dev/null @@ -1,106 +0,0 @@ -let { mpxPluginConf, dllConf, supportedModes } = require('../config/index') -const MpxWebpackPlugin = require('@mpxjs/webpack-plugin') -const { resolve, resolveSrc, getConf } = require('./utils') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const CopyWebpackPlugin = require('copy-webpack-plugin') -const ESLintPlugin = require('eslint-webpack-plugin') -const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin -const VueLoaderPlugin = require('vue-loader').VueLoaderPlugin -const webpack = require('webpack') -const path = require('path') - -module.exports = function getPlugins (options) { - const { mode, srcMode, env, subDir, production, report, cloudFunc, needDll, needEslint } = options - const plugins = [] - const copyIgnoreArr = supportedModes.map((item) => { - return `**/${item}/**` - }) - - const currentMpxPluginConf = getConf(mpxPluginConf, options) - - plugins.push(new MpxWebpackPlugin(Object.assign({}, currentMpxPluginConf, { - mode, - srcMode - }, env && { env }))) - - const copyList = [ - { - context: resolve(`static/${mode}`), - from: '**/*', - to: subDir ? '..' : '', - noErrorOnMissing: true - }, - { - context: resolve('static'), - from: '**/*', - to: subDir ? '..' : '', - globOptions: { - ignore: copyIgnoreArr - }, - noErrorOnMissing: true - } - ] - - if (cloudFunc) { - copyList.push({ - context: resolve('src/functions'), - from: '**/*', - to: '../functions/' - }) - } - - if (needDll) { - const getDllManifests = require('./getDllManifests') - const dllManifests = getDllManifests(production) - const localDllManifests = dllManifests.filter((manifest) => { - return manifest.mode === mode || !manifest.mode - }) - - localDllManifests.forEach((manifest) => { - plugins.push(new webpack.DllReferencePlugin({ - context: dllConf.context, - manifest: manifest.content - })) - copyList.push({ - context: path.join(dllConf.path, 'lib'), - from: manifest.content.name, - to: manifest.content.name - }) - }) - } - - if (needEslint) { - plugins.push(new ESLintPlugin({ - context: resolve(), - exclude: [resolve('node_modules')], - extensions: ['js', 'ts', 'mpx'] - })) - } - - plugins.push(new CopyWebpackPlugin({ - patterns: copyList - })) - - plugins.push(new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: production ? '"production"' : '"development"' - } - })) - - if (mode === 'web') { - plugins.push(new VueLoaderPlugin()) - plugins.push(new HtmlWebpackPlugin({ - filename: 'index.html', - template: resolveSrc('index.html', subDir), - inject: true - })) - } - - plugins.push(new webpack.ProgressPlugin()) - - if (report) { - plugins.push(new BundleAnalyzerPlugin()) - } - - return plugins -} diff --git a/test/e2e/miniprogram-wxss-loader/build/getRules.js b/test/e2e/miniprogram-wxss-loader/build/getRules.js deleted file mode 100644 index 7bc57e42ba..0000000000 --- a/test/e2e/miniprogram-wxss-loader/build/getRules.js +++ /dev/null @@ -1,132 +0,0 @@ -let { mpxLoaderConf } = require('../config/index') -const MpxWebpackPlugin = require('@mpxjs/webpack-plugin') -const { resolve, getConf } = require('./utils') - -const baseRules = [ - { - test: /\.js$/, - loader: 'babel-loader', - include: [resolve('src'), resolve('test'), resolve('node_modules/@mpxjs')] - }, - { - test: /\.json$/, - resourceQuery: /asScript/, - type: 'javascript/auto' - }, - { - test: /\.(wxs|qs|sjs|qjs|jds|dds|filter\.js)$/, - use: [ - MpxWebpackPlugin.wxsPreLoader() - ], - enforce: 'pre' - }, - { - test: /\.(png|jpe?g|gif|svg)$/, - use: [ - MpxWebpackPlugin.urlLoader({ - name: 'img/[name][hash].[ext]' - }) - ] - } -] - -const tsRule = { - test: /\.ts$/, - use: [ - 'babel-loader', - { - loader: 'ts-loader', - options: { - appendTsSuffixTo: [/\.(mpx|vue)$/] - } - } - ] -} - -module.exports = function getRules (options) { - const { mode, tsSupport } = options - - let rules = baseRules.slice() - - if (tsSupport) { - rules.push(tsRule) - } - - const currentMpxLoaderConf = getConf(mpxLoaderConf, options) - - if (mode === 'web') { - rules = rules.concat([ - { - test: /\.mpx$/, - use: [ - { - loader: 'vue-loader', - options: { - transformToRequire: { - 'mpx-image': 'src', - 'mpx-audio': 'src', - 'mpx-video': 'src' - } - } - }, - MpxWebpackPlugin.loader(currentMpxLoaderConf) - ] - }, - { - test: /\.vue$/, - loader: 'vue-loader' - }, - // 如输出web时需要支持其他预编译语言,可以在此添加rule配置 - { - test: /\.styl(us)?$/, - use: [ - 'vue-style-loader', - 'css-loader', - 'stylus-loader' - ] - }, - { - test: /\.css$/, - use: [ - 'vue-style-loader', - 'css-loader' - ] - } - ]) - } else { - rules = rules.concat([ - { - test: /\.mpx$/, - use: MpxWebpackPlugin.loader(currentMpxLoaderConf) - }, - { - test: /\.styl(us)?$/, - use: [ - MpxWebpackPlugin.wxssLoader(), - 'stylus-loader' - ] - }, - { - test: /\.less$/, - use: [ - MpxWebpackPlugin.wxssLoader({ - importLoaders: 1 - }), - 'less-loader' - ] - }, - { - test: /\.(wxss|acss|css|qss|ttss|jxss|ddss)$/, - use: MpxWebpackPlugin.wxssLoader() - }, - { - test: /\.(wxml|axml|swan|qml|ttml|qxml|jxml|ddml)$/, - use: [ - 'html-loader' - ] - } - ]) - } - - return rules -} diff --git a/test/e2e/miniprogram-wxss-loader/build/getWebpackConf.js b/test/e2e/miniprogram-wxss-loader/build/getWebpackConf.js deleted file mode 100644 index 3ef9698bf8..0000000000 --- a/test/e2e/miniprogram-wxss-loader/build/getWebpackConf.js +++ /dev/null @@ -1,51 +0,0 @@ -const webpackBaseConf = require('./webpack.base.conf') -const { mergeWithCustomize, customizeObject } = require('webpack-merge') -const getRules = require('./getRules') -const getPlugins = require('./getPlugins') -const { resolveSrc, resolveDist, getRootPath } = require('./utils') - -module.exports = function getWebpackConfs (options) { - const { plugin, subDir, mode, env, production, watch } = options - const entry = plugin ? { - plugin: resolveSrc('plugin.json?mpx&type=json&extract&isPlugin&asScript', subDir) - } : { - app: resolveSrc('app.mpx', subDir) - } - const rootPath = getRootPath(mode, env) - const output = { - path: resolveDist(rootPath, subDir), - publicPath: '/', - filename: '[name].js' - } - const name = plugin ? `${rootPath}-plugin-compiler` : `${rootPath}-compiler` - const rules = getRules(options) - const plugins = getPlugins(options) - const extendConfs = {} - if (production) { - extendConfs.mode = 'production' - } - extendConfs.optimization = { - nodeEnv: production ? 'production' : 'development' - } - if (watch) { - // 仅在watch模式下生产sourcemap - // 百度小程序不开启sourcemap,开启会有模板渲染问题 - if (mode !== 'swan') { - extendConfs.devtool = 'source-map' - } - } - - return mergeWithCustomize({ - customizeObject: customizeObject({ - snapshot: 'replace' - }) - })(webpackBaseConf, { - name, - entry, - output, - module: { - rules - }, - plugins - }, extendConfs) -} diff --git a/test/e2e/miniprogram-wxss-loader/build/package.json b/test/e2e/miniprogram-wxss-loader/build/package.json deleted file mode 100644 index a84ff3ca30..0000000000 --- a/test/e2e/miniprogram-wxss-loader/build/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "build", - "version": "1.0.0", - "description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!" -} diff --git a/test/e2e/miniprogram-wxss-loader/build/utils.js b/test/e2e/miniprogram-wxss-loader/build/utils.js deleted file mode 100644 index 5334f26415..0000000000 --- a/test/e2e/miniprogram-wxss-loader/build/utils.js +++ /dev/null @@ -1,39 +0,0 @@ -const path = require('path') - -function resolveSrc (file, subDir = '') { - return path.join(__dirname, '../src', subDir, file || '') -} - -function resolveDist (platform, subDir = '') { - return path.join(__dirname, '../dist', platform, subDir) -} - -function resolve (file) { - return path.join(__dirname, '..', file || '') -} - -function normalizeArr (arrCfg) { - if (Array.isArray(arrCfg) && arrCfg.length) { - return arrCfg - } else if (arrCfg) { - return [arrCfg] - } - return [] -} - -function getRootPath (...args) { - return args.filter(item => item).join('_') -} - -function getConf (conf, options) { - return typeof conf === 'function' ? conf(options) : conf -} - -module.exports = { - resolve, - resolveSrc, - resolveDist, - normalizeArr, - getRootPath, - getConf -} diff --git a/test/e2e/miniprogram-wxss-loader/build/webpack.base.conf.js b/test/e2e/miniprogram-wxss-loader/build/webpack.base.conf.js deleted file mode 100644 index d653ac678a..0000000000 --- a/test/e2e/miniprogram-wxss-loader/build/webpack.base.conf.js +++ /dev/null @@ -1,43 +0,0 @@ -const { resolve } = require('./utils') - -module.exports = { - performance: { - hints: false - }, - mode: 'none', - resolve: { - extensions: ['.mpx', '.js', '.wxml', '.vue', '.ts'], - modules: ['node_modules'] - }, - cache: { - type: 'filesystem', - buildDependencies: { - build: [resolve('build/')], - config: [resolve('config/')] - }, - cacheDirectory: resolve('.cache/') - }, - snapshot: { - // 如果希望修改node_modules下的文件时对应的缓存可以失效,可以将此处的配置改为 managedPaths: [] - managedPaths: [resolve('node_modules/')] - }, - optimization: { - minimizer: [ - { - apply: compiler => { - // Lazy load the Terser plugin - const TerserPlugin = require('terser-webpack-plugin') - new TerserPlugin({ - // terserOptions参考 https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions - terserOptions: { - // terser的默认行为会把某些对象方法转为箭头函数,导致ios9等不支持箭头函数的环境白屏,详情见 https://github.com/terser/terser#compress-options - compress: { - arrows: false - } - } - }).apply(compiler) - } - } - ] - } -} diff --git a/test/e2e/miniprogram-wxss-loader/config/index.js b/test/e2e/miniprogram-wxss-loader/config/index.js deleted file mode 100644 index 9f84ab52c3..0000000000 --- a/test/e2e/miniprogram-wxss-loader/config/index.js +++ /dev/null @@ -1,22 +0,0 @@ -const mpxLoaderConf = require('./mpxLoader.conf') -const mpxPluginConf = require('./mpxPlugin.conf') -const userConf = require('./user.conf') - -const supportedModes = ['wx', 'ali', 'swan', 'qq', 'tt', 'qa', 'jd', 'dd'] - -if (userConf.transWeb) { - supportedModes.push('web') -} - -const options = { - userConf, - mpxLoaderConf, - mpxPluginConf, - supportedModes -} - -if (userConf.needDll) { - options.dllConf = require('./dll.conf') -} - -module.exports = options diff --git a/test/e2e/miniprogram-wxss-loader/config/mpxLoader.conf.js b/test/e2e/miniprogram-wxss-loader/config/mpxLoader.conf.js deleted file mode 100644 index 36bbfe2cf2..0000000000 --- a/test/e2e/miniprogram-wxss-loader/config/mpxLoader.conf.js +++ /dev/null @@ -1,3 +0,0 @@ -// mpx的loader配置在这里传入 -// 配置项文档:https://www.mpxjs.cn/api/compile.html#mpxwebpackplugin-loader -module.exports = {} diff --git a/test/e2e/miniprogram-wxss-loader/config/mpxPlugin.conf.js b/test/e2e/miniprogram-wxss-loader/config/mpxPlugin.conf.js deleted file mode 100644 index 7db0cbf9cc..0000000000 --- a/test/e2e/miniprogram-wxss-loader/config/mpxPlugin.conf.js +++ /dev/null @@ -1,94 +0,0 @@ -const resolve = require('../build/utils').resolve -const path = require('path') - -// 可以在此配置mpx webpack plugin -// 配置项文档: https://www.mpxjs.cn/api/compile.html#mpxwebpackplugin-options -module.exports = { - // resolve的模式 - resolveMode: 'webpack', // 可选值 webpack / native,默认是webpack,原生迁移建议使用native - - // 当resolveMode为native时可通过该字段指定项目根目录 - // projectRoot: resolve('src'), - - // 可选值 full / changed,不传默认为change,当设置为changed时在watch模式下将只会对内容发生变化的文件进行写入,以提升小程序开发者工具编译性能 - writeMode: 'changed', - - env: 'someEnv', - - // 是否需要对样式加scope,因为只有ali平台没有样式隔离,只对ali平台生效,提供include和exclude,和webpack的rules规则相同 - // autoScopeRules: { - // include: [resolve('src')] - // }, - - // 批量指定文件mode,用法如下,指定平台,提供include/exclude指定文件,即include的文件会默认被认为是该平台的,include/exclude的规则和webpack的rules的相同 - modeRules: { - // ali: { - // include: [resolve('node_modules/vant-aliapp')] - // } - }, - - // 定义一些全局环境变量,可在JS/模板/样式/JSON中使用 - defs: { - __black__: 'blackgan test' - }, - - // 是否转换px到rpx - transRpxRules: [ - { - mode: 'all', - comment: 'use rpx', - designWidth: 1280, - include: resolve('src') - } - ], - - decodeHTMLText: true, - - transMpxRules: { - include: () => true, - exclude: ['@mpxjs'] - }, - - autoScopeRules: { - include: [resolve('src')] - }, - - generateBuildMap: true, - - // 输出web时,vue-loader版本<15时需要将该配置关闭 - forceDisableBuiltInLoader: true, - - subpackageModulesRules: { - include: [/utils\/common/] - }, - - // 多语言i18n能力 以下是简单示例,更多详情请参考文档:https://didi.github.io/mpx/i18n.html - i18n: { - locale: 'en-US', - // messages既可以通过对象字面量传入,也可以通过messagesPath指定一个js模块路径,在该模块中定义配置并导出,dateTimeFormats/dateTimeFormatsPath和numberFormats/numberFormatsPath同理 - messages: { - 'en-US': { - message: { - hello: '{msg} world' - } - }, - 'zh-CN': { - message: { - hello: '{msg} 世界' - } - } - } - }, - customOutputPath: (type, name, hash, ext) => { - // type: 资源类型(page | component | static) - // name: 资源原有文件名 - // hash: 8位长度的hash串 - // ext: 文件后缀(.js| .wxml | .json 等) - if (name === 'customOutputCom') { - return path.join(type + 's', name, 'index' + ext) - } - // 输出示例: pages/testax34dde3/index.js - return path.join(type + 's', name + hash, 'index' + ext) - } - -} diff --git a/test/e2e/miniprogram-wxss-loader/config/package.json b/test/e2e/miniprogram-wxss-loader/config/package.json deleted file mode 100644 index a59b4221e8..0000000000 --- a/test/e2e/miniprogram-wxss-loader/config/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "config", - "version": "1.0.0", - "description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!" -} diff --git a/test/e2e/miniprogram-wxss-loader/config/user.conf.js b/test/e2e/miniprogram-wxss-loader/config/user.conf.js deleted file mode 100644 index 154a99a940..0000000000 --- a/test/e2e/miniprogram-wxss-loader/config/user.conf.js +++ /dev/null @@ -1,22 +0,0 @@ -function formatOption (option) { - if (option === 'true') return true - if (option === 'false') return false - return option -} - -// 根据创建项目时的问题生成的 -// 改动需谨慎,有的选项存在互斥关系,比如跨平台,则无法使用云函数 -// 若需修改以启用新的能力,建议试试新建项目按问题生成模板后把这部分内容拷贝过来 -module.exports = { - srcMode: formatOption('wx'), - cross: formatOption('true'), - openChildProcess: formatOption('true'), - transWeb: formatOption('true'), - cloudFunc: formatOption('false'), - isPlugin: formatOption('false'), - tsSupport: formatOption('false'), - babel7Support: formatOption('true'), - needEslint: formatOption('false'), - needDll: formatOption('false'), - needUnitTest: formatOption('false') -} diff --git a/test/e2e/miniprogram-wxss-loader/package.json b/test/e2e/miniprogram-wxss-loader/package.json deleted file mode 100644 index 977f2b10b8..0000000000 --- a/test/e2e/miniprogram-wxss-loader/package.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "name": "mpx-feature-unit-test", - "version": "1.0.0", - "description": "mpx feature unit test", - "main": "index.js", - "scripts": { - "watch": "node ./build/build.js -w", - "watch:prod": "node ./build/build.js -w -p", - "build": "node ./build/build.js", - "build:wx": "npm run build --mode=wx", - "build:ali": "npm run build --mode=ali", - "build:dev": "node ./build/build.js", - "watch:cross": "npm run watch --modes=wx,ali,web", - "build:cross": "npm run build --modes=wx,ali,tt,swan", - "copyPlugin": "sh ../copyWebpackPlugin.sh", - "watch:web:serve": "npx npm-run-all --parallel watch:web serve", - "watch:web": "npm run watch --mode=web", - "serve": "npx http-server dist/web", - "help": "node ./build/build.js --help", - "test": "jest --no-cache" - }, - "_moduleAliases": { - "@mpxjs/webpack-plugin": "../../packages/webpack-plugin" - }, - "author": "octoberluobin ", - "license": "ISC", - "dependencies": { - "@mpxjs/api-proxy": "^2.7.1", - "@mpxjs/core": "^2.9.1", - "@mpxjs/utils": "^2.9.1", - "semver": "^7.5.4", - "vue": "^2.6.10", - "vue-i18n": "^8.15.3", - "@mpxjs/api-proxy": "^2.8.0", - "@mpxjs/core": "^2.8.0", - "@mpxjs/fetch": "^2.8.0", - "@mpxjs/pinia": "^2.8.0", - "@mpxjs/store": "^2.8.0", - "@mpxjs/utils": "^2.8.0" - }, - "browserslist": [ - "ios >= 9", - "chrome >= 47" - ], - "devDependencies": { - "@babel/core": "^7.10.4", - "@babel/plugin-transform-runtime": "^7.10.4", - "@babel/preset-env": "^7.10.4", - "@babel/runtime-corejs3": "^7.10.4", - "@mpxjs/miniprogram-simulate": "1.4.9", - "@mpxjs/mpx-jest": "0.0.16", - "@mpxjs/webpack-plugin": "^2.8.0", - "@typescript-eslint/eslint-plugin": "^5.2.0", - "@typescript-eslint/parser": "^5.2.0", - "babel-eslint": "^10.0.1", - "babel-jest": "^25.3.0", - "babel-loader": "^8.1.0", - "chalk": "^2.3.2", - "commander": "^6.0.0", - "copy-webpack-plugin": "^9.0.1", - "css-loader": "^0.28.11", - "eslint": "^7.32.0", - "eslint-config-babel": "^8.0.2", - "eslint-config-standard": "^16.0.3", - "eslint-friendly-formatter": "^4.0.1", - "eslint-plugin-html": "^6.2.0", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-local-rules": "^0.1.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^2.6.2", - "eslint-plugin-promise": "^5.1.1", - "eslint-plugin-standard": "^4.0.0", - "eslint-webpack-plugin": "^3.1.1", - "html-loader": "^0.5.5", - "html-webpack-plugin": "^5.3.2", - "http-server": "^0.12.0", - "jest": "^24.9.0", - "json5": "^2.2.0", - "less": "^4.1.3", - "less-loader": "^11.1.0", - "link-module-alias": "^1.2.0", - "miniprogram-simulate": "^1.1.6", - "npm-run-all": "^4.1.5", - "path": "^0.12.7", - "progress-bar-webpack-plugin": "^2.1.0", - "rimraf": "^2.6.2", - "stylus": "^0.54.5", - "stylus-loader": "^3.0.2", - "ts-loader": "^6.0.0", - "typescript": "^4.1.2", - "vue-loader": "^15.9.3", - "vue-router": "^3.1.3", - "vue-style-loader": "^4.1.2", - "vue-template-compiler": "^2.6.10", - "webpack": "^5.48.0", - "webpack-bundle-analyzer": "^4.5.0", - "webpack-cli": "^4.9.2", - "webpack-merge": "^5.8.0" - } -} diff --git a/test/e2e/miniprogram-wxss-loader/postcss.config.js b/test/e2e/miniprogram-wxss-loader/postcss.config.js deleted file mode 100644 index affde7208f..0000000000 --- a/test/e2e/miniprogram-wxss-loader/postcss.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - plugins: [ - require('autoprefixer')({ remove: false }) - ] -} diff --git a/test/e2e/miniprogram-wxss-loader/src/app.mpx b/test/e2e/miniprogram-wxss-loader/src/app.mpx deleted file mode 100644 index f5f2b80729..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/app.mpx +++ /dev/null @@ -1,28 +0,0 @@ - - - - - diff --git a/test/e2e/miniprogram-wxss-loader/src/index.html b/test/e2e/miniprogram-wxss-loader/src/index.html deleted file mode 100644 index c2a5176b1a..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - mpx-test - - -
- - - diff --git a/test/e2e/miniprogram-wxss-loader/src/pages/index/index.mpx b/test/e2e/miniprogram-wxss-loader/src/pages/index/index.mpx deleted file mode 100644 index ed5920b7f4..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/pages/index/index.mpx +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - diff --git a/test/e2e/miniprogram-wxss-loader/src/pages/once/index.mpx b/test/e2e/miniprogram-wxss-loader/src/pages/once/index.mpx deleted file mode 100644 index 0fd4345a5b..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/pages/once/index.mpx +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - diff --git a/test/e2e/miniprogram-wxss-loader/src/pages/other/index.mpx b/test/e2e/miniprogram-wxss-loader/src/pages/other/index.mpx deleted file mode 100644 index ddf36cdc49..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/pages/other/index.mpx +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - diff --git a/test/e2e/miniprogram-wxss-loader/src/pages/scoped/index.mpx b/test/e2e/miniprogram-wxss-loader/src/pages/scoped/index.mpx deleted file mode 100644 index 5378828254..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/pages/scoped/index.mpx +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - diff --git a/test/e2e/miniprogram-wxss-loader/src/static/img/test.png b/test/e2e/miniprogram-wxss-loader/src/static/img/test.png deleted file mode 100644 index 58fa0b57f0b679a1618b7a6591ea8da588cb505f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3842 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 diff --git a/test/e2e/miniprogram-wxss-loader/src/styless/global.css b/test/e2e/miniprogram-wxss-loader/src/styless/global.css deleted file mode 100644 index 316570974d..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/styless/global.css +++ /dev/null @@ -1,3 +0,0 @@ -.title-wrapper { - font-size: 30rpx; -} \ No newline at end of file diff --git a/test/e2e/miniprogram-wxss-loader/src/styless/global.less b/test/e2e/miniprogram-wxss-loader/src/styless/global.less deleted file mode 100644 index 95cc5fd1b5..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/styless/global.less +++ /dev/null @@ -1,5 +0,0 @@ -html { - body { - font-size: 24rpx; - } -} \ No newline at end of file diff --git a/test/e2e/miniprogram-wxss-loader/src/utils/common.js b/test/e2e/miniprogram-wxss-loader/src/utils/common.js deleted file mode 100644 index f7473935a4..0000000000 --- a/test/e2e/miniprogram-wxss-loader/src/utils/common.js +++ /dev/null @@ -1,2 +0,0 @@ - -export const commonName = 'blackgan common util common name' diff --git a/test/e2e/miniprogram-wxss-loader/static/ali/mini.project.json b/test/e2e/miniprogram-wxss-loader/static/ali/mini.project.json deleted file mode 100644 index 37b4002f92..0000000000 --- a/test/e2e/miniprogram-wxss-loader/static/ali/mini.project.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component2": true -} \ No newline at end of file diff --git a/test/e2e/miniprogram-wxss-loader/static/swan/project.swan.json b/test/e2e/miniprogram-wxss-loader/static/swan/project.swan.json deleted file mode 100644 index 54761aa523..0000000000 --- a/test/e2e/miniprogram-wxss-loader/static/swan/project.swan.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilation-args": { - "common": { - "ignoreTransJs": true, - "ignoreUglify": true - }, - "options": [], - "selected": -3 - }, - "projectname": "mpx-feature-unit-test", - "setting": { - "urlCheck": true - } -} diff --git a/test/e2e/miniprogram-wxss-loader/static/tt/project.config.json b/test/e2e/miniprogram-wxss-loader/static/tt/project.config.json deleted file mode 100644 index 1110fd0c69..0000000000 --- a/test/e2e/miniprogram-wxss-loader/static/tt/project.config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "setting": { - "urlCheck": true, - "es6": false, - "postcss": false, - "minified": false, - "newFeature": true - }, - "appid": "testAppId", - "projectname": "mpx-feature-unit-test" -} diff --git a/test/e2e/miniprogram-wxss-loader/static/wx/project.config.json b/test/e2e/miniprogram-wxss-loader/static/wx/project.config.json deleted file mode 100644 index 2bdc3cc097..0000000000 --- a/test/e2e/miniprogram-wxss-loader/static/wx/project.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compileType": "miniprogram", - "setting": { - "newFeature": true, - "urlCheck": true, - "es6": false, - "postcss": false, - "minified": false, - "checkSiteMap": false, - "autoAudits": false - }, - "appid": "touristappid", - "projectname": "mpx-feature-unit-test", - "description": "mpx feature unit test", - "condition": {} -} diff --git a/test/e2e/miniprogram-wxss-loader/test/index.spec.js b/test/e2e/miniprogram-wxss-loader/test/index.spec.js deleted file mode 100644 index 2a22237c23..0000000000 --- a/test/e2e/miniprogram-wxss-loader/test/index.spec.js +++ /dev/null @@ -1,178 +0,0 @@ -const simulate = require('@mpxjs/miniprogram-simulate') -const fs = require('fs') -const path = require('path') -const { resolveDist, resolve } = require('./util') - -function loadComponent (componentPathStr) { - const outputMap = require(resolveDist('outputMap.json', 'wx')) - const componentPath = resolve(componentPathStr) - const realComponentPath = resolveDist(outputMap[componentPath], 'wx') - return simulate.load(realComponentPath, undefined, { - rootPath: resolveDist('', 'wx') - }) -} - -function getBuildOutFilePath (componentPathStr, mode) { - const outputMap = require(resolveDist('outputMap.json', mode)) - const componentPath = resolve(componentPathStr) - return resolveDist(outputMap[componentPath], mode) -} - -function readFile (path) { - const result = fs.readFileSync(path, 'utf-8') - return result -} - -describe('index page', () => { - let id - beforeAll(() => { - id = loadComponent('src/pages/index/index.mpx') - }) - let comp = null - let parent = null - beforeEach(() => { - comp = simulate.render(id) - parent = document.createElement('parent-wrapper') // 创建容器节点 - comp.attach(parent) // 挂载组件到容器节点 - }) - - it('when the style import css file, it will draw out of this file', async () => { - const { mode, css } = { - mode: 'wx', - css: '.wxss' - } - - const listComponentPath = getBuildOutFilePath( - 'src/pages/index/index.mpx', - mode - ) - const listComponentCss = readFile(listComponentPath + css) - const cssImportCode = `@import "../../styless/global43985ba5/index${css}";` - const outputDir = resolveDist('', mode) - const outputStylePath = path.join( - outputDir, - `styless/global43985ba5/index${css}` - ) - const styleContent = await fs.readFileSync(outputStylePath, 'utf8') - - expect(listComponentCss.indexOf(cssImportCode) !== -1).toBe(true) - expect( - styleContent.includes(` -.title-wrapper { - font-size: 30rpx; -}`) - ).toBe(true) - }) - - it('When ali mode, the style import css file, it will draw out of this file', async () => { - const { mode, css } = { - mode: 'ali', - css: '.acss' - } - - const listComponentPath = getBuildOutFilePath( - 'src/pages/index/index.mpx', - mode - ) - const listComponentCss = readFile(listComponentPath + css) - const cssImportCode = `@import "../../styless/global43985ba5/index${css}";` - const outputDir = resolveDist('', mode) - const outputStylePath = path.join( - outputDir, - `styless/global43985ba5/index${css}` - ) - const styleContent = await fs.readFileSync(outputStylePath, 'utf8') - - expect(listComponentCss.indexOf(cssImportCode) !== -1).toBe(true) - expect( - styleContent.includes(` -.title-wrapper { - font-size: 30rpx; -}`) - ).toBe(true) - }) - - it("when wx mode, use /* @mpx-import 'xx.less' */ note,the less-loader、stylus-loader or other preLoaders will ignore the import file compilation,finally draw out of this file", async () => { - const { mode, css } = { - mode: 'wx', - css: '.wxss' - } - const listComponentPath = getBuildOutFilePath( - 'src/pages/other/index.mpx', - mode - ) - const listComponentCss = readFile(listComponentPath + css) - const cssImportCode = `@import "../../styless/global2f76fc37/index${css}";` - const outputDir = resolveDist('', mode) - const outputStylePath = path.join( - outputDir, - `styless/global2f76fc37/index${css}` - ) - const styleContent = await fs.readFileSync(outputStylePath, 'utf8') - - expect(listComponentCss.indexOf(cssImportCode) !== -1).toBe(true) - expect( - styleContent.includes(` -html body { - font-size: 24rpx; -}`) - ).toBe(true) - }) - - it("when ali mode, use /* @mpx-import 'xx.less' */ note,the less-loader、stylus-loader or other preLoaders will ignore the import file compilation,finally draw out of this file", async () => { - const { mode, css } = { - mode: 'ali', - css: '.acss' - } - const listComponentPath = getBuildOutFilePath( - 'src/pages/other/index.mpx', - mode - ) - const listComponentCss = readFile(listComponentPath + css) - const cssImportCode = `@import "../../styless/global2f76fc37/index${css}";` - const outputDir = resolveDist('', mode) - const outputStylePath = path.join( - outputDir, - `styless/global2f76fc37/index${css}` - ) - const styleContent = await fs.readFileSync(outputStylePath, 'utf8') - - expect(listComponentCss.indexOf(cssImportCode) !== -1).toBe(true) - expect( - styleContent.includes(` -html body { - font-size: 24rpx; -}`) - ).toBe(true) - }) - - it('when use ali mode, it should correctly contain css scope feature', async () => { - const { mode, css } = { - mode: 'ali', - css: '.acss' - } - - const listComponentPath = getBuildOutFilePath( - 'src/pages/scoped/index.mpx', - mode - ) - const listComponentCss = readFile(listComponentPath + css) - expect(/.title\../.test(listComponentCss)).toBe(true) - }) - - it('import common url more than two times, finally it will be parse once', async () => { - const { mode, css } = { - mode: 'wx', - css: '.wxss' - } - - const listComponentPath = getBuildOutFilePath( - 'src/pages/once/index.mpx', - mode - ) - const listComponentCss = readFile(listComponentPath + css) - const REGEXP = /(@import[\s]+["|'].+wxss["|'];)/g - const matched = listComponentCss.match(REGEXP) - expect(matched.length).toBe(1) - }) -}) diff --git a/test/e2e/miniprogram-wxss-loader/test/util.js b/test/e2e/miniprogram-wxss-loader/test/util.js deleted file mode 100644 index ae168c7af1..0000000000 --- a/test/e2e/miniprogram-wxss-loader/test/util.js +++ /dev/null @@ -1,9 +0,0 @@ -import path from 'path' - -export function resolveDist (dir, mode = 'wx') { - return path.join(__dirname, `../dist/${mode}`, dir) -} - -export function resolve (file) { - return path.join(__dirname, '..', file || '') -} From 77635d1e98e9d495f0ff2651e7b5ca08e9b3c441 Mon Sep 17 00:00:00 2001 From: xuegan Date: Thu, 29 Feb 2024 17:33:13 +0800 Subject: [PATCH 07/14] fix: change package.json content --- test/e2e/miniprogram-project/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/miniprogram-project/package.json b/test/e2e/miniprogram-project/package.json index 441afd96cd..b5ac1b5848 100644 --- a/test/e2e/miniprogram-project/package.json +++ b/test/e2e/miniprogram-project/package.json @@ -84,7 +84,7 @@ "vue-router": "^3.1.3", "vue-style-loader": "^4.1.2", "vue-template-compiler": "^2.6.10", - "webpack": "^5.48.0", + "webpack": "^5.75.0", "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.2", "webpack-merge": "^5.8.0" From 6b89a8d974fd54eddb5c1176da7e4bba09829f09 Mon Sep 17 00:00:00 2001 From: xuegan Date: Thu, 29 Feb 2024 17:43:59 +0800 Subject: [PATCH 08/14] fix: some fix --- .github/workflows/test.yml | 2 +- test/e2e/miniprogram-project/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b70e463c1..276d99f1fc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: ${{ runner.os }}- - name: install deps - if: steps.cache.outputs.cache-hit != 'true' +# if: steps.cache.outputs.cache-hit != 'true' run: npm i && npm i --prefix test/e2e/miniprogram-project && npm i --prefix test/e2e/plugin-project && npx lerna bootstrap --no-ci - name: copy-webpack-plugin diff --git a/test/e2e/miniprogram-project/package.json b/test/e2e/miniprogram-project/package.json index b5ac1b5848..9ea3be83d6 100644 --- a/test/e2e/miniprogram-project/package.json +++ b/test/e2e/miniprogram-project/package.json @@ -42,7 +42,7 @@ "@mpxjs/babel-plugin-inject-page-events": "^2.8.0", "@mpxjs/miniprogram-simulate": "1.4.9", "@mpxjs/mpx-jest": "0.0.27", - "@mpxjs/webpack-plugin": "^2.8.0", + "@mpxjs/webpack-plugin": "^2.9.21", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "async": "^3.2.4", From c7f17e8d73d6e4004244d3b949ffa8f7259e0a8e Mon Sep 17 00:00:00 2001 From: xuegan Date: Thu, 29 Feb 2024 18:39:29 +0800 Subject: [PATCH 09/14] test delete cache dir --- .github/workflows/test.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 276d99f1fc..08cefa93b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,23 +14,23 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Cache node modules - id: cache - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: | - ~/.npm - node_modules - test/e2e/miniprogram-project/node_modules - test/e2e/plugin-project/node_modules - - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- +# - name: Cache node modules +# id: cache +# uses: actions/cache@v2 +# env: +# cache-name: cache-node-modules +# with: +# path: | +# ~/.npm +# node_modules +# test/e2e/miniprogram-project/node_modules +# test/e2e/plugin-project/node_modules +# +# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} +# restore-keys: | +# ${{ runner.os }}-build-${{ env.cache-name }}- +# ${{ runner.os }}-build- +# ${{ runner.os }}- - name: install deps # if: steps.cache.outputs.cache-hit != 'true' From de178add06cb35ddd961de867f6b6c375ff8788b Mon Sep 17 00:00:00 2001 From: xuegan Date: Thu, 29 Feb 2024 19:10:18 +0800 Subject: [PATCH 10/14] fix: update package.json --- test/e2e/miniprogram-project/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/test/e2e/miniprogram-project/package.json b/test/e2e/miniprogram-project/package.json index 9ea3be83d6..0ef9161bea 100644 --- a/test/e2e/miniprogram-project/package.json +++ b/test/e2e/miniprogram-project/package.json @@ -25,6 +25,7 @@ "dependencies": { "@mpxjs/api-proxy": "^2.7.1", "@mpxjs/core": "^2.9.1", + "@mpxjs/store": "^2.9.9", "@mpxjs/utils": "^2.9.1", "semver": "^7.5.4", "vue": "^2.6.10", From 23e22b9f89ea64c1d100650907fafb7565b9905a Mon Sep 17 00:00:00 2001 From: xuegan Date: Thu, 29 Feb 2024 19:33:22 +0800 Subject: [PATCH 11/14] fix: change --- test/e2e/copyWebpackPlugin.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/e2e/copyWebpackPlugin.sh b/test/e2e/copyWebpackPlugin.sh index e43bec5767..ed61570eb1 100644 --- a/test/e2e/copyWebpackPlugin.sh +++ b/test/e2e/copyWebpackPlugin.sh @@ -2,4 +2,6 @@ echo "start copy webpackPlugin" cp -r ../../../packages/* ./node_modules/@mpxjs/ +rm -rf ./node_modules/@mpxjs/webpack-plugin/node_modules/webpack + echo "end copy webpackPlugin" From 524a5ebee10a027b0af3a16dfe79aa500658105a Mon Sep 17 00:00:00 2001 From: xuegan Date: Thu, 29 Feb 2024 21:04:46 +0800 Subject: [PATCH 12/14] fix: change --- test/e2e/plugin-project/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/plugin-project/package.json b/test/e2e/plugin-project/package.json index 15629a5a06..a7ddd57b05 100644 --- a/test/e2e/plugin-project/package.json +++ b/test/e2e/plugin-project/package.json @@ -43,7 +43,7 @@ "@babel/preset-env": "^7.10.4", "@babel/runtime-corejs3": "^7.10.4", "@mpxjs/miniprogram-simulate": "1.4.9", - "@mpxjs/mpx-jest": "0.0.16", + "@mpxjs/mpx-jest": "0.0.30", "@mpxjs/webpack-plugin": "^2.8.0", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", From 5e603cdb5fd822d23a2d6a4c2173169705a7472e Mon Sep 17 00:00:00 2001 From: xuegan Date: Fri, 1 Mar 2024 11:10:49 +0800 Subject: [PATCH 13/14] fix:change --- test/e2e/plugin-project/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/plugin-project/package.json b/test/e2e/plugin-project/package.json index a7ddd57b05..2c9cce44ff 100644 --- a/test/e2e/plugin-project/package.json +++ b/test/e2e/plugin-project/package.json @@ -42,8 +42,8 @@ "@babel/plugin-transform-typescript": "^7.16.1", "@babel/preset-env": "^7.10.4", "@babel/runtime-corejs3": "^7.10.4", - "@mpxjs/miniprogram-simulate": "1.4.9", - "@mpxjs/mpx-jest": "0.0.30", + "@mpxjs/miniprogram-simulate": "^1.4.17", + "@mpxjs/mpx-jest": "0.0.27", "@mpxjs/webpack-plugin": "^2.8.0", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", From 0487ddf31d701cca99e2e7e1b12b90badd0347ef Mon Sep 17 00:00:00 2001 From: xuegan Date: Fri, 1 Mar 2024 11:40:16 +0800 Subject: [PATCH 14/14] feat: convert cache action --- .github/workflows/test.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 08cefa93b8..9b70e463c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,26 +14,26 @@ jobs: steps: - uses: actions/checkout@v2 -# - name: Cache node modules -# id: cache -# uses: actions/cache@v2 -# env: -# cache-name: cache-node-modules -# with: -# path: | -# ~/.npm -# node_modules -# test/e2e/miniprogram-project/node_modules -# test/e2e/plugin-project/node_modules -# -# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} -# restore-keys: | -# ${{ runner.os }}-build-${{ env.cache-name }}- -# ${{ runner.os }}-build- -# ${{ runner.os }}- + - name: Cache node modules + id: cache + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: | + ~/.npm + node_modules + test/e2e/miniprogram-project/node_modules + test/e2e/plugin-project/node_modules + + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- - name: install deps -# if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache.outputs.cache-hit != 'true' run: npm i && npm i --prefix test/e2e/miniprogram-project && npm i --prefix test/e2e/plugin-project && npx lerna bootstrap --no-ci - name: copy-webpack-plugin