Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Commit

Permalink
Merge pull request #553 from ice-lab/release-next
Browse files Browse the repository at this point in the history
Release-rc.4
  • Loading branch information
ClarkXia authored Oct 13, 2022
2 parents 854b7b3 + 22d9b21 commit 2ad98a0
Show file tree
Hide file tree
Showing 287 changed files with 18,075 additions and 6,018 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { getESLintConfig } = require('@applint/spec');

const commonRules = {
'react/jsx-filename-extension': 0,
'react/no-unknown-property': 0,
'no-underscore-dangle': 0,
'class-methods-use-this': 0,
'no-param-reassign': 0,
Expand Down
15 changes: 1 addition & 14 deletions examples/app-config/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/app-config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
5 changes: 0 additions & 5 deletions examples/basic-project/ice.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ export default defineConfig({
dropLogLevel: 'warn',
plugins: [
auth(),
{
name: 'runtime-donot-exsist',
setup() {},
runtime: './test',
},
custom,
],
eslint: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-project/src/components/bar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import style from './cssWithEscapedSymbols.module.css';

console.log('style', style);
console.log('style', style.test);

export default function Bar() {
return (
Expand Down
1 change: 0 additions & 1 deletion examples/basic-project/src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Link, useData, useConfig, history } from 'ice';
import { isWeb } from '@uni/env';
// @ts-expect-error
import url from './ice.png';

interface Data {
Expand Down
19 changes: 19 additions & 0 deletions examples/basic-project/src/pages/downgrade.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default function Downgrade() {
const isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node);

if (isNode) {
throw new Error('Downgrade to CSR.');
}

return (
<>
<h2>Page Downgrade to CSR.</h2>
</>
);
}

export function getConfig() {
return {
title: 'hello',
};
}
2 changes: 1 addition & 1 deletion examples/basic-project/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ export function getStaticData() {
count: 100,
from: 'getStaticData',
};
}
}
15 changes: 1 addition & 14 deletions examples/basic-project/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
4 changes: 2 additions & 2 deletions examples/basic-project/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"baseUrl": ".",
"outDir": "build",
"module": "esnext",
"target": "es6",
"target": "ESNext",
"jsx": "react-jsx",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
Expand All @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
15 changes: 1 addition & 14 deletions examples/csr-project/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/csr-project/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
5 changes: 5 additions & 0 deletions examples/disable-data-loader/ice.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@ice/app';

export default defineConfig({
dataLoader: false,
});
28 changes: 28 additions & 0 deletions examples/disable-data-loader/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "disable-data-loader",
"version": "1.0.0",
"scripts": {
"start": "ice start",
"build": "ice build",
"build:splitChunks": "ice build --config splitChunks.config.mts"
},
"description": "",
"author": "",
"license": "MIT",
"dependencies": {
"@ice/app": "workspace:*",
"@ice/plugin-auth": "workspace:*",
"@ice/plugin-rax-compat": "workspace:*",
"@ice/runtime": "workspace:*",
"@uni/env": "^1.1.0",
"ahooks": "^3.3.8",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.73.0"
}
}
19 changes: 19 additions & 0 deletions examples/disable-data-loader/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineAppConfig } from 'ice';
import type { GetAppData } from 'ice';

export default defineAppConfig({
app: {
rootId: 'app',
},
});

export const getAppData: GetAppData = () => {
return new Promise((resolve) => {
resolve({
title: 'gogogogo',
auth: {
admin: true,
},
});
});
};
22 changes: 22 additions & 0 deletions examples/disable-data-loader/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 3.0 Demo" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Title />
<Links />
</head>
<body>
<Main />
<Scripts />
</body>
</html>
);
}

export default Document;
37 changes: 37 additions & 0 deletions examples/disable-data-loader/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export default function Home() {
return (
<>
<h2 className="title">Home Page</h2>
</>
);
}

export function getConfig() {
return {
title: 'Home',
meta: [
{
name: 'theme-color',
content: '#000',
},
{
name: 'title-color',
content: '#f00',
},
],
auth: ['admin'],
};
}

export function getData({ pathname, query }) {
return new Promise((resolve) => {
setTimeout(() => {
resolve({
name: 'Home',
count: 100,
pathname,
query,
});
}, 1 * 100);
});
}
32 changes: 32 additions & 0 deletions examples/disable-data-loader/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": ["node_modules", "build", "public"]
}
1 change: 1 addition & 0 deletions examples/miniapp-project/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chrome 55
13 changes: 13 additions & 0 deletions examples/miniapp-project/ice.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from '@ice/app';
import pluginMiniapp from '@ice/plugin-miniapp';

export default defineConfig({
alias: {
components: './src/components',
},
// TODO:
// proxy: {}
sourceMap: false,
plugins: [pluginMiniapp()],
// eslint: false,
});
3 changes: 3 additions & 0 deletions examples/miniapp-project/mock/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
'/api/foo': { foo: 'foo' },
};
9 changes: 9 additions & 0 deletions examples/miniapp-project/mock/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { Request, Response } from 'express';

export default {
'GET /api/users': ['a', 'b'],
'POST /api/users/:id': (req: Request, res: Response) => {
const { id } = req.params;
res.send({ id: id });
},
};
29 changes: 29 additions & 0 deletions examples/miniapp-project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "miniapp-project",
"version": "1.0.0",
"scripts": {
"start": "ice start",
"start:wechat": "ice start --platform wechat-miniprogram",
"start:ali": "ice start --platform ali-miniapp",
"build": "ice build",
"build:wechat": "ice build --platform wechat-miniprogram"
},
"description": "",
"author": "",
"license": "MIT",
"dependencies": {
"@ice/app": "workspace:*",
"@ice/runtime": "workspace:*",
"@ice/plugin-miniapp": "workspace:*",
"ahooks": "^3.3.8",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"browserslist": "^4.19.3",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.73.0"
}
}
Binary file added examples/miniapp-project/public/favicon.ico
Binary file not shown.
26 changes: 26 additions & 0 deletions examples/miniapp-project/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineAppConfig, type GetAppData } from 'ice';

export const getAppData: GetAppData = () => {
return new Promise((resolve) => {
resolve({
success: true,
id: 34293,
});
});
};


export const miniappManifest = {
title: 'miniapp test',
routes: [
'index',
'about',
'second/profile',
],
};

export default defineAppConfig({
app: {
rootId: 'app',
},
});
5 changes: 5 additions & 0 deletions examples/miniapp-project/src/components/Logo/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.logo {
width: 200rpx;
height: 180rpx;
margin-bottom: 20rpx;
}
7 changes: 7 additions & 0 deletions examples/miniapp-project/src/components/bar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Bar() {
return (
<view>
bar
</view>
);
}
Loading

0 comments on commit 2ad98a0

Please sign in to comment.