Skip to content

Commit

Permalink
Merge pull request #5950 from alibaba/release/next
Browse files Browse the repository at this point in the history
Release 3.1.2
  • Loading branch information
ClarkXia authored Mar 2, 2023
2 parents cc3af50 + e3ca513 commit c23c10e
Show file tree
Hide file tree
Showing 178 changed files with 2,609 additions and 591 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: Setup
run: pnpm run setup

- name: Setup git user
run: pnpm run setup-git

- name: Publish to npm
id: changesets
uses: changesets/action@v1
Expand All @@ -41,6 +44,7 @@ jobs:
title: 'chore: update versions'
publish: pnpm release
createGithubReleases: false
setupGitUser: false
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 4 additions & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ jobs:
- name: Install Dependencies
run: pnpm install

- name: Setup git user
run: pnpm run setup-git

- name: Create Release Pull Request
uses: changesets/action@v1
with:
version: pnpm run version
commit: 'chore: update versions'
title: 'chore: update versions'

setupGitUser: false
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions examples/basic-project/ice.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export default defineConfig(() => ({
syntaxFeatures: {
exportDefaultFrom: true,
},
server: {
onDemand: true,
format: 'esm',
},
alias: {
'@comp': './src/components',
},
Expand Down
2 changes: 1 addition & 1 deletion examples/csr-project/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAppConfig } from 'ice';
import { defineAuthConfig } from '@ice/plugin-auth/esm/types';
import { defineAuthConfig } from '@ice/plugin-auth/types';

console.log('__LOG__');
console.warn('__WARN__');
Expand Down
4 changes: 2 additions & 2 deletions examples/icestark-child/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAppConfig } from 'ice';
import { defineChildConfig } from '@ice/plugin-icestark/esm/types';
import { defineChildConfig } from '@ice/plugin-icestark/types';

export const icestark = defineChildConfig(() => {
return {
Expand Down Expand Up @@ -29,4 +29,4 @@ export default defineAppConfig(() => ({
router: {
basename,
},
}));
}));
4 changes: 2 additions & 2 deletions examples/icestark-layout/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAppConfig } from 'ice';
import { defineFrameworkConfig } from '@ice/plugin-icestark/esm/types';
import { defineFrameworkConfig } from '@ice/plugin-icestark/types';
import FrameworkLayout from '@/components/FrameworkLayout';

export const icestark = defineFrameworkConfig(() => ({
Expand All @@ -21,4 +21,4 @@ export default defineAppConfig(() => ({
app: {
rootId: 'app',
},
}));
}));
1 change: 1 addition & 0 deletions examples/routes-config/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chrome 55
9 changes: 9 additions & 0 deletions examples/routes-config/ice.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from '@ice/app';
import routeConfig from './src/routes';

export default defineConfig({
routes: {
ignoreFiles: ['**'],
config: routeConfig,
},
});
22 changes: 22 additions & 0 deletions examples/routes-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@examples/routes-config",
"private": true,
"version": "1.0.0",
"scripts": {
"start": "ice start",
"build": "ice build"
},
"description": "",
"author": "",
"license": "MIT",
"dependencies": {
"@ice/app": "workspace:*",
"@ice/runtime": "workspace:*",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0"
}
}
3 changes: 3 additions & 0 deletions examples/routes-config/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineAppConfig } from 'ice';

export default defineAppConfig({});
7 changes: 7 additions & 0 deletions examples/routes-config/src/components/bar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Bar() {
return (
<div>
bar
</div>
);
}
22 changes: 22 additions & 0 deletions examples/routes-config/src/document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Meta, Title, Links, Main, Scripts } from 'ice';

function Document() {
return (
<html>
<head>
<meta charSet="utf-8" />
<meta name="description" content="ice.js example" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Title />
<Links />
</head>
<body>
<Main />
<Scripts />
</body>
</html>
);
}

export default Document;
9 changes: 9 additions & 0 deletions examples/routes-config/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Link } from 'ice';

export default function Home() {
return (
<>
<Link to="/rewrite/overview">link to sales page</Link>
</>
);
}
7 changes: 7 additions & 0 deletions examples/routes-config/src/pages/sales/favorites.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Favorites() {
return (
<>
my favorite items
</>
);
}
24 changes: 24 additions & 0 deletions examples/routes-config/src/pages/sales/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.tabs {
display: flex;
border-bottom: 1px solid #ccc;
}

.tabs a {
line-height: 36px;
color: #333;
text-decoration: none;
padding: 0 8px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 4px;
background-color: rgba(208, 215, 222, 0.32);
}

.tabs a:hover {
background-color: rgba(208, 215, 222, 0.64);
}

.container {
border-top: 1px solid #ccc;
padding-top: 20px;
}
18 changes: 18 additions & 0 deletions examples/routes-config/src/pages/sales/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Outlet, Link } from 'ice';
import styles from './index.module.css';

