├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .github ├── CONTRIBUTING.md ├── GIT_COMMIT_SPECIFIC.md └── ISSUE_TEMPLATE.md ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.en-US.md ├── README.md ├── commitlint.config.js ├── docs ├── README.md ├── cli-1.x │ ├── about.md │ ├── advanced │ │ ├── biz-component.md │ │ ├── cloud-build.md │ │ ├── custom-template.md │ │ ├── debug.md │ │ ├── mock.md │ │ ├── proxy.md │ │ └── public.md │ ├── basic │ │ ├── block.md │ │ ├── config.md │ │ ├── start.md │ │ ├── style.md │ │ ├── theme.md │ │ └── typescript.md │ ├── en-us │ │ ├── about.md │ │ └── basic │ │ │ └── start.md │ └── others │ │ ├── bizcharts-size.md │ │ ├── browser-router.md │ │ ├── custom-webpack.md │ │ ├── local-img.md │ │ ├── moment.md │ │ └── monaco-editor.md ├── cli │ ├── about.md │ ├── config │ │ ├── config-file.md │ │ ├── config.md │ │ ├── custom-webpack.md │ │ └── plugins.md │ ├── en-us │ │ ├── about.md │ │ └── basic │ │ │ └── start.md │ ├── feature │ │ ├── cloud-build.md │ │ ├── mock.md │ │ ├── proxy.md │ │ ├── public.md │ │ ├── style.md │ │ ├── test.md │ │ └── typescript.md │ ├── migrate.md │ ├── plugin-dev │ │ └── api.md │ ├── plugin-list │ │ ├── antd.md │ │ ├── component.md │ │ ├── dll.md │ │ ├── fusion.md │ │ ├── load-assets.md │ │ ├── local.md │ │ ├── modular-import.md │ │ ├── moment.md │ │ ├── multi-pages.md │ │ └── smart-debug.md │ └── start.md ├── design │ ├── about.md │ ├── mode │ │ ├── cognition.md │ │ ├── mind.md │ │ └── operate.md │ ├── tools.md │ └── vision │ │ ├── color.md │ │ ├── font.md │ │ ├── frame.md │ │ ├── icon.md │ │ └── layout.md ├── guide │ ├── about.md │ ├── backend │ │ ├── java.md │ │ ├── nodejs.md │ │ └── static.md │ ├── dev │ │ ├── ajax.md │ │ ├── authority.md │ │ ├── build.md │ │ ├── directory-structure.md │ │ ├── dynamic-load.md │ │ ├── form.md │ │ ├── i18n.md │ │ ├── nav.md │ │ ├── quality.md │ │ ├── react-materials.md │ │ ├── router.md │ │ ├── store.md │ │ ├── style.md │ │ └── theme.md │ ├── monitor │ │ ├── data.md │ │ └── tracker.md │ ├── publish │ │ ├── assets.md │ │ └── version.md │ ├── resource │ │ ├── front-basic.md │ │ ├── migrate.md │ │ ├── npms.md │ │ ├── tools.md │ │ └── upgrade-version.md │ ├── start.md │ └── test │ │ └── jest.md ├── icestark │ ├── api │ │ ├── app-history.md │ │ ├── app-link.md │ │ ├── app-route.md │ │ ├── app-router.md │ │ ├── get-basename.md │ │ ├── get-mount-node.md │ │ └── render-not-found.md │ ├── guide │ │ ├── about.md │ │ ├── interaction.md │ │ ├── migrating.md │ │ └── start.md │ └── reference │ │ └── isolation.md ├── icestore │ ├── about.md │ ├── guide │ │ ├── async.md │ │ ├── concept.md │ │ ├── debug.md │ │ ├── middleware.md │ │ └── recommend.md │ ├── reference │ │ ├── api.md │ │ └── migrate.md │ └── start.md ├── iceworks-2.x │ ├── about.md │ ├── engineering.md │ ├── material.md │ ├── new-page.md │ ├── new-project.md │ ├── project.md │ └── settings.md ├── iceworks │ ├── Installation.md │ ├── about.md │ ├── advanced │ │ ├── adapter-about.md │ │ └── adapter-guide.md │ ├── contributing │ │ ├── architecture-design.md │ │ ├── codebase-overview.md │ │ ├── how-to-contribute.md │ │ ├── implementation-notes.md │ │ └── release-notes.md │ ├── engineering │ │ ├── configuration.md │ │ ├── intro.md │ │ └── task.md │ ├── material │ │ └── about.md │ ├── migrate.md │ ├── project │ │ ├── dependency.md │ │ ├── git.md │ │ ├── menu.md │ │ ├── oss.md │ │ ├── other.md │ │ ├── page.md │ │ └── router.md │ ├── quick-start.md │ └── upgrade.md └── materials │ ├── about.md │ ├── get_start.md │ ├── guide │ ├── dev.md │ ├── generate.md │ ├── init.md │ ├── sync.md │ └── usage.md │ ├── recommand.md │ └── reference │ ├── custom.md │ ├── dev.md │ ├── private.md │ └── protocol.md ├── package.json ├── packages ├── ice-koa-template │ ├── README.md │ ├── package.json │ ├── templates │ │ ├── README.md │ │ ├── _gitignore │ │ ├── client │ │ │ ├── .gitkeep │ │ │ └── _package.json │ │ ├── package.json │ │ └── server │ │ │ ├── _editorconfig │ │ │ ├── _eslintignore │ │ │ ├── _eslintrc │ │ │ ├── _gitignore │ │ │ ├── package.json │ │ │ └── src │ │ │ ├── app.js │ │ │ ├── config │ │ │ └── .gitkeep │ │ │ ├── controller │ │ │ └── user.js │ │ │ ├── middleware │ │ │ └── .gitkeep │ │ │ ├── model │ │ │ └── User.js │ │ │ ├── router.js │ │ │ └── service │ │ │ └── user.js │ └── utils │ │ └── .gitkeep ├── ice-layout-builder │ ├── README.md │ ├── package.json │ ├── src │ │ ├── components │ │ │ ├── Aside │ │ │ │ ├── Aside.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ ├── Footer │ │ │ │ ├── Footer.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ ├── Form │ │ │ │ ├── AsideForm │ │ │ │ │ ├── AsideForm.jsx │ │ │ │ │ └── index.js │ │ │ │ ├── BasicForm │ │ │ │ │ ├── BasicForm.jsx │ │ │ │ │ ├── ColorBlock.jsx │ │ │ │ │ ├── ColorPicker.jsx │ │ │ │ │ └── index.js │ │ │ │ ├── FooterForm │ │ │ │ │ ├── FooterForm.jsx │ │ │ │ │ └── index.js │ │ │ │ ├── HeaderForm │ │ │ │ │ ├── HeaderForm.jsx │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── Header │ │ │ │ ├── Header.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ ├── LayoutBuilder │ │ │ │ ├── LayoutBuilder.jsx │ │ │ │ ├── LayoutBuilder.scss │ │ │ │ └── index.js │ │ │ ├── Logo │ │ │ │ ├── Logo.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ └── PreviewLayout │ │ │ │ ├── PreviewLayout.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ ├── base.scss │ │ │ │ ├── dark.scss │ │ │ │ ├── index.scss │ │ │ │ └── light.scss │ │ ├── index.js │ │ ├── main.scss │ │ └── scss │ │ │ ├── mixin.scss │ │ │ └── variable.scss │ ├── templates │ │ ├── components │ │ │ ├── Aside │ │ │ │ ├── Aside.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ ├── Footer │ │ │ │ ├── Footer.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ ├── Header │ │ │ │ ├── Header.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ └── Logo │ │ │ │ ├── Logo.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ ├── base.scss │ │ │ │ ├── dark.scss │ │ │ │ └── light.scss │ │ └── layouts │ │ │ ├── Layout.jsx │ │ │ ├── index.js │ │ │ └── scss │ │ │ ├── base.scss │ │ │ ├── dark.scss │ │ │ ├── index.scss │ │ │ └── light.scss │ ├── tests │ │ └── index.js │ └── utils │ │ ├── generator.js │ │ ├── index.js │ │ └── prettierFormat.js ├── ice-midway-template │ ├── README.md │ ├── package.json │ ├── templates │ │ ├── README.md │ │ ├── _gitignore │ │ ├── client │ │ │ ├── .gitkeep │ │ │ └── _package.json │ │ ├── package.json │ │ └── server │ │ │ ├── .travis.yml │ │ │ ├── README.md │ │ │ ├── _editorconfig │ │ │ ├── _eslintignore │ │ │ ├── _eslintrc │ │ │ ├── _gitignore │ │ │ ├── appveyor.yml │ │ │ ├── package.json │ │ │ ├── procfile.js │ │ │ ├── src │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ ├── home.ts │ │ │ │ │ └── user.ts │ │ │ │ ├── middleware │ │ │ │ │ └── assets_info.ts │ │ │ │ └── view │ │ │ │ │ └── index.ejs │ │ │ ├── config │ │ │ │ ├── config.default.ts │ │ │ │ └── plugin.ts │ │ │ ├── interface.ts │ │ │ └── lib │ │ │ │ ├── model │ │ │ │ └── user.ts │ │ │ │ └── service │ │ │ │ └── user.ts │ │ │ ├── test │ │ │ └── app │ │ │ │ └── controller │ │ │ │ └── home.test.ts │ │ │ ├── tsconfig.json │ │ │ └── tslint.json │ └── utils │ │ └── .gitkeep ├── ice-npm-utils │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── lib │ │ ├── index.js │ │ └── log.js │ ├── package.json │ └── test │ │ └── index.test.js ├── ice-template-builder │ ├── .gitignore │ ├── README.md │ ├── demo │ │ ├── form.md │ │ └── layout.md │ ├── package.json │ ├── src │ │ ├── components │ │ │ ├── Aside │ │ │ │ ├── Aside.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ ├── Footer │ │ │ │ ├── Footer.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ ├── Form │ │ │ │ ├── AdvancedForm │ │ │ │ │ ├── AdvancedForm.jsx │ │ │ │ │ └── index.js │ │ │ │ ├── AsideForm │ │ │ │ │ ├── AsideForm.jsx │ │ │ │ │ └── index.js │ │ │ │ ├── BasicForm │ │ │ │ │ ├── BasicForm.jsx │ │ │ │ │ ├── ColorBlock.jsx │ │ │ │ │ ├── ColorPicker.jsx │ │ │ │ │ └── index.js │ │ │ │ ├── CreateForm.jsx │ │ │ │ ├── FooterForm │ │ │ │ │ ├── FooterForm.jsx │ │ │ │ │ └── index.js │ │ │ │ ├── HeaderForm │ │ │ │ │ ├── HeaderForm.jsx │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── Header │ │ │ │ ├── Header.jsx │ │ │ │ ├── images │ │ │ │ │ └── avatar.png │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ ├── LayoutBuilder │ │ │ │ ├── LayoutBuilder.jsx │ │ │ │ ├── LayoutBuilder.scss │ │ │ │ └── index.js │ │ │ ├── Logo │ │ │ │ ├── Logo.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ └── PreviewLayout │ │ │ │ ├── PreviewLayout.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ ├── base.scss │ │ │ │ ├── dark.scss │ │ │ │ ├── index.scss │ │ │ │ └── light.scss │ │ ├── index.js │ │ ├── main.scss │ │ └── scss │ │ │ ├── mixin.scss │ │ │ └── variable.scss │ ├── templates │ │ ├── components │ │ │ ├── Aside │ │ │ │ ├── Aside.jsx │ │ │ │ ├── Aside.scss │ │ │ │ └── index.js │ │ │ ├── Footer │ │ │ │ ├── Footer.jsx │ │ │ │ ├── Footer.scss │ │ │ │ └── index.js │ │ │ ├── Header │ │ │ │ ├── Header.jsx │ │ │ │ ├── Header.scss │ │ │ │ └── index.js │ │ │ ├── Layout │ │ │ │ ├── Layout.jsx │ │ │ │ ├── index.js │ │ │ │ └── index.scss │ │ │ └── Logo │ │ │ │ ├── Logo.jsx │ │ │ │ ├── Logo.scss │ │ │ │ └── index.js │ │ └── redux │ │ │ ├── README.md │ │ │ ├── _editorconfig │ │ │ ├── _eslintignore │ │ │ ├── _eslintrc │ │ │ ├── _gitignore │ │ │ ├── _package.json │ │ │ ├── ice.config.js │ │ │ ├── mock │ │ │ └── index.js │ │ │ ├── public │ │ │ ├── favicon.png │ │ │ └── index.html │ │ │ ├── src │ │ │ ├── api │ │ │ │ ├── index.js │ │ │ │ └── user.js │ │ │ ├── components │ │ │ │ ├── Authorized │ │ │ │ │ ├── Authorized.js │ │ │ │ │ ├── AuthorizedRoute.js │ │ │ │ │ ├── CheckPermissions.js │ │ │ │ │ ├── PromiseRender.js │ │ │ │ │ ├── Secured.js │ │ │ │ │ └── index.js │ │ │ │ └── Exception │ │ │ │ │ ├── Exception.jsx │ │ │ │ │ ├── Exception.scss │ │ │ │ │ └── index.js │ │ │ ├── configureStore.js │ │ │ ├── index.js │ │ │ ├── layouts │ │ │ │ ├── BasicLayout │ │ │ │ │ ├── BasicLayoutHoc.jsx │ │ │ │ │ └── MainRoutes.jsx │ │ │ │ └── UserLayout │ │ │ │ │ ├── Footer.jsx │ │ │ │ │ ├── UserLayout.jsx │ │ │ │ │ ├── UserLayout.scss │ │ │ │ │ └── index.js │ │ │ ├── menuConfig.js │ │ │ ├── pages │ │ │ │ ├── Dashboard │ │ │ │ │ ├── Dashboard.jsx │ │ │ │ │ ├── Dashboard.scss │ │ │ │ │ └── index.js │ │ │ │ ├── UserLogin │ │ │ │ │ ├── UserLogin.jsx │ │ │ │ │ ├── actions.js │ │ │ │ │ ├── constants.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── reducer.js │ │ │ │ └── UserRegister │ │ │ │ │ ├── UserRegister.jsx │ │ │ │ │ ├── action.js │ │ │ │ │ ├── constants.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── reducer.js │ │ │ ├── reducers.js │ │ │ ├── router.jsx │ │ │ ├── routerConfig.js │ │ │ ├── store │ │ │ │ ├── userLogout │ │ │ │ │ ├── action.js │ │ │ │ │ ├── constants.js │ │ │ │ │ └── reducer.js │ │ │ │ └── userProfile │ │ │ │ │ ├── action.js │ │ │ │ │ ├── constants.js │ │ │ │ │ └── reducer.js │ │ │ └── utils │ │ │ │ ├── Authorized.js │ │ │ │ ├── authority.js │ │ │ │ ├── checkStore.js │ │ │ │ ├── formatter.js │ │ │ │ ├── injectReducer.js │ │ │ │ └── reducerInjectors.js │ │ │ └── tests │ │ │ └── index.js │ ├── tests │ │ └── index.js │ └── utils │ │ ├── generateTemplate.js │ │ ├── index.js │ │ ├── layoutFileMapping.js │ │ ├── prettierFormat.js │ │ └── reduxFileMapping.js ├── iceworks-client │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── ice.config.js │ ├── jsconfig.json │ ├── package.json │ ├── public │ │ ├── favicon.png │ │ └── index.html │ ├── scripts │ │ └── upload-oss.js │ ├── src │ │ ├── appConfig.js │ │ ├── components │ │ │ ├── ActionStatus │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── BlockCard │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── Card │ │ │ │ └── index.js │ │ │ ├── ComponentCard │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── ConnectModal │ │ │ │ └── index.js │ │ │ ├── CreateProjectModal │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── DynamicForm │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── ErrorBoundary │ │ │ │ ├── FallbackComponent.js │ │ │ │ └── index.js │ │ │ ├── GlobalBar │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── Icon │ │ │ │ └── index.js │ │ │ ├── LoadingIndicator │ │ │ │ └── index.js │ │ │ ├── Locale │ │ │ │ └── index.js │ │ │ ├── MaterialCategories │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── MenuTreeConfig │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── Modal │ │ │ │ └── index.js │ │ │ ├── NavigationBar │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── NoData │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── Progress │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── ScaffoldCard │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── SelectWorkFolderModal │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── SubMenu │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── SubMenuItem │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── SubRoutes │ │ │ │ └── index.js │ │ │ ├── TaskBar │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── TaskButton │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── ThemeProvider │ │ │ │ └── index.js │ │ │ ├── TipIcon │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── User │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── UserLoginModal │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ └── XtermTerminal │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ ├── global.scss │ │ ├── hooks │ │ │ ├── useDependency.js │ │ │ ├── useLoadingTheme.js │ │ │ ├── useMaterial.js │ │ │ ├── useModal.js │ │ │ ├── useProject.js │ │ │ ├── useSocket.js │ │ │ ├── useTask.js │ │ │ ├── useTermTheme.js │ │ │ ├── useTheme.js │ │ │ ├── useVisibilityChange.js │ │ │ └── useWhenValueChanges.js │ │ ├── index.js │ │ ├── layouts │ │ │ └── MainLayout │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ ├── locales │ │ │ ├── en-US │ │ │ │ └── index.js │ │ │ └── zh-CN │ │ │ │ └── index.js │ │ ├── menuConfig.js │ │ ├── pages │ │ │ ├── Engineering │ │ │ │ ├── components │ │ │ │ │ ├── Configuration │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── Task │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ └── TaskModal │ │ │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ ├── index.module.scss │ │ │ │ └── stores │ │ │ │ │ ├── configuration.js │ │ │ │ │ └── index.js │ │ │ ├── Material │ │ │ │ ├── components │ │ │ │ │ ├── AddMaterialModal │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── DeleteMaterialModal │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── InstallModal │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── MaterialPanel │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ └── SubMenu │ │ │ │ │ │ ├── SubMenuItem.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ │ ├── Project │ │ │ │ ├── components │ │ │ │ │ ├── DEFPanel │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── DeleteProjectModal │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── DependencyPanel │ │ │ │ │ │ ├── CreateDependencyModal.js │ │ │ │ │ │ ├── CreateDependencyModal.module.scss │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── FallbackPanel │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── GitPanel │ │ │ │ │ │ ├── CreateBranchModal.js │ │ │ │ │ │ ├── CreateBranchModal.module.scss │ │ │ │ │ │ ├── GitRemote.js │ │ │ │ │ │ ├── Main.js │ │ │ │ │ │ ├── Main.module.scss │ │ │ │ │ │ ├── SwtichBranchModal.js │ │ │ │ │ │ ├── SwtichBranchModal.module.scss │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── GuidePanel │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── LayoutPanel │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── MenuPanel │ │ │ │ │ │ ├── CreateMenuModal.js │ │ │ │ │ │ ├── CreateMenuModal.module.scss │ │ │ │ │ │ ├── DeleteMenuModal.js │ │ │ │ │ │ ├── DeleteMenuModal.module.scss │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── OSSPanel │ │ │ │ │ │ ├── dataSource.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── PagePanel │ │ │ │ │ │ ├── BuildPageModal.js │ │ │ │ │ │ ├── BuildPageModal.module.scss │ │ │ │ │ │ ├── DeletePageModal.js │ │ │ │ │ │ ├── SavePageModal.js │ │ │ │ │ │ ├── SavePageModal.module.scss │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── Panel │ │ │ │ │ │ ├── head.js │ │ │ │ │ │ ├── head.module.scss │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── QuickBuildPanel │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── QuickDevPanel │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── QuickStart │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── RouterPanel │ │ │ │ │ │ ├── CreateRouterModal.js │ │ │ │ │ │ ├── CreateRouterModal.module.scss │ │ │ │ │ │ ├── DeleteRouterModal.js │ │ │ │ │ │ ├── DeleteRouterModal.module.scss │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── SettingPanel │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── SubMenu │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ ├── TaskItem │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ │ └── TodoPanel │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.module.scss │ │ │ │ ├── index.js │ │ │ │ ├── index.module.scss │ │ │ │ ├── panels.js │ │ │ │ └── stores │ │ │ │ │ ├── git.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── layouts.js │ │ │ │ │ ├── menu.js │ │ │ │ │ ├── oss.js │ │ │ │ │ ├── page.js │ │ │ │ │ ├── pages.js │ │ │ │ │ ├── routes.js │ │ │ │ │ └── todo.js │ │ │ └── Setting │ │ │ │ ├── components │ │ │ │ ├── General │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.module.scss │ │ │ │ └── Main │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.module.scss │ │ │ │ ├── index.js │ │ │ │ └── index.module.scss │ │ ├── routerConfig.js │ │ ├── socket.js │ │ ├── stores │ │ │ ├── dependencies.js │ │ │ ├── globalTerminal.js │ │ │ ├── index.js │ │ │ ├── material.js │ │ │ ├── progress.js │ │ │ ├── project.js │ │ │ ├── projects.js │ │ │ ├── settingPanel.js │ │ │ ├── task.js │ │ │ └── user.js │ │ ├── utils │ │ │ ├── getMenuData.js │ │ │ ├── goldlog.js │ │ │ ├── logger.js │ │ │ ├── showMessage.js │ │ │ ├── termManager.js │ │ │ ├── traverse.js │ │ │ └── writeGlobalLog.js │ │ └── variables.scss │ └── tests │ │ └── index.js ├── iceworks-scaffolder │ ├── README.md │ ├── demo │ │ └── angular.js │ ├── docs │ │ └── scaffold-data.md │ ├── package.json │ ├── src │ │ ├── CONSTANT.js │ │ ├── ScaffoldResult.js │ │ ├── index.js │ │ ├── locale.js │ │ ├── logger.js │ │ ├── material │ │ │ ├── extractCustomBlock.js │ │ │ ├── extractTarball.js │ │ │ ├── extractTarballLayout.js │ │ │ ├── getBlockComponentsPaths.js │ │ │ ├── getBlockPaths.js │ │ │ ├── getDependencies.js │ │ │ ├── getLayoutPaths.js │ │ │ ├── getTarball.js │ │ │ ├── index.js │ │ │ └── parseFilename.js │ │ ├── menu │ │ │ ├── appendMenu.js │ │ │ └── removeMenu.js │ │ ├── normalizeScaffoldrc.js │ │ ├── page │ │ │ ├── addBlocks.js │ │ │ ├── addLayout.js │ │ │ └── addPage.js │ │ ├── project │ │ │ ├── checkExists.js │ │ │ ├── getPackageData.js │ │ │ ├── getScaffoldTemplate.js │ │ │ └── index.js │ │ ├── router │ │ │ ├── appendManifestRouter.js │ │ │ ├── appendRouter.js │ │ │ ├── removeManifestRouter.js │ │ │ └── removeRouter.js │ │ └── utils │ │ │ ├── astToCode.js │ │ │ └── index.js │ └── test │ │ ├── createPage.test.js │ │ ├── extractTarballLayout.test.js │ │ ├── features │ │ ├── default │ │ │ ├── .iceworks │ │ │ │ ├── pageTemplate │ │ │ │ │ ├── [name].jsx.ejs │ │ │ │ │ ├── index.js.ejs │ │ │ │ │ └── index.scss.ejs │ │ │ │ └── scaffoldrc.json │ │ │ ├── mock │ │ │ │ └── blank-layout.json │ │ │ ├── package.json │ │ │ └── src │ │ │ │ ├── layouts │ │ │ │ └── BlankLayout │ │ │ │ │ ├── Layout.jsx │ │ │ │ │ ├── Layout.scss │ │ │ │ │ └── index.js │ │ │ │ └── pages │ │ │ │ └── Hello │ │ │ │ ├── Hello.jsx │ │ │ │ ├── components │ │ │ │ ├── AbilityIntroduction │ │ │ │ │ ├── AbilityIntroduction.jsx │ │ │ │ │ └── index.js │ │ │ │ └── ApplicationProgress │ │ │ │ │ ├── ApplicationProgress.jsx │ │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ └── index.scss │ │ ├── layout │ │ │ └── src │ │ │ │ ├── components │ │ │ │ ├── Footer.jsx │ │ │ │ ├── Header.jsx │ │ │ │ └── Logo.jsx │ │ │ │ ├── layout │ │ │ │ ├── Layout.jsx │ │ │ │ ├── index.js │ │ │ │ └── scss │ │ │ │ │ ├── base.scss │ │ │ │ │ ├── dark.scss │ │ │ │ │ └── light.scss │ │ │ │ └── menuConfig.js │ │ ├── menu │ │ │ └── src │ │ │ │ ├── menuConfig.js │ │ │ │ └── menuConfig2.js │ │ └── router │ │ │ └── src │ │ │ ├── routerConfig.js │ │ │ ├── routerConfig2.js │ │ │ ├── routerConfigHas404.js │ │ │ └── routerConfigHasPreview.js │ │ ├── menu.test.js │ │ ├── router.test.js │ │ ├── scaffoldrc.test.js │ │ └── unpad.js ├── iceworks-server │ ├── .gitignore │ ├── README.md │ ├── README.zh-CN.md │ ├── package.json │ ├── scripts │ │ ├── generateProject.js │ │ ├── install.js │ │ └── removeProject.js │ ├── src │ │ ├── app.ts │ │ ├── app │ │ │ ├── controller │ │ │ │ ├── goldlog.ts │ │ │ │ └── home.ts │ │ │ ├── io │ │ │ │ ├── controller │ │ │ │ │ ├── home │ │ │ │ │ │ ├── project.ts │ │ │ │ │ │ ├── setting.ts │ │ │ │ │ │ └── system.ts │ │ │ │ │ └── material │ │ │ │ │ │ └── index.ts │ │ │ │ └── middleware │ │ │ │ │ └── adapter.ts │ │ │ ├── middleware │ │ │ │ └── client.ts │ │ │ ├── router.ts │ │ │ └── view │ │ │ │ └── index.html │ │ ├── config │ │ │ ├── config.default.ts │ │ │ ├── config.local.ts │ │ │ ├── config.prod.ts │ │ │ └── plugin.ts │ │ ├── interface │ │ │ ├── base.ts │ │ │ ├── component.ts │ │ │ ├── configuration.ts │ │ │ ├── def.ts │ │ │ ├── dependency.ts │ │ │ ├── git.ts │ │ │ ├── index.ts │ │ │ ├── layout.ts │ │ │ ├── menu.ts │ │ │ ├── mock.ts │ │ │ ├── oss.ts │ │ │ ├── page.ts │ │ │ ├── router.ts │ │ │ ├── task.ts │ │ │ └── todo.ts │ │ ├── lib │ │ │ ├── adapter-cra-v1 │ │ │ │ ├── README.md │ │ │ │ ├── index.ts │ │ │ │ ├── modules │ │ │ │ │ └── router │ │ │ │ │ │ └── index.ts │ │ │ │ └── package.json │ │ │ ├── adapter-react-v0 │ │ │ │ ├── README.md │ │ │ │ ├── index.ts │ │ │ │ └── package.json │ │ │ ├── adapter-react-v1 │ │ │ │ ├── README.md │ │ │ │ ├── index.ts │ │ │ │ └── package.json │ │ │ ├── adapter-react-v2 │ │ │ │ ├── README.md │ │ │ │ ├── index.ts │ │ │ │ ├── modules │ │ │ │ │ ├── menu │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── router │ │ │ │ │ │ └── index.ts │ │ │ │ └── package.json │ │ │ ├── adapter-react-v3 │ │ │ │ ├── README.md │ │ │ │ ├── index.ts │ │ │ │ └── package.json │ │ │ ├── adapter-vue-v1 │ │ │ │ ├── README.md │ │ │ │ ├── index.ts │ │ │ │ ├── modules │ │ │ │ │ ├── configuration │ │ │ │ │ │ ├── getConfigSchema.ts │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── task │ │ │ │ │ │ ├── getTaskConfig.ts │ │ │ │ │ │ └── index.ts │ │ │ │ └── package.json │ │ │ ├── adapter-vue-v2 │ │ │ │ ├── README.md │ │ │ │ ├── index.ts │ │ │ │ ├── modules │ │ │ │ │ ├── configuration │ │ │ │ │ │ ├── getConfigSchema.ts │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── page │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ └── template.vue.ejs │ │ │ │ │ └── task │ │ │ │ │ │ ├── getTaskConfig.ts │ │ │ │ │ │ └── index.ts │ │ │ │ └── package.json │ │ │ ├── adapter │ │ │ │ ├── README.md │ │ │ │ ├── index.ts │ │ │ │ ├── locales │ │ │ │ │ ├── en-US.json │ │ │ │ │ └── zh-CN.json │ │ │ │ ├── modules │ │ │ │ │ ├── configuration │ │ │ │ │ │ ├── getConfigSchema.ts │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── def │ │ │ │ │ │ ├── client.ts │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── dependency │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── git │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── layout │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── menu │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── oss │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── page │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ └── template.jsx.ejs │ │ │ │ │ ├── router │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── task │ │ │ │ │ │ ├── getTaskConfig.ts │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── todo │ │ │ │ │ │ └── index.ts │ │ │ │ ├── package.json │ │ │ │ └── utils │ │ │ │ │ ├── cliConf.ts │ │ │ │ │ ├── formatCodeFromAST.ts │ │ │ │ │ └── getIceVersion.ts │ │ │ ├── getNpmClient.ts │ │ │ ├── getTarballURLByMaterielSource.ts │ │ │ ├── plugin │ │ │ │ ├── i18n │ │ │ │ │ ├── app.ts │ │ │ │ │ └── package.json │ │ │ │ └── project-manager │ │ │ │ │ ├── app.ts │ │ │ │ │ └── package.json │ │ │ ├── recursiveReaddir.ts │ │ │ ├── remoteLogger │ │ │ │ └── index.ts │ │ │ ├── scanDirectory.ts │ │ │ └── storage.ts │ │ └── locales │ │ │ ├── en-US.json │ │ │ └── zh-CN.json │ ├── test │ │ ├── app │ │ │ └── controller │ │ │ │ ├── goldlog.test.ts │ │ │ │ └── home.test.ts │ │ └── lib │ │ │ └── adapter │ │ │ ├── common.ts │ │ │ ├── configuration.test.ts │ │ │ ├── dependency.test.ts │ │ │ ├── git.test.ts │ │ │ ├── layout.test.ts │ │ │ ├── menu.test.ts │ │ │ ├── oss.test.ts │ │ │ ├── page.test.ts │ │ │ ├── router.test.ts │ │ │ ├── task.test.ts │ │ │ └── todo.test.ts │ └── tsconfig.json ├── koa-generator │ ├── README.md │ ├── package.json │ ├── templates │ │ ├── README.md │ │ ├── _editorconfig │ │ ├── _eslintignore │ │ ├── _eslintrc │ │ ├── _gitignore │ │ ├── client │ │ │ └── .gitkeep │ │ ├── package.json │ │ └── server │ │ │ ├── app.js │ │ │ ├── config │ │ │ └── .gitkeep │ │ │ ├── controller │ │ │ └── user.js │ │ │ ├── middleware │ │ │ └── .gitkeep │ │ │ ├── model │ │ │ └── User.js │ │ │ ├── router.js │ │ │ └── service │ │ │ └── user.js │ └── utils │ │ └── .gitkeep └── props-schema-generator │ ├── README.md │ ├── lib │ ├── apiExtractor.js │ ├── codeToAST.js │ ├── findDef.js │ ├── getComponentMeta.js │ ├── getPath.js │ ├── index.js │ ├── parseJsDoc.js │ └── treeToJSON.js │ └── package.json ├── scripts ├── docConfig.js ├── generate-docs-database.js ├── participle │ ├── index.js │ └── userDict.utf8 └── upload-oss.js └── tools ├── iceworks-app ├── .gitignore ├── README.zh-CN.md ├── app │ ├── autoUpdate.js │ ├── getEnv.js │ ├── getURL.js │ └── index.js ├── bin-darwin │ ├── README.md │ ├── node │ └── npm ├── bin-win32 │ ├── README.md │ ├── node.exe │ ├── npm │ └── npm.cmd ├── changelog │ └── 3.0.0.json ├── gulpfile.js ├── package.json ├── public │ └── icons │ │ ├── mac │ │ └── icon.icns │ │ ├── png │ │ ├── 1024x1024.png │ │ ├── 128x128.png │ │ ├── 16x16.png │ │ ├── 24x24.png │ │ ├── 256x256.png │ │ ├── 32x32.png │ │ ├── 48x48.png │ │ ├── 512x512.png │ │ └── 64x64.png │ │ └── win │ │ └── icon.ico └── renderer │ ├── .gitignore │ ├── README.md │ ├── ice.config.js │ ├── package.json │ ├── public │ └── index.html │ └── src │ ├── global.scss │ ├── pages │ ├── About │ │ ├── index.jsx │ │ └── index.scss │ ├── Error │ │ ├── index.jsx │ │ └── index.scss │ ├── Loading │ │ ├── index.jsx │ │ └── index.scss │ └── Updater │ │ ├── index.jsx │ │ └── index.scss │ └── utils │ └── isInElectron.js └── iceworks-cli ├── .gitignore ├── CHANGELOG.md ├── README.md ├── bin └── iceworks.js ├── command ├── add │ ├── addBlockToProject.js │ └── index.js ├── config │ └── index.js ├── generate │ ├── generateMaterialData.js │ └── index.js ├── init │ ├── addSingleMaterial.js │ ├── downloadMaterialTemplate.js │ ├── ejsRenderDir.js │ ├── generateNpmName.js │ ├── index.js │ ├── initMaterialAndComponent.js │ └── initProject.js ├── start │ ├── downloadServer.js │ └── index.js └── sync │ ├── fusionSDK.js │ └── index.js ├── lib ├── checkEmpty.js ├── checkVersion.js ├── config.js ├── constants.js ├── extractTarball.js ├── getNpmRegistry.js ├── getNpmTarball.js ├── getUnpkgHost.js ├── goldlog.js └── log.js ├── package.json └── template ├── componentAdaptor └── adaptor │ └── index.js.ejs └── initMaterial ├── README.md ├── _eslintignore ├── _eslintrc.js ├── _gitignore ├── _package.json.ejs ├── _stylelintignore └── _stylelintrc.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [makefile] 15 | indent_style = tab 16 | indent_size = 4 17 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # 忽略目录 2 | build/ 3 | test/ 4 | tests/ 5 | node_modules/ 6 | dist/ 7 | 8 | # node 覆盖率文件 9 | coverage/ 10 | 11 | # 忽略文件 12 | **/*-min.js 13 | **/*.min.js 14 | 15 | templates 16 | 17 | # 忽略 packages 部分包 18 | # packages/ice-npm-utils 19 | packages/clean-css-parallel 20 | packages/css-prefix-plugin 21 | packages/eslint-config-ice 22 | packages/extract-css-assets-webpack-plugin 23 | packages/koa-generator 24 | packages/props-schema-generator 25 | packages/uglify-parallel 26 | packages/webpack-dev-mock 27 | packages/webpack-plugin-import 28 | packages/ice-layout-builder 29 | packages/ice-skin-loader 30 | packages/ice-template-builder 31 | packages/iceworks-scaffolder 32 | 33 | # temp ignore 34 | tools/iceworks 35 | tools/ice-devtools 36 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { eslintTS, deepmerge } = require('@ice/spec'); 2 | 3 | module.exports = deepmerge(eslintTS, { 4 | rules: { 5 | "@typescript-eslint/no-var-requires": 0, 6 | "class-methods-use-this": 1, 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | ## 问题描述 15 | 16 | 17 | 18 | ## 错误信息 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | .idea 4 | lerna-debug.log 5 | npm-debug.log 6 | mochawesome-report 7 | .happypack 8 | package-lock.json 9 | yarn.lock 10 | yarn-error.log 11 | tempDir 12 | coverage/ 13 | 14 | .eslintcache 15 | databases 16 | build 17 | .vscode/ 18 | tools/ice-scripts/lib/ICE_CA 19 | .tmp/ 20 | 21 | npmrc 22 | tools/extract-css-assets-webpack-plugin/test/actual/ 23 | tools/extract-css-assets-webpack-plugin/lib/ 24 | 25 | # iceworks 26 | !tools/iceworks/**/yarn.lock 27 | !tools/iceworks/build 28 | tools/iceworks/out 29 | tools/iceworks/dist 30 | tools/iceworks/renderer/src/datacenter/data 31 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: node_js 3 | node_js: 4 | - '8' 5 | install: 6 | - npm install 7 | - npm install codecov -g 8 | script: 9 | - npm run ci 10 | after_script: 11 | - codecov 12 | deploy: 13 | provider: script 14 | skip_cleanup: true # 避免清空已安装的依赖 15 | script: npm run generate:docs && npm run upload-oss 16 | on: 17 | all_branches: true 18 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { extends: ['@commitlint/config-conventional'] }; 2 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | > 在修改文档之前,请先阅读此文章 2 | 3 | ### 目录结构 4 | 5 | ``` 6 | - foo.md 文档内容, 可以有文件夹嵌套 7 | - yoo.md 8 | ``` 9 | 10 | ### 文档结构 11 | 12 | ```markdown 13 | --- 14 | title: 文档标题(必须有) 15 | order: 可选, 文档顺序, 数字越小越在前面, 否则按照字母序 16 | hide: 可选, 布尔值, 是否隐藏文档 17 | 18 | cover: 可选, 建议有, 封面图 19 | --- 20 | 21 | markdown 格式的文档内容 22 | ``` 23 | 24 | ### 链接跳转 25 | 26 | 统一使用绝对路径跳转,比如:`[设计工具](/docs/design/tools.md)` 27 | 28 | ### 词汇表述 29 | 30 | 请注意大小写和复数形式 31 | 32 | * `ICE`: 品牌名, 中文称之为 `飞冰` 33 | * `iceworks`: 配套 GUI 软件 34 | * `物料 - marterial`: 包含区块, 布局, 模板和组件 35 | * `区块 - block`: 复用的最小代码片段 36 | * `布局 - layout`: 为 ICE 提供整体布局方案的代码 37 | * `模板 - scaffold`: 整站示例, 脚手架 38 | -------------------------------------------------------------------------------- /docs/cli-1.x/about.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 关于 ice-scripts 3 | order: 1 4 | --- 5 | 6 | > ice-scripts@2.0.0 版本已发布,在可配置与定制性上做了很多提升,[迁移文档](/docs/cli/migrate.md)。 7 | 8 | [ice-scripts](https://github.com/ice-lab/ice-scripts) 是飞冰(ICE)React 链路的工程工具,类似 Vue CLI 之于 Vue 的关系。ice-scripts 提供了丰富的功能帮助我们开发 React 项目: 9 | 10 | - 完善的命令行工具 11 | - 支持项目/业务组件/区块的开发&构建 12 | - 基于 Fusion 体系的主题配置 13 | - 完善的自定义 webpack 配置 14 | - …… 15 | 16 | 我们致力于将 ice-scripts 打造为 React 生态下高可配置性、高可用的工程工具。 -------------------------------------------------------------------------------- /docs/cli-1.x/advanced/cloud-build.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 接入云构建(阿里内部) 3 | order: 6 4 | --- 5 | 6 | > 仅阿里内部同学需要关心 7 | 8 | 参考 [文档](https://yuque.antfin-inc.com/ice/rdy99p/syvuzh) 接入 DEF 云构建,即可快速发布前端资源到 CDN。 -------------------------------------------------------------------------------- /docs/cli-1.x/advanced/debug.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 调试本地资源 3 | order: 3 4 | --- 5 | 6 | 如果应用的日常/线上环境已经部署,并且大部分接口已经稳定,此时如果想快速便捷的调试前端资源,不推荐通过「访问本地前端服务然后 Proxy 请求后端接口」的方式调试前端代码,因为此时前端页面里没有任何 cookie 及用户信息,涉及到后端接口有鉴权的情况下无法解决绕过。 7 | 8 | 这个场景我们推荐的方案:直接访问日常/线上页面,然后将页面里加载的前端资源代理到本地前端服务对应的资源,代理工具推荐 [xswitch chrome 插件](https://github.com/yize/xswitch),相应的配置非常简单: 9 | 10 | ``` 11 | { 12 | "proxy": [ 13 | # css 同理,直接替换匹配的路径,支持正则(比如 (.*) 部分用于无视变化的版本号) 14 | [ 15 | "g.alicdn/xxx-assets/(.*)/index.js", 16 | "127.0.0.1:4444/build/index.js" 17 | ] 18 | ] 19 | } 20 | ``` 21 | 22 | 如果对应环境是 https 协议的话,那么启动本地前端服务时需要添加 `--https` 参数: 23 | 24 | ```json 25 | // package.json 26 | { 27 | "scripts": { 28 | "start": "ice dev --https" 29 | } 30 | } 31 | ``` -------------------------------------------------------------------------------- /docs/cli-1.x/advanced/public.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 使用 public 目录 3 | order: 6 4 | --- 5 | 6 | 我们约定 public 目录下的文件会在 dev 和 build 时被自动 copy 到输出目录(默认是 ./build)下。所以可以在这里存放 7 | favicon, index.html 等静态文件。 -------------------------------------------------------------------------------- /docs/cli-1.x/basic/block.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 使用区块 3 | order: 7 4 | --- 5 | 6 | ### 添加区块 7 | 8 | ```bash 9 | $ cd src/pages/home/components 10 | $ ice add block -t @icedesign/document-list-block 11 | => src/pages/home/components/DocumentListBlock 12 | ``` 13 | 14 | 海量区块列表,参考 [区块](https://ice.work/block) 15 | -------------------------------------------------------------------------------- /docs/cli-1.x/en-us/about.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: About ice-scripts 3 | order: 1 4 | --- 5 | 6 | About about -------------------------------------------------------------------------------- /docs/cli-1.x/en-us/basic/start.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Quick start 3 | order: 1 4 | --- 5 | 6 | Quick start [test](/docs/cli/en-us/basic/start.md); -------------------------------------------------------------------------------- /docs/cli-1.x/others/browser-router.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 本地开发使用 BrowserRouter 3 | order: 2 4 | --- 5 | 6 | ## 修改配置 7 | 8 | 创建 `.webpackrc.js` 文件 9 | 10 | ```js 11 | module.exports = { 12 | devServer: { 13 | historyApiFallback: true 14 | } 15 | }; 16 | ``` 17 | 18 | ## 修改 `router.jsx` 19 | 20 | 将 `HashRouter` 修改为 `BrowserRouter` 21 | 22 | ```diff 23 | -import { HashRouter as Router } from 'react-router-dom'; 24 | +import { BrowserRouter as Router } from 'react-router-dom'; 25 | ``` 26 | 27 | 完成上述修改后,本地开发就可以使用 BrowserRouter 了。 -------------------------------------------------------------------------------- /docs/cli-1.x/others/local-img.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 使用本地图片 3 | order: 1 4 | --- 5 | 6 | 项目打包基于 [webpack](https://webpack.js.org/) 所有项目内的资源都可理解为 Module 通过依赖关系最后打包出项目资源。 7 | 8 | ## 在 jsx 中依赖图片的写法 9 | 10 | ```javascript 11 | // 本地图片填写相对路径 12 | 13 | ``` 14 | 15 | ```javascript 16 | // 网络图片常规写法即可 17 | 18 | ``` 19 | 20 | ## 在样式文件中依赖图片的写法 21 | 22 | ```css 23 | // 网络图片常规写法即可 24 | .header { 25 | backround-image: url('http://example.com/img.jpg'); 26 | } 27 | ``` 28 | 29 | ```css 30 | // 本地图片填写相对路径 31 | .header { 32 | backround-image: url('../../img.jpg'); 33 | } 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/cli-1.x/others/moment.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Moment.js 按需加载 3 | order: 1 4 | --- 5 | 6 | 基础组件 `@alifd/next` 里的时间相关组件依赖了 moment,但是为了业务可以优化 moment 的包大小,所以 `@alifd/next` 里将 moment 作为自己的 peerDependencies 而非 dependencies,因此项目使用到时间组件时需要自行引入 moment 依赖: 7 | 8 | ```bash 9 | $ npm install moment --save 10 | ``` 11 | 12 | moment 里有针对国际化语言的大量代码,如果不做任何处理的话会导致 bundle 变大,因此 ice-scripts 默认对 moment 文案做了按需加载,只有通过 `import 'moment/locale/zh-cn.js'` 才会引入对应文案代码,比如如果想支持中文需要在项目入口文件里引入中文的语言文件: 13 | 14 | ``` 15 | // index.js 16 | import 'moment/locale/zh-cn.js'; 17 | ``` -------------------------------------------------------------------------------- /docs/cli/config/plugins.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 插件配置 3 | order: 3 4 | --- 5 | 6 | 插件配置由配置文件 `ice.config.js` 中提供的 `plugins` 字段来配置插件列表。 7 | 8 | * 类型:`Array` 9 | * 默认值:`[]` 10 | 11 | 插件数组项每一项代表一个插件,ice-scripts 将按顺序执行插件列表,插件配置形式如下: 12 | 13 | ```js 14 | // ice.config.js 15 | const icePluginFusion = require('ice-plugin-fusion'); 16 | 17 | module.exports = { 18 | plugins: [ 19 | // npm依赖包 20 | 'ice-plugin-antd', 21 | // 相对路径 22 | './plugins/custom-plugin', 23 | // 插件方法 24 | icePluginFusion, 25 | ] 26 | } 27 | ``` 28 | 29 | 如果插件包含自定义配置参数,则可以通过数组的形式配置 30 | 31 | ```js 32 | module.exports = { 33 | plugins: [ 34 | // 数组第一项为插件,第二项为参数 35 | ['ice-plugin-fusion', { 36 | themePackages: [] 37 | }], 38 | ] 39 | } 40 | ``` -------------------------------------------------------------------------------- /docs/cli/en-us/about.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: About ice-scripts 3 | order: 1 4 | --- 5 | 6 | About about -------------------------------------------------------------------------------- /docs/cli/en-us/basic/start.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Quick start 3 | order: 1 4 | --- 5 | 6 | Quick start [test](/docs/cli/en-us/basic/start.md); -------------------------------------------------------------------------------- /docs/cli/feature/cloud-build.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 接入云构建(阿里内部) 3 | order: 7 4 | --- 5 | 6 | > 仅阿里内部同学需要关心 7 | 8 | 参考 [文档](https://yuque.antfin-inc.com/ice/rdy99p/angwyx) 接入 DEF 云构建,即可快速发布前端资源到 CDN。 -------------------------------------------------------------------------------- /docs/cli/feature/public.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 使用 public 目录 3 | order: 4 4 | --- 5 | 6 | 我们约定 public 目录下的文件会在 dev 和 build 时被自动 copy 到输出目录(默认是 ./build)下。所以可以在这里存放 7 | favicon, index.html 等静态文件。 -------------------------------------------------------------------------------- /docs/cli/plugin-list/antd.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ice-plugin-antd 3 | order: 2 4 | --- 5 | 6 | `ice-plugin-antd` 插件为项目中使用 antd 组件提供按需加载和主题定制的能力。 7 | 8 | ## 功能 9 | 10 | - antd 组件按需加载 11 | - 主题定制能力 12 | 13 | ## 如何使用 14 | 15 | Install: 16 | 17 | ```bash 18 | $ npm i --save-dev ice-plugin-antd 19 | ``` 20 | 21 | Options: 22 | 23 | - `themeConfig`: 设置替换主题颜色 24 | 25 | Usage: 26 | 27 | ```js 28 | module.exports = { 29 | plugins: [ 30 | ['ice-plugin-antd', { 31 | themeConfig: { 32 | 'primary-color': '#1DA57A', 33 | 'link-color': '#1DA57A', 34 | 'border-radius-base': '2px', 35 | } 36 | }] 37 | ] 38 | } 39 | ``` -------------------------------------------------------------------------------- /docs/cli/plugin-list/component.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ice-plugin-component 3 | order: 3 4 | --- 5 | 6 | `ice-plugin-component` 提供组件开发时的基础能力扩展,本文将详细介绍插件具体用法。 7 | 8 | ## 功能 9 | 10 | - 支持组件模块开发 dev & build 11 | - 支持接入 Fusion Cool & 设计板块的组件构建 12 | 13 | ## 如何使用 14 | 15 | ```bash 16 | $ npm i --save-dev ice-plugin-component 17 | ``` 18 | 19 | Options: 20 | 21 | - `type`: 默认值 `fusion` ,如无需生成接入 Fusion 相关样式文件,可设置为 `component` 22 | 23 | Usage: 24 | 25 | ```js 26 | module.exports = { 27 | plugins: [ 28 | ['ice-plugin-component', { type: 'fusion' }] 29 | ] 30 | } 31 | ``` 32 | 33 | 更多组件开发相关内容,详见[业务组件开发规范](/docs/materials/react.md)。 -------------------------------------------------------------------------------- /docs/cli/plugin-list/dll.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ice-plugin-dll 3 | order: 10 4 | --- 5 | 6 | 用于本地开发时,加快项目二次启动速度。 7 | 8 | ## 功能 9 | 10 | - 通过 webpack 的 dllPlugin 打包一份 dll 文件来达到项目二次启动的编译速度 11 | - 启动时分析项目的依赖 `dependencies` 信息,发生变化后将后重新打包 dll 文件 12 | 13 | ## 如何使用 14 | 15 | Install: 16 | 17 | ```bash 18 | $ npm i -save-dev ice-plugin-dll 19 | ``` 20 | 21 | Usage: 22 | 23 | ```js 24 | module.exports = { 25 | plugins: [ 26 | 'ice-plugin-dll' 27 | ] 28 | } 29 | ``` 30 | 31 | > 注意:`ice-plugin-dll` 仅在 `dev` 命令下生效 -------------------------------------------------------------------------------- /docs/cli/plugin-list/local.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ice-plugin-css-assets-local 3 | order: 4 4 | --- 5 | 6 | `ice-plugin-css-assets-local` 提供将 css 中的网络资源本地化能力,本文将详细介绍该插件具体用法。 7 | 8 | ## 功能 9 | 10 | - 将 CSS 中依赖的资源本地化,例如字体文件等。 11 | 12 | ## 如何使用 13 | 14 | Install: 15 | 16 | ```bash 17 | $ npm i --save-dev ice-plugin-css-assets-local 18 | ``` 19 | 20 | Options: 21 | 22 | - `outputPath`: 默认值: `assets` 提取后的文件目录前缀 23 | - `relativeCssPath`: 默认值: `../` 提取的文件后相对于 CSS 的路径 24 | 25 | Usage: 26 | 27 | ```js 28 | // ice.config.js 29 | module.exports = { 30 | plugins: [ 31 | ['ice-plugin-css-assets-local', { 32 | outputPath: 'assets', 33 | relativeCssPath: '../' 34 | }] 35 | ] 36 | } 37 | ``` -------------------------------------------------------------------------------- /docs/cli/plugin-list/modular-import.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ice-plugin-modular-import 3 | order: 7 4 | --- 5 | 6 | 用于快捷增加 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 的配置 7 | 8 | ## 功能 9 | 10 | - 参考 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 11 | 12 | ## 如何使用 13 | 14 | Install: 15 | 16 | ```bash 17 | $ npm i --save-dev ice-plugin-modular-import 18 | ``` 19 | 20 | Usage: 21 | 22 | ```js 23 | // ice.config.js 24 | module.exports = { 25 | plugins: [ 26 | ['ice-plugin-modular-import', [{ 27 | 'libraryName': 'lodash', 28 | 'libraryDirectory': '', 29 | 'camel2DashComponentName': false, 30 | }, { 31 | 'libraryName': '@material-ui/core', 32 | 'libraryDirectory': 'components', 33 | 'camel2DashComponentName': false, 34 | }]] 35 | ] 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/cli/plugin-list/moment.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ice-plugin-moment-locales 3 | order: 6 4 | --- 5 | 6 | `ice-plugin-moment-locales` 将对 moment 依赖的使用进行优化,根据配置加载对应的语言包。 7 | 8 | ## 功能 9 | 10 | - 优化 moment 语言包加载 11 | - 根据设置自动加载对应语言包 12 | 13 | ## 如何使用 14 | 15 | Install: 16 | 17 | ```bash 18 | $ npm i --save-dev ice-plugin-moment-locales 19 | ``` 20 | 21 | Options: 22 | 23 | - `locales`:类型 `String | Array`,需要加载的多语言包 24 | 25 | Usage: 26 | 27 | ```js 28 | // ice.config.js 29 | module.exports = { 30 | plugins: [ 31 | ['ice-plugin-moment-locales', { 32 | locales: ['zh-cn', 'en-au'] 33 | }] 34 | ] 35 | } 36 | ``` 37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/cli/plugin-list/multi-pages.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ice-plugin-multi-pages 3 | order: 5 4 | --- 5 | 6 | `ice-plugin-multi-pages` 支持解析 `src/pages/*/index.js` 生成多 entry 的配置。 7 | 8 | ## 功能 9 | 10 | - 构建传统的多页应用,默认会将 `src/pages/*/index.js` 作为 entry,每个 page 都会作为一个 entry,以 pageName 构建多个同名 HTML 文件。 11 | 12 | ## 如何使用 13 | 14 | Install: 15 | 16 | ```bash 17 | $ npm i --save-dev ice-plugin-multi-pages 18 | ``` 19 | 20 | Options: 21 | 22 | - `getEntryName{function}`: 自定义 entry name,默认取小写的 `src/pages/*/index.js` 文件夹名称。 23 | 24 | Usage: 25 | 26 | ```js 27 | // ice.config.js 28 | module.exports = { 29 | plugins: [ 30 | ['ice-plugin-multi-pages', { 31 | // customize entry name 32 | // BasicCharts => basic_charts 33 | getEntryName: (pageName) => _.snakeCase(pageName), 34 | }] 35 | ] 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/design/tools.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 设计工具 3 | order: 2 4 | --- 5 | 6 | 在设计理念的基础上,我们同时推荐一款全能的设计辅助工具 FusionCool,该工具由 [Fusion](https://fusion.design/tool) 团队开发,FusionCool 拥有一下特性: 7 | 8 | - Sketch 最佳伴侣,组件直接拖拽使用 9 | - 整合设计资源,应有尽有 10 | - 令人震惊的组件编辑能力 11 | - 嵌入式面板,如影随形 12 | 13 | ![](https://img.alicdn.com/tfs/TB1UnVfrzTpK1RjSZKPXXa3UpXa-2468-1672.png) 14 | 15 | 可以在 [Fusion-工具](https://fusion.design/tool) 下载使用,使用文档参考 [FusionCool 使用文档](https://fusion.design/help.html#/design-use-cool)。 -------------------------------------------------------------------------------- /docs/guide/backend/static.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 在 HTML 托管服务中集成 3 | order: 3 4 | --- 5 | 6 | 本文讲解如何在 HTML 托管服务中集成前端资源,我们以 [surge](http://surge.sh/) 为例。 7 | 8 | ## 全局安装 surge 9 | 10 | ```bash 11 | npm install --global surge 12 | ``` 13 | 14 | ## 运行 surge 15 | 16 | 以 `ice-demo` 项目名,ice 项目默认构建目录 `build` 为例: 17 | 18 | ```bash 19 | cd ice-demo/build 20 | surge 21 | ``` 22 | 23 | > 依次确认账户, `project path`, `domain` 等信息,等待上传生效即可,详见 [surge](https://surge.sh/) 官方说明 24 | 25 | ## 其他同类产品 26 | 27 | - [surge](http://surge.sh/) 28 | - [github pages](https://pages.github.com/) 29 | - [netlify](https://www.netlify.com/) 30 | -------------------------------------------------------------------------------- /docs/guide/monitor/tracker.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 代码稳定性监控 3 | order: 2 4 | --- 5 | 6 | ## 为什么要有前端监控? 7 | 8 | 用户访问我们的业务时,整个访问过程大致可以分为三个阶段:页面生产时(Server 端状态)、页面加载时和页面运行时。 9 | 10 | 为了保证线上业务稳定运行,我们会在 Server 端对业务的运行状态进行各种监控。现有的 Server 端监控系统相对已经很成熟了,而页面加载和页面运行时的状态监控一直比较欠缺。例如: 11 | 12 | - 无法第一时间获知用户访问我们的站点时遇到的错误; 13 | - 各个国家、各个地区的用户访问我们站点的真实速度未知; 14 | - 每个应用内有大量的异步数据调用,而它们的性能、成功率都是未知的。 15 | 16 | ## 我们推荐的解决方案 17 | 18 | 我们推荐使用 [ARMS 前端监控平台](https://www.aliyun.com/product/arms)进行 Web 端体验数据监控,它将从页面打开速度(测速)、页面稳定性(JS Error)和外部服务调用成功率(API)这三个方面监测 Web 页面的健康度。 19 | 20 | ![页面健康度度量](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/152257/155496244543324_zh-CN.png) 21 | 22 | 它的接入方式非常简单,可通过查看[《以 CDN 方式接入》](https://help.aliyun.com/document_detail/58663.html) 进行了解。 -------------------------------------------------------------------------------- /docs/guide/publish/assets.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 前端静态资源发布 3 | order: 1 4 | --- 5 | 6 | > 如果是阿里内部同学,请参考 [文档](https://yuque.antfin-inc.com/ice/rdy99p/syvuzh) 7 | 8 | 前面的章节提到过前端代码开发完成后我们会执行 `npm run build` 命令来进行构建,接下来需要我们需要在 HTML 或者后端模板中引入构建好的 js&css 文件,这时候就需要将构建好的文件进行发布,静态资源的发布一般有两种方式:CDN 发布、通过后端服务托管。 9 | 10 | ## CDN 发布 11 | 12 | 推荐通过 [阿里云 OSS](https://cn.aliyun.com/product/oss) 服务进行非覆盖式发布,每个版本建一个 `x.y.z` 的文件夹,然后将 `build` 资源复制进去,接着就可以通过 url 访问这些 CDN 资源了。 13 | 14 | ## 后端服务托管 15 | 16 | 一般情况下你只需要使用对应的 web 框架启动一个静态文件服务器,然后将构建好的 `build` 资源复制到对应目录下,即可在模板中通过 `https://127.0.0.1:6001/static/js/index.js` 的方式引入对应资源。 -------------------------------------------------------------------------------- /docs/guide/publish/version.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 管理资源版本号 3 | order: 2 4 | --- 5 | 6 | 为了便于代码的回滚,我们推荐使用非覆盖式发布前端资源,每一次发布都会产生一个新的资源地址,比如: 7 | 8 | - 0.1.0 版本:https://g.alicdn.com/creator/assets/0.1.0/index.js 9 | - 0.1.1 版本:https://g.alicdn.com/creator/assets/0.1.1/index.js 10 | 11 | 这样我们每次发布前端资源后,只需要更新下后端模板里引用的前端资源地址即可。但是如果每次前端发布都需要更改后端代码同时发布一次后端应用,这样效率太低,因此我们推荐通过一些配置管理系统来管理前端版本,只需要在系统上点击发布即可将新的版本同步给对应的后端应用。如果你是阿里内部的开发者,可以参考[这篇文档](https://yuque.antfin-inc.com/ice/rdy99p/snt52t)实现前端版本号的动态管理。 -------------------------------------------------------------------------------- /docs/guide/test/jest.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 使用 Jest 写测试用例 3 | order: 1 4 | hide: true 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /docs/icestark/api/app-history.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: appHistory 3 | order: 11 4 | --- 5 | 6 | 提供手动切换不同应用的方法。 7 | 8 | ## appHistory.push 9 | 10 | - 类型:`function` 11 | - 代码示例: 12 | 13 | ```js 14 | import React from 'react'; 15 | import { appHistory } from '@ice/stark'; 16 | 17 | export default class SelfLink extends React.Component { 18 | render() { 19 | return ( 20 | { 21 | appHistory.push('/home'); 22 | }}> 23 | selfLink 24 | 25 | ); 26 | } 27 | } 28 | ``` 29 | 30 | ## appHistory.replace 31 | 32 | - 类型:`function` 33 | - 代码示例参考 `appHistory.push` 34 | -------------------------------------------------------------------------------- /docs/icestark/api/app-link.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: AppLink 3 | order: 7 4 | --- 5 | 6 | 子应用之间跳转,替代 React Router 的 `Link` 组件,表示本次跳转需要重新加载静态资源;子应用内部跳转仍然使用 `Link`,包含如下 props 7 | 8 | ## to 9 | 10 | - 目标路径,同 `Link` 中的 `to` 保持一致 ,必填 11 | - 类型:`string` 12 | - 默认值:`-` 13 | 14 | ## message 15 | 16 | - 表示当前跳转需要弹窗确认,message为提示文案内容,选填 17 | - 类型:`string` 18 | - 默认值:`-` 19 | 20 | 代码示例: 21 | 22 | ```js 23 | import React from 'react'; 24 | import { Link } from 'react-router-dom'; 25 | import { AppLink } from '@ice/stark'; 26 | 27 | export default class SelfLink extends React.Component { 28 | // 商家平台代码 29 | render() { 30 | return ( 31 |
32 | 使用 AppLink 跳转到小二平台的列表页 33 | 跳转到商家平台详情页 34 |
35 | ); 36 | } 37 | } 38 | ``` 39 | -------------------------------------------------------------------------------- /docs/icestark/api/app-router.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: AppRouter 3 | order: 5 4 | --- 5 | 6 | 定位子应用渲染节点,包含如下 props 属性 7 | 8 | ## onRouteChange 9 | 10 | - 子应用 route 变化时的回调,选填 11 | - 类型:`Function(pathname, query, type)` 12 | - 默认值:`-` 13 | 14 | ## NotFoundComponent 15 | 16 | - 渲染全局 404 内容,选填 17 | - 类型:`string | ReactNode` 18 | - 默认值:`
NotFound
` 19 | 20 | ## ErrorComponent 21 | 22 | - 子应用 `js` 静态资源加载出错时的展示内容,选填 23 | - 类型:`string | ReactNode` 24 | - 默认值:`
js bundle loaded error
` 25 | 26 | ## LoadingComponent 27 | 28 | - 子应用静态资源加载时的展示内容,选填 29 | - 类型:`string | ReactNode` 30 | - 默认值:`-` 31 | 32 | ## useShadow 33 | 34 | - 是否开启 shadowRoot 隔离 css,选填 35 | - 类型:`boolean` 36 | - 默认:`false` 37 | -------------------------------------------------------------------------------- /docs/icestark/api/get-basename.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: getBasename 3 | order: 10 4 | --- 5 | 6 | 配置子应用 `React Router` 中的 `basename` 参数的方法,根据 `AppRoute` 中的 `basename` 或者 `path` 配置生成最终结果 7 | 8 | - 类型:`function` 9 | - 默认值:`() => basename || (Array.isArray(path) ? path[0] : path)) || "/"` 10 | - 代码示例参考 [renderNotFound](/docs/icestark/api/render-not-found) -------------------------------------------------------------------------------- /docs/icestark/api/get-mount-node.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: getMountNode 3 | order: 8 4 | --- 5 | 6 | 根据子应用运行环境,返回子应用渲染节点 7 | 8 | - 类型:`function` 9 | - 默认值:`
` 10 | - 使用规则:方法支持传参,传参代表默认渲染的 DOM 节点,默认节点只在子应用单独启动时生效。支持 `string | HTMLElement | function`, `string` 表示默认 DOM 节点的 `id`,`function` 支持函数返回值作为默认 DOM 节点 11 | - 代码示例: 12 | 13 | ```js 14 | import React from 'react'; 15 | import ReactDOM from 'react-dom'; 16 | 17 | import { getMountNode } from '@ice/stark'; 18 | 19 | import '@alifd/next/reset.scss'; 20 | 21 | import App from './App'; 22 | 23 | ReactDOM.render(, getMountNode()); 24 | ``` 25 | -------------------------------------------------------------------------------- /docs/icestark/guide/about.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 关于 icestark 3 | order: 0 4 | --- 5 | 6 | ## 背景 7 | 8 | 大型中后台系统开发,往往涉及到多团队协作的情况。传统 SPA 应用都是基于一个代码仓库,业务逻辑交织,随着业务不断发展,逐渐成为巨石(Monolithic)应用,不利于维护。而为了解决这些问题,往往采用 iframe 做隔离。但 iframe 方案有以下问题: 9 | 10 | - 网页性能,onload 事件延迟和复用连接池问题 11 | - 用户体验,页面跳转生硬、多滚动条和弹窗的遮罩问题 12 | - 通讯模式,iframe 需要自定义通讯协议以及安全校验(如 postMessage) 13 | 14 | ## 什么是 icestark 15 | 16 | [icestark](https://github.com/ice-lab/icestark) 是面向大型应用的微前端解决方案,包含以下特性: 17 | 18 | - 基于路由,模块化管理多个独立应用 19 | - 不同应用独立仓库、独立开发与部署 20 | - 统一管理页面公共内容(Common Header、Common Sidebar 等) 21 | - 支持应用低成本迁移 22 | - SPA 用户体验 23 | 24 | ## 应用架构 25 | 26 | ![应用架构](https://img.alicdn.com/tfs/TB1kbF7bbY1gK0jSZTEXXXDQVXa-1421-1416.png) 27 | 28 | - 按照 UI 结构进行框架应用、子应用的拆分 29 | - 框架应用:负责子应用的注册,公共内容展示(Common Header、Common Sidebar、Common Footer等) 30 | - 子应用:负责自身业务相关的内容展示 31 | -------------------------------------------------------------------------------- /docs/icestark/guide/start.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 快速上手 3 | order: 1 4 | --- 5 | 6 | ## 创建项目 7 | 8 | 启动 iceworks 9 | 10 | ![iceworks](https://img.alicdn.com/tfs/TB1h8v0b5_1gK0jSZFqXXcpaXXa-2880-1372.png) 11 | 12 | 选择 icestark 模板 13 | 14 | ![选择模板](https://img.alicdn.com/tfs/TB1x7v2b7H0gK0jSZPiXXavapXa-2880-1372.png) 15 | 16 | - 新建一个 icestarkLayout 文件夹或者选择已有的空文件夹(避免覆盖原有文件) 17 | - 给项目起一个项目名 icestarkLayout ,以便后续识别 18 | 19 | ## 调试服务 20 | 21 | 通过启动项目面板,可执行 **运行** 22 | 23 | ![启动调试](https://img.alicdn.com/tfs/TB1IFL3b1H2gK0jSZJnXXaT1FXa-2880-1372.png) 24 | 25 | 点击 `运行` 等待完成后出现服务地址,点击可以预览当前项目。 26 | 27 | ![demo](https://img.alicdn.com/tfs/TB10yr1bYr1gK0jSZR0XXbP8XXa-2880-1372.png) 28 | 29 | > 上图是 icestark 模板启动后的预览效果 30 | 31 | -------------------------------------------------------------------------------- /docs/iceworks/engineering/configuration.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 工程配置 3 | order: 3 4 | --- 5 | 6 | 在工程管理简介中,我们了解到工程配置主要是可视化管理当前项目所使用的工程工具对应的配置。在飞冰工程中,提供了最佳实践的默认配置,但如果你想改动其中部分配置,可以在 iceworks 工程管理的配置菜单进行更改。 7 | 8 | ## 配置选项 9 | 10 | 工程配置主要包含 [基础配置](https://ice.work/docs/cli/config/config) 和 [插件配置](https://ice.work/docs/cli/config/plugins) 两部分,目前 iceworks 只支持基础配置的部分,可以在可视化界面快速操作相关的配置项,更改的配置项会自动写入到对应的配置文件。 11 | 12 | ![配置选项](https://img.alicdn.com/tfs/TB1zhj2eL1G3KVjSZFkXXaK4XXa-2877-1586.png) 13 | 14 | ## 其他 15 | 16 | 更多配置项请参考 [ice-scripts 配置指南](https://ice.work/docs/cli/config/config-file)。 17 | -------------------------------------------------------------------------------- /docs/iceworks/engineering/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 工程管理 3 | order: 1 4 | --- 5 | 6 | 在 iceworks 中 **工程管理** 主要是指的是对项目使用的构建工具和对应的工程进行可视化的管理,包括对项目的工程配置,启动调试服务,构建项目等操作。通过可视化的管理配置,屏蔽复杂的工程体系,降低工程配置门槛,让开发者专注于项目开发,不必理会复杂的工程配置问题。 7 | 8 | 工程管理主要包括 **工程任务** 和 **工程配置** 两部分,其背后依赖的是飞冰提供的基于 Webpack 最佳实践的工程工具 [ice-scripts](https://ice.work/docs/cli/about) 。 9 | 10 | ## 工程任务 11 | 12 | 工程任务本质上对应的是 ice-scripts 提供的基础命令能力。主要包括 **启动调试服务**、**构建项目** 以及 **语法检查** 部分, 13 | 14 | * `ice-scripts dev`:启动调试服务 15 | * `ice-scripts build`:构建项目 16 | 17 | ## 工程配置 18 | 19 | 工程配置主要包括当前工程的配置项,通过对工程的配置项进行抽象并可视化展示管理,即可直接在 iceworks 工作台操作配置项,对应的配置改动会自动写入到项目的工程配置文件中。 20 | -------------------------------------------------------------------------------- /docs/iceworks/project/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 其他面板 3 | order: 7 4 | --- 5 | 6 | 由于 iceworks 支持定制工作台的能力,目前支持的功能面板就有 12 个之多,后续还会不断的增加,但并不是所有的面板都是开发项目中核心且重要的,可以根据当前项目进行自定义添加,本篇文档主要用来展示非核心的功能面板。 7 | 8 | ## TODO 9 | 10 | **TODO** 面板是对项目所有 `// TODO` 注释进行可视化管理的功能模块。通过可视化的方式,展示当前项目的 TODO 信息,方便查看项目有那些未完成的工作。 11 | 12 | 例如,项目的 `src/index.jsx` 中有一个 `// TODO` 注释: 13 | 14 | ![文件中的 todo 注释](https://img.alicdn.com/tfs/TB1MIW8aoY1gK0jSZFMXXaWcVXa-1396-708.png) 15 | 16 | 则面板内将列出这个 TODO 注释所在的页面、所在行及注释内容信息: 17 | 18 | ![TODO](https://img.alicdn.com/tfs/TB1OOe.bxz1gK0jSZSgXXavwpXa-2110-622.png) 19 | 20 | ## 布局管理 21 | 22 | **布局管理** 面板是对项目所有的布局进行可视化管理的功能模块,通过可视化的方式,展示当前项目的布局信息。 23 | 24 | ![布局管理](https://img.alicdn.com/tfs/TB1_zG9bpY7gK0jSZKzXXaikpXa-2112-626.png) 25 | -------------------------------------------------------------------------------- /docs/iceworks/project/page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 页面管理 3 | order: 1 4 | --- 5 | 6 | **页面管理** 面板是对项目所有页面进行可视化管理的功能模块。通过可视化的方式,展示当前项目的页面信息,快速地创建、修改和删除页面。 7 | 8 | ## 查看页面信息 9 | 10 | 项目管理面板中全量显示了当前项目的所有页面,并实时保持更新。 11 | 12 | ![所有页面](https://img.alicdn.com/tfs/TB16pqYaaL7gK0jSZFBXXXZZpXa-1425-745.gif) 13 | 14 | ## 创建页面 15 | 16 | 你可以通过点击面板右上角的 + 号开始快速创建一个页面。基于飞冰提供的官方物料或自定义物料,自由组合页面。 17 | 18 | ![创建页面](https://img.alicdn.com/tfs/TB1IYa2akL0gK0jSZFAXXcA9pXa-1425-745.gif) 19 | 20 | ## 添加区块 21 | 22 | 对于已存在的页面,你可以使用 iceworks 继续添加区块,点击页面列表项中的 + 号按钮,开始添加区块。 23 | 24 | ![添加区块](https://img.alicdn.com/tfs/TB18GG2abH1gK0jSZFwXXc7aXXa-1425-745.gif) 25 | 26 | ## 删除页面 27 | 28 | 对于已存在的页面,你可以使用 iceworks 进行删除,点击页面列表项中的“回收站”按钮,删除一个页面。 29 | 30 | ![删除页面](https://img.alicdn.com/tfs/TB1tbqYaXP7gK0jSZFjXXc5aXXa-1425-745.gif) 31 | -------------------------------------------------------------------------------- /docs/materials/guide/init.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 物料初始化 3 | order: 1 4 | --- 5 | 6 | 通过 `iceworks init` 命令可以初始化一个物料项目: 7 | 8 | ```bash 9 | # 创建物料文件夹 10 | $ mkdir my-materials & cd my-materials 11 | 12 | # 初始化物料项目 13 | $ iceworks init 14 | ``` 15 | 16 | 执行 init 命令后,默认创建完整的物料项目,如需独立开发业务组件,请参考[《开发独立业务组件》](/docs/materials/reference/dev.md)。初始化完成后,在项目根目录 `package.json` 中,iceworks 会生成一个 `materialConfig` 字段,这个字段存储了一些当前物料的信息及配置: 17 | 18 | ```json 19 | { 20 | "materialConfig": { 21 | "type": "react", // 字符串,指定当前物料的前端框架类型 eg: 'react', 'vue', 'angular',请勿随意更改 22 | "template": "@icedesign/ice-react-material-template", // 记录当前物料初始化时的物料模版,当添加物料时,将依赖这个值获取物料模版,请勿随意更改 23 | } 24 | } 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/materials/guide/usage.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 使用物料 3 | order: 5 4 | --- 5 | 6 | 物料数据托管同步之后,都会获得唯一的 URL 地址,此时只需将物料源地址配置到 iceworks 中即可使用。 7 | 8 | 打开 iceworks,进入设置面板,在设置中新增自定义物料源,填写物料名称和物料源 URL,就可以在初始化项目或者添加页面时使用这份物料了。 9 | 10 | ![](https://img.alicdn.com/tfs/TB1VY.ybwFY.1VjSZFqXXadbXXa-2790-1532.png) 11 | 12 | 关于 iceworks 使用,请查看 [iceworks 文档](https://ice.work/docs/iceworks/about)。 13 | 14 | > 不管是将物料数据托管到 fusign.design 还是 unpkg,本质上都是通过 HTTP GET 请求获取物料数据,因此,除了以上方式,你也可以将物料数据的 JSON 文件放到你的 CDN 或某个后端接口上使用。 15 | 16 | iceworks 生成的物料数据是一份不包含物料源码的元数据,当用户在 iceworks 中添加物料 URL 后,iceworks 会向该 URL 请求物料数据,根据物料数据在页面中展示当前物料集合包含的组件、区块和项目。当用户选择使用物料时,iceworks 再通过 npm 下载源码。 17 | -------------------------------------------------------------------------------- /docs/materials/recommand.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 推荐物料 3 | order: 3 4 | --- 5 | 6 | ## React 物料 7 | 8 | 飞冰官方开发的 React 物料(模板/区块/组件),基于 Fusion 组件和 ice-scripts 工程工具。 9 | 10 | - 物料源地址:http://ice.alicdn.com/assets/materials/react-materials.json 11 | - 物料源码:https://github.com/ice-lab/react-materials 12 | - 物料预览:https://ice.work/scaffold 13 | 14 | ## Vue 物料 15 | 16 | 飞冰官方推荐 Vue 物料(模板/区块/组件),基于 Vue 2.x, Element, Vue CLI。 17 | 18 | - 物料源地址:http://ice.alicdn.com/assets/materials/vue-materials.json 19 | - 物料源码:https://github.com/ice-lab/vue-materials 20 | - 物料预览:https://ice.work/scaffold?type=vue 21 | 22 | ## Create React App 物料 23 | 24 | 使用 iceworks 开发 Create React App 项目: 25 | 26 | - 物料源地址:http://ice.alicdn.com/assets/materials/cra-materials.json 27 | - 物料源码:https://github.com/ice-lab/cra-materials 28 | -------------------------------------------------------------------------------- /docs/materials/reference/dev.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 开发独立业务组件 3 | order: 3 4 | --- 5 | 6 | 在某些特殊情况下,我们可能只想开发一个独立的业务组件,而非完整的物料集合,这种情况下,可使用 `iceworks` 开发基于指定物料模版的独立业务组件。 7 | 8 | ## 初始化 9 | 10 | ```bash 11 | # 新建组件文件夹 12 | $ mkdir my-component & cd my-component 13 | 14 | # 初始化 15 | $ iceworks init component 16 | ``` 17 | 18 | 根据提示选择物料模版及输入组件信息,会生成初始化代码。 19 | 20 | ## 开发 21 | 22 | 进入当前组件目录,开发过程与单个物料开发是类似的。执行以下命令启动 dev server: 23 | 24 | ```bash 25 | $ npm install 26 | 27 | $ npm start 28 | ``` 29 | 30 | ## 发布 31 | 32 | 发布组件的流程实际上也就是发布一个 npm 包的过程。 33 | 34 | ```bash 35 | # 在组件根目录下 36 | $ npm publish 37 | ``` 38 | -------------------------------------------------------------------------------- /packages/ice-koa-template/README.md: -------------------------------------------------------------------------------- 1 | # Koa Generator 2 | -------------------------------------------------------------------------------- /packages/ice-koa-template/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ice-koa-template", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT" 11 | } 12 | -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/_gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | logs/ 4 | npm-debug.log 5 | yarn-error.log 6 | node_modules/ 7 | coverage/ 8 | .idea/ 9 | .DS_Store 10 | *.sw* 11 | *.un~ 12 | .nodejs-cache 13 | .happypack 14 | .tmp/ 15 | 16 | # client 17 | /client/build/ 18 | /client/dist/ 19 | 20 | # server 21 | /server/logs/ 22 | /server/run/ -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/client/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/ice-koa-template/templates/client/.gitkeep -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/server/_editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/server/_eslintignore: -------------------------------------------------------------------------------- 1 | # 忽略目录 2 | build/ 3 | tests/ 4 | demo/ 5 | 6 | # node 覆盖率文件 7 | coverage/ 8 | 9 | # 忽略文件 10 | **/*-min.js 11 | **/*.min.js 12 | -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/server/_gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /client/node_modules 5 | /server/node_modules 6 | /node_modules 7 | 8 | # production 9 | /build 10 | /dist 11 | 12 | # misc 13 | .idea/ 14 | .happypack 15 | .DS_Store 16 | 17 | npm-debug.log* 18 | yarn-debug.log* 19 | yarn-error.log* 20 | -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/server/src/config/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/ice-koa-template/templates/server/src/config/.gitkeep -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/server/src/middleware/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/ice-koa-template/templates/server/src/middleware/.gitkeep -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/server/src/model/User.js: -------------------------------------------------------------------------------- 1 | /* eslint no-return-await:0 */ 2 | class UserModel { 3 | async findUserProfile() { 4 | // Similar: return await query('select * from user where uid = ?', uid); 5 | return await { 6 | name: '淘小宝', 7 | department: '技术部', 8 | avatar: 9 | 'https://img.alicdn.com/tfs/TB1L6tBXQyWBuNjy0FpXXassXXa-80-80.png', 10 | userid: 10001, 11 | }; 12 | } 13 | } 14 | 15 | module.exports = new UserModel(); 16 | -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/server/src/router.js: -------------------------------------------------------------------------------- 1 | const userController = require('./controller/user'); 2 | 3 | module.exports = (router) => { 4 | router.prefix('/api'); 5 | router 6 | .get('/profile', userController.profile) 7 | .post('/login', userController.login) 8 | .post('/register', userController.register) 9 | .post('/logout', userController.logout); 10 | }; 11 | -------------------------------------------------------------------------------- /packages/ice-koa-template/templates/server/src/service/user.js: -------------------------------------------------------------------------------- 1 | const UserModel = require('../model/User'); 2 | 3 | class UserService { 4 | async profile() { 5 | const data = await UserModel.findUserProfile(); 6 | return { data }; 7 | } 8 | } 9 | 10 | module.exports = new UserService(); 11 | -------------------------------------------------------------------------------- /packages/ice-koa-template/utils/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/ice-koa-template/utils/.gitkeep -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Aside/index.js: -------------------------------------------------------------------------------- 1 | import Aside from './Aside'; 2 | 3 | export default Aside; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Footer/index.js: -------------------------------------------------------------------------------- 1 | import Footer from './Footer'; 2 | 3 | export default Footer; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Footer/scss/base.scss: -------------------------------------------------------------------------------- 1 | $page-container-width: 100%; 2 | 3 | /* FOOTER */ 4 | .ice-layout-builder { 5 | .ice-design-layout-footer { 6 | width: $page-container-width; 7 | margin: 0 auto; 8 | .ice-design-layout-footer-body { 9 | margin: 20px auto; 10 | display: flex; 11 | justify-content: space-between; 12 | align-items: center; 13 | .copyright { 14 | color: $ice-copyright-text-color; 15 | line-height: 1.5; 16 | font-size: 12px; 17 | text-align: left; 18 | } 19 | .copyright-link { 20 | color: $ice-copyright-text-color; 21 | &:hover { 22 | color: $ice-copyright-text-hover-color; 23 | text-decoration: none; 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Footer/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-copyright-text-color: $color-text1-3 !default; 4 | $ice-copyright-text-hover-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Footer/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-copyright-text-color: $color-text1-3 !default; 4 | $ice-copyright-text-hover-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Form/AsideForm/index.js: -------------------------------------------------------------------------------- 1 | import AsideForm from './AsideForm'; 2 | 3 | export default AsideForm; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Form/BasicForm/ColorBlock.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | class ColorBlock extends Component { 4 | render() { 5 | const { backgroundColor } = this.props; 6 | return ( 7 |
17 | ); 18 | } 19 | } 20 | 21 | export default ColorBlock; 22 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Form/BasicForm/index.js: -------------------------------------------------------------------------------- 1 | import BasicForm from './BasicForm'; 2 | 3 | export default BasicForm; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Form/FooterForm/index.js: -------------------------------------------------------------------------------- 1 | import FooterForm from './FooterForm'; 2 | 3 | export default FooterForm; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Form/HeaderForm/index.js: -------------------------------------------------------------------------------- 1 | import HeaderForm from './HeaderForm'; 2 | 3 | export default HeaderForm; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Form/index.js: -------------------------------------------------------------------------------- 1 | import BasicForm from './BasicForm'; 2 | import HeaderForm from './HeaderForm'; 3 | import AsideForm from './AsideForm'; 4 | import FooterForm from './FooterForm'; 5 | 6 | export { BasicForm, HeaderForm, AsideForm, FooterForm }; 7 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Header/index.js: -------------------------------------------------------------------------------- 1 | import Header from './Header'; 2 | 3 | export default Header; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Header/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-header-menu-bg: $color-transparent !default; 4 | $ice-header-text-color: $color-white !default; 5 | $ice-header-text-hover-color: $color-brand1-6 !default; 6 | $ice-header-icon-down-color: $color-white !default; 7 | 8 | $theme: 'dark'; 9 | 10 | @import './base.scss'; 11 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Header/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-header-menu-bg: transparent !default; 4 | $ice-header-text-color: $color-text1-3 !default; 5 | $ice-header-text-hover-color: $color-brand1-6 !default; 6 | $ice-header-icon-down-color: $color-text1-3 !default; 7 | 8 | $theme: 'light'; 9 | 10 | @import './base.scss'; 11 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/LayoutBuilder/index.js: -------------------------------------------------------------------------------- 1 | import LayoutBuilder from './LayoutBuilder'; 2 | 3 | export default LayoutBuilder; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Logo/Logo.jsx: -------------------------------------------------------------------------------- 1 | /* eslint object-shorthand: 0 */ 2 | import React, { PureComponent } from 'react'; 3 | 4 | import './scss/dark.scss'; 5 | import './scss/light.scss'; 6 | 7 | export default class Logo extends PureComponent { 8 | render() { 9 | const { color } = this.props; 10 | const logoStyle = color ? { color: color } : {}; 11 | 12 | return ( 13 |
14 | 15 | LOGO 16 | 17 |
18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Logo/index.js: -------------------------------------------------------------------------------- 1 | import Logo from './Logo'; 2 | 3 | export default Logo; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Logo/scss/base.scss: -------------------------------------------------------------------------------- 1 | .logo { 2 | max-width: 340px; 3 | height: 42px; 4 | line-height: 42px; 5 | .logo-text { 6 | display: block; 7 | width: 100%; 8 | overflow: hidden; 9 | text-overflow: ellipsis; 10 | white-space: nowrap; 11 | font-size: 36px; 12 | color: $ice-logo-text-color; 13 | text-decoration: none; 14 | font-weight: bold; 15 | font-family: Helvetica, sans-serif; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Logo/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Layout dark styles 4 | $ice-logo-text-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/Logo/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Layout dark styles 4 | $ice-logo-text-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/PreviewLayout/index.js: -------------------------------------------------------------------------------- 1 | import PreviewLayout from './PreviewLayout'; 2 | 3 | export default PreviewLayout; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/PreviewLayout/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Basic color variables 4 | $custom-layout-bg: #2e323f; 5 | $ice-body-bg: $color-white !default; 6 | 7 | .ice-layout-builder.ice-design-layout-dark.ice-design-layout { 8 | background-image: url(https://img.alicdn.com/tfs/TB1_YvwXTtYBeNjy1XdXXXXyVXa-1680-370.png); 9 | background-color: $custom-layout-bg; 10 | } 11 | 12 | $theme: 'dark'; 13 | 14 | @import './base.scss'; 15 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/PreviewLayout/scss/index.scss: -------------------------------------------------------------------------------- 1 | @import './dark.scss'; 2 | @import './light.scss'; 3 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/components/PreviewLayout/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Basic color variables 4 | $custom-layout-bg: #fafafa; 5 | $ice-body-bg: $color-white !default; 6 | 7 | .ice-layout-builder.ice-design-layout-light.ice-design-layout { 8 | background-image: url(https://img.alicdn.com/tfs/TB1GsHCd8fH8KJjy1XbXXbLdXXa-1680-370.png); 9 | background-color: $custom-layout-bg; 10 | } 11 | 12 | $theme: 'light'; 13 | 14 | @import './base.scss'; 15 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/index.js: -------------------------------------------------------------------------------- 1 | import BasicForm from './components/Form/BasicForm'; 2 | import HeaderForm from './components/Form/HeaderForm'; 3 | import AsideForm from './components/Form/AsideForm'; 4 | import FooterForm from './components/Form/FooterForm'; 5 | import LayoutBuilder from './components/LayoutBuilder'; 6 | import PreviewLayout from './components/PreviewLayout'; 7 | 8 | export { 9 | LayoutBuilder, 10 | BasicForm, 11 | HeaderForm, 12 | AsideForm, 13 | FooterForm, 14 | PreviewLayout, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/main.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | // 全局变量(只有变量) 4 | @import '~@icedesign/base/reset.scss'; 5 | 6 | // variables && mixins 7 | @import 'scss/variable'; 8 | @import 'scss/mixin'; 9 | 10 | #{$layout-builder-prefix} { 11 | } 12 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/scss/mixin.scss: -------------------------------------------------------------------------------- 1 | // @icedesign/base/layout-builder mixins 2 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/src/scss/variable.scss: -------------------------------------------------------------------------------- 1 | // @icedesign/layout-builder variables 2 | // -------------------------------------------------- 3 | 4 | //// 5 | /// @module @icedesign/layout-builder: layout生成器 6 | /// @tag LayoutBuilder 7 | /// @category custom 8 | /// @family ice 9 | /// @varPrefix $layout-builder 10 | /// @classPrefix layout-builder 11 | //// 12 | 13 | // -------------- variable -------------- 14 | 15 | $layout-builder-prefix: '.layout-builder'; 16 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Aside/index.js: -------------------------------------------------------------------------------- 1 | import Aside from './Aside'; 2 | 3 | export default Aside; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Footer/index.js: -------------------------------------------------------------------------------- 1 | import Footer from './Footer'; 2 | 3 | export default Footer; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Footer/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-copyright-text-color: $color-text1-3 !default; 4 | $ice-copyright-text-hover-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Footer/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-copyright-text-color: $color-text1-3 !default; 4 | $ice-copyright-text-hover-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Header/index.js: -------------------------------------------------------------------------------- 1 | import Header from './Header'; 2 | 3 | export default Header; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Header/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-header-menu-bg: $color-transparent !default; 4 | $ice-header-text-color: $color-white !default; 5 | $ice-header-text-hover-color: $color-brand1-6 !default; 6 | $ice-header-icon-down-color: $color-white !default; 7 | 8 | $theme: 'dark'; 9 | 10 | @import './base.scss'; 11 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Header/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-header-menu-bg: transparent !default; 4 | $ice-header-text-color: $color-text1-3 !default; 5 | $ice-header-text-hover-color: $color-brand1-6 !default; 6 | $ice-header-icon-down-color: $color-text1-3 !default; 7 | 8 | $theme: 'light'; 9 | 10 | @import './base.scss'; 11 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Logo/Logo.jsx: -------------------------------------------------------------------------------- 1 | import React, { PureComponent } from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | 4 | import './scss/dark.scss'; 5 | import './scss/light.scss'; 6 | 7 | export default class Logo extends PureComponent { 8 | render() { 9 | return ( 10 |
11 | 12 | LOGO 13 | 14 |
15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Logo/index.js: -------------------------------------------------------------------------------- 1 | import Logo from './Logo'; 2 | 3 | export default Logo; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Logo/scss/base.scss: -------------------------------------------------------------------------------- 1 | .logo { 2 | max-width: 340px; 3 | height: 42px; 4 | line-height: 42px; 5 | .logo-text { 6 | display: block; 7 | width: 100%; 8 | overflow: hidden; 9 | text-overflow: ellipsis; 10 | white-space: nowrap; 11 | font-size: 36px; 12 | color: $ice-logo-text-color; 13 | font-weight: bold; 14 | font-family: Helvetica, sans-serif; 15 | } 16 | } 17 | 18 | @media screen and (max-width: 1199px) { 19 | .logo { 20 | width: 80px; 21 | .logo-text { 22 | font-size: 22px; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Logo/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-logo-text-color: $color-brand1-6 !default; 4 | 5 | @import './base.scss'; 6 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/components/Logo/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-logo-text-color: $color-brand1-6 !default; 4 | 5 | @import './base.scss'; 6 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/layouts/index.js: -------------------------------------------------------------------------------- 1 | import <%= name %> from './<%= name %>'; 2 | 3 | export default <%= name %>; 4 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/layouts/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Basic color variables 4 | $custom-layout-bg: #2e323f; 5 | $ice-body-bg: $color-white !default; 6 | 7 | .ice-design-layout-dark.ice-design-layout { 8 | background-image: url(https://img.alicdn.com/tfs/TB1_YvwXTtYBeNjy1XdXXXXyVXa-1680-370.png); 9 | background-color: $custom-layout-bg; 10 | } 11 | 12 | $theme: 'dark'; 13 | 14 | @import './base.scss'; 15 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/layouts/scss/index.scss: -------------------------------------------------------------------------------- 1 | @import './dark.scss'; 2 | @import './light.scss'; 3 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/templates/layouts/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Basic color variables 4 | $custom-layout-bg: #fafafa; 5 | $ice-body-bg: $color-white !default; 6 | 7 | .ice-design-layout-light.ice-design-layout { 8 | background-image: url(https://img.alicdn.com/tfs/TB1GsHCd8fH8KJjy1XbXXbLdXXa-1680-370.png); 9 | background-color: $custom-layout-bg; 10 | } 11 | 12 | $theme: 'light'; 13 | 14 | @import './base.scss'; 15 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/utils/index.js: -------------------------------------------------------------------------------- 1 | const generatorLayout = require('./generator'); 2 | 3 | module.exports = { 4 | generatorLayout, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/ice-layout-builder/utils/prettierFormat.js: -------------------------------------------------------------------------------- 1 | const prettier = require('prettier'); 2 | 3 | const config = { 4 | singleQuote: true, 5 | arrowParens: 'always', 6 | trailingComma: 'es5', 7 | }; 8 | 9 | module.exports = function prettierFormat(str, opts) { 10 | return prettier.format(str, Object.assign({}, config, opts)); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/ice-midway-template/README.md: -------------------------------------------------------------------------------- 1 | # Ice Midway template 2 | 3 | ## 简介 4 | 5 | 基于 Iceworks 能够一键生成 ice 和 Node 的前后端分离的项目;前端使用 React 技术栈,后端使用 [Midway](https://github.com/midwayjs/midway/) 作为服务端开发框架。 6 | 7 | ## 使用 8 | 9 | ```bash 10 | # 安装 client & server 本地依赖 11 | $ npm run postinstall 12 | # 构建本地前端资源 13 | $ npm run build 14 | # 启动服务 15 | $ npm run start 16 | # 打开浏览器查看 17 | $ open http://localhost:7001/ 18 | ``` 19 | -------------------------------------------------------------------------------- /packages/ice-midway-template/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ice-midway-template", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT" 11 | } 12 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/_gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | logs/ 4 | npm-debug.log 5 | yarn-error.log 6 | node_modules/ 7 | coverage/ 8 | .idea/ 9 | .DS_Store 10 | *.sw* 11 | *.un~ 12 | .nodejs-cache 13 | .happypack 14 | .tmp/ 15 | 16 | # client 17 | /client/build/ 18 | /client/dist/ 19 | 20 | # server 21 | /server/logs/ 22 | /server/run/ -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/client/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/ice-midway-template/templates/client/.gitkeep -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - '6, 8, 10' 5 | install: 6 | - npm i npminstall && npminstall 7 | script: 8 | - npm run ci 9 | after_script: 10 | - npminstall codecov && codecov 11 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/_editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/_eslintignore: -------------------------------------------------------------------------------- 1 | # 忽略目录 2 | build/ 3 | tests/ 4 | demo/ 5 | 6 | # node 覆盖率文件 7 | coverage/ 8 | 9 | # 忽略文件 10 | **/*-min.js 11 | **/*.min.js 12 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/_gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /client/node_modules 5 | /server/node_modules 6 | /node_modules 7 | 8 | # production 9 | /build 10 | /dist 11 | 12 | # misc 13 | .idea/ 14 | .happypack 15 | .DS_Store 16 | 17 | npm-debug.log* 18 | yarn-debug.log* 19 | yarn-error.log* 20 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | matrix: 3 | - nodejs_version: '6, 8, 10' 4 | 5 | install: 6 | - ps: Install-Product node $env:nodejs_version 7 | - npm i npminstall && node_modules\.bin\npminstall 8 | 9 | test_script: 10 | - node --version 11 | - npm --version 12 | - npm run test 13 | 14 | build: off 15 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/procfile.js: -------------------------------------------------------------------------------- 1 | // you can use this file to deploy by pandora 2 | // please use 'npm i pandora --save' first 3 | 4 | 'use strict'; 5 | 6 | module.exports = pandora => { 7 | 8 | /** 9 | * default is fork mode 10 | */ 11 | pandora 12 | .fork('empty', require.resolve('midway/server')); 13 | 14 | /** 15 | * you can use cluster mode to start application 16 | */ 17 | // pandora 18 | // .cluster('./cluster.js'); 19 | 20 | /** 21 | * you can create another process here 22 | */ 23 | // pandora 24 | // .process('background') 25 | // .argv(['--expose-gc']); 26 | 27 | /** 28 | * more features please visit our document. 29 | * https://github.com/midwayjs/pandora/ 30 | */ 31 | 32 | }; 33 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/src/app/controller/home.ts: -------------------------------------------------------------------------------- 1 | import { controller, get, provide } from 'midway'; 2 | 3 | @provide() 4 | @controller('/') 5 | export class HomeController { 6 | @get('/') 7 | async index(ctx) { 8 | await ctx.render('index.ejs', { 9 | assets: ctx.assets, 10 | }); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/src/app/middleware/assets_info.ts: -------------------------------------------------------------------------------- 1 | module.exports = (app) => { 2 | return async (ctx, next) => { 3 | const env = ctx.app.env; 4 | ctx.assets = { 5 | // 当前 egg-static 地址 6 | prefix: '/', 7 | }; 8 | if (env === 'local') { 9 | // Webpack 本地开发热加载地址 10 | ctx.assets.prefix = 'http://127.0.0.1:4444/'; 11 | } 12 | 13 | await next(); 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/src/app/view/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/src/config/config.default.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | 3 | module.exports = (appInfo: any) => { 4 | const config: any = (exports = {}); 5 | 6 | // use for cookie sign key, should change to your own and keep security 7 | config.keys = appInfo.name + '_1541510581780_3944'; 8 | 9 | // 配置自定义中间件 10 | config.middleware = ['assetsInfo']; 11 | 12 | // https://www.npmjs.com/package/egg-static#configuration 13 | config.static = { 14 | // maxAge: 31536000, 15 | prefix: '/', 16 | dir: path.join(__dirname, '../../../client/build'), 17 | }; 18 | 19 | config.view = { 20 | mapping: { 21 | '.ejs': 'ejs', 22 | }, 23 | // root: path.join(__dirname, '../../../client/build') 24 | }; 25 | 26 | return config; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/src/config/plugin.ts: -------------------------------------------------------------------------------- 1 | // had enabled by midway 2 | exports.static = true; 3 | 4 | exports.ejs = { 5 | enable: true, 6 | package: 'egg-view-ejs', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/src/interface.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @description User-Service parameters 3 | */ 4 | export interface IUserOptions { 5 | id: number; 6 | } 7 | 8 | export interface IUserData { 9 | name: string; 10 | department: string; 11 | avatar: string; 12 | userid: number; 13 | } 14 | 15 | /** 16 | * @description User-Service response 17 | */ 18 | export interface IUserResult { 19 | id: number; 20 | username: string; 21 | phone: string; 22 | email?: string; 23 | } 24 | 25 | export interface IUserModel { 26 | findUserProfile(): Promise; 27 | } 28 | 29 | export interface IUserProfile { 30 | data: IUserData; 31 | } 32 | 33 | /** 34 | * @description User-Service abstractions 35 | */ 36 | export interface IUserService { 37 | profile(): Promise; 38 | } 39 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/src/lib/model/user.ts: -------------------------------------------------------------------------------- 1 | import { provide } from 'midway'; 2 | import { IUserModel, IUserData } from '../../interface'; 3 | 4 | @provide('userModel') 5 | export class UserModel implements IUserModel { 6 | async findUserProfile(): Promise { 7 | // Similar: return await query('select * from user where uid = ?', uid); 8 | return { 9 | name: '淘小宝', 10 | department: '技术部', 11 | avatar: 12 | 'https://img.alicdn.com/tfs/TB1L6tBXQyWBuNjy0FpXXassXXa-80-80.png', 13 | userid: 10001, 14 | }; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/src/lib/service/user.ts: -------------------------------------------------------------------------------- 1 | import { provide, inject } from 'midway'; 2 | import { IUserService, IUserProfile } from '../../interface'; 3 | 4 | @provide('userService') 5 | export class UserService implements IUserService { 6 | @inject('userModel') 7 | model; 8 | 9 | async profile(): Promise { 10 | const data = await this.model.findUserProfile(); 11 | return { data }; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/test/app/controller/home.test.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | const { app, assert } = require('midway-mock/bootstrap'); 3 | /* tslint:enable */ 4 | 5 | describe('test/app/controller/home.test.ts', () => { 6 | 7 | it('should assert', function* () { 8 | const pkg = require('../../../package.json'); 9 | assert(app.config.keys.startsWith(pkg.name)); 10 | // const ctx = app.mockContext({}); 11 | // yield ctx.service.xx(); 12 | }); 13 | 14 | it('should GET /', () => { 15 | return app.httpRequest() 16 | .get('/') 17 | .expect('hi, midway') 18 | .expect(200); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/ice-midway-template/templates/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "compilerOptions": { 4 | "target": "ES2017", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "experimentalDecorators": true, 8 | "emitDecoratorMetadata": true, 9 | "inlineSourceMap":true, 10 | "noImplicitThis": true, 11 | "noUnusedLocals": true, 12 | "stripInternal": true, 13 | "pretty": true, 14 | "declaration": true, 15 | "outDir": "dist", 16 | "lib": ["es2017", "dom"] 17 | }, 18 | "exclude": [ 19 | "app/public", 20 | "app/views", 21 | "dist", 22 | "node_modules", 23 | "test" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /packages/ice-midway-template/utils/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/ice-midway-template/utils/.gitkeep -------------------------------------------------------------------------------- /packages/ice-npm-utils/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.3.0 4 | 5 | - [feat] getNpmRegistry remove npmconf and default `https://registry.npm.taobao.org` 6 | 7 | ## 1.2.0 8 | 9 | - [feat] getNpmRegistry 优先读取 npm config,否则返回 `https://registry.npm.com` 10 | - [fix] extract tarball consider directory 11 | 12 | ## 1.1.2 13 | 14 | - [fix] 修复getAndExtractTarball写空文件时卡死的问题 15 | 16 | ## 1.1.1 17 | 18 | - [fix] 用 request-promise 替换 axios 之后的参数变化 19 | 20 | ## 1.1.0 21 | 22 | - [feat] 新增 getAndExtractTarball&getNpmTarball 两个 API 23 | - [chore] 请求库从 axios 统一为 request 24 | 25 | ## 1.0.3 26 | 27 | - [chore] 增加 log 28 | - [fix] checkInternal timeout 延长到 3s 29 | 30 | ## 1.0.2 31 | 32 | - init 33 | -------------------------------------------------------------------------------- /packages/ice-npm-utils/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // https://github.com/axios/axios/issues/1418 3 | testEnvironment: 'node', 4 | collectCoverage: true, 5 | setupFilesAfterEnv: ['jest-extended'], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/ice-npm-utils/lib/log.js: -------------------------------------------------------------------------------- 1 | const npmlog = require('npmlog'); 2 | 3 | const envs = ['verbose', 'info', 'error', 'warn']; 4 | const logLevel = envs.indexOf(process.env.LOG_LEVEL) !== -1 ? process.env.LOG_LEVEL : 'info'; 5 | 6 | npmlog.level = logLevel; 7 | 8 | // LOG_LEVEL=verbose ice dev 9 | // log.verbose: 调试日志 10 | // log.info 11 | // log.error 12 | module.exports = npmlog; 13 | -------------------------------------------------------------------------------- /packages/ice-npm-utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ice-npm-utils", 3 | "version": "1.3.0", 4 | "description": "npm utils for ice", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "LOG_LEVEL=verbose jest" 8 | }, 9 | "files": [ 10 | "lib" 11 | ], 12 | "author": "", 13 | "license": "MIT", 14 | "dependencies": { 15 | "mkdirp": "^0.5.1", 16 | "npmlog": "^4.1.2", 17 | "request": "^2.88.0", 18 | "request-progress": "^3.0.0", 19 | "request-promise": "^4.2.4", 20 | "semver": "^6.0.0", 21 | "tar": "^4.4.8" 22 | }, 23 | "devDependencies": { 24 | "jest": "^24.5.0", 25 | "jest-extended": "^0.11.1", 26 | "rimraf": "^2.6.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/ice-template-builder/.gitignore: -------------------------------------------------------------------------------- 1 | tests/app -------------------------------------------------------------------------------- /packages/ice-template-builder/demo/layout.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 布局预览 3 | order: 2 4 | importStyle: true 5 | --- 6 | 7 | 布局预览 8 | 9 | --- 10 | 11 | ```jsx 12 | import React, { Component } from 'react'; 13 | import ReactDOM from 'react-dom'; 14 | import { LayoutBuilder } from '@icedesign/template-builder'; 15 | 16 | class App extends Component { 17 | state = {}; 18 | 19 | render() { 20 | return ; 21 | } 22 | } 23 | 24 | ReactDOM.render(, mountNode); 25 | ``` 26 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Aside/index.js: -------------------------------------------------------------------------------- 1 | import Aside from './Aside'; 2 | 3 | export default Aside; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Footer/index.js: -------------------------------------------------------------------------------- 1 | import Footer from './Footer'; 2 | 3 | export default Footer; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Footer/scss/base.scss: -------------------------------------------------------------------------------- 1 | $page-container-width: 100%; 2 | 3 | /* FOOTER */ 4 | .ice-layout-builder { 5 | .ice-design-layout-footer { 6 | width: $page-container-width; 7 | margin: 0 auto; 8 | .ice-design-layout-footer-body { 9 | margin: 20px auto; 10 | display: flex; 11 | justify-content: space-between; 12 | align-items: center; 13 | .copyright { 14 | color: $ice-copyright-text-color; 15 | line-height: 1.5; 16 | font-size: 12px; 17 | text-align: left; 18 | } 19 | .copyright-link { 20 | color: $ice-copyright-text-color; 21 | &:hover { 22 | color: $ice-copyright-text-hover-color; 23 | text-decoration: none; 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Footer/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-copyright-text-color: $color-text1-3 !default; 4 | $ice-copyright-text-hover-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Footer/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-copyright-text-color: $color-text1-3 !default; 4 | $ice-copyright-text-hover-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Form/AdvancedForm/index.js: -------------------------------------------------------------------------------- 1 | import AdvancedForm from './AdvancedForm'; 2 | 3 | export default AdvancedForm; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Form/AsideForm/index.js: -------------------------------------------------------------------------------- 1 | import AsideForm from './AsideForm'; 2 | 3 | export default AsideForm; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Form/BasicForm/ColorBlock.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | class ColorBlock extends Component { 4 | render() { 5 | const { backgroundColor } = this.props; 6 | return ( 7 |
17 | ); 18 | } 19 | } 20 | 21 | export default ColorBlock; 22 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Form/BasicForm/index.js: -------------------------------------------------------------------------------- 1 | import BasicForm from './BasicForm'; 2 | 3 | export default BasicForm; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Form/FooterForm/index.js: -------------------------------------------------------------------------------- 1 | import FooterForm from './FooterForm'; 2 | 3 | export default FooterForm; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Form/HeaderForm/index.js: -------------------------------------------------------------------------------- 1 | import HeaderForm from './HeaderForm'; 2 | 3 | export default HeaderForm; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Form/index.js: -------------------------------------------------------------------------------- 1 | import BasicForm from './BasicForm'; 2 | import HeaderForm from './HeaderForm'; 3 | import AsideForm from './AsideForm'; 4 | import FooterForm from './FooterForm'; 5 | import AdvancedForm from './AdvancedForm'; 6 | 7 | export { BasicForm, HeaderForm, AsideForm, FooterForm, AdvancedForm }; 8 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Header/images/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/ice-template-builder/src/components/Header/images/avatar.png -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Header/index.js: -------------------------------------------------------------------------------- 1 | import Header from './Header'; 2 | 3 | export default Header; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Header/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-header-menu-bg: $color-transparent !default; 4 | $ice-header-text-color: $color-white !default; 5 | $ice-header-text-hover-color: $color-brand1-6 !default; 6 | $ice-header-icon-down-color: $color-white !default; 7 | 8 | $theme: 'dark'; 9 | 10 | @import './base.scss'; 11 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Header/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | $ice-header-menu-bg: transparent !default; 4 | $ice-header-text-color: $color-text1-3 !default; 5 | $ice-header-text-hover-color: $color-brand1-6 !default; 6 | $ice-header-icon-down-color: $color-text1-3 !default; 7 | 8 | $theme: 'light'; 9 | 10 | @import './base.scss'; 11 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/LayoutBuilder/index.js: -------------------------------------------------------------------------------- 1 | import LayoutBuilder from './LayoutBuilder'; 2 | 3 | export default LayoutBuilder; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Logo/Logo.jsx: -------------------------------------------------------------------------------- 1 | /* eslint object-shorthand: 0 */ 2 | import React, { PureComponent } from 'react'; 3 | 4 | import './scss/dark.scss'; 5 | import './scss/light.scss'; 6 | 7 | export default class Logo extends PureComponent { 8 | render() { 9 | const { color } = this.props; 10 | const logoStyle = color ? { color: color } : {}; 11 | 12 | return ( 13 | 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Logo/index.js: -------------------------------------------------------------------------------- 1 | import Logo from './Logo'; 2 | 3 | export default Logo; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Logo/scss/base.scss: -------------------------------------------------------------------------------- 1 | .logo { 2 | max-width: 340px; 3 | height: 42px; 4 | line-height: 42px; 5 | .logo-text { 6 | display: block; 7 | width: 100%; 8 | overflow: hidden; 9 | text-overflow: ellipsis; 10 | white-space: nowrap; 11 | font-size: 36px; 12 | color: $ice-logo-text-color; 13 | text-decoration: none; 14 | font-weight: bold; 15 | font-family: Helvetica, sans-serif; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Logo/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Layout dark styles 4 | $ice-logo-text-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/Logo/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Layout dark styles 4 | $ice-logo-text-color: $color-brand1-6 !default; 5 | 6 | @import './base.scss'; 7 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/PreviewLayout/index.js: -------------------------------------------------------------------------------- 1 | import PreviewLayout from './PreviewLayout'; 2 | 3 | export default PreviewLayout; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/PreviewLayout/scss/dark.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Basic color variables 4 | $custom-layout-bg: #2e323f; 5 | $ice-body-bg: $color-white !default; 6 | 7 | .ice-layout-builder.ice-design-layout-dark.ice-design-layout { 8 | background-image: url(https://img.alicdn.com/tfs/TB1_YvwXTtYBeNjy1XdXXXXyVXa-1680-370.png); 9 | background-color: $custom-layout-bg; 10 | } 11 | 12 | $theme: 'dark'; 13 | 14 | @import './base.scss'; 15 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/PreviewLayout/scss/index.scss: -------------------------------------------------------------------------------- 1 | @import './dark.scss'; 2 | @import './light.scss'; 3 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/components/PreviewLayout/scss/light.scss: -------------------------------------------------------------------------------- 1 | @import '~@icedesign/skin/variables.scss'; 2 | 3 | // Basic color variables 4 | $custom-layout-bg: #fafafa; 5 | $ice-body-bg: $color-white !default; 6 | 7 | .ice-layout-builder.ice-design-layout-light.ice-design-layout { 8 | background-image: url(https://img.alicdn.com/tfs/TB1GsHCd8fH8KJjy1XbXXbLdXXa-1680-370.png); 9 | background-color: $custom-layout-bg; 10 | } 11 | 12 | $theme: 'light'; 13 | 14 | @import './base.scss'; 15 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/index.js: -------------------------------------------------------------------------------- 1 | import BasicForm from './components/Form/BasicForm'; 2 | import HeaderForm from './components/Form/HeaderForm'; 3 | import AsideForm from './components/Form/AsideForm'; 4 | import FooterForm from './components/Form/FooterForm'; 5 | import AdvancedForm from './components/Form/AdvancedForm'; 6 | import LayoutBuilder from './components/LayoutBuilder'; 7 | import PreviewLayout from './components/PreviewLayout'; 8 | 9 | export { 10 | LayoutBuilder, 11 | BasicForm, 12 | HeaderForm, 13 | AsideForm, 14 | FooterForm, 15 | AdvancedForm, 16 | PreviewLayout, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/main.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | // 全局变量(只有变量) 4 | @import '~@icedesign/base/reset.scss'; 5 | 6 | // variables && mixins 7 | @import 'scss/variable'; 8 | @import 'scss/mixin'; 9 | 10 | #{$layout-builder-prefix} { 11 | } 12 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/scss/mixin.scss: -------------------------------------------------------------------------------- 1 | // @icedesign/base/layout-builder mixins 2 | -------------------------------------------------------------------------------- /packages/ice-template-builder/src/scss/variable.scss: -------------------------------------------------------------------------------- 1 | // @icedesign/layout-builder variables 2 | // -------------------------------------------------- 3 | 4 | //// 5 | /// @module @icedesign/layout-builder: layout生成器 6 | /// @tag LayoutBuilder 7 | /// @category custom 8 | /// @family ice 9 | /// @varPrefix $layout-builder 10 | /// @classPrefix layout-builder 11 | //// 12 | 13 | // -------------- variable -------------- 14 | 15 | $layout-builder-prefix: '.layout-builder'; 16 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/components/Aside/index.js: -------------------------------------------------------------------------------- 1 | import Aside from './Aside'; 2 | 3 | export default Aside; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/components/Footer/Footer.scss: -------------------------------------------------------------------------------- 1 | /* Footer */ 2 | .ice-design-layout-footer { 3 | width: 100%; 4 | padding: 20px 0; 5 | .ice-design-layout-footer-body { 6 | margin: 20px auto; 7 | display: flex; 8 | justify-content: space-between; 9 | align-items: center; 10 | .copyright { 11 | color: #666; 12 | line-height: 1.5; 13 | font-size: 12px; 14 | text-align: left; 15 | } 16 | .copyright-link { 17 | color: #666; 18 | &:hover { 19 | text-decoration: none; 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/components/Footer/index.js: -------------------------------------------------------------------------------- 1 | import Footer from './Footer'; 2 | 3 | export default Footer; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/components/Header/index.js: -------------------------------------------------------------------------------- 1 | import Header from './Header'; 2 | 3 | export default Header; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/components/Layout/index.js: -------------------------------------------------------------------------------- 1 | import BasicLayout from './BasicLayout'; 2 | 3 | export default BasicLayout; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/components/Logo/Logo.jsx: -------------------------------------------------------------------------------- 1 | import React, { PureComponent } from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import './Logo.scss'; 4 | 5 | export default class Logo extends PureComponent { 6 | render() { 7 | return ( 8 |
9 | 10 | LOGO 11 | 12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/components/Logo/Logo.scss: -------------------------------------------------------------------------------- 1 | .logo { 2 | max-width: 340px; 3 | height: 42px; 4 | line-height: 42px; 5 | .logo-text { 6 | display: block; 7 | width: 100%; 8 | overflow: hidden; 9 | text-overflow: ellipsis; 10 | white-space: nowrap; 11 | font-size: 36px; 12 | color: $color-brand1-6; 13 | font-weight: bold; 14 | font-family: Helvetica, sans-serif; 15 | } 16 | } 17 | 18 | @media screen and (max-width: 1199px) { 19 | .logo { 20 | width: 80px; 21 | .logo-text { 22 | font-size: 22px; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/components/Logo/index.js: -------------------------------------------------------------------------------- 1 | import Logo from './Logo'; 2 | 3 | export default Logo; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/README.md: -------------------------------------------------------------------------------- 1 | # 自定义模板 2 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/_editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/_eslintignore: -------------------------------------------------------------------------------- 1 | # 忽略目录 2 | build/ 3 | tests/ 4 | demo/ 5 | 6 | # node 覆盖率文件 7 | coverage/ 8 | 9 | # 忽略文件 10 | **/*-min.js 11 | **/*.min.js 12 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/_gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # production 7 | /build 8 | /dist 9 | 10 | # misc 11 | .idea/ 12 | .happypack 13 | .DS_Store 14 | 15 | npm-debug.log* 16 | yarn-debug.log* 17 | yarn-error.log* 18 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/ice.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | [ 4 | 'ice-plugin-fusion', 5 | { 6 | <% if (themeConfig) { %>themeConfig: { 7 | primaryColor: "<%- themeConfig.primaryColor %>" 8 | }<% } %> 9 | }, 10 | ], 11 | ], 12 | }; 13 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/ice-template-builder/templates/redux/public/favicon.png -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ICE Design Pro 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/components/Authorized/Authorized.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CheckPermissions from './CheckPermissions'; 3 | 4 | class Authorized extends React.Component { 5 | render() { 6 | // children:正常渲染的元素,权限判断通过时展示 ReactNode 7 | // authority:准入权限/权限判断 string | array | Promise 8 | // noMatch:权限异常渲染元素,权限判断不通过时展示 ReactNode 9 | const { children, authority, noMatch = null } = this.props; 10 | const childrenRender = typeof children === 'undefined' ? null : children; 11 | 12 | // CheckPermissions返回childrenRender或者noMatch 13 | return CheckPermissions(authority, childrenRender, noMatch); 14 | } 15 | } 16 | 17 | export default Authorized; 18 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/components/Exception/index.js: -------------------------------------------------------------------------------- 1 | import Exception from './Exception'; 2 | 3 | export default Exception; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/layouts/UserLayout/index.js: -------------------------------------------------------------------------------- 1 | import UserLayout from './UserLayout'; 2 | 3 | export default UserLayout; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/pages/Dashboard/Dashboard.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | import './Dashboard.scss'; 4 | 5 | export default class Dashboard extends Component { 6 | static displayName = 'Dashboard'; 7 | 8 | constructor(props) { 9 | super(props); 10 | this.state = {}; 11 | } 12 | 13 | render() { 14 | return
; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/pages/Dashboard/Dashboard.scss: -------------------------------------------------------------------------------- 1 | .dashboard-page { 2 | 3 | } -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/pages/Dashboard/index.js: -------------------------------------------------------------------------------- 1 | import Dashboard from './Dashboard'; 2 | 3 | export default Dashboard; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/pages/UserLogin/constants.js: -------------------------------------------------------------------------------- 1 | /* 2 | * LoginConstants 3 | * Each action has a corresponding type, which the reducer knows and picks up on. 4 | * To avoid weird typos between the reducer and the actions, we save them as 5 | * constants here. We prefix them with 'yourproject/YourComponent' so we avoid 6 | * reducers accidentally picking up actions they shouldn't. 7 | * 8 | * Follow this format: 9 | * export const YOUR_ACTION_CONSTANT = 'yourproject/YourContainer/YOUR_ACTION_CONSTANT'; 10 | */ 11 | export const USER_LOGIN_REQUEST = 'PRO/USER_LOGIN_REQUEST'; 12 | export const USER_LOGIN_FAILURE = 'PRO/USER_LOGIN_FAILURE'; 13 | export const USER_LOGIN_SUCCESS = 'PRO/USER_LOGIN_SUCCESS'; 14 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/pages/UserLogin/index.js: -------------------------------------------------------------------------------- 1 | import UserLogin from './UserLogin'; 2 | 3 | export default UserLogin; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/pages/UserRegister/constants.js: -------------------------------------------------------------------------------- 1 | /* 2 | * LoginConstants 3 | * Each action has a corresponding type, which the reducer knows and picks up on. 4 | * To avoid weird typos between the reducer and the actions, we save them as 5 | * constants here. We prefix them with 'yourproject/YourComponent' so we avoid 6 | * reducers accidentally picking up actions they shouldn't. 7 | * 8 | * Follow this format: 9 | * export const YOUR_ACTION_CONSTANT = 'yourproject/YourContainer/YOUR_ACTION_CONSTANT'; 10 | */ 11 | export const USER_REGISTER_REQUEST = 'PRO/USER_REGISTER_REQUEST'; 12 | export const USER_REGISTER_FAILURE = 'PRO/USER_REGISTER_FAILURE'; 13 | export const USER_REGISTER_SUCCESS = 'PRO/USER_REGISTER_SUCCESS'; 14 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/pages/UserRegister/index.js: -------------------------------------------------------------------------------- 1 | import UserRegister from './UserRegister'; 2 | 3 | export default UserRegister; 4 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/router.jsx: -------------------------------------------------------------------------------- 1 | /** 2 | * 定义应用路由 3 | */ 4 | import { Switch, Route } from 'react-router-dom'; 5 | import React from 'react'; 6 | 7 | <% if (redux.enabled && redux.registerLoginModule) { %> 8 | import UserLayout from './layouts/UserLayout'; 9 | <% } %> 10 | 11 | import BasicLayout from './layouts/BasicLayout'; 12 | 13 | // 按照 Layout 归类分组可以按照如下方式组织路由 14 | const router = () => { 15 | return ( 16 | 17 | <% if (redux.enabled && redux.registerLoginModule) { %> 18 | 19 | <% } %> 20 | 21 | 22 | ); 23 | }; 24 | 25 | export default router; 26 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/store/userLogout/constants.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * userLogout constants 4 | * 5 | */ 6 | 7 | export const USER_LOGOUT_REQUEST = 'PRO/USER_LOGOUT_REQUEST'; 8 | export const USER_LOGOUT_FAILURE = 'PRO/USER_LOGOUT_FAILURE'; 9 | export const USER_LOGOUT_SUCCESS = 'PRO/USER_LOGOUT_SUCCESS'; 10 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/store/userProfile/constants.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * userProfile constants 4 | * 5 | */ 6 | 7 | export const USER_PROFILE_REQUEST = 'PRO/USER_PROFILE_REQUEST'; 8 | export const USER_PROFILE_FAILURE = 'PRO/USER_PROFILE_FAILURE'; 9 | export const USER_PROFILE_SUCCESS = 'PRO/USER_PROFILE_SUCCESS'; 10 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/utils/Authorized.js: -------------------------------------------------------------------------------- 1 | import RenderAuthorized from '../components/Authorized'; 2 | import { getAuthority } from './authority'; 3 | 4 | let Authorized = RenderAuthorized(getAuthority()); // eslint-disable-line 5 | 6 | // 更新权限 7 | const reloadAuthorized = () => { 8 | Authorized = RenderAuthorized(getAuthority()); 9 | }; 10 | 11 | export { reloadAuthorized }; 12 | export default Authorized; 13 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/utils/authority.js: -------------------------------------------------------------------------------- 1 | // use localStorage to store the authority info, which might be sent from server in actual project. 2 | export function getAuthority() { 3 | return localStorage.getItem('ice-pro-authority') || 'admin'; 4 | } 5 | 6 | export function setAuthority(authority) { 7 | return localStorage.setItem('ice-pro-authority', authority); 8 | } 9 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/src/utils/checkStore.js: -------------------------------------------------------------------------------- 1 | import conformsTo from 'lodash/conformsTo'; 2 | import isFunction from 'lodash/isFunction'; 3 | import isObject from 'lodash/isObject'; 4 | import invariant from 'invariant'; 5 | 6 | /** 7 | * Validate the shape of redux store 8 | */ 9 | export default function checkStore(store) { 10 | const shape = { 11 | dispatch: isFunction, 12 | subscribe: isFunction, 13 | getState: isFunction, 14 | replaceReducer: isFunction, 15 | injectedReducers: isObject, 16 | }; 17 | invariant( 18 | conformsTo(store, shape), 19 | '(app/utils...) injectors: Expected a valid redux store' 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /packages/ice-template-builder/templates/redux/tests/index.js: -------------------------------------------------------------------------------- 1 | // test 2 | -------------------------------------------------------------------------------- /packages/ice-template-builder/utils/index.js: -------------------------------------------------------------------------------- 1 | const generateTemplate = require('./generateTemplate'); 2 | 3 | module.exports = { 4 | generateTemplate, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/ice-template-builder/utils/layoutFileMapping.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Layout 文件映射表 3 | * 根据用户输入的数据进行组装 4 | * 生成自定义布局模板 5 | */ 6 | const LAYOUT_TEMPLATE_FILE_MAPPING = { 7 | aside: ['components/Aside/*'], 8 | header: ['components/Header/*', 'components/Logo/*'], 9 | footer: ['components/Footer/*', 'components/Logo/*'], 10 | layout: ['components/Layout/*'], 11 | }; 12 | 13 | module.exports = LAYOUT_TEMPLATE_FILE_MAPPING; 14 | -------------------------------------------------------------------------------- /packages/ice-template-builder/utils/prettierFormat.js: -------------------------------------------------------------------------------- 1 | const prettier = require('prettier'); 2 | 3 | const config = { 4 | singleQuote: true, 5 | arrowParens: 'always', 6 | trailingComma: 'es5', 7 | }; 8 | 9 | module.exports = function prettierFormat(str, opts) { 10 | return prettier.format(str, Object.assign({}, config, opts)); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/iceworks-client/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /packages/iceworks-client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # production 7 | /dist 8 | 9 | # misc 10 | .idea/ 11 | .happypack 12 | .DS_Store 13 | 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | -------------------------------------------------------------------------------- /packages/iceworks-client/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "jsx": "react", 5 | "paths": { 6 | "@src/*": ["./src/*"], 7 | "@layouts/*": ["./src/layouts/*"], 8 | "@components/*": ["./src/components/*"], 9 | "@utils/*": ["./src/utils/*"], 10 | "@hooks/*": ["./src/hooks/*"], 11 | "@stores/*": ["./src/stores/*"], 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/iceworks-client/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/iceworks-client/public/favicon.png -------------------------------------------------------------------------------- /packages/iceworks-client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Iceworks 8 | 9 | 10 | 11 |
12 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/appConfig.js: -------------------------------------------------------------------------------- 1 | export default window.iceworksConfig || {}; 2 | 3 | const PLACEHOLDER_IMG = '//img.alicdn.com/tfs/TB1lCcKc8Kw3KVjSZFOXXarDVXa-350-200.png'; 4 | const THEMES = { 5 | dark: { 6 | themePackage: '@alifd/theme-iceworks-dark', 7 | loadingTheme: { 8 | color: '#fff', 9 | }, 10 | termTheme: { 11 | foreground: '#fff', 12 | background: '#333646', 13 | }, 14 | }, 15 | light: { 16 | themePackage: '@alifd/theme-iceworks-light', 17 | loadingTheme: { 18 | color: '#999', 19 | }, 20 | termTheme: { 21 | foreground: '#333', 22 | background: '#f7f8fa', 23 | }, 24 | }, 25 | }; 26 | 27 | export { 28 | THEMES, 29 | PLACEHOLDER_IMG, 30 | }; 31 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/ActionStatus/index.module.scss: -------------------------------------------------------------------------------- 1 | .overlay { 2 | position: absolute; 3 | top: 0; 4 | left: 0; 5 | right: 0; 6 | bottom: 0; 7 | display: flex; 8 | align-items: center; 9 | justify-content: center; 10 | height: 100%; 11 | } 12 | .message { 13 | max-width: 90%; 14 | overflow: scroll; 15 | } 16 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/Card/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { Card as NextCard } from '@alifd/next'; 4 | 5 | const Card = ({ children, style, ...props }) => { 6 | return ( 7 | 16 | {children} 17 | 18 | ); 19 | }; 20 | 21 | export default Card; 22 | 23 | Card.defaultProps = { 24 | showTitleBullet: false, 25 | style: {}, 26 | }; 27 | 28 | Card.propTypes = { 29 | style: PropTypes.object, 30 | showTitleBullet: PropTypes.bool, 31 | children: PropTypes.node.isRequired, 32 | }; 33 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/CreateProjectModal/index.module.scss: -------------------------------------------------------------------------------- 1 | .form { 2 | width: 320px; 3 | 4 | .item { 5 | position: relative; 6 | 7 | .input { 8 | height: 24px; 9 | line-height: 24px; 10 | } 11 | 12 | .pathInput { 13 | &, input { 14 | cursor: pointer!important; 15 | } 16 | } 17 | 18 | .icon { 19 | position: absolute; 20 | right: 4px; 21 | bottom: 4px; 22 | cursor: pointer; 23 | } 24 | } 25 | 26 | .opts { 27 | text-align: center; 28 | margin-top: 32px; 29 | 30 | .button { 31 | margin-right: 12px; 32 | 33 | &:last-child { 34 | margin-right: 0; 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/DynamicForm/index.module.scss: -------------------------------------------------------------------------------- 1 | .itemLabel { 2 | margin: 0; 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/ErrorBoundary/FallbackComponent.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { injectIntl } from 'react-intl'; 4 | import { Loading } from '@alifd/next'; 5 | 6 | const FallbackComponent = ({ intl }) => { 7 | return ( 8 |
16 | 19 |
20 | ); 21 | }; 22 | 23 | FallbackComponent.propTypes = { 24 | intl: PropTypes.object.isRequired, 25 | }; 26 | 27 | export default injectIntl(FallbackComponent); 28 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/Icon/index.js: -------------------------------------------------------------------------------- 1 | import DynamicIcon from '@icedesign/dynamic-icon'; 2 | 3 | const Icon = DynamicIcon.create({ 4 | fontFamily: 'iceworks', 5 | prefix: 'iceworks', 6 | css: '//at.alicdn.com/t/font_568722_z34tb0kjp9h.css', 7 | }); 8 | 9 | export default Icon; 10 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/LoadingIndicator/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Loading } from '@alifd/next'; 3 | import useLoadingTheme from '@hooks/useLoadingTheme'; 4 | 5 | const LoadingIndicator = () => { 6 | const { loadingTheme } = useLoadingTheme(); 7 | return ( 8 |
16 | 17 |
18 | ); 19 | }; 20 | 21 | export default LoadingIndicator; 22 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/Modal/index.js: -------------------------------------------------------------------------------- 1 | import React, { useRef, useEffect } from 'react'; 2 | import { createPortal } from 'react-dom'; 3 | import { Dialog } from '@alifd/next'; 4 | 5 | const Modal = ({ children, ...props }) => { 6 | const modalRef = useRef(null); 7 | 8 | if (!modalRef.current) { 9 | modalRef.current = document.createElement('div'); 10 | } 11 | 12 | useEffect(() => { 13 | document.body.appendChild(modalRef.current); 14 | return () => { 15 | document.body.removeChild(modalRef.current); 16 | }; 17 | }); 18 | 19 | const { onCancel } = props; 20 | 21 | return createPortal( 22 | 23 | {children} 24 | , 25 | modalRef.current, 26 | ); 27 | }; 28 | 29 | export default Modal; 30 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/NoData/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import cx from 'classnames'; 3 | import { FormattedMessage } from 'react-intl'; 4 | import PropTypes from 'prop-types'; 5 | import Icon from '@components/Icon'; 6 | 7 | import styles from './index.module.scss'; 8 | 9 | const NoData = ({ className }) => { 10 | return ( 11 |
12 | 13 | 14 |
15 | ); 16 | }; 17 | 18 | NoData.defaultProps = { 19 | className: '', 20 | }; 21 | 22 | NoData.propTypes = { 23 | className: PropTypes.string, 24 | }; 25 | 26 | export default NoData; 27 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/NoData/index.module.scss: -------------------------------------------------------------------------------- 1 | .tips { 2 | padding: 30px; 3 | text-align: center; 4 | font-size: 14px; 5 | .icon { 6 | margin-right: 8px; 7 | } 8 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/Progress/index.module.scss: -------------------------------------------------------------------------------- 1 | .wrap { 2 | display: flex; 3 | flex-direction: column; 4 | 5 | .status { 6 | margin-bottom: 6px; 7 | } 8 | 9 | .progress { 10 | flex: 1; 11 | 12 | :global { 13 | .next-progress-line { 14 | display: flex; 15 | 16 | .next-progress-line-container { 17 | flex: 1; 18 | } 19 | 20 | .next-progress-line-text { 21 | width: auto; 22 | } 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/SubMenu/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { FormattedMessage } from 'react-intl'; 4 | import styles from './index.module.scss'; 5 | 6 | const SubMenu = ({ title, children }) => { 7 | return ( 8 |
9 | {title ? ( 10 |

11 | 12 |

13 | ) : null} 14 | {children} 15 |
16 | ); 17 | }; 18 | 19 | SubMenu.defaultProps = { 20 | title: '', 21 | children: null, 22 | }; 23 | 24 | SubMenu.propTypes = { 25 | children: PropTypes.node, 26 | title: PropTypes.string, 27 | }; 28 | 29 | export default SubMenu; 30 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/SubMenu/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../variables.scss'; 2 | 3 | .wrapper { 4 | width: 240px; 5 | min-width: 240px; 6 | background: $sub-menu-bg; 7 | box-shadow: $shadow-right; 8 | display: flex; 9 | flex-direction: column; 10 | 11 | .title { 12 | margin: 15px; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/SubMenuItem/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../variables.scss'; 2 | 3 | .item { 4 | &:hover { 5 | background: $background-color-base; 6 | } 7 | .link { 8 | display: flex; 9 | align-items: center; 10 | height: 58px; 11 | padding: 0 15px; 12 | color: $text-color-secondary; 13 | text-decoration: none; 14 | } 15 | 16 | .icon { 17 | color: $text-color-primary; 18 | } 19 | 20 | .info { 21 | margin-left: 10px; 22 | .name { 23 | margin: 0; 24 | } 25 | 26 | .desc { 27 | margin: 0; 28 | color: $text-color-primary; 29 | } 30 | } 31 | } 32 | 33 | :global { 34 | .selected { 35 | background: $background-color-light; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/TaskBar/index.module.scss: -------------------------------------------------------------------------------- 1 | .taskBar { 2 | display: flex; 3 | justify-content: space-between; 4 | flex: auto 0 0; 5 | 6 | .leftButton { 7 | display: inline-flex; 8 | align-items: center; 9 | margin: 0 10px; 10 | } 11 | 12 | .rightButton { 13 | display: inline-flex; 14 | align-items: center; 15 | } 16 | 17 | .icon { 18 | margin-right: 5px; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/TaskButton/index.module.scss: -------------------------------------------------------------------------------- 1 | .taskButton { 2 | display: inline-flex; 3 | align-items: center; 4 | margin: 0 10px; 5 | 6 | .icon { 7 | margin-right: 5px; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/ThemeProvider/index.js: -------------------------------------------------------------------------------- 1 | import React, { createContext } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | export const ThemeContext = createContext(); 5 | 6 | const ThemeProvider = ({ theme, setTheme, children }) => { 7 | return ( 8 | 11 | {children} 12 | 13 | ); 14 | }; 15 | 16 | ThemeProvider.defaultProps = { 17 | theme: '', 18 | setTheme: () => {}, 19 | }; 20 | 21 | ThemeProvider.propTypes = { 22 | theme: PropTypes.string, 23 | setTheme: PropTypes.func, 24 | children: PropTypes.element.isRequired, 25 | }; 26 | 27 | export default ThemeProvider; 28 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/TipIcon/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Balloon } from '@alifd/next'; 3 | import Icon from '@components/Icon'; 4 | import PropTypes from 'prop-types'; 5 | import styles from './index.module.scss'; 6 | 7 | const TipIcon = (props) => { 8 | const triggerIcon = ( 9 | 14 | ); 15 | 16 | return ( 17 | 23 | {props.children} 24 | 25 | ); 26 | }; 27 | 28 | TipIcon.propTypes = { 29 | children: PropTypes.node.isRequired, 30 | }; 31 | 32 | export default TipIcon; 33 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/TipIcon/index.module.scss: -------------------------------------------------------------------------------- 1 | .tipIcon { 2 | margin-left: 4px; 3 | color: $tip-icon-color; 4 | cursor: pointer; 5 | } 6 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/User/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../variables.scss'; 2 | 3 | .wrap { 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | color: $white; 8 | cursor: pointer; 9 | 10 | &.isLogin { 11 | cursor: default; 12 | } 13 | 14 | .avatar { 15 | img { 16 | width: 32px; 17 | height: 32px; 18 | border-radius: 50%; 19 | } 20 | margin-bottom: 4px; 21 | } 22 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/UserLoginModal/index.module.scss: -------------------------------------------------------------------------------- 1 | .wrap { 2 | height: calc(100vh - 160px); 3 | width: calc(100vw - 160px); 4 | 5 | .iframe { 6 | width: 100%; 7 | height: 100%; 8 | border: 0 none; 9 | } 10 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/components/XtermTerminal/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../variables.scss'; 2 | 3 | .xtermContainer { 4 | position: relative; 5 | width: 100%; 6 | height: 100%; 7 | background: $background-color-light; 8 | 9 | .clearIcon { 10 | position: absolute; 11 | right: 15px; 12 | top: 10px; 13 | z-index: 9; 14 | cursor: pointer; 15 | } 16 | } 17 | 18 | .xtermRef { 19 | height: 100%; 20 | padding: 10px; 21 | } 22 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/global.scss: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | #iceworks { 4 | height: 100%; 5 | } 6 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/hooks/useLoadingTheme.js: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react'; 2 | import { ThemeContext } from '@components/ThemeProvider'; 3 | import { THEMES } from '@src/appConfig'; 4 | 5 | export default function useLoadingTheme() { 6 | const { theme } = useContext(ThemeContext); 7 | const themeValue = theme.indexOf('dark') > -1 ? 'dark' : 'light'; 8 | 9 | return { 10 | themeValue, 11 | loadingTheme: THEMES[themeValue].loadingTheme, 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/hooks/useModal.js: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | function useModal(bool = false) { 4 | const [on, setOn] = useState(bool); 5 | const [loading, setLoading] = useState(false); 6 | const showModal = () => setOn(true); 7 | const hideModal = () => setOn(false); 8 | const toggleModal = () => setOn(!on); 9 | const setModal = (value) => setOn(value); 10 | return { 11 | on, 12 | showModal, 13 | hideModal, 14 | toggleModal, 15 | setModal, 16 | loading, 17 | setLoading, 18 | }; 19 | } 20 | 21 | export default useModal; 22 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/hooks/useSocket.js: -------------------------------------------------------------------------------- 1 | /* eslint consistent-return:0 */ 2 | import { useEffect } from 'react'; 3 | import logger from '@utils/logger'; 4 | import socket from '@src/socket'; 5 | 6 | export default function useSocket(eventName, callback, initValue = []) { 7 | useEffect(() => { 8 | if (eventName && callback) { 9 | logger.debug(`socket on ${eventName}.`); 10 | socket.on(eventName, callback); 11 | 12 | return () => { 13 | logger.debug(`socket off ${eventName}.`); 14 | socket.removeListener(eventName, callback); 15 | }; 16 | } 17 | }, initValue); 18 | 19 | return socket; 20 | } 21 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/hooks/useTermTheme.js: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react'; 2 | import { ThemeContext } from '@components/ThemeProvider'; 3 | import { THEMES } from '@src/appConfig'; 4 | 5 | export default function useTermTheme() { 6 | const { theme } = useContext(ThemeContext); 7 | const themeValue = theme.indexOf('dark') > -1 ? 'dark' : 'light'; 8 | 9 | return { 10 | themeValue, 11 | termTheme: THEMES[themeValue].termTheme, 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/hooks/useTheme.js: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | const useTheme = (initTheme) => { 4 | const [theme, fn] = useState(initTheme); 5 | 6 | const setTheme = (newTheme) => { 7 | fn(newTheme); 8 | // eslint-disable-next-line 9 | window.__changeTheme__(newTheme); 10 | }; 11 | 12 | return [ 13 | theme, 14 | setTheme, 15 | ]; 16 | }; 17 | 18 | export default useTheme; 19 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/hooks/useWhenValueChanges.js: -------------------------------------------------------------------------------- 1 | import { useEffect, useRef } from 'react'; 2 | 3 | export default function useWhenValueChanges( 4 | value, 5 | callback, 6 | isEqual = (a, b) => a === b, 7 | ) { 8 | const previous = useRef(value); 9 | useEffect(() => { 10 | if (!isEqual(value, previous.current)) { 11 | callback(); 12 | previous.current = value; 13 | } 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/layouts/MainLayout/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../variables.scss'; 2 | 3 | .container { 4 | display: flex; 5 | flex-direction: column; 6 | height: 100%; 7 | min-width: 1200px; 8 | background: $background-color-base; 9 | 10 | .content { 11 | display: flex; 12 | flex-direction: row; 13 | flex: auto 1 1; 14 | height: 100%; 15 | overflow: hidden; 16 | } 17 | 18 | .main { 19 | flex: auto 1 1; 20 | overflow-x: hidden; 21 | overflow-y: auto; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Engineering/components/Task/index.module.scss: -------------------------------------------------------------------------------- 1 | .taskCard { 2 | display: flex; 3 | flex-direction: column; 4 | 5 | .content { 6 | margin: 20px 0; 7 | flex: 1 1 auto; 8 | min-height: 0; 9 | } 10 | } 11 | 12 | // TODO: should use :local,but ice-scripts not support 13 | :global { 14 | .next-card-body { 15 | flex: 1 1 auto; 16 | min-height: 0; 17 | } 18 | .next-card-content { 19 | display: flex; 20 | flex-direction: column; 21 | height: 100%; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Engineering/index.module.scss: -------------------------------------------------------------------------------- 1 | .tasksPage { 2 | display: flex; 3 | height: 100%; 4 | 5 | .main { 6 | flex: 1; 7 | margin: 20px; 8 | min-width: 0; 9 | } 10 | } 11 | 12 | .noProject { 13 | display: flex; 14 | align-items: center; 15 | justify-content: center; 16 | height: 100%; 17 | } 18 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Engineering/stores/configuration.js: -------------------------------------------------------------------------------- 1 | import socket from '@src/socket'; 2 | 3 | export default { 4 | dataSource: { 5 | cli: null, 6 | }, 7 | 8 | async getCLIConf() { 9 | this.dataSource.cli = await socket.emit('adapter.configuration.getCLIConf'); 10 | }, 11 | 12 | async setCLIConf(params) { 13 | const result = await socket.emit('adapter.configuration.setCLIConf', { 14 | options: params, 15 | }); 16 | 17 | return result; 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Engineering/stores/index.js: -------------------------------------------------------------------------------- 1 | import Icestore from '@ice/store'; 2 | import configuration from './configuration'; 3 | 4 | const icestore = new Icestore(); 5 | icestore.registerStore('configuration', configuration); 6 | 7 | export default icestore; 8 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Material/components/AddMaterialModal/index.module.scss: -------------------------------------------------------------------------------- 1 | .form { 2 | width: 500px; 3 | 4 | .input { 5 | height: 24px; 6 | line-height: 24px; 7 | } 8 | 9 | .opts { 10 | text-align: center; 11 | margin-top: 32px; 12 | 13 | .button { 14 | margin-right: 12px; 15 | 16 | &:last-child { 17 | margin-right: 0; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Material/components/DeleteMaterialModal/index.module.scss: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | width: 200px; 3 | padding: 18px 0; 4 | } 5 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Material/components/InstallModal/index.module.scss: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | width: 320px; 3 | 4 | .item { 5 | margin-bottom: 24px; 6 | 7 | &:last-child { 8 | margin-bottom: 0; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Material/components/MaterialPanel/index.module.scss: -------------------------------------------------------------------------------- 1 | .materialsPanel { 2 | padding: 0 16px; 3 | margin-top: 20px; 4 | 5 | .tips { 6 | margin: 30px 0; 7 | text-align: center; 8 | font-size: 14px; 9 | } 10 | 11 | .loadingWrap { 12 | display: flex; 13 | justify-content: center; 14 | min-height: 600px; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Material/index.module.scss: -------------------------------------------------------------------------------- 1 | .materialPage { 2 | display: flex; 3 | height: 100%; 4 | 5 | .main { 6 | flex: 1; 7 | margin: 20px; 8 | overflow: hidden; 9 | } 10 | :global { 11 | .next-card { 12 | padding: 0; 13 | } 14 | 15 | .next-card-head { 16 | padding: 0 16px; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/DEFPanel/index.module.scss: -------------------------------------------------------------------------------- 1 | .wrap { 2 | height: 100%; 3 | align-items: center; 4 | justify-content: center; 5 | display: flex; 6 | 7 | .main { 8 | align-items: center; 9 | justify-content: center; 10 | display: flex; 11 | flex-direction: column; 12 | 13 | .tips { 14 | margin-bottom: 24px; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/DeleteProjectModal/index.module.scss: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | p { 3 | margin-bottom: 18px; 4 | } 5 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/DependencyPanel/CreateDependencyModal.module.scss: -------------------------------------------------------------------------------- 1 | .textarea { 2 | width: 320px; 3 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/GitPanel/CreateBranchModal.module.scss: -------------------------------------------------------------------------------- 1 | .wrap { 2 | width: 320px; 3 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/GitPanel/SwtichBranchModal.module.scss: -------------------------------------------------------------------------------- 1 | .wrap { 2 | > span { 3 | padding: 0 4px; 4 | } 5 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/GitPanel/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../../../variables.scss'; 2 | 3 | .wrap { 4 | height: 100%; 5 | } 6 | 7 | .editModal { 8 | width: 320px; 9 | } 10 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/LayoutPanel/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../../../variables.scss'; 2 | 3 | .main { 4 | .item { 5 | display: flex; 6 | flex-direction: row; 7 | border-bottom: 1px solid $border-color-base; 8 | height: 32px; 9 | align-items: center; 10 | 11 | strong { 12 | flex: 1; 13 | font-size: $font-size-base; 14 | height: $font-size-base; 15 | line-height: $font-size-base; 16 | font-weight: 400; 17 | } 18 | 19 | span { 20 | font-size: $font-size-sm; 21 | height: $font-size-base; 22 | line-height: $font-size-base; 23 | margin-right: 6px; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/MenuPanel/CreateMenuModal.module.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/iceworks-client/src/pages/Project/components/MenuPanel/CreateMenuModal.module.scss -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/MenuPanel/DeleteMenuModal.module.scss: -------------------------------------------------------------------------------- 1 | .tips { 2 | color: red; 3 | } 4 | 5 | .warn { 6 | color: red; 7 | } 8 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/MenuPanel/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../../../variables.scss'; 2 | 3 | .confirmContent { 4 | line-height: 24px; 5 | width: 320px; 6 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/PagePanel/SavePageModal.module.scss: -------------------------------------------------------------------------------- 1 | 2 | .form { 3 | width: 400px; 4 | 5 | .input { 6 | height: 24px; 7 | line-height: 24px; 8 | } 9 | 10 | .select { 11 | width: 100%; 12 | } 13 | 14 | .opts { 15 | text-align: center; 16 | margin-top: 32px; 17 | 18 | .button { 19 | margin-right: 12px; 20 | 21 | &:last-child { 22 | margin-right: 0; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/PagePanel/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../../../variables.scss'; 2 | 3 | .main { 4 | .item { 5 | display: flex; 6 | flex-direction: row; 7 | border-bottom: 1px solid $border-color-base; 8 | height: 32px; 9 | align-items: center; 10 | 11 | strong { 12 | flex: 1; 13 | font-size: $font-size-base; 14 | height: $font-size-base; 15 | line-height: $font-size-base; 16 | font-weight: 400; 17 | } 18 | 19 | time { 20 | font-size: $font-size-sm; 21 | height: $font-size-base; 22 | line-height: $font-size-base; 23 | margin-right: 6px; 24 | } 25 | 26 | .icon { 27 | color: $brand-color-primary; 28 | cursor: pointer; 29 | margin-right: 4px; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/Panel/head.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../../../variables.scss'; 2 | 3 | .wrapper { 4 | display: flex; 5 | flex-direction: row; 6 | background-color: $brand-color-normal; 7 | height: 48px; 8 | align-items: center; 9 | padding: 0 12px; 10 | 11 | h3 { 12 | margin: 0; 13 | font-size: 16px; 14 | font-weight: bold; 15 | margin-right: 4px; 16 | z-index: 2; 17 | } 18 | 19 | .main { 20 | flex: 1; 21 | } 22 | 23 | .operation { 24 | display: flex; 25 | justify-content: center; 26 | align-items: center; 27 | z-index: 2; 28 | 29 | .icon { 30 | margin-right: 12px; 31 | color: $brand-color-primary; 32 | cursor: pointer; 33 | 34 | &:last-child { 35 | margin-right: 0; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/Panel/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import styles from './index.module.scss'; 4 | 5 | const Panel = ({ header, children }) => { 6 | return ( 7 |
8 | { header } 9 |
10 |
11 | {children} 12 |
13 |
14 |
15 | ); 16 | }; 17 | 18 | Panel.defaultProps = { 19 | header: null, 20 | }; 21 | 22 | Panel.propTypes = { 23 | header: PropTypes.element, 24 | children: PropTypes.any.isRequired, 25 | }; 26 | 27 | export default Panel; 28 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/Panel/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../../../variables.scss'; 2 | 3 | .wrapper { 4 | border: 1px solid $border-color-base; 5 | border-radius: $border-radius-base; 6 | overflow: hidden; 7 | display: flex; 8 | flex-direction: column; 9 | height: 320px; 10 | 11 | .main { 12 | padding: 12px; 13 | background: $panel-bg; 14 | display: flex; 15 | flex: 1; 16 | overflow: hidden; 17 | 18 | .box { 19 | flex: 1; 20 | padding-right: 10px; 21 | overflow-y: auto; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/RouterPanel/CreateRouterModal.module.scss: -------------------------------------------------------------------------------- 1 | .selectBox { 2 | width: 200px; 3 | } -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/RouterPanel/DeleteRouterModal.module.scss: -------------------------------------------------------------------------------- 1 | .warn { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/components/TodoPanel/index.module.scss: -------------------------------------------------------------------------------- 1 | @import '../../../../variables.scss'; 2 | 3 | .main { 4 | .item { 5 | margin-bottom: 12px; 6 | .path { 7 | margin-bottom: 6px; 8 | color: $text-color-secondary; 9 | font-size: 14px; 10 | } 11 | 12 | .msg { 13 | margin-left: 20px; 14 | margin-bottom: 4px; 15 | 16 | .msgLine { 17 | margin-right: 6px; 18 | color: $text-color-secondary; 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/stores/index.js: -------------------------------------------------------------------------------- 1 | import Icestore from '@ice/store'; 2 | import pages from './pages'; 3 | import layouts from './layouts'; 4 | import menu from './menu'; 5 | import routes from './routes'; 6 | import git from './git'; 7 | import oss from './oss'; 8 | import todo from './todo'; 9 | 10 | const icestore = new Icestore(); 11 | icestore.registerStore('pages', pages); 12 | icestore.registerStore('layouts', layouts); 13 | icestore.registerStore('menu', menu); 14 | icestore.registerStore('routes', routes); 15 | icestore.registerStore('git', git); 16 | icestore.registerStore('oss', oss); 17 | icestore.registerStore('todo', todo); 18 | 19 | export default icestore; 20 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/stores/layouts.js: -------------------------------------------------------------------------------- 1 | import socket from '@src/socket'; 2 | 3 | export default { 4 | dataSource: [], 5 | async refresh() { 6 | this.dataSource = await socket.emit('adapter.layout.getAll'); 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/stores/menu.js: -------------------------------------------------------------------------------- 1 | import socket from '@src/socket'; 2 | 3 | export default { 4 | asideMenuConfig: [], 5 | headerMenuConfig: [], 6 | async refresh() { 7 | const dataSource = await socket.emit('adapter.menu.getAll'); 8 | this.asideMenuConfig = dataSource.asideMenuConfig; 9 | this.headerMenuConfig = dataSource.headerMenuConfig; 10 | }, 11 | async bulkCreate(args) { 12 | await socket.emit('adapter.menu.bulkCreate', args); 13 | }, 14 | async delete(args) { 15 | await socket.emit('adapter.menu.delete', args); 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/stores/oss.js: -------------------------------------------------------------------------------- 1 | import socket from '@src/socket'; 2 | 3 | const defaultDataSource = { 4 | region: '', 5 | accessKeyId: '', 6 | accessKeySecret: '', 7 | bucket: '', 8 | directory: '', 9 | }; 10 | export default { 11 | dataSource: defaultDataSource, 12 | async refresh() { 13 | this.dataSource = await socket.emit('adapter.oss.getConfig'); 14 | }, 15 | async setConfig(config) { 16 | this.dataSource = await socket.emit('adapter.oss.setConfig', config); 17 | }, 18 | async clearConfig() { 19 | this.dataSource = await socket.emit('adapter.oss.setConfig', defaultDataSource); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/stores/page.js: -------------------------------------------------------------------------------- 1 | export default { 2 | dataSource: { 3 | blocks: [], 4 | layout: {}, 5 | }, 6 | setData(dataSource) { 7 | this.dataSource = { ...this.dataSource, ...dataSource }; 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/stores/pages.js: -------------------------------------------------------------------------------- 1 | import socket from '@src/socket'; 2 | 3 | export default { 4 | dataSource: [], 5 | createPageName: '', 6 | async refresh() { 7 | this.dataSource = await socket.emit('adapter.page.getAll'); 8 | }, 9 | async delete(name) { 10 | await socket.emit('adapter.page.delete', { name }); 11 | }, 12 | async create(data) { 13 | this.createPageName = await socket.emit('adapter.page.create', data); 14 | }, 15 | async addBlocks(data) { 16 | await socket.emit('adapter.page.addBlocks', data); 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Project/stores/todo.js: -------------------------------------------------------------------------------- 1 | import socket from '@src/socket'; 2 | 3 | export default { 4 | dataSource: [], 5 | async refresh() { 6 | this.dataSource = await socket.emit('adapter.todo.getList'); 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Setting/components/General/index.module.scss: -------------------------------------------------------------------------------- 1 | .row { 2 | margin-bottom: 30px; 3 | display: flex; 4 | align-items: center; 5 | .label { 6 | text-align: right; 7 | padding-right: 20px; 8 | } 9 | .select { 10 | min-width: 150px; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Setting/components/Main/index.module.scss: -------------------------------------------------------------------------------- 1 | .wrap { 2 | display: flex; 3 | height: 100%; 4 | 5 | .main { 6 | flex: 1; 7 | margin: 20px; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Setting/index.js: -------------------------------------------------------------------------------- 1 | import { lazy } from 'react'; 2 | 3 | const Main = lazy(() => import('./components/Main')); 4 | const General = lazy(() => import('./components/General')); 5 | 6 | export { 7 | Main, 8 | General, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/pages/Setting/index.module.scss: -------------------------------------------------------------------------------- 1 | .settingPage { 2 | display: flex; 3 | height: 100%; 4 | } 5 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/stores/globalTerminal.js: -------------------------------------------------------------------------------- 1 | export default { 2 | dataSource: { 3 | show: false, 4 | globalTerminalType: 'operation', 5 | }, 6 | async show(globalTerminalType) { 7 | this.dataSource.show = true; 8 | this.dataSource.globalTerminalType = globalTerminalType; 9 | }, 10 | async hide() { 11 | this.dataSource.show = false; 12 | }, 13 | async trigger() { 14 | this.dataSource.show = !this.dataSource.show; 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/stores/index.js: -------------------------------------------------------------------------------- 1 | import Icestore from '@ice/store'; 2 | import projects from './projects'; 3 | import project from './project'; 4 | import material from './material'; 5 | import task from './task'; 6 | import progress from './progress'; 7 | import dependencies from './dependencies'; 8 | import user from './user'; 9 | import globalTerminal from './globalTerminal'; 10 | import settingPanel from './settingPanel'; 11 | 12 | const stores = { 13 | material, 14 | project, 15 | projects, 16 | progress, 17 | dependencies, 18 | user, 19 | globalTerminal, 20 | task, 21 | settingPanel, 22 | }; 23 | 24 | const icestore = new Icestore(); 25 | Object.keys(stores).forEach(key => icestore.registerStore(key, stores[key])); 26 | 27 | export default icestore; 28 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/stores/progress.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | dataSource: { 4 | show: false, 5 | percent: 0, 6 | statusText: '', 7 | }, 8 | async show({ percent, statusText }) { 9 | this.dataSource.percent = percent || 0; 10 | this.dataSource.statusText = statusText; 11 | this.dataSource.show = true; 12 | }, 13 | async hide() { 14 | this.dataSource.percent = 100; 15 | this.dataSource.show = false; 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/stores/projects.js: -------------------------------------------------------------------------------- 1 | import socket from '@src/socket'; 2 | 3 | export default { 4 | dataSource: [], 5 | async refresh() { 6 | this.dataSource = await socket.emit('home.project.list'); 7 | }, 8 | async add(projectPath) { 9 | await socket.emit('home.project.add', { projectPath }); 10 | }, 11 | async delete(params) { 12 | await socket.emit('home.project.delete', params); 13 | }, 14 | async create(params) { 15 | await socket.emit('home.project.create', params); 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/stores/settingPanel.js: -------------------------------------------------------------------------------- 1 | export default { 2 | dataSource: { 3 | visible: false, 4 | }, 5 | 6 | toggle() { 7 | this.dataSource.visible = !this.dataSource.visible; 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/stores/user.js: -------------------------------------------------------------------------------- 1 | import socket from '@src/socket'; 2 | 3 | export default { 4 | dataSource: null, 5 | 6 | async refresh() { 7 | this.dataSource = await socket.emit('home.setting.getUser'); 8 | }, 9 | 10 | async login({ workid, cname, avatar_url: avatarUrl }) { 11 | this.dataSource = await socket.emit('home.setting.setUser', { 12 | name: cname, 13 | workId: workid, 14 | avatarUrl, 15 | }); 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/utils/goldlog.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import dateTime from 'date-time'; 3 | import browser from 'browser-detect'; 4 | import appConfig from '../appConfig'; 5 | 6 | const UA = browser(); 7 | 8 | function goldlog(data = {}) { 9 | // eslint-disable-next-line @typescript-eslint/camelcase 10 | data.visit_time = dateTime(); 11 | data.UA = UA; 12 | 13 | return axios({ 14 | method: 'post', 15 | url: `${appConfig.apiUrl}goldlog/record`, 16 | data, 17 | }); 18 | } 19 | 20 | export default goldlog; 21 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/utils/showMessage.js: -------------------------------------------------------------------------------- 1 | import { Message } from '@alifd/next'; 2 | 3 | export default function showMessage(message, type = 'error') { 4 | let content = 'Please try again'; 5 | 6 | if (message) { 7 | content = (message instanceof Error || typeof message === 'object') && message.message ? message.message : message; 8 | } 9 | 10 | Message.show({ 11 | title: 'Message', 12 | align: 'tr tr', 13 | type, 14 | content, 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /packages/iceworks-client/src/utils/writeGlobalLog.js: -------------------------------------------------------------------------------- 1 | import termManager from './termManager'; 2 | 3 | function writeGlobalLog(msg, isStdout = true) { 4 | const logType = isStdout ? 'globalProcessLog' : 'globalOperationLog'; 5 | const term = termManager.find(logType); 6 | if (term) { 7 | const writeLogType = isStdout ? 'writeChunk' : 'writeLog'; 8 | term[writeLogType](msg); 9 | } 10 | } 11 | 12 | export default writeGlobalLog; 13 | -------------------------------------------------------------------------------- /packages/iceworks-client/tests/index.js: -------------------------------------------------------------------------------- 1 | // test file 2 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/docs/scaffold-data.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/iceworks-scaffolder/docs/scaffold-data.md -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/CONSTANT.js: -------------------------------------------------------------------------------- 1 | exports.PRETTIER_CONFIG = { 2 | parser: 'babylon', 3 | singleQuote: true, // prefer 单引号 4 | trailingComma: 'es5', // 追加末尾逗号 5 | }; 6 | 7 | exports.BABEL_CONFIG = { 8 | sourceType: 'module', 9 | plugins: ['*', 'exportDefaultFrom', 'typescript'], 10 | }; 11 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/locale.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | unknown: { 3 | en: 'Catch an unknown error, continue?', 4 | cn: '发生了未知错误, 继续?', 5 | }, 6 | DESTDIR_EXISTS_OVERRIDE: { 7 | cn: '文件夹已存在, 是否覆盖?', 8 | }, 9 | FILE_CREATED: { 10 | cn: '以下文件已经成功创建!', 11 | }, 12 | BLOCK_EXISTS_RENAME: { 13 | cn: '同名 Block 已存在, 重命名或取消?', 14 | }, 15 | UNSUPPORTED_DESTPATH: { 16 | cn: 'Iceworks 无法识别该项目', 17 | }, 18 | RENDER_PAGE_FAIL: { 19 | cn: '渲染页面出错', 20 | }, 21 | ADD_DEPENDENCIES: { 22 | cn: '有新增的依赖项', 23 | }, 24 | EMTPY_PAGE_TEMPLATE: { 25 | cn: '当前项目不存在页面模板', 26 | }, 27 | }; 28 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/logger.js: -------------------------------------------------------------------------------- 1 | const debug = require('debug'); 2 | const chalk = require('chalk'); 3 | 4 | const logger = debug('icewokrs'); 5 | 6 | logger.info = logger.bind(logger, chalk.green('INFO')); 7 | logger.error = logger.bind(logger, chalk.red('ERROR')); 8 | logger.warn = logger.bind(logger, chalk.yellow('WARN')); 9 | 10 | module.exports = logger; 11 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/material/extractCustomBlock.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const mkdirp = require('mkdirp'); 3 | const path = require('path'); 4 | 5 | /** 6 | * 将自定义区块写入到指定位置 7 | * @param {array} block 区块 8 | * @param {string} output 目标路径 9 | */ 10 | module.exports = function extractTarball({ block, output }) { 11 | return new Promise((resolve) => { 12 | const allFiles = []; 13 | let codeFileTree = block.code; 14 | mkdirp.sync(output); 15 | fs.writeFileSync(path.join(output, 'index.jsx'), codeFileTree['index.jsx']); 16 | allFiles.push(path.join(output, 'index.jsx')); 17 | resolve(allFiles); 18 | }); 19 | }; 20 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/material/getBlockComponentsPaths.js: -------------------------------------------------------------------------------- 1 | const getBlockPaths = require('./getBlockPaths'); 2 | 3 | module.exports = function getBlockComponentsPaths({ cwd, name, blocks, preview }) { 4 | return blocks.map((block) => { 5 | return getBlockPaths({ 6 | cwd, 7 | name, 8 | block, 9 | preview, 10 | }); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/material/getLayoutPaths.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const uppercamelcase = require('uppercamelcase'); 3 | const { getClientFolderName } = require('../utils'); 4 | 5 | module.exports = function getLayoutPaths({ cwd, layout, nodeFramework = '' }) { 6 | const layoutClassName = uppercamelcase(layout.name); 7 | const clientFolder = getClientFolderName(nodeFramework); 8 | const layoutOutputPath = path.join(cwd, clientFolder, 'layouts', layoutClassName); 9 | return { 10 | outputPath: layoutOutputPath, 11 | relativePath: './layouts/' + layoutClassName, 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/material/index.js: -------------------------------------------------------------------------------- 1 | const extractTarball = require('./extractTarball'); 2 | const extractTarballLayout = require('./extractTarballLayout'); 3 | const getDependencies = require('./getDependencies'); 4 | const getTarball = require('./getTarball'); 5 | const parseFilename = require('./parseFilename'); 6 | const getBlockPaths = require('./getBlockPaths'); 7 | const getBlockComponentsPaths = require('./getBlockComponentsPaths'); 8 | const getLayoutPaths = require('./getLayoutPaths'); 9 | const extractCustomBlock = require('./extractCustomBlock'); 10 | 11 | module.exports = { 12 | extractTarball, 13 | extractTarballLayout, 14 | getDependencies, 15 | getTarball, 16 | parseFilename, 17 | getBlockPaths, 18 | getLayoutPaths, 19 | getBlockComponentsPaths, 20 | extractCustomBlock 21 | }; 22 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/material/parseFilename.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 转换模块名 3 | * 4 | * @example 5 | * [name].js => hello.js 6 | */ 7 | const get = require('lodash.get'); 8 | 9 | module.exports = function parseFilename(input, data) { 10 | return input.replace(/\[([\.a-z0-9]+)\]/gi, (str, key) => { 11 | return get(data, key, `[${key}]`); 12 | }); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/project/checkExists.js: -------------------------------------------------------------------------------- 1 | const pathExists = require('path-exists'); 2 | const path = require('path'); 3 | 4 | module.exports = async function checkProjectExists(cwd) { 5 | if (pathExists.sync(path.join(cwd, 'package.json'))) { 6 | return true; 7 | } 8 | throw new Error('当前目录不存在 package.json'); 9 | }; 10 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/project/getPackageData.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | module.exports = async function getPackageJson(cwd) { 5 | const pkgFile = path.join(cwd, 'package.json'); 6 | 7 | let pkgData; 8 | try { 9 | pkgData = fs.readFileSync(pkgFile, 'utf-8'); 10 | pkgData = JSON.parse(pkgData); 11 | } catch (err) { 12 | throw err; 13 | } 14 | return pkgData; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/project/getScaffoldTemplate.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const junk = require('junk'); 3 | const path = require('path'); 4 | const pathExists = require('path-exists'); 5 | 6 | async function findScaffoldTemplate(targetPath) { 7 | if (!pathExists.sync(targetPath)) { 8 | return []; 9 | } 10 | let files = fs.readdirSync(targetPath).filter(junk.not); 11 | files = files.map((n) => path.join(targetPath, n)); 12 | return files; 13 | } 14 | 15 | module.exports = async function getScaffoldTemplate(pageFolder) { 16 | const pageTemplate = await findScaffoldTemplate(pageFolder); 17 | 18 | return { 19 | page: pageTemplate, 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/project/index.js: -------------------------------------------------------------------------------- 1 | const checkExists = require('./checkExists'); 2 | const getPackageData = require('./getPackageData'); 3 | const getScaffoldTemplate = require('./getScaffoldTemplate'); 4 | 5 | module.exports = { 6 | checkExists, 7 | getPackageData, 8 | getScaffoldTemplate, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/router/removeManifestRouter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 对 manifest 文件进行操作,增加 pages 的注册 3 | */ 4 | 5 | /** 6 | * 删除路由文件 7 | */ 8 | 9 | const fs = require('fs'); 10 | const pathExists = require('path-exists'); 11 | 12 | module.exports = async function addManifestRouter({ path: routePath = 'IceworksPreviewPage', manifestFilePath }) { 13 | if (!pathExists.sync(manifestFilePath)) { 14 | return false; 15 | } 16 | 17 | if (!routePath) { 18 | return false; 19 | } 20 | 21 | let manifestContent = fs.readFileSync(manifestFilePath); 22 | manifestContent = manifestContent.toString(); 23 | const manifestData = JSON.parse(manifestContent); 24 | 25 | const pages = manifestData.pages || {}; 26 | 27 | delete pages[routePath]; 28 | 29 | return JSON.stringify(manifestData, null, 2); 30 | }; 31 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/src/utils/astToCode.js: -------------------------------------------------------------------------------- 1 | const generator = require('@babel/generator').default; 2 | 3 | const { unicodeUnescape } = require('./index'); 4 | 5 | module.exports = (ast) => { 6 | let code = generator(ast, { 7 | jsonCompatibleStrings: true, 8 | jsescOption: { 9 | minimal: true, 10 | }, 11 | }).code; 12 | return unicodeUnescape(code); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/.iceworks/pageTemplate/[name].jsx.ejs: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | <%_ blocks.forEach(function(block) { _%> 3 | import <%= block.className %> from '<%= block.path %>'; 4 | <%_ }); _%> 5 | 6 | import './idnex.scss'; 7 | 8 | export default class <%= name %> extends Component { 9 | static displayName = '<%= name %>'; 10 | 11 | constructor(props) { 12 | super(props); 13 | this.state = {}; 14 | } 15 | 16 | render() { 17 | return ( 18 |
19 | <%_ blocks.forEach(function(block) { _%> 20 | <<%= block.className %> /> 21 | <%_ }); _%> 22 |
23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/.iceworks/pageTemplate/index.js.ejs: -------------------------------------------------------------------------------- 1 | import loadable from 'react-loadable'; 2 | import LoadingIndicator from '@/components/LoadingIndicator'; 3 | 4 | export default loadable({ 5 | loader: () => import('./<%= name %>'), 6 | loading: LoadingIndicator, 7 | }); 8 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/.iceworks/pageTemplate/index.scss.ejs: -------------------------------------------------------------------------------- 1 | .<%= name %>-page { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/.iceworks/scaffoldrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "menuConfigFilePath": "${workspaceRoot}/src/menuConfig.js", 4 | "routerConfigFilePath": "${workspaceRoot}/src/routerConfig.js", 5 | "templates": { 6 | "pageFolder": "${workspaceRoot}/.iceworks/pageTemplate/" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/mock/blank-layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": "SUCCESS", 3 | "data": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/src/layouts/BlankLayout/Layout.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Layout from '@icedesign/layout'; 3 | 4 | import './Layout.scss'; 5 | 6 | export default class BlankLayout extends Component { 7 | static propTypes = {}; 8 | 9 | static defaultProps = {}; 10 | 11 | render() { 12 | return ( 13 | 14 | {this.props.children} 15 | 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/src/layouts/BlankLayout/Layout.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | .blank-layout { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/src/layouts/BlankLayout/index.js: -------------------------------------------------------------------------------- 1 | import Layout from './Layout'; 2 | 3 | export default Layout; 4 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/src/pages/Hello/Hello.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import AbilityIntroduction from './components/AbilityIntroduction/index'; 3 | import ApplicationProgress from './components/ApplicationProgress/index'; 4 | 5 | import './idnex.scss'; 6 | 7 | export default class Hello extends Component { 8 | static displayName = 'Hello'; 9 | 10 | constructor(props) { 11 | super(props); 12 | this.state = {}; 13 | } 14 | 15 | render() { 16 | return ( 17 |
18 | 19 | 20 |
21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/src/pages/Hello/components/AbilityIntroduction/index.js: -------------------------------------------------------------------------------- 1 | import AbilityIntroduction from './AbilityIntroduction'; 2 | 3 | export default AbilityIntroduction; 4 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/src/pages/Hello/components/ApplicationProgress/index.js: -------------------------------------------------------------------------------- 1 | import ApplicationProgress from './ApplicationProgress'; 2 | 3 | export default ApplicationProgress; 4 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/src/pages/Hello/index.js: -------------------------------------------------------------------------------- 1 | import loadable from 'react-loadable'; 2 | import LoadingIndicator from '@/components/LoadingIndicator'; 3 | 4 | export default loadable({ 5 | loader: () => import('./Hello'), 6 | loading: LoadingIndicator, 7 | }); 8 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/default/src/pages/Hello/index.scss: -------------------------------------------------------------------------------- 1 | .Hello-page { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/layout/src/components/Logo.jsx: -------------------------------------------------------------------------------- 1 | import React, { PureComponent } from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | 4 | export default class Logo extends PureComponent { 5 | render() { 6 | return ( 7 |
8 | 9 | LOGO 10 | 11 |
12 | ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/layout/src/layout/index.js: -------------------------------------------------------------------------------- 1 | import Layout from './Layout'; 2 | 3 | export default Layout; 4 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/menu/src/menuConfig.js: -------------------------------------------------------------------------------- 1 | // 菜单配置 2 | // headerMenuConfig:头部导航配置 3 | // asideMenuConfig:侧边导航配置 4 | 5 | const headerMenuConfig = []; 6 | 7 | const asideMenuConfig = [ 8 | { 9 | name: 'Dashboard', 10 | path: '/', 11 | icon: 'home2', 12 | }, 13 | ]; 14 | 15 | export { headerMenuConfig, asideMenuConfig }; 16 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/menu/src/menuConfig2.js: -------------------------------------------------------------------------------- 1 | // 菜单配置 2 | // headerMenuConfig:头部导航配置 3 | // asideMenuConfig:侧边导航配置 4 | 5 | const headerMenuConfig = []; 6 | 7 | const asideMenuConfig = [ 8 | { 9 | name: 'Dashboard', 10 | path: '/', 11 | icon: 'home2', 12 | }, 13 | { 14 | name: 'IceworksPreview', 15 | path: '/IceworksPreview', 16 | icon: 'home', 17 | }, 18 | ]; 19 | 20 | export { headerMenuConfig, asideMenuConfig }; 21 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/router/src/routerConfig.js: -------------------------------------------------------------------------------- 1 | import Page3 from './pages/Page3'; 2 | import BlankLayout from './layouts/BlankLayout'; 3 | 4 | const routerConfig = [ 5 | { 6 | path: 'hello', 7 | component: Page3, 8 | layout: BlankLayout, 9 | }, 10 | ]; 11 | 12 | export default routerConfig; 13 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/router/src/routerConfig2.js: -------------------------------------------------------------------------------- 1 | import Page3 from './pages/Page3'; 2 | import IceworksPreviewPageo from './pages/IceworksPreviewPage'; 3 | import BlankLayout from './layouts/BlankLayout'; 4 | 5 | const routerConfig = [ 6 | { 7 | path: 'hello', 8 | component: Page3, 9 | layout: BlankLayout, 10 | }, 11 | { 12 | path: '/IceworksPreviewPage', 13 | layout: BlankLayout, 14 | component: IceworksPreviewPageo, 15 | }, 16 | ]; 17 | 18 | export default routerConfig; 19 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/router/src/routerConfigHas404.js: -------------------------------------------------------------------------------- 1 | import Page3 from './pages/Page3'; 2 | import NotFound from './pages/NotFound'; 3 | import BlankLayout from './layouts/BlankLayout'; 4 | 5 | const routerConfig = [ 6 | { 7 | path: 'hello', 8 | component: Page3, 9 | layout: BlankLayout, 10 | }, 11 | { 12 | path: '*', 13 | component: NotFound, 14 | layout: BlankLayout, 15 | }, 16 | ]; 17 | 18 | export default routerConfig; 19 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/features/router/src/routerConfigHasPreview.js: -------------------------------------------------------------------------------- 1 | import Page3 from './pages/Page3'; 2 | import IceworksPreviewPage from './pages/IceworksPreviewPage'; 3 | import BlankLayout from './layouts/BlankLayout'; 4 | 5 | const routerConfig = [ 6 | { 7 | path: 'hello', 8 | component: Page3, 9 | layout: BlankLayout, 10 | }, 11 | { 12 | path: '/IceworksPreviewPage', 13 | layout: BlankLayout, 14 | component: IceworksPreviewPage, 15 | }, 16 | ]; 17 | 18 | export default routerConfig; 19 | -------------------------------------------------------------------------------- /packages/iceworks-scaffolder/test/unpad.js: -------------------------------------------------------------------------------- 1 | // Remove left padding from a string. 2 | module.exports = function unpad(str) { 3 | const lines = str.split('\n'); 4 | const m = lines[1] && lines[1].match(/^\s+/); 5 | if (!m) { 6 | return str; 7 | } 8 | const spaces = m[0].length; 9 | return lines 10 | .map((line) => line.slice(spaces)) 11 | .join('\n') 12 | .trim(); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/iceworks-server/.gitignore: -------------------------------------------------------------------------------- 1 | logs/ 2 | npm-debug.log 3 | yarn-error.log 4 | node_modules/ 5 | package-lock.json 6 | yarn.lock 7 | coverage/ 8 | .idea/ 9 | run/ 10 | .DS_Store 11 | *.sw* 12 | *.un~ 13 | .nodejs-cache 14 | src/tms/ 15 | src/app/public 16 | data/ 17 | dist/ 18 | -------------------------------------------------------------------------------- /packages/iceworks-server/README.md: -------------------------------------------------------------------------------- 1 | # iceworks server 2 | 3 | ## QuickStart 4 | 5 | 6 | 7 | see [midway docs][midway] for more detail. 8 | 9 | ### Development 10 | 11 | ```bash 12 | $ npm i 13 | $ npm run dev 14 | $ open http://localhost:7001/ 15 | ``` 16 | 17 | ### Deploy 18 | 19 | ```bash 20 | $ npm start 21 | $ npm stop 22 | ``` 23 | 24 | ### npm scripts 25 | 26 | - Use `npm run lint` to check code style. 27 | - Use `npm test` to run unit test. 28 | - Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail. 29 | 30 | [midway]: https://midwayjs.org 31 | -------------------------------------------------------------------------------- /packages/iceworks-server/README.zh-CN.md: -------------------------------------------------------------------------------- 1 | # iceworks-server 2 | 3 | iceworks server 4 | 5 | ## 快速入门 6 | 7 | 8 | 9 | 如需进一步了解,参见 [midway 文档][midway]。 10 | 11 | ### 本地开发 12 | 13 | ```bash 14 | $ npm i 15 | $ npm run dev 16 | $ open http://localhost:7001/ 17 | ``` 18 | 19 | ### 部署 20 | 21 | ```bash 22 | $ npm start 23 | $ npm stop 24 | ``` 25 | 26 | ### 单元测试 27 | 28 | - [midway-bin] 内置了 [mocha], [thunk-mocha], [power-assert], [istanbul] 等框架,让你可以专注于写单元测试,无需理会配套工具。 29 | - 断言库非常推荐使用 [power-assert]。 30 | - 具体参见 [midway 文档 - 单元测试](https://eggjs.org/zh-cn/core/unittest)。 31 | 32 | ### 内置指令 33 | 34 | - 使用 `npm run lint` 来做代码风格检查。 35 | - 使用 `npm test` 来执行单元测试。 36 | - 使用 `npm run autod` 来自动检测依赖更新,详细参见 [autod](https://www.npmjs.com/package/autod) 。 37 | 38 | 39 | [midway]: https://midwayjs.org 40 | -------------------------------------------------------------------------------- /packages/iceworks-server/scripts/removeProject.js: -------------------------------------------------------------------------------- 1 | const util = require('util'); 2 | const path = require('path'); 3 | const rimraf = require('rimraf'); 4 | 5 | const removeAdapterTestProject = async () => { 6 | const rimrafAsync = util.promisify(rimraf); 7 | const adapterTestPath = path.join(__dirname, '../test/lib/adapter/'); 8 | 9 | const tmpPath = path.join(adapterTestPath, '/tmp'); 10 | await rimrafAsync(tmpPath); 11 | 12 | const bareRepoPath = path.join(adapterTestPath, '/tmp.git'); 13 | await rimrafAsync(bareRepoPath); 14 | 15 | // mock the second user to use the bare repository 16 | const tmpRepoPath = path.join(adapterTestPath, '/tmpRepo'); 17 | await rimrafAsync(tmpRepoPath); 18 | }; 19 | 20 | removeAdapterTestProject(); 21 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/app.ts: -------------------------------------------------------------------------------- 1 | import RemoteLogger from './lib/remoteLogger'; 2 | 3 | export default class AppBootHook { 4 | public app: any; 5 | 6 | constructor(app) { 7 | this.app = app; 8 | } 9 | 10 | public async didLoad() { 11 | // send server log to remote in production 12 | if (this.app.config.env === 'prod') { 13 | this.app.getLogger().set('remote', new RemoteLogger({ level: 'INFO' })); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/app/controller/home.ts: -------------------------------------------------------------------------------- 1 | import { controller, get, provide } from 'midway-mirror'; 2 | 3 | @provide() 4 | @controller('/') 5 | export class HomeController { 6 | 7 | @get('*') 8 | public async render(ctx) { 9 | await ctx.render('index.html'); 10 | await ctx.render('index.html', ctx.clientConfig); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/app/middleware/client.ts: -------------------------------------------------------------------------------- 1 | import { checkAliInternal } from 'ice-npm-utils'; 2 | 3 | export default function() { 4 | return async function client(ctx, next) { 5 | if (String(ctx.path).indexOf('/api') === 0) { 6 | await next(); 7 | return; 8 | } 9 | 10 | ctx.clientConfig = { 11 | // default use iceworks-client@latest 12 | clientPath: process.env.ICEWORKS_CORE_VERSION 13 | ? `https://unpkg.com/iceworks-client@${process.env.ICEWORKS_CORE_VERSION}/build/` 14 | : 'http://ice.alicdn.com/iceworks-client/assets/', 15 | socketUrl: `//127.0.0.1:${process.env.PORT}/`, 16 | apiUrl: `//127.0.0.1:${process.env.PORT}/api/`, 17 | isAliInternal: await checkAliInternal(), 18 | }; 19 | 20 | await next(); 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/app/view/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | iceworks 10 | 11 | 12 | 13 |
14 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/config/config.local.ts: -------------------------------------------------------------------------------- 1 | export const development = { 2 | watchDirs: [ 3 | 'app', 4 | 'lib', 5 | 'service', 6 | 'config', 7 | 'app.ts', 8 | 'agent.ts', 9 | 'interface.ts', 10 | ], 11 | overrideDefault: true, 12 | }; 13 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/config/config.prod.ts: -------------------------------------------------------------------------------- 1 | exports.logger = { 2 | disableConsoleAfterReady: false, 3 | }; 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/config/plugin.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | 3 | export = { 4 | nunjucks: { 5 | enable: true, 6 | package: 'egg-view-nunjucks', 7 | }, 8 | 9 | io: { 10 | enable: true, 11 | package: 'egg-socket.io', 12 | }, 13 | 14 | cors: { 15 | enable: true, 16 | package: 'egg-cors', 17 | }, 18 | 19 | projectManager: { 20 | enable: true, 21 | path: path.join(__dirname, '../lib/plugin/project-manager'), 22 | }, 23 | 24 | i18n: { 25 | enable: true, 26 | path: path.join(__dirname, '../lib/plugin/i18n'), 27 | }, 28 | }; 29 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/interface/configuration.ts: -------------------------------------------------------------------------------- 1 | import { IBaseModule, IConfSchema, IContext } from './base'; 2 | 3 | export interface IConfParam { 4 | /** 5 | * 配置类型 6 | */ 7 | type: string; 8 | 9 | /** 10 | * 参数对象 11 | */ 12 | options: object; 13 | } 14 | 15 | export interface IConfigurationModule extends IBaseModule { 16 | /** 17 | * 获取构建配置项 18 | */ 19 | getCLIConf(args, ctx: IContext): Promise; 20 | 21 | /** 22 | * 设置构建配置项 23 | */ 24 | setCLIConf(param: IConfParam): any; 25 | } 26 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/interface/def.ts: -------------------------------------------------------------------------------- 1 | import { IBaseModule, IContext } from './base'; 2 | 3 | export interface IDEFPushParams { 4 | target: string; 5 | commitId: string; 6 | branch: string; 7 | repository: string; 8 | empId: string; 9 | } 10 | 11 | export interface IDEFModule extends IBaseModule { 12 | push(params: IDEFPushParams, ctx: IContext): Promise; 13 | } 14 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/interface/index.ts: -------------------------------------------------------------------------------- 1 | export * from './base'; 2 | export * from './layout'; 3 | export * from './page'; 4 | export * from './menu'; 5 | export * from './layout'; 6 | export * from './page'; 7 | export * from './menu'; 8 | export * from './component'; 9 | export * from './router'; 10 | export * from './dependency'; 11 | export * from './todo'; 12 | export * from './mock'; 13 | export * from './task'; 14 | export * from './configuration'; 15 | export * from './router'; 16 | export * from './git'; 17 | export * from './def'; 18 | export * from './oss'; 19 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/interface/layout.ts: -------------------------------------------------------------------------------- 1 | import { IProjectLayout, IBaseModule, IContext } from './base'; 2 | 3 | export interface ILayoutModule extends IBaseModule { 4 | /** 5 | * 获取单个布局的信息 6 | * 7 | * @param layoutName 布局名 8 | */ 9 | getOne(layoutName: string, ctx: IContext): Promise; 10 | 11 | /** 12 | * 获取项目内的布局 13 | */ 14 | getAll(args, ctx: IContext): Promise; 15 | } 16 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/interface/oss.ts: -------------------------------------------------------------------------------- 1 | import { IBaseModule, IContext } from './base'; 2 | 3 | export interface IOSSGetBucketsParams { 4 | region: string; 5 | accessKeyId: string; 6 | accessKeySecret: string; 7 | } 8 | 9 | export interface IOSSBucket { 10 | name: string; 11 | } 12 | 13 | export interface IOSSUploadParams { 14 | region: string; 15 | accessKeyId: string; 16 | accessKeySecret: string; 17 | bucket: string; 18 | directory: string; 19 | } 20 | 21 | export interface IUploadResult { 22 | success: boolean; 23 | path: string; 24 | message?: string; 25 | url?: string; 26 | } 27 | 28 | export interface IOSSModule extends IBaseModule { 29 | getBuckets(params: IOSSGetBucketsParams): Promise; 30 | upload(params: IOSSUploadParams, ctx: IContext): Promise; 31 | } 32 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/interface/todo.ts: -------------------------------------------------------------------------------- 1 | import { IBaseModule } from './base'; 2 | 3 | export interface ITodoMsg { 4 | /** 5 | * 在第几行 6 | */ 7 | line: number; 8 | 9 | /** 10 | * 文本 11 | */ 12 | content: string; 13 | 14 | /** 15 | * 类型 16 | */ 17 | type: string; 18 | } 19 | 20 | /** 21 | * 项目的 Todo 22 | */ 23 | export interface ITodo { 24 | /** 25 | * 文件路径 26 | */ 27 | path: string; 28 | 29 | /** 30 | * 文件内的 todo 31 | */ 32 | messages: ITodoMsg[]; 33 | } 34 | 35 | export interface ITodoModule extends IBaseModule { 36 | /** 37 | * 获取项目内的 todo 38 | */ 39 | getList(): Promise; 40 | } 41 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-cra-v1/README.md: -------------------------------------------------------------------------------- 1 | # adapter-cra-v1 2 | 3 | adapter for project based on `create-react-app` and `kit@3.x`. 4 | 5 | 适用于使用`create-react-app`工程和`kit@3.x`最佳实践的项目 6 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-cra-v1/modules/router/index.ts: -------------------------------------------------------------------------------- 1 | import { baseModules } from '../../../adapter'; 2 | 3 | export default class Router extends baseModules.Router { 4 | public noPathPrefix: boolean; 5 | 6 | constructor(params) { 7 | super(params); 8 | // cra only support 'src' as baseUrl, so the import dependency path has no prefix such as: 9 | // import foo from 'pages/foo'; 10 | this.noPathPrefix = true; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-cra-v1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adapter-cra-v1" 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v0/README.md: -------------------------------------------------------------------------------- 1 | # adapter-react-v0 2 | 3 | adapter for project based on `ice-scripts@1.x` and `kit@1.x`. 4 | 5 | 适用于使用 `ice-scripts@1.x` 工程和 `kit@1.x` 最佳实践的项目 6 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adapter-react-v0" 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v1/README.md: -------------------------------------------------------------------------------- 1 | # adapter-react-v1 2 | 3 | adapter for project based on `ice-scripts@2.x` and `kit@1.x`. 4 | 5 | 适用于使用 `ice-scripts@2.x` 工程和 `kit@1.x` 最佳实践的项目 6 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adapter-react-v1" 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v2/README.md: -------------------------------------------------------------------------------- 1 | # adapter-react-v2 2 | 3 | adapter for project based on `ice-scripts@2.x` and `kit@2.x`. 4 | 5 | 适用于使用 `ice-scripts@2.x` 工程和 `kit@2.x` 最佳实践的项目 6 | 7 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v2/modules/menu/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { baseModules } from '../../../adapter'; 3 | import { IProject } from '../../../../interface'; 4 | 5 | export default class Menu extends baseModules.Menu { 6 | public readonly path: string; 7 | 8 | public configFilePath = 'menuConfig'; 9 | 10 | constructor(params: {project: IProject; storage: any }) { 11 | super(params); 12 | this.path = path.join(this.project.path, 'src', `${this.configFilePath}.${this.project.language}`); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v2/modules/router/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { baseModules } from '../../../adapter'; 3 | import { IProject } from '../../../../interface'; 4 | 5 | export default class Router extends baseModules.Router { 6 | public readonly path: string; 7 | 8 | public configFilePath = 'routerConfig'; 9 | 10 | constructor(params: {project: IProject; storage: any }) { 11 | super(params); 12 | this.path = path.join(this.project.path, 'src', `${this.configFilePath}.${this.project.language}`); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adapter-react-v2" 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v3/README.md: -------------------------------------------------------------------------------- 1 | # adapter-react-v3 2 | 3 | adapter for project based on `ice-scripts@2.x` and `kit@3.x`. 4 | 5 | 适用于使用 `ice-scripts@2.x` 工程和 `kit@3.x` 最佳实践的项目 6 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-react-v3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adapter-react-v3" 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v1/README.md: -------------------------------------------------------------------------------- 1 | # adapter-vue-v1 2 | 3 | adapter for project based on `vue-cli@3.x` and `kit@2.x`. 4 | 5 | 适用于使用 `vue-cli@3.x` 工程和 `kit@2.x` 最佳实践的项目 6 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v1/modules/configuration/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { baseModules } from '../../../adapter'; 3 | import getConfigSchema from './getConfigSchema'; 4 | 5 | export default class Configuration extends baseModules.Configuration { 6 | public cliConfFilename = 'vue.config.js'; 7 | 8 | public getConfigSchema = getConfigSchema; 9 | 10 | public cliConfPath: string; 11 | 12 | constructor(params) { 13 | super(params); 14 | this.cliConfPath = path.join(this.project.path, this.cliConfFilename); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v1/modules/task/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { baseModules } from '../../../adapter'; 3 | import getTaskConfig from './getTaskConfig'; 4 | 5 | export default class Task extends baseModules.Task { 6 | public cliConfFilename = 'vue.config.js'; 7 | 8 | public cliConfPath: string; 9 | 10 | public getTaskConfig = getTaskConfig; 11 | 12 | constructor(params) { 13 | super(params); 14 | this.cliConfPath = path.join(this.project.path, this.cliConfFilename); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adapter-vue-v1" 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v2/README.md: -------------------------------------------------------------------------------- 1 | # adapter-vue-v2 2 | 3 | adapter for project based on `vue-cli@3.x` and `kit@3.x`. 4 | 5 | 适用于使用`vue-cli@3.x`工程和`kit@3.x`最佳实践的项目 6 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v2/modules/configuration/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { baseModules } from '../../../adapter'; 3 | import getConfigSchema from './getConfigSchema'; 4 | 5 | export default class Configuration extends baseModules.Configuration { 6 | public cliConfFilename: string = 'vue.config.js'; 7 | 8 | public cliConfPath: string; 9 | 10 | public getConfigSchema = getConfigSchema; 11 | 12 | constructor(params) { 13 | super(params); 14 | this.cliConfPath = path.join(this.project.path, this.cliConfFilename); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v2/modules/page/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { baseModules } from '../../../adapter'; 3 | import { IProject } from '../../../../interface'; 4 | 5 | export default class Page extends baseModules.Page { 6 | public readonly templateFileName: string; 7 | 8 | public readonly templateFilePath: string; 9 | 10 | public readonly prettierParseType: string; 11 | 12 | constructor(params: { project: IProject; storage: any }) { 13 | super(params); 14 | 15 | this.templateFileName = 'template.vue'; 16 | this.templateFilePath = path.join(__dirname, `${this.templateFileName}.ejs`); 17 | this.prettierParseType = 'vue'; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v2/modules/page/template.vue.ejs: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v2/modules/task/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { baseModules } from '../../../adapter'; 3 | import getTaskConfig from './getTaskConfig'; 4 | 5 | export default class Task extends baseModules.Task { 6 | public cliConfFilename: string = 'vue.config.js'; 7 | 8 | public cliConfPath: string; 9 | 10 | public getTaskConfig = getTaskConfig; 11 | 12 | constructor(params) { 13 | super(params); 14 | this.cliConfPath = path.join(this.project.path, this.cliConfFilename); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter-vue-v2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adapter-vue-v2" 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter/README.md: -------------------------------------------------------------------------------- 1 | # adapter-react-v3 2 | 3 | 适用于 ice-scripts@2.x 的工程和 kit@3.x 的项目最佳实践 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter/modules/def/client.ts: -------------------------------------------------------------------------------- 1 | /* eslint import/no-mutable-exports: 0, global-require: 0 */ 2 | 3 | let ClientWrap; 4 | 5 | try { 6 | ClientWrap = require('@ali/def-pub-client'); 7 | } catch (e) { 8 | ClientWrap = { 9 | Client: class C { 10 | public run() { 11 | throw new Error('缺少 DEF 客户端依赖'); 12 | } 13 | }, 14 | }; 15 | } 16 | 17 | export default ClientWrap; 18 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter/modules/page/template.jsx.ejs: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | <% for(var i = 0; i < blocks.length; i++) { -%> 3 | import <%= blocks[i].className %> from '<%= blocks[i].relativePath -%>'; 4 | <% } -%> 5 | 6 | export default function () { 7 | return ( 8 |
9 | <% for(var i = 0; i < blocks.length; i++){ -%> 10 | <% if (blocks[i].description) { %>{/* <%= blocks[i].description -%> */}<% } %> 11 | <<%= blocks[i].className -%> /> 12 | <% } -%> 13 |
14 | ); 15 | } -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adapter-ice-v3" 3 | } 4 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter/utils/formatCodeFromAST.ts: -------------------------------------------------------------------------------- 1 | import generate from '@babel/generator'; 2 | import * as prettier from 'prettier'; 3 | 4 | export default (ast: any): string => { 5 | return prettier.format(generate(ast, { 6 | retainLines: true, 7 | }).code, { 8 | singleQuote: true, 9 | trailingComma: 'es5', 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/adapter/utils/getIceVersion.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @icedesign/base: 0.x 3 | * @alifd/next: 1.x 4 | * none: 1.x 5 | */ 6 | export default function getIceVersion(packageJSON): string { 7 | const dependencies = packageJSON.dependencies || {}; 8 | const hasIceDesignBase = dependencies['@icedesign/base']; 9 | return hasIceDesignBase ? '0.x' : '1.x'; 10 | } 11 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/getNpmClient.ts: -------------------------------------------------------------------------------- 1 | import { checkAliInternal } from 'ice-npm-utils'; 2 | import storage from './storage'; 3 | 4 | const getNpmClient = async () => { 5 | const originClientValue = storage.get('npmClient'); 6 | let registry = ''; 7 | let npmClient = originClientValue; 8 | if (!npmClient) { 9 | // set default npm client 10 | npmClient = await checkAliInternal() ? 'tnpm' : 'npm'; 11 | storage.set('npmClient', npmClient); 12 | } else if (npmClient === 'custom') { 13 | registry = storage.get('registry'); 14 | npmClient = 'npm'; 15 | } 16 | return [npmClient, registry, originClientValue]; 17 | }; 18 | 19 | export default getNpmClient; -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/plugin/i18n/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "i18n" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/plugin/project-manager/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "projectManager", 4 | "dependencies": [ "i18n" ] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/lib/recursiveReaddir.ts: -------------------------------------------------------------------------------- 1 | import { isBinaryFileSync } from 'isbinaryfile'; 2 | import * as junk from 'junk'; 3 | import * as fs from 'fs-extra'; 4 | import * as readdir from 'recursive-readdir'; 5 | 6 | type TIgores = ((filePath: string, stats: fs.Stats) => boolean) | string; 7 | 8 | function ignoreFile(filePath: string, stats: fs.Stats) { 9 | return junk.is(filePath) || (!stats.isDirectory() && isBinaryFileSync(filePath)); 10 | } 11 | 12 | export default async function(filePath: string, ignores: TIgores[] = []): Promise { 13 | const combinedIgnores = ['node_modules', '.*', ignoreFile].concat(ignores); 14 | const files = await readdir(filePath, combinedIgnores); 15 | 16 | return files; 17 | } 18 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/locales/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "controller.home.userError": "User information is incorrect, login failed", 3 | "controller.settings.setWorkFolder.error": "No permission or not found directory" 4 | } 5 | -------------------------------------------------------------------------------- /packages/iceworks-server/src/locales/zh-CN.json: -------------------------------------------------------------------------------- 1 | { 2 | "controller.home.userError": "用户信息有误,登录失败", 3 | "controller.settings.setWorkFolder.error": "无权限或找不到该目录" 4 | } 5 | -------------------------------------------------------------------------------- /packages/iceworks-server/test/app/controller/goldlog.test.ts: -------------------------------------------------------------------------------- 1 | const { app } = require('midway-mock/bootstrap'); 2 | 3 | describe('POST /api/goldlog/record', () => { 4 | it('success should be true', () => { 5 | return app 6 | .httpRequest() 7 | .post('/api/goldlog/record') 8 | .send({ 9 | namespace: 'goldlog-test', 10 | action: 'test', 11 | data: {}, 12 | }) 13 | .expect(200, { 14 | success: true, 15 | }); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/iceworks-server/test/lib/adapter/common.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is mainly to define the public variables used in the test. 3 | */ 4 | import * as path from 'path'; 5 | import storage from '../../../src/lib/storage'; 6 | 7 | const tmpPath = path.join(__dirname, 'tmp'); 8 | 9 | export { storage, tmpPath }; 10 | -------------------------------------------------------------------------------- /packages/iceworks-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "compilerOptions": { 4 | "target": "ES2017", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "experimentalDecorators": true, 8 | "emitDecoratorMetadata": true, 9 | "resolveJsonModule": true, 10 | "inlineSourceMap":true, 11 | "noImplicitThis": true, 12 | "stripInternal": true, 13 | "pretty": true, 14 | "outDir": "dist", 15 | "lib": ["es2017", "dom"] 16 | }, 17 | "include": [ 18 | "src" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /packages/koa-generator/README.md: -------------------------------------------------------------------------------- 1 | # Koa Generator 2 | -------------------------------------------------------------------------------- /packages/koa-generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "koa-generator", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT" 11 | } 12 | -------------------------------------------------------------------------------- /packages/koa-generator/templates/_editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /packages/koa-generator/templates/_eslintignore: -------------------------------------------------------------------------------- 1 | # 忽略目录 2 | build/ 3 | tests/ 4 | demo/ 5 | 6 | # node 覆盖率文件 7 | coverage/ 8 | 9 | # 忽略文件 10 | **/*-min.js 11 | **/*.min.js 12 | -------------------------------------------------------------------------------- /packages/koa-generator/templates/_gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /client/node_modules 5 | /server/node_modules 6 | /node_modules 7 | 8 | # production 9 | /build 10 | /dist 11 | 12 | # misc 13 | .idea/ 14 | .happypack 15 | .DS_Store 16 | 17 | npm-debug.log* 18 | yarn-debug.log* 19 | yarn-error.log* 20 | -------------------------------------------------------------------------------- /packages/koa-generator/templates/client/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/koa-generator/templates/client/.gitkeep -------------------------------------------------------------------------------- /packages/koa-generator/templates/server/config/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/koa-generator/templates/server/config/.gitkeep -------------------------------------------------------------------------------- /packages/koa-generator/templates/server/middleware/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/koa-generator/templates/server/middleware/.gitkeep -------------------------------------------------------------------------------- /packages/koa-generator/templates/server/model/User.js: -------------------------------------------------------------------------------- 1 | /* eslint no-return-await:0 */ 2 | class UserModel { 3 | async findUserProfile() { 4 | // Similar: return await query('select * from user where uid = ?', uid); 5 | return await { 6 | name: '淘小宝', 7 | department: '技术部', 8 | avatar: 9 | 'https://img.alicdn.com/tfs/TB1L6tBXQyWBuNjy0FpXXassXXa-80-80.png', 10 | userid: 10001, 11 | }; 12 | } 13 | } 14 | 15 | module.exports = new UserModel(); 16 | -------------------------------------------------------------------------------- /packages/koa-generator/templates/server/router.js: -------------------------------------------------------------------------------- 1 | const userController = require('./controller/user'); 2 | 3 | module.exports = (router) => { 4 | router.prefix('/api'); 5 | router 6 | .get('/profile', userController.profile) 7 | .post('/login', userController.login) 8 | .post('/register', userController.register) 9 | .post('/logout', userController.logout); 10 | }; 11 | -------------------------------------------------------------------------------- /packages/koa-generator/templates/server/service/user.js: -------------------------------------------------------------------------------- 1 | const UserModel = require('../model/User'); 2 | 3 | class UserService { 4 | async profile() { 5 | const data = await UserModel.findUserProfile(); 6 | return { data }; 7 | } 8 | } 9 | 10 | module.exports = new UserService(); 11 | -------------------------------------------------------------------------------- /packages/koa-generator/utils/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/packages/koa-generator/utils/.gitkeep -------------------------------------------------------------------------------- /packages/props-schema-generator/README.md: -------------------------------------------------------------------------------- 1 | # props-schema-generator 2 | > 生成 PropsSchema -------------------------------------------------------------------------------- /packages/props-schema-generator/lib/codeToAST.js: -------------------------------------------------------------------------------- 1 | const babylon = require('babylon'); 2 | 3 | const conf = { 4 | sourceType: 'module', 5 | plugins: [ 6 | 'jsx', 7 | 'flow', 8 | 'asyncFunctions', 9 | 'classConstructorCall', 10 | 'doExpressions', 11 | 'trailingFunctionCommas', 12 | 'objectRestSpread', 13 | 'decorators', 14 | 'classProperties', 15 | 'exportExtensions', 16 | 'exponentiationOperator', 17 | 'asyncGenerators', 18 | 'functionBind', 19 | 'functionSent', 20 | ], 21 | }; 22 | 23 | module.exports = function(code) { 24 | code = code.toString(); 25 | return babylon.parse(code, conf); 26 | }; 27 | -------------------------------------------------------------------------------- /packages/props-schema-generator/lib/index.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const { cloneDeep } = require('lodash'); 4 | const findDef = require('./findDef'); 5 | const treeToJSON = require('./treeToJSON'); 6 | const meta = require('./getComponentMeta')(); 7 | 8 | function parse(arg, output) { 9 | const definitions = findDef(arg, process.cwd()); 10 | const propsSchema = treeToJSON(definitions); 11 | if (!propsSchema.name && meta && meta.title) { 12 | propsSchema.name = meta.title; 13 | } 14 | if (!propsSchema.description && meta && meta.chinese) { 15 | propsSchema.description = meta.chinese; 16 | } 17 | return propsSchema; 18 | } 19 | 20 | module.exports = parse; 21 | -------------------------------------------------------------------------------- /packages/props-schema-generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "props-schema-generator", 3 | "version": "0.1.1", 4 | "description": "生成 PropsSchema", 5 | "main": "lib/index.js", 6 | "dependencies": { 7 | "babel-traverse": "^6.25.0", 8 | "babylon": "^6.17.4", 9 | "glob": "^7.1.2", 10 | "install": "^0.10.1", 11 | "js-yaml": "^3.9.1", 12 | "lodash": "^4.17.4", 13 | "prettier": "^1.10.2", 14 | "react-docgen": "^2.17.0", 15 | "typescript": "^2.4.2" 16 | }, 17 | "keywords": [], 18 | "author": "ICE Team", 19 | "license": "MIT" 20 | } 21 | -------------------------------------------------------------------------------- /scripts/participle/userDict.utf8: -------------------------------------------------------------------------------- 1 | 云计算 2 | 区块链 10 nz 3 | ice 10 n 4 | ICE 10 n 5 | React n 6 | admin 7 | alibaba 8 | alibaba-inc 9 | com 10 | http 11 | https 12 | Design 13 | iceworks 14 | Iceworks 15 | Radio 16 | Input 17 | Tag 18 | FormBinder 19 | Wrapper 20 | ref 21 | this 22 | formChange 23 | HTML5 24 | html 25 | jsx 26 | import 27 | @icedesign 28 | @icedesign/base 10 n 29 | FormBinder 30 | formbinder 31 | form-binder 32 | value 33 | alicdn 34 | img 35 | from 36 | npm 37 | NPM 38 | -------------------------------------------------------------------------------- /tools/iceworks-app/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | build/ 3 | server/ -------------------------------------------------------------------------------- /tools/iceworks-app/app/getURL.js: -------------------------------------------------------------------------------- 1 | const is = require('electron-is'); 2 | const { resolve } = require('app-root-path'); 3 | const address = require('address'); 4 | 5 | const windowHost = is.dev() 6 | ? `http://${address.ip()}:4444` 7 | : `file://${resolve('public')}`; 8 | 9 | module.exports = (name) => { 10 | return `${windowHost}/${name}.html`; 11 | }; -------------------------------------------------------------------------------- /tools/iceworks-app/bin-darwin/README.md: -------------------------------------------------------------------------------- 1 | - node: v12.6.0 -------------------------------------------------------------------------------- /tools/iceworks-app/bin-darwin/node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/bin-darwin/node -------------------------------------------------------------------------------- /tools/iceworks-app/bin-darwin/npm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const path = require('path'); 4 | const npmCli = path.join( 5 | __dirname, 6 | '..', 7 | 'app', 8 | 'node_modules', 9 | 'npm', 10 | 'bin', 11 | 'npm-cli.js' 12 | ); 13 | require(npmCli); -------------------------------------------------------------------------------- /tools/iceworks-app/bin-win32/README.md: -------------------------------------------------------------------------------- 1 | - node: v12.6.0 -------------------------------------------------------------------------------- /tools/iceworks-app/bin-win32/node.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/bin-win32/node.exe -------------------------------------------------------------------------------- /tools/iceworks-app/bin-win32/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | "$basedir/node" "$basedir/../app/node_modules/npm/bin/npm-cli.js" "$@" 10 | ret=$? 11 | else 12 | node "$basedir/../app/node_modules/npm/bin/npm-cli.js" "$@" 13 | ret=$? 14 | fi 15 | exit $ret 16 | -------------------------------------------------------------------------------- /tools/iceworks-app/bin-win32/npm.cmd: -------------------------------------------------------------------------------- 1 | @IF EXIST "%~dp0\node.exe" ( 2 | "%~dp0\node.exe" "%~dp0\..\app\node_modules\npm\bin\npm-cli.js" %* 3 | ) ELSE ( 4 | @SETLOCAL 5 | @SET PATHEXT=%PATHEXT:;.JS;=;% 6 | node "%~dp0\..\app\node_modules\npm\bin\npm-cli.js" %* 7 | ) 8 | -------------------------------------------------------------------------------- /tools/iceworks-app/changelog/3.0.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "log": [ 3 | "升级产品结构:「项目管理」、「工程管理」、「物料市场」三大板块助力源码链路研发", 4 | "全新用户界面:多主题和多语言,满足开发者的个性化诉求", 5 | "可定制化工作台:任何前端项目,无论何种工程工具或项目规范,都可在 iceworks 中集成!" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/mac/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/mac/icon.icns -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/1024x1024.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/128x128.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/16x16.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/24x24.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/256x256.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/32x32.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/48x48.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/512x512.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/png/64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/png/64x64.png -------------------------------------------------------------------------------- /tools/iceworks-app/public/icons/win/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mtrucc/ice-electron/cb5742ad75707bef85a0faed58d9fc2f52b86b2c/tools/iceworks-app/public/icons/win/icon.ico -------------------------------------------------------------------------------- /tools/iceworks-app/renderer/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # production 7 | /build 8 | /dist 9 | 10 | # misc 11 | .idea/ 12 | .happypack 13 | .DS_Store 14 | 15 | npm-debug.log* 16 | yarn-debug.log* 17 | yarn-error.log* -------------------------------------------------------------------------------- /tools/iceworks-app/renderer/README.md: -------------------------------------------------------------------------------- 1 | # iceworks-renderer 2 | 3 | ## 使用 4 | 5 | - 启动调试服务: `npm start` 6 | - 构建 dist: `npm run build` -------------------------------------------------------------------------------- /tools/iceworks-app/renderer/ice.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | entry: 'src/index.jsx', 5 | publicPath: './', 6 | plugins: [ 7 | ['ice-plugin-fusion', { 8 | themePackage: '@icedesign/theme', 9 | }], 10 | ['ice-plugin-moment-locales', { 11 | locales: ['zh-cn'], 12 | }], 13 | ['ice-plugin-multi-pages'], 14 | ], 15 | alias: { 16 | '@': path.resolve(__dirname, './src/'), 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /tools/iceworks-app/renderer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "iceworks-renderer", 3 | "version": "3.0.0", 4 | "dependencies": { 5 | "@alifd/next": "^1.x", 6 | "@icedesign/theme": "^1.0.0", 7 | "axios": "^0.19.0", 8 | "react": "^16.4.1", 9 | "react-dom": "^16.4.1" 10 | }, 11 | "devDependencies": { 12 | "ice-plugin-fusion": "^0.1.4", 13 | "ice-plugin-moment-locales": "^0.1.0", 14 | "ice-plugin-multi-pages": "^0.1.0", 15 | "ice-scripts": "^2.0.0" 16 | }, 17 | "scripts": { 18 | "start": "ice-scripts dev", 19 | "build": "ice-scripts build" 20 | }, 21 | "engines": { 22 | "node": ">=8.0.0" 23 | }, 24 | "iceworks": { 25 | "type": "react", 26 | "adapter": "adapter-react-v3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tools/iceworks-app/renderer/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | iceworks 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tools/iceworks-app/renderer/src/global.scss: -------------------------------------------------------------------------------- 1 | // 引入默认全局样式 2 | @import '@alifd/next/reset.scss'; 3 | 4 | body { 5 | -webkit-font-smoothing: antialiased; 6 | } -------------------------------------------------------------------------------- /tools/iceworks-app/renderer/src/pages/About/index.scss: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 0; 3 | margin: 0; 4 | user-select: none; 5 | cursor: pointer; 6 | -webkit-app-region: drag; 7 | font-family: Roboto, "Helvetica Neue", Helvetica, Tahoma, Arial, FZLanTingHeiS-L-G, "PingFang SC", "Microsoft YaHei"; 8 | } 9 | 10 | .about-body { 11 | text-align: center; 12 | height: 100vh; 13 | overflow: hidden; 14 | .logo { 15 | margin: 12px 0; 16 | } 17 | .appname { 18 | margin-bottom: 12px; 19 | b { 20 | font-size: 16px; 21 | line-height: 16px; 22 | font-weight: 500; 23 | } 24 | } 25 | .version, .copyright { 26 | margin-bottom: 12px; 27 | font-size: 10px; 28 | line-height: 10px; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tools/iceworks-app/renderer/src/utils/isInElectron.js: -------------------------------------------------------------------------------- 1 | export default window.require; -------------------------------------------------------------------------------- /tools/iceworks-cli/.gitignore: -------------------------------------------------------------------------------- 1 | server/ -------------------------------------------------------------------------------- /tools/iceworks-cli/README.md: -------------------------------------------------------------------------------- 1 | # Iceworks CLI 2 | 3 | A simple CLI for iceworks. 4 | 5 | ## Usage 6 | 7 | ```bash 8 | $ npm i iceworks -g 9 | $ iceworks init # init project by scaffold 10 | ``` 11 | -------------------------------------------------------------------------------- /tools/iceworks-cli/command/config/index.js: -------------------------------------------------------------------------------- 1 | const config = require('../../lib/config'); 2 | 3 | module.exports = async function({ type, key, value }) { 4 | if (!type || type === 'list') { 5 | const data = await config.get(); 6 | console.log(data); 7 | } else if (type === 'set') { 8 | await config.set(key, value); 9 | console.log('update config success'); 10 | } else if (type === 'get') { 11 | const data = await config.get(key); 12 | console.log(data); 13 | } else { 14 | throw new Error('Invalid options'); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /tools/iceworks-cli/command/init/generateNpmName.js: -------------------------------------------------------------------------------- 1 | const kebabCase = require('kebab-case'); 2 | 3 | module.exports = function(name, npmScope) { 4 | // WebkitTransform -> @ice/webkit-transform 5 | name = kebabCase(name).replace(/^-/, ''); 6 | return npmScope ? `${npmScope}/${name}` : name; 7 | }; 8 | -------------------------------------------------------------------------------- /tools/iceworks-cli/lib/checkVersion.js: -------------------------------------------------------------------------------- 1 | const semver = require('semver'); 2 | const { getNpmLatestSemverVersion } = require('ice-npm-utils'); 3 | 4 | module.exports = (packageName, packageVersion) => { 5 | // 默认使用 taobao 源,可能会有不同步问题 6 | return getNpmLatestSemverVersion(packageName, packageVersion).then(latestVersion => { 7 | if (latestVersion && semver.lt(packageVersion, latestVersion)) { 8 | return Promise.resolve(latestVersion); 9 | } 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /tools/iceworks-cli/lib/constants.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const userHome = require('user-home'); 3 | 4 | module.exports = { 5 | DB_PATH: 'build/materials.json', 6 | TEMP_PATH: path.join(process.cwd(), '.iceworks-tmp'), 7 | CONFIG_PATH: path.join(userHome || __dirname, '.iceworks/cli-config.json'), 8 | TOKEN_KEY: 'fusion-token', 9 | TOKEN_ALI_KEY: 'fusion-token-ali', 10 | }; 11 | -------------------------------------------------------------------------------- /tools/iceworks-cli/lib/getUnpkgHost.js: -------------------------------------------------------------------------------- 1 | const { isAliNpm } = require('ice-npm-utils'); 2 | const config = require('./config'); 3 | 4 | module.exports = async function(npmName, materialConfig) { 5 | let unpkgHost = 'https://unpkg.com'; 6 | if (process.env.UNPKG) { 7 | // 兼容老的用法 8 | unpkgHost = process.env.UNPKG; 9 | } else if (isAliNpm(npmName)) { 10 | unpkgHost = 'https://unpkg.alibaba-inc.com'; 11 | } else if (materialConfig.unpkgHost) { 12 | unpkgHost = materialConfig.unpkgHost; 13 | } else { 14 | const configUnpkgHost = await config.get('unpkgHost'); 15 | if (configUnpkgHost) { 16 | unpkgHost = configUnpkgHost; 17 | } 18 | } 19 | 20 | return unpkgHost; 21 | }; 22 | -------------------------------------------------------------------------------- /tools/iceworks-cli/lib/log.js: -------------------------------------------------------------------------------- 1 | const npmlog = require('npmlog'); 2 | 3 | const envs = ['verbose', 'info', 'error', 'warn']; 4 | const logLevel = 5 | envs.indexOf(process.env.LOG_LEVEL) !== -1 ? process.env.LOG_LEVEL : 'info'; 6 | 7 | npmlog.level = logLevel; 8 | 9 | module.exports = npmlog; 10 | -------------------------------------------------------------------------------- /tools/iceworks-cli/template/componentAdaptor/adaptor/index.js.ejs: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import MainComponent from '../src'; 3 | 4 | export default { 5 | name: '<%= name %>', // 组件名称 6 | editor: () => { 7 | return { 8 | props: [], 9 | }; 10 | }, 11 | adaptor: (props) => { 12 | return ( 13 | // eslint-disable-next-line react/react-in-jsx-scope 14 | 15 | ); 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /tools/iceworks-cli/template/initMaterial/_eslintignore: -------------------------------------------------------------------------------- 1 | # 忽略目录 2 | build/ 3 | node_modules/ 4 | **/*-min.js 5 | **/*.min.js 6 | coverage/ 7 | -------------------------------------------------------------------------------- /tools/iceworks-cli/template/initMaterial/_eslintrc.js: -------------------------------------------------------------------------------- 1 | const { eslint, deepmerge } = require('@ice/spec'); 2 | 3 | module.exports = deepmerge(eslint, { 4 | rules: {}, 5 | }); 6 | -------------------------------------------------------------------------------- /tools/iceworks-cli/template/initMaterial/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | lerna-debug.log 4 | npm-debug.log 5 | .happypack 6 | package-lock.json 7 | yarn.lock 8 | yarn-error.log 9 | coverage/ 10 | .eslintcache 11 | .vscode/ 12 | .tmp/ 13 | 14 | build 15 | blocks/**/lib/ 16 | components/**/lib/ 17 | screenshot.png 18 | -------------------------------------------------------------------------------- /tools/iceworks-cli/template/initMaterial/_package.json.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= npmName %>", 3 | "version": "<%= version %>", 4 | "description": "<%= description %>", 5 | "author": "", 6 | "scripts": { 7 | "deploy": "npm run generate && npm run sync", 8 | "generate": "iceworks generate", 9 | "sync": "iceworks sync", 10 | "lint": "npm run eslint && npm run stylelint", 11 | "eslint": "eslint --cache --ext .js,.jsx ./", 12 | "stylelint": "stylelint ./**/*.scss" 13 | }, 14 | "files": ["build"], 15 | "devDependencies": { 16 | "@ice/spec": "^0.1.1", 17 | "eslint": "^6.0.1", 18 | "stylelint": "^10.1.0" 19 | }, 20 | "materialConfig": { 21 | "template": "<%= template %>", 22 | "type": "<%= materialConfig.type %>" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tools/iceworks-cli/template/initMaterial/_stylelintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | 4 | build/ 5 | -------------------------------------------------------------------------------- /tools/iceworks-cli/template/initMaterial/_stylelintrc.js: -------------------------------------------------------------------------------- 1 | const { stylelint } = require('@ice/spec'); 2 | 3 | module.exports = stylelint; 4 | --------------------------------------------------------------------------------