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 #455 from ice-lab/release-next
Browse files Browse the repository at this point in the history
Release next
  • Loading branch information
ClarkXia authored Aug 30, 2022
2 parents f5755a0 + c2c697e commit 6857c74
Show file tree
Hide file tree
Showing 104 changed files with 1,214 additions and 550 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ on: [push]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14.x]
node-version: [14.x, 16.x]
os: [ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint:diff
npx lint-staged
4 changes: 0 additions & 4 deletions constants.ts

This file was deleted.

5 changes: 1 addition & 4 deletions examples/basic-project/ice.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ export default defineConfig({
'process.env.HAHA': JSON.stringify(true),
},
transform: (code, id) => {
if (id.includes('src/pages')) {
// console.log('transform page:', id);
}
return code;
return id.includes('src/pages') && id.endsWith('.js') ? code : null;
},
webpack: (webpackConfig) => {
if (process.env.NODE_ENV !== 'test') {
Expand Down
5 changes: 2 additions & 3 deletions examples/basic-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"scripts": {
"start": "ice start",
"build": "ice build"
"build": "ice build",
"build:splitChunks": "ice build --config splitChunks.config.mts"
},
"description": "",
"author": "",
Expand All @@ -21,8 +22,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"browserslist": "^4.19.3",
"regenerator-runtime": "^0.13.9",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.73.0"
}
Expand Down
6 changes: 6 additions & 0 deletions examples/basic-project/splitChunks.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from '@ice/app';

export default defineConfig({
splitChunks: false,
minify: false,
});
5 changes: 3 additions & 2 deletions examples/basic-project/src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, useData, useConfig } from 'ice';
import { Link, useData, useConfig, history } from 'ice';
import { isWeb } from '@uni/env';
// @ts-expect-error
import url from './ice.png';
Expand All @@ -12,14 +12,15 @@ export default function About() {
const config = useConfig();

console.log('render About', 'data', data, 'config', config);
console.log('history in component', history);

return (
<>
<h2>About Page</h2>
<Link to="/">home</Link>
<img src={url} height="40" width="40" />
<span className="mark">new</span>
<div>isWeb: { isWeb ? 'true' : 'false' }</div>
<div>isWeb: {isWeb ? 'true' : 'false'}</div>
</>
);
}
Expand Down
2 changes: 0 additions & 2 deletions examples/csr-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"browserslist": "^4.19.3",
"regenerator-runtime": "^0.13.9",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.73.0"
}
Expand Down
3 changes: 1 addition & 2 deletions examples/hash-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"regenerator-runtime": "^0.13.9"
"@types/react-dom": "^18.0.0"
}
}
2 changes: 0 additions & 2 deletions examples/rax-project/ice.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { defineConfig } from '@ice/app';
import compatRax from '@ice/plugin-rax-compat';

export default defineConfig({
ssr: false,
ssg: false,
publicPath: '/',
plugins: [compatRax()],
});
2 changes: 0 additions & 2 deletions examples/rax-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
"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"
}
}
4 changes: 1 addition & 3 deletions examples/routes-generate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"browserslist": "^4.19.3",
"regenerator-runtime": "^0.13.9"
"@types/react-dom": "^18.0.0"
}
}
5 changes: 3 additions & 2 deletions examples/single-route/ice.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from '@ice/app';

export default defineConfig({
publicPath: '/',
removeHistoryDeadCode: true,
sourceMap: true,
optimization: {
router: false,
}
});
8 changes: 8 additions & 0 deletions examples/single-route/optimization.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from '@ice/app';

export default defineConfig({
publicPath: '/',
optimization: {
router: true,
}
});
7 changes: 3 additions & 4 deletions examples/single-route/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"scripts": {
"start": "ice start",
"build": "ice build"
"build": "ice build",
"build:optimization": "ice build --config optimization.config.mts"
},
"description": "",
"author": "",
Expand All @@ -15,9 +16,7 @@
"react-dom": "^18.0.0"
},
"devDependencies": {
"browserslist": "^4.19.3",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"webpack-bundle-analyzer": "^4.5.0"
"@types/react-dom": "^18.0.0"
}
}
4 changes: 1 addition & 3 deletions examples/with-antd-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"browserslist": "^4.19.3",
"regenerator-runtime": "^0.13.9"
"@types/react-dom": "^18.0.2"
}
}
4 changes: 1 addition & 3 deletions examples/with-antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"browserslist": "^4.19.3",
"regenerator-runtime": "^0.13.9"
"@types/react-dom": "^18.0.2"
}
}
3 changes: 1 addition & 2 deletions examples/with-fusion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"regenerator-runtime": "^0.13.9"
"@types/react-dom": "^18.0.2"
}
}
1 change: 1 addition & 0 deletions examples/with-fusion/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button } from '@alifd/next';
import '@alifd/next/dist/next.css';

