浏览代码

添加基本文件

ZXW 7 年之前
当前提交
e624da134e
共有 8 个文件被更改,包括 442 次插入0 次删除
  1. 13 0
      .editorconfig
  2. 36 0
      .gitignore
  3. 72 0
      LICENSE
  4. 55 0
      README.md
  5. 二进制
      appx.gif
  6. 31 0
      bower.json
  7. 200 0
      gulpfile.js
  8. 35 0
      package.json

+ 13 - 0
.editorconfig

@@ -0,0 +1,13 @@
+# editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_size = 4
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false

+ 36 - 0
.gitignore

@@ -0,0 +1,36 @@
+# Bower 安装的三方库文件
+#       bower 程序以及配置文件 bower.json 安装的一些三方库文件,如 jquery\lodash等.
+#       >bower install
+bower_components
+
+# 编译后发布的程序文件
+#       此文件夹中存放着编译后运行的网页程序,通过自动编译软件进行生成
+#       >npm run build
+dist
+
+# Node.js 安装的模块文件
+#       可通过 Node.js 自带包管理器 npm 以及配置文件 package.json 进行安装
+#       >npm install
+node_modules
+
+# 临时暂存文件
+#       用做存放临时测试或对比的文件
+temp
+
+# Typescript 类型定义文件夹
+#       可通过 Typings 工具以及 typings.json 配置位文件进行生成
+#       >typings install
+#   !!现文件夹中包含自定义文件,由于此文件还处在变动期,暂未直接加入 github,所以不排除以下文件夹
+#typings
+
+# VS Code 配置文件夹
+.vscode
+
+# WEbStorm 配置文件夹
+.idea
+
+# 允许建立名为 Test 的 Widget,并不会被同步
+src/widgets/Test
+
+# 不排除Vender中的文件
+!vender/**/dist

文件差异内容过多而无法显示
+ 72 - 0
LICENSE


+ 55 - 0
README.md

