Skip to content

Commit

Permalink
Merge pull request #6006 from alibaba/release/next
Browse files Browse the repository at this point in the history
Release 3.1.3
  • Loading branch information
ClarkXia authored Mar 16, 2023
2 parents 87472b3 + b119e34 commit b04a59c
Show file tree
Hide file tree
Showing 84 changed files with 667 additions and 257 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7

- name: Use Node.js 16.x
uses: actions/setup-node@v3
Expand Down
1 change: 1 addition & 0 deletions examples/routes-generate/ice.config.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from '@ice/app';

export default defineConfig(() => ({
codeSplitting: false,
routes: {
ignoreFiles: ['about.tsx', 'products.tsx'],
defineRoutes: (route) => {
Expand Down
5 changes: 5 additions & 0 deletions examples/routes-generate/src/pages/$.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as React from 'react';

export default function Fallback() {
return <><h2>Fallback</h2></>;
}
25 changes: 25 additions & 0 deletions examples/with-data-loader/src/pages/blog1.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useData, defineDataLoader, Link } from 'ice';
import styles from './index.module.css';

export default function Blog1() {
const data = useData();

return (
<>
<h2 className={styles.title}>Blog1 With dataLoader</h2>
<Link to="/blog2">link to blog2</Link>
<div id="timestamp">{data}</div>
</>
);
}

export function pageConfig() {
return {
title: 'Blog',
};
}

export const dataLoader = defineDataLoader(async () => {
console.log('Loading data for blog 1');
return new Date().getTime();
});
25 changes: 25 additions & 0 deletions examples/with-data-loader/src/pages/blog2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useData, defineDataLoader, Link } from 'ice';
import styles from './index.module.css';

export default function Blog2() {
const data = useData();

return (
<>
<h2 className={styles.title}>Blog2 With dataLoader</h2>
<Link to="/blog1">link to blog1</Link>
<div id="timestamp">{data}</div>
</>
);
}

export function pageConfig() {
return {
title: 'Blog',
};
}

export const dataLoader = defineDataLoader(async () => {
console.log('Loading data for blog 2');
return new Date().getTime();
});
1 change: 1 addition & 0 deletions examples/with-data-loader/src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function pageConfig() {
}

export const dataLoader = defineDataLoader(async () => {
console.log('Loading data for Home');
const result = await fetch('https://api.github.com/repos/ice-lab/ice-next');
const data = await result.json();
console.log('target, renderer:', import.meta.target, import.meta.renderer);
Expand Down
19 changes: 19 additions & 0 deletions examples/with-data-loader/src/pages/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

import { Outlet, defineDataLoader, useData } from 'ice';

const Layout = () => {
const data = useData();
return (
<>
<div id="layout-timestamp">{data}</div>
<Outlet />
</>
);
};

export default Layout;

export const dataLoader = defineDataLoader(() => {
console.log('Loading data for Layout');
return new Date().getTime();
});
4 changes: 4 additions & 0 deletions examples/with-fusion/ice.config.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from '@ice/app';
import fusion from '@ice/plugin-fusion';
import cssAssetsLocal from '@ice/plugin-css-assets-local';
import moment from '@ice/plugin-moment-locales';

export default defineConfig({
plugins: [
Expand All @@ -11,5 +12,8 @@ export default defineConfig({
},
}),
cssAssetsLocal(),
moment({
locales: ['af'],
}),
],
});
6 changes: 4 additions & 2 deletions examples/with-fusion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
"@alifd/next": "^1.25.49",
"@ice/runtime": "workspace:*",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"react-dom": "^18.0.0",
"moment": "^2.29.4"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"@ice/app": "workspace:*",
"@ice/plugin-css-assets-local": "workspace:*",
"@ice/plugin-fusion": "workspace:*"
"@ice/plugin-fusion": "workspace:*",
"@ice/plugin-moment-locales": "workspace:*"
}
}
3 changes: 3 additions & 0 deletions examples/with-fusion/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { defineAppConfig } from 'ice';
import moment from 'moment';

moment.locale('af');

export default defineAppConfig(() => ({
app: {
Expand Down
3 changes: 3 additions & 0 deletions examples/with-nested-routes/src/pages/about/#a.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function A() {
return <div>111</div>;
}
5 changes: 5 additions & 0 deletions examples/with-nested-routes/src/pages/about/$id[.pdf].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function About() {
return (
<div>About 111.pdf</div>
);
}
5 changes: 5 additions & 0 deletions examples/with-nested-routes/src/pages/about/[index].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function About() {
return (
<div>About [Index]</div>
);
}
5 changes: 5 additions & 0 deletions examples/with-nested-routes/src/pages/about/a.b.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function About() {
return (
<div>About a/b</div>
);
}
5 changes: 5 additions & 0 deletions examples/with-nested-routes/src/pages/about/abc[.pdf].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function About() {
return (
<div>About abc.pdf</div>
);
}
5 changes: 5 additions & 0 deletions examples/with-nested-routes/src/pages/about/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function About() {
return (
<div>About Index</div>
);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix"
},
"packageManager": "pnpm@7.2.1"
"packageManager": "pnpm@7.29.1"
}
6 changes: 6 additions & 0 deletions packages/bundles/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.1.6

### Patch Changes

- 18ea5b2d: fix: enable hmr to avoid reload

## 0.1.5

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/bundles/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/bundles",
"version": "0.1.5",
"version": "0.1.6",
"license": "MIT",
"author": "ICE",
"description": "Basic dependencies for ice.",
Expand Down Expand Up @@ -68,7 +68,7 @@
"trusted-cert": "1.1.3",
"webpack": "5.75.0",
"webpack-bundle-analyzer": "4.5.0",
"webpack-dev-server": "4.10.0",
"webpack-dev-server": "4.11.1",
"unplugin": "0.9.5",
"bonjour-service": "^1.0.13",
"colorette": "^2.0.10",
Expand All @@ -91,7 +91,7 @@
"webpack-dev-middleware": "^5.3.1",
"ws": "^8.4.2",
"globby": "13.1.2",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.7",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
"loader-utils": "^2.0.0",
"source-map": "0.8.0-beta.0",
"find-up": "5.0.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/create-ice/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.9.0

### Minor Changes

- d3f3e684: feat: use @iceworks/generate-project@2.x to generate scaffold

## v1.8.2

- [feat] Add Fusion Design Pro 模板(`@ice/fusion-pro-scaffold`
Expand Down
4 changes: 2 additions & 2 deletions packages/create-ice/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-ice",
"version": "1.8.2",
"version": "1.9.0",
"description": "npm init ice",
"type": "module",
"main": "./esm/index.mjs",
Expand All @@ -24,7 +24,7 @@
"build": "tsc"
},
"dependencies": {
"@iceworks/generate-project": "^1.0.0",
"@iceworks/generate-project": "^2.0.2",
"chalk": "^5.0.0",
"commander": "^9.0.0",
"fs-extra": "^10.0.0",
Expand Down
45 changes: 44 additions & 1 deletion packages/create-ice/src/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ interface ITemplate {
npmName: string;
description?: string;
}
interface EjsOptions {
iceConfig?: Record<string, any>;
appConfig?: Record<string, any>;
esLintConfigOptions?: string;
}

export default async function create(dirPath: string, templateName: string, dirname: string): Promise<void> {
if (!templateName) {
Expand All @@ -28,8 +33,46 @@ export default async function create(dirPath: string, templateName: string, dirn
if (!go) process.exit(1);
}

await downloadAndGenerateProject(dirPath, templateName);
let ejsOptions: EjsOptions = {
appConfig: null,
};
let extraDependencies: Record<string, any> = {};

const isAliInternal = await checkAliInternal();
if (isAliInternal) {
ejsOptions = {
...ejsOptions,
iceConfig: {
importDeclarationsStr: 'import def from \'@ali/ice-plugin-def\';\n',
options: {
pluginItemsStr: 'def(),',
},
optionsStr: `plugins: [
def(),
],`,
},
esLintConfigOptions: `{
extends: ['@ali/eslint-config-att/typescript/react']
}`,
};

extraDependencies = {
...extraDependencies,
devDependencies: {
...extraDependencies?.devDependencies || {},
'@ali/eslint-config-att': '^1.0.0',
'@ali/ice-plugin-def': '^1.0.0',
},
};
}
await downloadAndGenerateProject(
dirPath,
templateName,
{
ejsOptions,
extraDependencies,
},
);

console.log();
console.log('Initialize project successfully.');
Expand Down
21 changes: 21 additions & 0 deletions packages/ice/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 3.1.3

### Patch Changes

- acfd0a00: chore: optional ts type of onDemand
- 18ea5b2d: fix: enable hmr to avoid reload
- 754e28b4: fix: break build if occur data loader error
- 754e28b4: fix: compatibility with module false
- fa618ea2: fix: file name should compat with win32
- 0fb80639: fix: improve performance by use async function
- bb748872: fix: compatible with dynamic routes when disable lazy import
- bb748872: feat: export logger for plugin
- 6c8d2e46: fix: set platform node for compile project config
- 54868109: fix: add leading slash for basename
- e096c671: fix: declarationType of dataLoaderImport should be NORMAL
- Updated dependencies
- @ice/webpack-config@1.0.9
- @ice/bundles@0.1.6
- @ice/runtime@1.1.4
- @ice/route-manifest@1.1.0

## 3.1.2

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions packages/ice/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/app",
"version": "3.1.2",
"version": "3.1.3",
"description": "provide scripts and configuration used by web framework ice",
"type": "module",
"main": "./esm/index.js",
Expand Down Expand Up @@ -38,10 +38,10 @@
"@babel/parser": "7.18.10",
"@babel/traverse": "7.18.10",
"@babel/types": "7.18.10",
"@ice/bundles": "0.1.5",
"@ice/route-manifest": "1.0.0",
"@ice/runtime": "^1.1.3",
"@ice/webpack-config": "1.0.8",
"@ice/bundles": "0.1.6",
"@ice/route-manifest": "1.1.0",
"@ice/runtime": "^1.1.4",
"@ice/webpack-config": "1.0.9",
"@swc/helpers": "0.4.14",
"@types/express": "^4.17.14",
"address": "^1.1.2",
Expand Down
Loading

0 comments on commit b04a59c

Please sign in to comment.