Skip to content

Commit

Permalink
Merge pull request #987 from raxjs/release-next
Browse files Browse the repository at this point in the history
release: v3.8.14
  • Loading branch information
SoloJiang authored Apr 1, 2022
2 parents c14c8a1 + c120bec commit 9d8d795
Show file tree
Hide file tree
Showing 18 changed files with 127 additions and 93 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changelog

## 3.8.14

- Feat: add splashViewUrl and splashViewHtml fields
- Fix: only inject webpack hot client in webpack4

## 3.8.13

- Fix: build-scripts version
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"lerna": "^3.16.4",
"mark-twain": "^2.0.3",
"npm-run-all": "^4.1.5",
"nsfw": "1.2.6",
"pify": "^4.0.1",
"puppeteer": "^5.5.0",
"rax": "^1.1.0",
Expand All @@ -68,10 +67,10 @@
"rax-waterfall": "^1.1.2",
"rimraf": "^3.0.0",
"semver": "^7.3.2",
"simple-git": "^1.132.0",
"ts-jest": "^25.4.0",
"ts-node": "^8.6.1",
"typescript": "^4.0.0"
"typescript": "^4.0.0",
"chokidar": "^3.5.3"
},
"resolutions": {
"colors": "1.4.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-rax-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.0.8

- Fix: only inject webpack hot client in webpack4

## 7.0.7

- Fix: SPA title couldn't specified by route info
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-rax-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-rax-app",
"version": "7.0.7",
"version": "7.0.8",
"description": "The basic webpack configuration for rax project",
"author": "Rax Team",
"main": "lib/index.js",
Expand All @@ -18,9 +18,9 @@
],
"license": "MIT",
"dependencies": {
"rax-webpack-config": "^3.0.2",
"rax-webpack-config": "^3.0.4",
"rax-babel-config": "^2.0.0",
"rax-jest-config": "^1.0.0",
"rax-jest-config": "^1.1.0",
"rax-platform-loader": "^1.1.1",
"@builder/user-config": "^2.0.0",
"@builder/app-helpers": "^2.1.0",
Expand Down Expand Up @@ -52,4 +52,4 @@
"url": "[email protected]:raxjs/rax-app.git"
},
"gitHead": "07ac7bb07162aac8c90778dd1de4a2060f8df498"
}
}
6 changes: 4 additions & 2 deletions packages/plugin-rax-app/src/config/user.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ const devServerDefaultOptionsMap = {
},
},
client: {
overlay: false,
logging: 'none',
overlay: {
errors: true,
warnings: false,
},
},
onBeforeSetupMiddleware({ app }) {
app.use((req, res, next) => {
Expand Down
8 changes: 6 additions & 2 deletions packages/plugin-rax-app/src/utils/injectHotReloadEntries.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { isWebpack4 } from '@builder/compat-webpack4';

export default function (config) {
const entries = config.entryPoints.entries();
Object.keys(entries).forEach((entryName) => {
const entrySet = config.entry(entryName);
const entryFiles = entrySet.values();
const finalEntryFile = entryFiles[entryFiles.length - 1];
// Add webpack hot dev client
entrySet.prepend(require.resolve('react-dev-utils/webpackHotDevClient'));
// Add webpack hot dev client for webpack4
if (isWebpack4) {
entrySet.prepend(require.resolve('react-dev-utils/webpackHotDevClient'));
}
// Add module.hot.accept() to entry
entrySet.add(`${require.resolve('../Loaders/HmrLoader')}!${finalEntryFile}`);
entrySet.delete(finalEntryFile);
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-rax-pha/CHANELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v2.1.0

- Feat: add splashViewUrl and splashViewHtml fields

## v2.0.3

- Fix: remove `html` field for TabBar
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-rax-pha/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-rax-pha",
"version": "2.0.3",
"version": "2.1.0",
"description": "Rax PHA plugins",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand Down
57 changes: 1 addition & 56 deletions packages/plugin-rax-pha/src/manifestHelpers.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,6 @@
const { decamelize } = require('humps');
const pathPackage = require('path');

// appConfig keys need transform to manifest
const retainKeys = [
'name',
'startUrl',
'shortName',
'lang',
'dir',
'description',
'backgroundColor',
'display',
'icons',
'appWorker',
'window',
'pageHeader',
'tabHeader',
'tabBar',
'pages',
'dataPrefetch',
'spm',
'metas',
'links',
'scripts',
'offlineResources',
'packageResources',
'manifestPrefetchExpires',
'manifestPrefetchMaxAge',
'maxAge',
'expires',
'queryParamsPassKeys',
'queryParamsPassIgnoreKeys',
'splashViewTimeout',
'splashViewAutoClose',
'swiperThreshold',
'requestHeaders',
'enablePoplayer',
'disableCapture',
'enablePullRefresh',
'pullRefreshBackgroundColor',
'pullRefreshColorScheme',
'pullRefresh',
'cacheQueryParams',
];

// do not decamelize list
const camelizeKeys = [
'appKey',
'dataType',
'valueType',
'isSec',
'LoginRequest',
'sessionOption',
'AntiCreep',
'AntiFlood',
'needLogin',
];
const { manifestRetainKeys: retainKeys, manifestCamelizeKeys: camelizeKeys } = require('./manifestWhiteList');

// transform app config to decamelize
function transformAppConfig(appConfig, isRoot = true, parentKey) {
Expand Down
62 changes: 62 additions & 0 deletions packages/plugin-rax-pha/src/manifestWhiteList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// appConfig keys need transform to manifest
const manifestRetainKeys = [
'name',
'startUrl',
'shortName',
'lang',
'dir',
'description',
'backgroundColor',
'display',
'icons',
'appWorker',
'window',
'pageHeader',
'tabHeader',
'tabBar',
'pages',
'dataPrefetch',
'spm',
'metas',
'links',
'scripts',
'offlineResources',
'packageResources',
'manifestPrefetchExpires',
'manifestPrefetchMaxAge',
'maxAge',
'expires',
'queryParamsPassKeys',
'queryParamsPassIgnoreKeys',
'splashViewTimeout',
'splashViewAutoClose',
'splashViewHtml',
'splashViewUrl',
'swiperThreshold',
'requestHeaders',
'enablePoplayer',
'disableCapture',
'enablePullRefresh',
'pullRefreshBackgroundColor',
'pullRefreshColorScheme',
'pullRefresh',
'cacheQueryParams',
];

// do not decamelize list
const manifestCamelizeKeys = [
'appKey',
'dataType',
'valueType',
'isSec',
'LoginRequest',
'sessionOption',
'AntiCreep',
'AntiFlood',
'needLogin',
];

module.exports = {
manifestRetainKeys,
manifestCamelizeKeys,
};
8 changes: 4 additions & 4 deletions packages/rax-app/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "rax-app",
"version": "3.8.13",
"version": "3.8.14",
"description": "command line interface and builtin plugin for rax app",
"author": "Rax Team",
"homepage": "https://github.com/alibaba/ice#readme",
"homepage": "https://github.com/raxjs/rax-app#readme",
"license": "MIT",
"main": "lib/index.js",
"bin": {
Expand All @@ -18,10 +18,10 @@
"build-scripts": "^1.1.0",
"build-plugin-app-core": "2.1.0",
"build-plugin-ice-config": "2.0.2",
"build-plugin-rax-app": "7.0.7",
"build-plugin-rax-app": "7.0.8",
"build-plugin-rax-kraken": "2.1.1",
"build-plugin-rax-miniapp": "2.0.2",
"build-plugin-rax-pha": "2.0.3",
"build-plugin-rax-pha": "2.1.0",
"build-plugin-rax-store": "2.0.1",
"build-plugin-rax-web": "2.0.8",
"build-plugin-rax-weex": "2.0.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/rax-jest-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## CHANGELOG

### v1.1.0

- chore: use `rax-babel-config` instead of `build-scripts-config`
4 changes: 2 additions & 2 deletions packages/rax-jest-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-jest-config",
"version": "1.0.0",
"version": "1.1.0",
"description": "rax jest config",
"main": "lib/index.js",
"files": [
Expand All @@ -19,6 +19,6 @@
"dependencies": {
"babel-jest": "^26.1.0",
"jest-transform-css": "^2.0.0",
"build-scripts-config": "^0.1.8"
"rax-babel-config": "^2.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/rax-jest-config/src/babelTransform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const babelJest = require('babel-jest');
const { getBabelConfig } = require('build-scripts-config');
const getBabelConfig = require('rax-babel-config');

const jestBabelConfig = getBabelConfig();
module.exports = babelJest.createTransformer(jestBabelConfig);
4 changes: 4 additions & 0 deletions packages/rax-webpack-config/CHANELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v3.0.4

- Chore: revert 3.0.3 changed file

## v3.0.3

- Fix: css modules `:global`
Expand Down
4 changes: 2 additions & 2 deletions packages/rax-webpack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-webpack-config",
"version": "3.0.3",
"version": "3.0.4",
"description": "rax base webpack config",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand Down Expand Up @@ -35,4 +35,4 @@
"devDependencies": {
"webpack": ">=4.0.0"
}
}
}
2 changes: 0 additions & 2 deletions packages/rax-webpack-config/src/setWebpackLoaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ const addCssLoader = (rule, isCSSModule) => {
const cssModuleLoaderOpts = {
...cssLoaderOpts,
modules: {
mode: 'local',
exportGlobals: true,
localIdentName: '[folder]--[local]--[hash:base64:7]',
},
};
Expand Down
30 changes: 16 additions & 14 deletions scripts/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import * as glob from 'glob';
import * as path from 'path';
import * as fs from 'fs-extra';
import * as nsfw from 'nsfw';
import { watch } from 'chokidar';
import { run } from './fn/shell';

let watcher;

(async () => {
await run('npm run clean');

Expand All @@ -21,24 +23,18 @@ import { run } from './fn/shell';
fileSet.add(path.join(cwd, file));
}

const watcher = await nsfw(cwd, (e) => {
e.forEach((e) => {
if (e.action === nsfw.actions.CREATED || e.action === nsfw.actions.MODIFIED || e.action === nsfw.actions.RENAMED) {
// eslint-disable-next-line
const filePath = e.newFile ? path.join(e.directory, e.newFile!) : path.join(e.directory, e.file!);
if (fileSet.has(filePath)) {
console.log('non-ts change detected:', filePath);
copyOneFile(path.relative(cwd, filePath), cwd);
}
}
});
const watcher = await watch(cwd, {
ignored: [/lib\//],
ignoreInitial: true
});

watcher.start();
watcher.on('add', reactFileChange.bind(null, cwd));
watcher.on('change', reactFileChange.bind(null, cwd));

await run('npx tsc --build ./tsconfig.json -w');
})().catch((e) => {
})().catch(async (e) => {
console.trace(e);
await watcher?.close();
process.exit(128);
});

Expand All @@ -47,3 +43,9 @@ async function copyOneFile(file, cwd) {
const to = path.join(cwd, file.replace(/\/src\//, '/lib/'));
await fs.copy(from, to);
}

function reactFileChange(cwd, file) {
if (/!\.tsx?$/.test(file)) {
copyOneFile(path.relative(cwd, file), cwd);
}
}

0 comments on commit 9d8d795

Please sign in to comment.