Skip to content

Commit

Permalink
Merge pull request #5519 from alibaba/release-next
Browse files Browse the repository at this point in the history
Release stable 2.x
  • Loading branch information
ClarkXia authored Nov 13, 2023
2 parents c1a6ab9 + 21bafc2 commit 467ca75
Show file tree
Hide file tree
Showing 25 changed files with 117 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Auto Publisher
on:
push:
branches:
- master
- stable/2.x

jobs:
build-and-publish:
Expand Down
2 changes: 1 addition & 1 deletion packages/create-ice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"url": "https://github.com/alibaba/ice/tree/master/packages/create-ice"
},
"gitHead": "07ac7bb07162aac8c90778dd1de4a2060f8df498"
}
}
8 changes: 4 additions & 4 deletions packages/icejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ice.js",
"version": "2.6.6",
"version": "2.6.7",
"description": "command line interface and builtin plugin for icejs",
"author": "[email protected]",
"homepage": "",
Expand Down Expand Up @@ -29,12 +29,12 @@
"build-plugin-ice-auth": "2.0.2",
"build-plugin-ice-config": "2.0.2",
"build-plugin-ice-logger": "2.0.0",
"build-plugin-ice-mpa": "2.1.1",
"build-plugin-ice-mpa": "2.1.2",
"build-plugin-ice-request": "2.0.1",
"build-plugin-ice-router": "2.1.3",
"build-plugin-ice-ssr": "3.1.4",
"build-plugin-ice-store": "2.0.8",
"build-plugin-react-app": "2.2.3",
"build-plugin-ice-store": "2.0.9",
"build-plugin-react-app": "2.2.4",
"build-plugin-pwa": "1.1.1",
"build-plugin-speed": "1.0.1",
"chalk": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-icestark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
}
}
}
6 changes: 5 additions & 1 deletion packages/plugin-ignore-style/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## 0.2.0
## 0.1.3

- [fix] compatible with win32 of rule test

## 0.1.2

- [feat] support custom style regexp

Expand Down
6 changes: 5 additions & 1 deletion packages/plugin-ignore-style/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { IPlugin } from 'build-scripts';
import type { Plugin } from 'vite';
import * as path from 'path';

interface Options {
libraryName: string;
Expand All @@ -24,7 +25,10 @@ const plugin: IPlugin = ({ onGetWebpackConfig, modifyUserConfig, log, context },
onGetWebpackConfig((config) => {
config.module
.rule('ignore-style')
.test(new RegExp(externalRule))
.test((pathStr) => {
const reg = new RegExp(externalRule);
return reg.test(pathStr.split(path.sep).join('/'));
})
.before('jsx')
.use('null-loader').loader(require.resolve('./null-loader'));
});
Expand Down
6 changes: 5 additions & 1 deletion packages/plugin-keep-alive/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# 1.9.0

- [feat] bump react-activation to `^0.12.0`

# 1.8.1

- [feat] compatible with ice.js 2.x
- [feat] compatible with ice.js 2.x
6 changes: 3 additions & 3 deletions packages/plugin-keep-alive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-keep-alive",
"version": "1.8.1",
"version": "1.9.0",
"description": "implementation of the keep-alive function for ice",
"author": "[email protected]",
"homepage": "",
Expand All @@ -11,7 +11,7 @@
"test": "__tests__"
},
"dependencies": {
"react-activation": "^0.7.0"
"react-activation": "^0.12.0"
},
"files": [
"lib",
Expand All @@ -25,4 +25,4 @@
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
}
}
}
2 changes: 1 addition & 1 deletion packages/plugin-keep-alive/src/runtime.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import KeepAlive, { AliveScope } from 'react-activation';
import { AliveScope, KeepAlive } from 'react-activation';

