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 #342 from ice-lab/release-next
Browse files Browse the repository at this point in the history
Release next
  • Loading branch information
ClarkXia authored Jul 14, 2022
2 parents c859856 + fa56813 commit c18cc8c
Show file tree
Hide file tree
Showing 90 changed files with 2,730 additions and 1,203 deletions.
9 changes: 7 additions & 2 deletions examples/basic-project/ice.config.mts
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import { defineConfig } from '@ice/app';
import SpeedMeasurePlugin from 'speed-measure-webpack-plugin';
import auth from '@ice/plugin-auth';
import compatRax from '@ice/plugin-rax-compat';

export default defineConfig({
publicPath: '/',
define: {
HAHA: JSON.stringify(true),
'process.env.HAHA': JSON.stringify(true),
},
transform: (code, id) => {
if (id.includes('src/pages')) {
console.log('transform page:', id);
}
return code;
},
webpack: (webpackConfig) => {
if (process.env.NODE_ENV !== 'test') {
webpackConfig.plugins?.push(new SpeedMeasurePlugin());
}
return webpackConfig;
},
dropLogLevel: 'warn',
plugins: [auth(), compatRax()],
plugins: [auth()],
eslint: true,
});
5 changes: 0 additions & 5 deletions examples/basic-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
"@ice/plugin-rax-compat": "workspace:*",
"@ice/runtime": "workspace:*",
"ahooks": "^3.3.8",
"rax": "^1.2.2",
"rax-image": "^2.4.1",
"rax-is-valid-element": "^1.0.0",
"rax-text": "^2.2.0",
"rax-view": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
Expand Down
3 changes: 3 additions & 0 deletions examples/basic-project/src/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
font-size: 14px;
}
1 change: 1 addition & 0 deletions examples/rax-project/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chrome 55
9 changes: 9 additions & 0 deletions examples/rax-project/ice.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from '@ice/app';
import compatRax from '@ice/plugin-rax-compat';

export default defineConfig({
ssr: false,
ssg: false,
publicPath: '/',
plugins: [compatRax()],
});
30 changes: 30 additions & 0 deletions examples/rax-project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "rax-project",
"version": "1.0.0",
"scripts": {
"start": "ice start",
"build": "ice build"
},
"description": "",
"author": "",
"license": "MIT",
"dependencies": {
"@ice/app": "workspace:*",
"@ice/plugin-rax-compat": "workspace:*",
"@ice/runtime": "workspace:*",
"rax": "^1.2.2",
"rax-image": "^2.4.1",
"rax-is-valid-element": "^1.0.0",
"rax-text": "^2.2.0",
"rax-view": "^2.3.0",
"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",
"regenerator-runtime": "^0.13.9",
"webpack": "^5.73.0"
}
}
Binary file added examples/rax-project/public/favicon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions examples/rax-project/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineAppConfig } from 'ice';

export default defineAppConfig({
app: {
rootId: 'app',
},
});
22 changes: 22 additions & 0 deletions examples/rax-project/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,maximum-scale=1,minimum-scale=1,user-scalable=no,viewport-fit=cover" />
<Meta />
<Title />
<Links />
</head>
<body>
<Main />
<Scripts />
</body>
</html>
);
}

export default Document;
3 changes: 3 additions & 0 deletions examples/rax-project/src/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
font-size: 14px;
}
25 changes: 25 additions & 0 deletions examples/rax-project/src/pages/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.title {
color: red;
margin-left: 10rpx;
}

.data {
margin-top: 10px;
}

.homeContainer {
align-items: center;
margin-top: 200rpx;
}

.homeTitle {
font-size: 45rpx;
font-weight: bold;
margin: 20rpx 0;
}

.homeInfo {
font-size: 36rpx;
margin: 8rpx 0;
color: #555;
}
14 changes: 14 additions & 0 deletions examples/rax-project/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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;
}
32 changes: 32 additions & 0 deletions examples/rax-project/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"]
}
Binary file added examples/with-antd-mobile/public/favicon.ico
Binary file not shown.
3 changes: 2 additions & 1 deletion packages/bundles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@
"less-loader": "10.2.0",
"lodash": "4.17.21",
"mini-css-extract-plugin": "2.6.0",
"ora": "5.4.1",
"postcss-loader": "6.2.1",
"postcss-modules": "4.3.1",
"postcss-nested": "5.0.6",
"postcss-plugin-rpx2vw": "^0.0.3",
"postcss-plugin-rpx2vw": "1.0.0",
"postcss-preset-env": "7.4.3",
"sass-loader": "12.6.0",
"tapable": "2.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundles/scripts/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const tasks = [
'less-loader', 'postcss-loader', 'sass-loader', 'css-loader',
'postcss-preset-env', 'postcss-nested', 'postcss-modules', 'postcss-plugin-rpx2vw',
'webpack-bundle-analyzer', 'es-module-lexer', 'terser',
'eslint-webpack-plugin', 'copy-webpack-plugin', 'cacache',
'eslint-webpack-plugin', 'copy-webpack-plugin', 'cacache', 'ora',
].map((pkgName) => ({ pkgName })),
{
// pack main package
Expand Down
10 changes: 5 additions & 5 deletions packages/ice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"files": [
"bin",
"esm",
"template",
"!esm/**/*.map"
"!esm/**/*.map",
"templates",
"openChrome.applescript"
],
"engines": {
"node": ">=12.22.0",
Expand All @@ -35,7 +36,7 @@
"@ice/webpack-config": "^1.0.0",
"acorn": "^8.7.1",
"address": "^1.1.2",
"build-scripts": "^2.0.0-22",
"build-scripts": "^2.0.0-23",
"body-parser": "^1.20.0",
"chalk": "^4.0.0",
"commander": "^9.0.0",
Expand All @@ -54,10 +55,9 @@
"magic-string": "^0.26.1",
"micromatch": "^4.0.5",
"mrmime": "^1.0.0",
"multer": "^1.4.4",
"multer": "^1.4.5-lts.1",
"open": "^8.4.0",
"path-to-regexp": "^6.2.0",
"prettier": "^2.5.1",
"react-router": "^6.3.0",
"resolve": "^1.22.0",
"resolve.exports": "^1.1.0",
Expand Down
18 changes: 11 additions & 7 deletions packages/ice/src/analyzeRuntime.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import * as path from 'path';
import consola from 'consola';
import type { ServerCompiler } from '@ice/types/esm/plugin.js';
import type { AppConfig } from './utils/runtimeEnv.js';
import type { AppConfig } from '@ice/types';

interface Options {
serverCompiler: ServerCompiler;
rootDir: string;
}

export const getAppConfig = async (options: Options): Promise<AppConfig> => {
const { serverCompiler, rootDir } = options;
let appConfig: AppConfig;

export const getAppConfig = (): AppConfig => {
return appConfig;
};

export async function compileAppConfig({ rootDir, serverCompiler }: Options) {
const outfile = path.join(rootDir, 'node_modules', 'entry.mjs');
// TODO: remove top level calls to ensure that appConfig is always returned successfully in build time
await serverCompiler({
Expand All @@ -18,8 +23,7 @@ export const getAppConfig = async (options: Options): Promise<AppConfig> => {
format: 'esm',
inject: [],
});

const appConfig = (await import(outfile)).default;
consola.debug('get app config by esbuild:', appConfig);
appConfig = (await import(outfile)).default;
consola.debug('Compile app config by esbuild: ', appConfig);
return appConfig;
};
}
Loading

0 comments on commit c18cc8c

Please sign in to comment.