From c5a79140dd9cf774dee516dd6d1d7eddbb444604 Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Wed, 3 Jul 2019 10:17:26 +0800 Subject: [PATCH] Read from .gitmodules instead of folders --- .drone.yml | 11 ++++++++++- drone_gen.js | 6 +++--- package.json | 1 + yarn.lock | 5 +++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 3666f3a..2481cd9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -50,7 +50,16 @@ steps: image: plugins/git settings: recursive: true - submodule_override: {} + submodule_override: + backend-core: 'https://git.makerforce.io/beep/backend-core.git' + backend-store: 'https://git.makerforce.io/beep/backend-store.git' + backend-transcription: 'https://git.makerforce.io/beep/backend-transcription.git' + backend-login: 'https://git.makerforce.io/beep/backend-login.git' + backend-heartbeat: 'https://git.makerforce.io/beep/backend-heartbeat.git' + backend-auth: 'https://git.makerforce.io/beep/backend-auth.git' + backend-pictures: 'https://git.makerforce.io/beep/backend-pictures.git' + backend-permissions: 'https://git.makerforce.io/beep/backend-permissions.git' + backend-webrtc: 'https://git.makerforce.io/beep/backend-webrtc.git' - name: copy-docker-compose image: appleboy/drone-scp settings: diff --git a/drone_gen.js b/drone_gen.js index 2f1d1db..1ffeffb 100644 --- a/drone_gen.js +++ b/drone_gen.js @@ -2,11 +2,11 @@ const fs = require('fs'); const path = require('path'); const cwd = process.cwd(); const yaml = require('js-yaml'); +const ini = require('ini'); +const gitmodules = ini.parse(fs.readFileSync('.gitmodules', 'utf-8')); +const submodules = Object.values(gitmodules).map(m => m.path); const folders = fs.readdirSync(cwd, { withFileTypes: true }); -const submodules = folders.filter(f => - f.isDirectory() && fs.readdirSync(path.join(cwd, f.name)).includes('.git') -).map(f => f.name); const dockers = folders.filter(f => f.isDirectory() && fs.readdirSync(path.join(cwd, f.name)).includes('Dockerfile') ).map(f => f.name); diff --git a/package.json b/package.json index b77f5da..b751b28 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "generate": "node drone_gen.js" }, "dependencies": { + "ini": "^1.3.5", "js-yaml": "^3.13.0" } } diff --git a/yarn.lock b/yarn.lock index 876ae29..5f26931 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14,6 +14,11 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +ini@^1.3.5: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + js-yaml@^3.13.0: version "3.13.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e"