const runtimeModule = ({ wrapperPageComponent, wrapperRouteComponent, modifyRoutesComponent }) => {
const wrapperKeepAlive = (PageComponent) => {
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-mpa/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# changelog

## 2.1.2

- [feat] custom optimizeRuntime when build

## 2.1.1

- [fix] additional analyze for auth
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-mpa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-mpa",
"version": "2.1.1",
"version": "2.1.2",
"description": "enable mpa project for icejs framework",
"author": "[email protected]",
"homepage": "",
Expand Down
7 changes: 5 additions & 2 deletions packages/plugin-mpa/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ const plugin: IPlugin = (api) => {
});
}
});
if (userConfig.optimizeRuntime) {
const optimizeRuntime = userConfig.optimizeRuntime as (boolean | Record<string, any>);
if (optimizeRuntime) {
onHook('before.build.load', async (options) => {
await Promise.all(Object.keys(parsedEntries).map(async (entryKey) => {
const { generator, generateTasks, entryPath } = parsedEntries[entryKey];
Expand All @@ -129,7 +130,9 @@ const plugin: IPlugin = (api) => {
alias,
analyzeRelativeImport: true,
});
Object.keys(runtimeUsedMap).forEach((pluginName) => {
const filterRuntime = typeof optimizeRuntime === 'object' && Array.isArray((optimizeRuntime?.keep))
? optimizeRuntime.keep : [];
Object.keys(runtimeUsedMap).filter((pluginName) => !filterRuntime.includes(pluginName)).forEach((pluginName) => {
const isUsed = runtimeUsedMap[pluginName];
if (!isUsed) {
if (pluginName === 'build-plugin-ice-auth') {
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-react-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.2.4

- [feat] custom optimizeRuntime when build

## 2.2.3

- [fix] skip public folder for minimization
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-react-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-react-app",
"version": "2.2.3",
"version": "2.2.4",
"description": "The basic webpack configuration for ice project",
"author": "[email protected]",
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-react-app/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = function() {
{
name: 'optimizeRuntime',
defaultValue: true,
validation: 'boolean',
validation: 'boolean|object',
},
];
};
3 changes: 2 additions & 1 deletion packages/plugin-react-app/src/setBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = (api) => {
onHook('before.build.load', async () => {
const sourceFiles = await globSourceFiles(path.join(rootDir, 'src'));
const runtimeUsedMap = await analyzeRuntime(sourceFiles, { rootDir });
Object.keys(runtimeUsedMap).forEach((pluginName) => {
const filterRuntime = Array.isArray(userConfig.optimizeRuntime?.keep) ? userConfig.optimizeRuntime.keep : [];
Object.keys(runtimeUsedMap).filter((pluginName) => !filterRuntime.includes(pluginName)).forEach((pluginName) => {
const isUsed = runtimeUsedMap[pluginName];
if (!isUsed) {
if (pluginName === 'build-plugin-ice-auth') {
Expand Down
46 changes: 46 additions & 0 deletions packages/plugin-request/tests/createTestServer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Fork create-test-server for OpenSSL error.
const http = require('http');
const express = require('express');
const pify = require('pify');

const createTestServer = () => {
const server = express();
server.http = http.createServer(server);

server.set('etag', false);

const send = fn => (req, res, next) => {
const cb = typeof fn === 'function' ? fn(req, res, next) : fn;

Promise.resolve(cb).then(val => {
if (val) {
res.send(val);
}
});
};

const get = server.get.bind(server);
server.get = function () {
const [path, ...handlers] = [...arguments];

for (const handler of handlers) {
get(path, send(handler));
}
};

server.listen = () =>
pify(server.http.listen.bind(server.http))().then(() => {
server.port = server.http.address().port;
server.url = `http://localhost:${server.port}`;
});

server.close = () =>
pify(server.http.close.bind(server.http))().then(() => {
server.port = undefined;
server.url = undefined;
});

return server.listen().then(() => server);
};

module.exports = createTestServer;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as createTestServer from 'create-test-server';
import * as createTestServer from './createTestServer';
import request from '../template/request';

const MOCK_DATA = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as createTestServer from 'create-test-server';
import * as createTestServer from './createTestServer';
import { act, renderHook } from '@testing-library/react-hooks';
import useRequest from '../template/useRequest';

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-request/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"exclude": [
"template/*",
"__tests__/*"
"tests/*"
]
}
2 changes: 1 addition & 1 deletion packages/plugin-stark-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"postcss-prefix-selector": "^1.15.0",
"webpack-plugin-import": "^0.2.7"
}
}
}
4 changes: 4 additions & 0 deletions packages/plugin-store/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.9

- [fix] convert kebab-case to PascalCase for `Layout` name, such as `hello-wordLayout` to `HelloWorldLayout`

## 2.0.8

- [feat] support export `createModel` API
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-store/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-store",
"version": "2.0.8",
"version": "2.0.9",
"description": "builtin `@ice/store` in icejs",
"author": "[email protected]",
"homepage": "https://github.com/alibaba/ice#readme",
Expand Down
6 changes: 5 additions & 1 deletion packages/plugin-store/src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export default class Generator {
this.applyMethod('addRenderFile', pageComponentTemplatePath, pageComponentTargetPath, pageComponentRenderData);
}

private kebabToPascal = (str: string) => {
return str.replace(/-(\w)/g, parts => parts[parts.length-1].toUpperCase()).replace(/^\w/, s => s.toUpperCase());
}

private renderPageLayout({ pageName, pageDir, pageStoreFile }: IRenderPageParams) {
const pageComponentTemplatePath = path.join(__dirname, './template/pageComponent.tsx.ejs');
const pageComponentTargetPath = path.join(this.tempPath, 'pages', pageName, 'Layout.tsx');
Expand All @@ -108,7 +112,7 @@ export default class Generator {
return;
}

const pageLayoutName = `${pageName}Layout`;
const pageLayoutName = `${pageName.indexOf('-') !== -1 ? this.kebabToPascal(pageName) : pageName}Layout`;
const pageStoreExtname = path.extname(pageStoreFile);
const pageLayoutRenderData = {
pageComponentImport: `import ${pageLayoutName} from '${pageComponentSourcePath}'`,
Expand Down
27 changes: 13 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4820,7 +4820,7 @@ cosmiconfig@^7.0.0:
create-cert@^1.0.2:
version "1.0.6"
resolved "https://registry.yarnpkg.com/create-cert/-/create-cert-1.0.6.tgz#7ed01fff7f9f0cea500aba5eff119af4c8de84f6"
integrity sha1-ftAf/3+fDOpQCrpe/xGa9MjehPY=
integrity sha512-jOVt/HWAWhFFlt3H8TrnlAfvZMUoVf4XjvZqLxZ1Yzy+VTEm/rTgnfliKs3yioYENs9mNoHRWZQKAmVSrHfESw==
dependencies:
pem "^1.9.7"
pify "^3.0.0"
Expand Down Expand Up @@ -10796,9 +10796,9 @@ path-type@^4.0.0:
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==

pem@^1.9.7:
version "1.14.4"
resolved "https://registry.yarnpkg.com/pem/-/pem-1.14.4.tgz#a68c70c6e751ccc5b3b5bcd7af78b0aec1177ff9"
integrity sha512-v8lH3NpirgiEmbOqhx0vwQTxwi0ExsiWBGYh0jYNq7K6mQuO4gI6UEFlr6fLAdv9TPXRt6GqiwE37puQdIDS8g==
version "1.14.6"
resolved "https://registry.yarnpkg.com/pem/-/pem-1.14.6.tgz#89babca3a73466fb844df70666dbf1b25eb0dc56"
integrity sha512-I5GKUer2PPv5qzUfxaZ6IGRkhp+357Kyv2t1JJg9vP8hGGI13qU34N2QupmggbpIZGPuudH0jn8KU5hjFpPk3g==
dependencies:
es6-promisify "^6.0.0"
md5 "^2.2.1"
Expand Down Expand Up @@ -11909,15 +11909,14 @@ rax@^1.0.0:
rax-create-factory "^1.0.0"
rax-is-valid-element "^1.0.0"

react-activation@^0.7.0:
version "0.7.4"
resolved "https://registry.yarnpkg.com/react-activation/-/react-activation-0.7.4.tgz#c65f8617f089527c0b976f51580d9587b2eb667d"
integrity sha512-go/UEuRW03jOaFM3NUc1doByzUBbrCyIHGEFNJ0tAqA2AKzmMyh0Ru8XVEY3PB1/ev9dYgRWfAiXeqyKn1kavg==
react-activation@^0.12.0:
version "0.12.2"
resolved "https://registry.yarnpkg.com/react-activation/-/react-activation-0.12.2.tgz#3fc28ac416b2a82841cbaa82bd26ae32cc270004"
integrity sha512-nNk0FJ0ljWPM3I5q5h9mewp/5mIKnJELOFc8mRq0JrwmVP4ozkZEUN05OolRXdnGPuS5S50ec3mTZA3B6wSYJA==
dependencies:
create-react-context "^0.3.0"
hoist-non-react-statics "^3.3.0"
jsx-ast-utils "^2.2.1"
react-node-key "^0.2.0"
react-node-key "^0.4.0"
szfe-tools "^0.0.0-beta.7"

react-dom@^16.12.0, react-dom@^16.4.1:
Expand Down Expand Up @@ -11964,10 +11963,10 @@ react-is@^17.0.1, react-is@^17.0.2:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-node-key@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/react-node-key/-/react-node-key-0.2.0.tgz#c937390208de87a0361bce87b507ccef35fb0f35"
integrity sha512-fC5ZVz3TwhSY0o1hw08R/V/Ze/exfhaeDllRucuvEH2Xj1qT4Y4IoSr93BftcVJHJFt3fmmTCV/mGk+LX5x20w==
react-node-key@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/react-node-key/-/react-node-key-0.4.0.tgz#acb90f06828f594051c6e37c005ea080be228ee2"
integrity sha512-puiuP2QYEuNBVVvcjpUE8d8/jdAhiXHBHMmjZzQT4+fe276RMYea/tY7JoZoYlrhAX8DORLPvjySjXYJZ1m6/A==
dependencies:
jsx-ast-utils "^2.2.1"
szfe-tools "^0.0.0-beta.7"
Expand Down

0 comments on commit 467ca75

Please sign in to comment.