seimin лет назад: 3
Родитель
Сommit
626bf85654
8 измененных файлов с 7237 добавлено и 2463 удалено
  1. BIN
      --favicon-32x32.png
  2. BIN
      bower_components/ckeditor.zip
  3. BIN
      favicon-32x32.png
  4. 22 0
      gulpfile.js
  5. 7118 2446
      package-lock.json
  6. 7 17
      package.json
  7. 45 0
      upload/development.js
  8. 45 0
      upload/production.js

BIN
--favicon-32x32.png


BIN
bower_components/ckeditor.zip


BIN
favicon-32x32.png


+ 22 - 0
gulpfile.js

@@ -0,0 +1,22 @@
1
+const { src, dest, series } = require('gulp');
2
+const del = require('del');
3
+const from = {
4
+  path: [
5
+    './assets/**/*',
6
+    // './bower_components/**/*',(第二次以后的更新不用)
7
+    // './index.html',(第二次以后的更新不用)
8
+  ]
9
+};
10
+// 清理dist文件夹
11
+const cleanDist = async (cb) => {
12
+  await del(['dist/**']);
13
+  cb();
14
+}
15
+// 移动assets文件夹的内容到dist
16
+const moveAssets = (cb) => {
17
+  src(from.path,{base:'./'})
18
+    .pipe(dest('dist'));
19
+  cb();
20
+}
21
+
22
+exports.build = series(cleanDist, moveAssets);

Разница между файлами не показана из-за своего большого размера
+ 7118 - 2446
package-lock.json


+ 7 - 17
package.json

@@ -3,7 +3,9 @@
3 3
   "version": "1.3.0",
4 4
   "description": "AngularJs Bootstrap Admin Template",
5 5
   "scripts": {
6
-    "start": "node node_modules/http-server/bin/http-server -o -p 8086"
6
+    "development": "node ./upload/development.js",
7
+    "production": "node ./upload/production.js",
8
+    "build": "npx gulp build"
7 9
   },
8 10
   "keywords": [
9 11
     "AngularJS",
@@ -28,22 +30,10 @@
28 30
   ],
29 31
   "repository": "",
30 32
   "author": "ClipTheme",
31
-  "dependencies": {
32
-    "angular-nicescroll": "0.0.0",
33
-    "blueimp-md5": "^2.12.0",
34
-    "echarts": "^4.2.0-rc.1"
35
-  },
36 33
   "devDependencies": {
37
-    "grunt": "^0.4.5",
38
-    "grunt-bower-install-simple": "^0.9.3",
39
-    "grunt-contrib-clean": "^0.6.0",
40
-    "grunt-contrib-compass": "^1.0.1",
41
-    "grunt-contrib-concat": "^0.5.0",
42
-    "grunt-contrib-copy": "^0.5.0",
43
-    "grunt-contrib-cssmin": "^0.12.2",
44
-    "grunt-contrib-uglify": "^0.8.0",
45
-    "gruntfile-gtx": "^0.3.0",
46
-    "http-server": "^0.9.0",
47
-    "require-directory": "^2.0.0"
34
+    "del": "^6.0.0",
35
+    "gulp": "^4.0.2",
36
+    "shelljs": "^0.8.5",
37
+    "ssh2-sftp-client": "^7.2.0"
48 38
   }
49 39
 }

+ 45 - 0
upload/development.js

@@ -0,0 +1,45 @@
1
+const shell = require('shelljs')
2
+const path = require('path');
3
+const config = {
4
+  ip: "192.168.3.109", // ssh地址
5
+  username: "root", // ssh 用户名
6
+  port: 22,      //端口
7
+  password: "DStech@123", // ssh 密码
8
+  // path: '/home/itsm/project/web/pc', // 上传地址,删除地址(第一次部署)
9
+  path: '/home/itsm/project/web/pc/assets', // 上传地址,删除地址(bower_components太大,第二次以后的更新只更新assets,具体的灵活应变)
10
+  // buildPath: '../dist' // 本地打包后文件地址(第一次部署)
11
+  buildPath: '../dist/assets' // 本地打包后文件地址(bower_components太大,第二次以后的更新只更新assets,具体的灵活应变)
12
+}
13
+let Client = require('ssh2-sftp-client');
14
+
15
+function connectSSh() {
16
+  let sftp = new Client();
17
+  sftp.connect({
18
+    host: config.ip,
19
+    port: config.port,
20
+    username: config.username,
21
+    password: config.password
22
+  }).then(() => {
23
+    console.log("-----先执行删除服务器文件-----")
24
+    return sftp.rmdir(config.path, true);
25
+  }).then(() => {
26
+    // 上传文件
27
+    console.log("-----开始上传-----")
28
+    return sftp.uploadDir(path.resolve(__dirname, config.buildPath), config.path);
29
+  }).then((data) => {
30
+    console.log("-----上传完成-----");
31
+    sftp.end();
32
+  }).catch((err) => {
33
+    console.log(err, '-----失败-----');
34
+    sftp.end();
35
+  });
36
+}
37
+function runTask() {
38
+  //打包完成
39
+  if (shell.exec(`npm run build`).code == 0) {
40
+    console.log("-----打包成功-----");
41
+    //提交上传
42
+    connectSSh();
43
+  }
44
+}
45
+runTask()

+ 45 - 0
upload/production.js

@@ -0,0 +1,45 @@
1
+const shell = require('shelljs')
2
+const path = require('path');
3
+const config = {
4
+  ip: "139.129.255.139", // ssh地址
5
+  username: "root", // ssh 用户名
6
+  port: 22,      //端口
7
+  password: "DStech@123", // ssh 密码
8
+  // path: '/home/md2/newweb/pc', // 上传地址,删除地址(第一次部署)
9
+  path: '/home/md2/newweb/pc/assets', // 上传地址,删除地址(bower_components太大,第二次以后的更新只更新assets,具体的灵活应变)
10
+  // buildPath: '../dist' // 本地打包后文件地址(第一次部署)
11
+  buildPath: '../dist/assets' // 本地打包后文件地址(bower_components太大,第二次以后的更新只更新assets,具体的灵活应变)
12
+}
13
+let Client = require('ssh2-sftp-client');
14
+
15
+function connectSSh() {
16
+  let sftp = new Client();
17
+  sftp.connect({
18
+    host: config.ip,
19
+    port: config.port,
20
+    username: config.username,
21
+    password: config.password
22
+  }).then(() => {
23
+    console.log("-----先执行删除服务器文件-----")
24
+    return sftp.rmdir(config.path, true);
25
+  }).then(() => {
26
+    // 上传文件
27
+    console.log("-----开始上传-----")
28
+    return sftp.uploadDir(path.resolve(__dirname, config.buildPath), config.path);
29
+  }).then((data) => {
30
+    console.log("-----上传完成-----");
31
+    sftp.end();
32
+  }).catch((err) => {
33
+    console.log(err, '-----失败-----');
34
+    sftp.end();
35
+  });
36
+}
37
+function runTask() {
38
+  //打包完成
39
+  if (shell.exec(`npm run build`).code == 0) {
40
+    console.log("-----打包成功-----");
41
+    //提交上传
42
+    connectSSh();
43
+  }
44
+}
45
+runTask()