Merge branch 'hotfix/21.56.9' into master
[gitter.git] / build-scripts / make-module
blob982ff53bc28659d2426343afc69223f240b06bbf
1 #!/bin/bash
3 set -euo pipefail
4 IFS=$'\n\t'
6 set -x
7 module_name=$1
9 mkdir -p "modules/${module_name}/lib"
10 mkdir -p "modules/${module_name}/test"
12 if [[ ! -f modules/${module_name}/package.json ]]; then
13 cat <<EOD > "modules/${module_name}/package.json"
15 "name": "gitter-web-${module_name}",
16 "version": "1.0.0",
17 "main": "lib/index.js",
18 "directories": {
19 "lib": "lib",
20 "test": "test"
22 "scripts": {
23 "test": "mocha test/"
25 "private": true
27 EOD
30 if [[ ! -f modules/${module_name}/test/.eslintrc.json ]]; then
31 cat <<EOD > "modules/${module_name}/test/.eslintrc.json"
33 "env": {
34 "commonjs": true,
35 "node": true,
36 "mocha": true
38 "plugins": [
39 "mocha"
41 "rules": {
42 "mocha/no-exclusive-tests": "error"
45 EOD
48 npm i "gitter-web-${module_name}@file:./modules/${module_name}/" --save
49 npm run shrinkwrap
50 npm run link