@@ -0,0 +1,55 @@
+# AppX
+
+基于 Dojo、JQuery、Lodash、Typescript、Gulp等构建的模块化 Web App 框架。
+具有:自动化、模块化、懒加载、高兼容性 以及 基于 Typescript 的智能提示等特性。
+
+![AppX](http://git.tofly.cn/Web_GIS/AppX/raw/c91a4caa9c338b1b958da0421fbf1f2034ba21c0/appx.gif)
+
+# 技术栈
+
+- [Node.js](https://nodejs.org/en/) --- 基础开发环境
+- [NPM](https://www.npmjs.com/) --- Node包管理器
+- [Bootstrap](http://www.bootcss.com/) --- 前端样式框架
+- [EChart](http://echarts.baidu.com/) --- 图表展示框架
+- [Git](https://git-scm.com/) --- 版本控制以及协作开发
+- [Sass](http://sass-lang.com/) --- CSS 扩展
+- [Javascript](https://en.wikipedia.org/wiki/JavaScript) --- 主要开发语言
+- [Typescript](http://www.typescriptlang.org/) --- Javascript 扩展
+- [Gulp](http://gulpjs.com/) --- 自动化工作
+- [ArcGIS for Javascript](https://developers.arcgis.com/javascript/) --- 基于此 API 做二次开发
+- [Dojo](https://dojotoolkit.org/) --- ArcGIS for Javascript 是基于此框架开发出来的
+- [JQuery](http://jquery.com/) --- 杰出的 Javascript 库
+- [JQuery-UI](http://jqueryui.com/) --- 用于给页面添加动画以及交互
+- [Lodash](https://lodash.com/) --- Javascript 函数库
+- [Bower](https://bower.io/) --- Javascript 包管理器
+
+# 环境要求
+
+| 应用名        | 版本号    | 查看版本      |
+| ------------- |:-------- | :----------- |
+| Node.js       | v6.6.0   | > node -v     |
+| npm           | v3.10.3  | > npm -v      |
+| Gulp          | v3.9.1   | > gulp -v     |
+| Typescript    | v2.0.3   | > tsc -v      |
+| Typings       | v1.4.0   | > typings -v  |
+
+**建议使用IDE** ***[Visual Studio Code](https://code.visualstudio.com)***。
+
+# 使用方法
+
+```bash
+git clone dev http://git.tofly.cn/Tofly_CR/WebGAS.git
+cd AppX
+npm install
+npm start
+```
+*注:* 1.国内因为 GFW 的原因 `npm install` 可能会失败(安装 Sass 失败)。
+如果失败,请用一下命令替换上方的 `npm install`, 其他命令不变。[CNPM](http://npm.taobao.org/)
+```bash
+npm install cnpm
+cnpm install
+```
+*注:* 2.请在dev分支下建立自己的分支进行开发,并定期合并到dev分支。
+# 开发人员
+
+王茭、宋凌、曾宪伟、王海...

二进制
appx.gif


+ 31 - 0
bower.json

@@ -0,0 +1,31 @@
+{
+  "name": "webappframe",
+  "description": "基于 Dojo、JQuery、Lodash、Typescript、Gulp等构建的模块化 Web App 框架。",
+  "main": "index.html",
+  "authors": [
+    "Aiello Chan",
+    "Wangjiao",
+    "Zengxianwei",
+    "Songling"
+  ],
+  "license": "Apache License 2.0",
+  "homepage": "",
+  "private": true,
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "test",
+    "tests"
+  ],
+  "dependencies": {
+    "bootstrap-datetimepicker": "^0.0.11",
+    "jquery": "1.12.4",
+    "jquery-ui": "1.12.1",
+    "bootstrap": "3.3.7",
+    "lodash-amd": "3.10.2",
+    "echarts": "^3.3.1",
+    "bootstrap-switch": "^3.3.2",
+    "file-saver": "^1.3.3"
+  }
+}

+ 200 - 0
gulpfile.js

@@ -0,0 +1,200 @@
+'use strict';
+// npm插件
+const gulp = require('gulp'),
+    ts = require('gulp-typescript'),
+    tsProject = ts.createProject('tsconfig.json'),
+    replace = require('gulp-batch-replace'),
+    htmlMin = require('gulp-htmlmin'),
+    sass = require('gulp-sass'),
+    clean = require('gulp-clean'),
+    browserSync = require('browser-sync').create(),
+    autoPrefixer = require('gulp-autoprefixer'),
+    cleanCSS = require('gulp-clean-css'),
+    imageMin = require('gulp-imagemin'),
+    ifElse = require('gulp-if-else'),
+    runSequence = require('run-sequence');
+
+// 定义统一常量
+var config = {
+    product: false,
+    src: "src",
+    dist: "dist",
+    serverRoot: "./dist"
+}
+
+// 处理 TypeScript 文件
+gulp.task('typescript', function () {
+    tsProject.src()
+        .pipe(tsProject())
+        .js
+        .pipe(ifElse(config.product, replace.bind(this, [
+            ['\n', ' '],
+            [/\s*=\s*/g, '='],
+            [/\s*,\s*/g, ','],
+            [/\s*\{\s*/g, '{'],
+            [/\s*}\s*/g, '}'],
+            [/\s+/g, ' ']
+        ])))
+        .pipe(gulp.dest(config.dist));
+});
+
+// 处理 HTML 文件
+gulp.task('html', function () {
+    return gulp.src(config.src + '/**/*.html')
+        .pipe(ifElse(config.product, htmlMin.bind(this, {
+            collapseWhitespace: true
+        })))
+        .pipe(gulp.dest(config.dist));
+});
+
+// 处理 Sass 文件
+gulp.task('sass', function () {
+    return gulp.src(config.src + '/**/*.scss')
+        .pipe(sass().on('error', sass.logError))
+        .pipe(autoPrefixer({
+            browsers: ["Firefox >= 38",
+                "Safari >= 7",
+                "Chrome >= 26",
+                "IE >= 10",
+                "Opera >= 12"
+            ]
+        }))
+        .pipe(ifElse(config.product, cleanCSS))
+        .pipe(gulp.dest(config.dist));
+});
+
+// 复制不需要处理的文件
+gulp.task('copy', function () {
+    return gulp.src([
+            config.src + '/**/*.txt',
+            config.src + '/**/*.xml',
+            config.src + '/**/*.pdf'
+        ])
+        .pipe(gulp.dest(config.dist));
+});
+
+// 处理字体文件
+gulp.task('font', function () {
+    return gulp.src([
+            config.src + '/**/*.{eot,svg,ttf,woff,woff2}'
+        ])
+        .pipe(gulp.dest(config.dist));
+});
+
+// 处理 css 文件
+gulp.task('css', function () {
+    return gulp.src([
+            config.src + '/**/*.css'
+        ])
+        .pipe(autoPrefixer({
+            browsers: ["Firefox >= 38",
+                "Safari >= 7",
+                "Chrome >= 26",
+                "IE >= 10",
+                "Opera >= 12"
+            ]
+        }))
+        .pipe(ifElse(config.product, cleanCSS))
+        .pipe(gulp.dest(config.dist));
+});
+
+// 处理 js 文件
+gulp.task('js', function () {
+    return gulp.src([
+            config.src + '/**/*.js'
+        ])
+        .pipe(ifElse(config.product, replace.bind(this, [
+            ['\n', ' '],
+            [/\s*=\s*/g, '='],
+            [/\s*,\s*/g, ','],
+            [/\s*\{\s*/g, '{'],
+            [/\s*}\s*/g, '}'],
+            [/\s+/g, ' ']
+        ])))
+        .pipe(gulp.dest(config.dist));
+});
+
+// 处理图片文件
+gulp.task('image', function () {
+    gulp.src(config.src + '/**/*.{png,jpeg,jpg,gif,ico,cur}')
+        .pipe(ifElse(config.product, imageMin))
+        .pipe(gulp.dest(config.dist));
+});
+
+// 处理 json 文件
+gulp.task('json', function () {
+    return gulp.src(config.src + '/**/*.json')
+        .pipe(ifElse(config.product, replace.bind(this, [
+            ['\n', ' '],
+            [/\s*,\s*/g, ','],
+            [/\s*\{\s*/g, '{'],
+            [/\s*}\s*/g, '}'],
+            [/\s+/g, ' ']
+        ])))
+        .pipe(gulp.dest(config.dist))
+});
+
+// 清除目录
+gulp.task('clean', function () {
+    return gulp.src(config.dist, {
+            read: false
+        })
+        .pipe(clean());
+});
+
+// 创建一个本地 Server
+gulp.task('serve', function () {
+    browserSync.init({
+        server: {
+            baseDir: config.serverRoot
+        }
+    });
+});
+
+// 刷新浏览器中的页面
+gulp.task('reload', function () {
+    browserSync.reload();
+});
+
+// 开启一个本地服务器,并文件变化时刷新页面
+gulp.task('serve:watch', ['serve'], function () {
+    gulp.watch(config.src + '/**/*.ts', function () {
+        runSequence(['typescript', 'reload']);
+    });
+    gulp.watch(config.src + '/**/*.json', function () {
+        runSequence(['json', 'reload']);
+    });
+    gulp.watch(config.src + '/**/*.html', function () {
+        runSequence(['html', 'reload']);
+    });
+    gulp.watch(config.src + '/**/*.scss', function () {
+        runSequence(['sass', 'reload']);
+    });
+    gulp.watch(config.src + '/**/*.js', function () {
+        runSequence(['js', 'reload']);
+    });
+    gulp.watch(config.src + '/**/*.css', function () {
+        runSequence(['css', 'reload']);
+    });
+    gulp.watch(config.src + '/**/*.{png,jpeg,jpg,gif,ico}', function () {
+        runSequence(['image', 'reload']);
+    });
+    gulp.watch([
+        config.src + '/**/*.txt',
+        config.src + '/**/*.xml'
+    ], function () {
+        runSequence(['copy', 'reload']);
+    });
+});
+
+// 默认任务
+gulp.task('default', ['clean'], function () {
+    gulp.start(['typescript', 'json', 'sass', 'image', 'copy', 'font', 'css', 'js', 'html']);
+});
+
+// 产品发布任务
+//  主要用于压缩所有的文件
+gulp.task('product', ['clean'], function () {
+    config.product = true;
+    gulp.start(['typescript', 'json', 'sass', 'image', 'copy', 'font', 'css', 'js', 'html']);
+});

+ 35 - 0
package.json

@@ -0,0 +1,35 @@
+{
+  "name": "AppX",
+  "version": "1.0.0",
+  "description": "基于 Dojo、JQuery、Lodash、Typescript、Gulp 等构建的模块化 Web App 框架。",
+  "main": "index.html",
+  "scripts": {
+    "start": "gulp serve:watch",
+    "postinstall": "gulp",
+    "build": "gulp product"
+  },
+  "author": "Aiello Chan",
+  "license": "Apache License 2.0",
+  "devDependencies": {
+    "browser-sync": "^2.16.1",
+    "gulp": "^3.9.1",
+    "gulp-autoprefixer": "^3.1.1",
+    "gulp-batch-replace": "^0.0.0",
+    "gulp-clean": "^0.3.2",
+    "gulp-clean-css": "^2.0.13",
+    "gulp-htmlmin": "^3.0.0",
+    "gulp-if-else": "^1.0.3",
+    "gulp-imagemin": "^3.1.1",
+    "gulp-sass": "^2.3.2",
+    "gulp-typescript": "^3.0.1",
+    "run-sequence": "^1.2.2",
+    "typescript": "^2.1.4",
+    "typings": "^1.4.0"
+  },
+  "dependencies": {
+    "graceful-fs": "^4.1.9",
+    "lodash": "^4.16.2",
+    "lodash-amd": "^4.16.2",
+    "minimatch": "^3.0.3"
+  }
+}