export default () => {
return (
<div>
<h1>Sales</h1>
<div className={styles.tabs}>
<Link to="/rewrite/overview">overview</Link>
<Link to="/rewrite/recommends">recommends</Link>
<Link to="/rewrite/favorites">favorites</Link>
</div>
<div className={styles.container}>
<Outlet />
</div>
</div>
);
};
7 changes: 7 additions & 0 deletions examples/routes-config/src/pages/sales/overview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Overview() {
return (
<h2>
overview all sale items
</h2>
);
}
7 changes: 7 additions & 0 deletions examples/routes-config/src/pages/sales/recommends.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Recommends() {
return (
<>
recommend items
</>
);
}
27 changes: 27 additions & 0 deletions examples/routes-config/src/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const routes = [
{
path: 'rewrite',
// 从 src/page 开始计算路径,并且需要写后缀
component: 'sales/layout.tsx',
children: [
{
// Test the legacy logic. It is not recommended to add slash for children path.
path: '/favorites',
component: 'sales/favorites.tsx',
},
{
path: 'overview',
component: 'sales/overview.tsx',
},
{
path: 'recommends',
component: 'sales/recommends.tsx',
},
],
},
{
path: '/',
component: 'index.tsx',
},
];
export default routes;
6 changes: 6 additions & 0 deletions examples/routes-config/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface AppData {
title: string;
auth: {
[key: string]: boolean;
};
}
1 change: 1 addition & 0 deletions examples/routes-config/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@ice/app/types" />
32 changes: 32 additions & 0 deletions examples/routes-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compileOnSave": false,
"buildOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"outDir": "build",
"module": "esnext",
"target": "es6",
"jsx": "react-jsx",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"lib": ["es6", "dom"],
"sourceMap": true,
"allowJs": true,
"rootDir": "./",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": false,
"importHelpers": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"paths": {
"@/*": ["./src/*"],
"ice": [".ice"]
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["build", "public"]
}
4 changes: 2 additions & 2 deletions examples/with-antd-mobile/src/store.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ComponentWithChildren } from '@ice/runtime/esm/types';
import type { ComponentWithChildren } from '@ice/runtime/types';
import { useState } from 'react';
import constate from 'constate';

Expand All @@ -18,4 +18,4 @@ export const StoreProvider: ComponentWithChildren = ({ children }) => {

export {
useCounterContext,
};
};
2 changes: 1 addition & 1 deletion examples/with-auth/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAppConfig, defineDataLoader, Link } from 'ice';
import { defineAuthConfig } from '@ice/plugin-auth/esm/types';
import { defineAuthConfig } from '@ice/plugin-auth/types';

export default defineAppConfig(() => ({}));

Expand Down
3 changes: 2 additions & 1 deletion examples/with-nested-routes/ice.config.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from '@ice/app';

export default defineConfig({
});
codeSplitting: false,
});
2 changes: 1 addition & 1 deletion examples/with-pha/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Manifest } from '@ice/plugin-pha/esm/types';
import type { Manifest } from '@ice/plugin-pha/types';

export const phaManifest: Manifest = {
title: 'test',
Expand Down
2 changes: 1 addition & 1 deletion examples/with-request/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { request as requestAPI, defineDataLoader } from 'ice';
import { defineRequestConfig } from '@ice/plugin-request/esm/types';
import { defineRequestConfig } from '@ice/plugin-request/types';

export const dataLader = defineDataLoader(async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-store/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAppConfig, defineDataLoader } from 'ice';
import { defineStoreConfig } from '@ice/plugin-store/esm/types';
import { defineStoreConfig } from '@ice/plugin-store/types';

export const storeConfig = defineStoreConfig(async (appData) => {
return {
Expand Down
3 changes: 2 additions & 1 deletion examples/with-suspense-ssr/src/components/Comments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const fakeData = [
'I like marshmallows',
];

async function getData() {
async function getData(ctx) {
console.log(ctx);
console.log('load comments');

await new Promise<any>((resolve) => {
Expand Down
5 changes: 3 additions & 2 deletions examples/with-suspense-ssr/src/pages/with-data-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Home() {
<div>
<h2>Home Page</h2>
<SuspenseComments id="comments" fallback={<Loading />} />
<Footer />
<Footer id="footer" />
</div>
);
}
Expand Down Expand Up @@ -43,14 +43,15 @@ const fakeData = [
'I like marshmallows',
];

async function getCommentsData() {
async function getCommentsData(ctx) {
console.log('load comments');

if (process.env.ICE_CORE_SSR === 'true') {
await new Promise<any>((resolve, reject) => {
setTimeout(() => reject('get data error'), 100);
});
} else {
console.log('client ctx', ctx);
await new Promise<any>((resolve) => {
setTimeout(() => resolve(null), 100);
});
Expand Down
Loading

0 comments on commit c23c10e

Please sign in to comment.