
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
create-dfxk-admin-app
Advanced tools
npx create-dfxk-admin-app my-app
cd my-app
npm start
(npx comes with npm 5.2+ and higher, see instructions for older npm versions)
Then open http://localhost:8000 to see your app. When you’re ready to deploy to production, create a minified bundle with npm run build.
├── Dockerfile docker镜像构建文件
├── README.md
├── docker-compose.yml docker-compose配置示例
├── pm2.json 生产环境pm2配置
├── proxy.config.js 开发环境api代理配置
├── public
│ └── index.html
├── server 生成环境前端代理服务
│ ├── package.json
│ └── server.js
├── src 源代码
│ ├── app.less 公共样式
│ ├── components 组件库
│ ├── containers 容器(渲染层)
│ │ └── package.json
│ ├── custom.d.ts 自定义typescript定义文件
│ ├── entry.config.ts 入口配置
│ ├── models model(数据层)
│ │ ├── index.tsx 在这里加载非异步的model
│ │ └── package.json
│ └── util 工具库
│ └── package.json
├── .adminrc.js dfxk-admin-build-dev配置
├── .webpackrc.js webpack配置
├── .gitlab-ci.yml gitlab ci配置
├── tsconfig.json typescript配置
└── tslint.json tslint配置
主要开发集中在 containers 和 models 里面,通常一个页面由一个容器和一个model组成。
containers 下的文件结构要跟路由一致
路由:
/system/user
容器目录:
├── containers
│ └── System
│ └── User
│ ├── EditUser /system/user的子页面
│ │ └── index.tsx
└── └── index.tsx
/System/User/index.tsx 示例:
import * as React from 'react';
import BasicComponent from 'dfxk-admin-tools/lib/components/BasicComponent';
import { injectNormal } from 'dfxk-admin-tools/lib/util/inject';
import model, { UserState } from 'models/system/user';
export interface UserProps {
data: UserState;
dataActions: typeof model.actions;
dataApiActions: typeof model.apiActions;
}
class User extends BasicComponent<UserProps, any> {
render() {
return (
<div>
User
</div>
);
}
}
export default injectNormal(User, {
data: require('models/system/user'),
});
model 是action、saga和reducer的集合,使用 tt-admin-tools 提供的工具快速创建。
npx tt-admin-tools model /system/user
user model 示例:
import model{ ApiConfig } from '@dfxk/luna/model';
export let keys = {
changeName: 'changeName',
};
export let apis = {
getName: 'getName',
};
export let apiConfigs: ApiConfig[] = [{
path: '/getName',
actionName: apis.getName,
}];
export interface UserState {
loading: boolean;
}
const userModel = model<typeof keys, typeof apis>({
modelName: 'user',
actionKeys: keys,
api: {
basePath: '/api',
config: apiConfigs,
},
reducer: ({ apiActionNames, createReducer }) => {
return createReducer<UserState, any>({
[apiActionNames.getName.request](state, action) {
return {
...state,
loading: true,
};
},
[apiActionNames.getName.success](state, action) {
return {
...state,
loading: false,
};
},
[apiActionNames.getName.error](state, action) {
return {
...state,
loading: false,
};
},
}, {
loading: false,
});
},
sagas: (m) => {
return [];
},
});
export default userModel;
FAQs
create a admin app
The npm package create-dfxk-admin-app receives a total of 2 weekly downloads. As such, create-dfxk-admin-app popularity was classified as not popular.
We found that create-dfxk-admin-app demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.