export default function Home() {
return (
Expand Down
2 changes: 0 additions & 2 deletions examples/with-pha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
"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"
}
}
4 changes: 1 addition & 3 deletions examples/with-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
"devDependencies": {
"@ice/plugin-store": "workspace:*",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"browserslist": "^4.19.3",
"regenerator-runtime": "^0.13.9"
"@types/react-dom": "^18.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/with-store/src/models/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createModel } from '@ice/plugin-store/esm/runtime';
import { createModel } from 'ice';

export default createModel({
state: {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-store/src/pages/blog/models/info.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createModel } from '@ice/plugin-store/esm/runtime';
import { createModel } from 'ice';

export default createModel({
state: {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-store/src/pages/blog/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStore } from '@ice/plugin-store/esm/runtime';
import { createStore } from 'ice';
import info from './models/info';

export default createStore({ info });
2 changes: 1 addition & 1 deletion examples/with-store/src/pages/models/counter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createModel } from '@ice/plugin-store/esm/runtime';
import { createModel } from 'ice';

export default createModel({
state: {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-store/src/pages/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStore } from '@ice/plugin-store/esm/runtime';
import { createStore } from 'ice';
import counter from './models/counter';

const store = createStore({ counter });
Expand Down
2 changes: 1 addition & 1 deletion examples/with-store/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStore } from '@ice/plugin-store/esm/runtime';
import { createStore } from 'ice';
import user from './models/user';

export default createStore({ user });
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "ice-monorepo",
"private": true,
"workspaces": [
"packages/*"
],
"version": "0.0.1",
"description": "A universal framework based on React",
"author": "[email protected]",
"license": "MIT",
"homepage": "https://v3.ice.work",
"repository": "ice-lab/ice-next",
"bugs": "https://github.com/ice-lab/ice-next/issues",
"scripts": {
"prepare": "husky install",
"setup": "rm -rf node_modules packages/*/node_modules && pnpm install && pnpm prebundle && pnpm build",
Expand All @@ -16,20 +18,13 @@
"dependency:check": "esmo ./scripts/dependencyCheck.ts",
"version": "esmo ./scripts/tagVersion.ts",
"version:check": "esmo ./scripts/versionCheck.ts",
"lint:diff": "esmo ./scripts/lintDiff.ts",
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./",
"lint:fix": "npm run lint -- --fix",
"publish:alpha": "PUBLISH_TYPE=alpha esmo ./scripts/publishPackageWithDistTag.ts",
"publish:beta": "PUBLISH_TYPE=beta esmo ./scripts/publishPackageWithDistTag.ts",
"publish:release": "PUBLISH_TYPE=release VERSION_PREFIX=rc esmo ./scripts/publishPackageWithDistTag.ts",
"cov": "vitest run --coverage",
"test": "vitest"
},
"author": "[email protected]",
"license": "MIT",
"repository": "ice-lab/ice-next",
"bugs": "https://github.com/ice-lab/ice-next/issues",
"homepage": "https://v3.ice.work",
"devDependencies": {
"@applint/spec": "^1.2.3",
"@commitlint/cli": "^16.3.0",
Expand All @@ -56,6 +51,7 @@
"husky": "^7.0.4",
"ice-npm-utils": "^3.0.2",
"jsdom": "^20.0.0",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"puppeteer": "^13.7.0",
"react": "^18.2.0",
Expand All @@ -66,5 +62,8 @@
"typescript": "^4.7.4",
"vitest": "^0.15.2"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix"
},
"packageManager": "[email protected]"
}
4 changes: 2 additions & 2 deletions packages/bundles/scripts/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const tasks = [
{
pkgName: 'terser-webpack-plugin',
matchCopyFiles: (data: { resolvePath: string; resolveId: string }): boolean => {
const { resolvePath, resolveId } = data;
return resolvePath.endsWith('./utils') && resolveId.endsWith('terser-webpack-plugin/dist/index.js');
const { resolvePath } = data;
return resolvePath.endsWith('./utils') || resolvePath.endsWith('.json');
},
},
{
Expand Down
7 changes: 4 additions & 3 deletions packages/ice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"acorn": "^8.7.1",
"address": "^1.1.2",
"body-parser": "^1.20.0",
"build-scripts": "^2.0.0-23",
"build-scripts": "^2.0.0-24",
"chalk": "^4.0.0",
"commander": "^9.0.0",
"consola": "^2.15.3",
Expand All @@ -63,6 +63,7 @@
"open": "^8.4.0",
"path-to-regexp": "^6.2.0",
"react-router": "^6.3.0",
"regenerator-runtime": "^0.13.9",
"resolve.exports": "^1.1.0",
"sass": "^1.49.9",
"semver": "^7.3.5",
Expand All @@ -71,8 +72,8 @@
"webpack-dev-server": "^4.7.4"
},
"devDependencies": {
"@types/babel__traverse": "^7.17.1",
"@types/babel__generator": "^7.6.4",
"@types/babel__traverse": "^7.17.1",
"@types/cross-spawn": "^6.0.2",
"@types/ejs": "^3.1.0",
"@types/estree": "^0.0.51",
Expand All @@ -83,7 +84,7 @@
"@types/temp": "^0.9.1",
"chokidar": "^3.5.3",
"react": "^18.0.0",
"unplugin": "^0.8.0",
"unplugin": "^0.9.5",
"webpack": "^5.73.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ice/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const start = async (
preBundle: format === 'esm' && (ssr || ssg),
swc: {
// Remove components and getData when document only.
removeExportExprs: false ? ['default', 'getData', 'getServerData', 'getStaticData'] : [],
removeExportExprs: (!ssg && !ssr) ? ['default', 'getData', 'getServerData', 'getStaticData'] : [],
keepPlatform: 'node',
},
},
Expand Down
Loading

0 comments on commit 6857c74

Please sign in to comment.