From aff83a66beda2a835e0fe31b2c9b91cb18b7c47f Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Tue, 8 May 2018 13:11:12 +0100 Subject: [PATCH] fix bamboo script publish restore general tslint file --- scripts/npm-publish.sh | 2 +- scripts/update-version.sh | 101 +++++++---------------- tsconfig.json | 1 + tslint.json | 166 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 195 insertions(+), 75 deletions(-) create mode 100644 tslint.json diff --git a/scripts/npm-publish.sh b/scripts/npm-publish.sh index 1210d8f6f2..64d4981d9b 100755 --- a/scripts/npm-publish.sh +++ b/scripts/npm-publish.sh @@ -146,7 +146,7 @@ fi if $EXEC_BUILD == true; then echo "====== Build ADF ===== " - npm run build + npm run build-lib fi for PACKAGE in ${projects[@]} diff --git a/scripts/update-version.sh b/scripts/update-version.sh index fa9c75bfe3..21c8930cd2 100755 --- a/scripts/update-version.sh +++ b/scripts/update-version.sh @@ -3,9 +3,9 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" eval JS_API=true eval GNU=false -eval EXEC_COMPONENT=true eval DIFFERENT_JS_API=false eval AUTO=false +eval ONLY_COMPONENT=false; eval projects=( "core" "content-services" @@ -21,7 +21,7 @@ show_help() { echo "" echo "-sj or -sjsapi don't update js-api version" echo "-vj or -versionjsapi to use a different version of js-api" - echo "-demoshell execute the change version only in the demo shell " + echo "-components execute the change version only in the components " echo "-v or -version version to update" echo "-nextalpha update next alpha version of js-api and lib automatically" echo "-nextbeta update next beta version of js-api and lib automatically" @@ -99,22 +99,16 @@ version_js_change() { DIFFERENT_JS_API=true } -only_demoshell() { +only_components() { echo "====== UPDATE Only the demo shell versions =====" - EXEC_COMPONENT=false + ONLY_COMPONENT=true } update_component_version() { echo "====== UPDATE PACKAGE VERSION of ${PACKAGE} to ${VERSION} version in all the package.json ======" - DESTDIR="$DIR/../${1}" - sed "${sedi[@]}" "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/g" ${DESTDIR}/package.json -} - -clean_lock() { - echo "====== clean lock file ${1} ======" DESTDIR="$DIR/../lib/${1}" - rm ${DESTDIR}/package-lock.json + sed "${sedi[@]}" "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/g" ${DESTDIR}/package.json } update_component_dependency_version(){ @@ -165,35 +159,6 @@ update_component_js_version(){ } -update_demo_shell_dependency_version(){ - - for (( k=0; k<${projectslength}; k++ )); - do - echo "====== UPDATE VERSION OF DEMO-SHELL to ${projects[$k]} version ${VERSION} ======" - DESTDIR="$DIR/../demo-shell/" - - sed "${sedi[@]}" "s/\"${prefix}${projects[$k]}\": \".*\"/\"${prefix}${projects[$k]}\": \"${VERSION}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${prefix}${projects[$k]}\": \"~.*\"/\"${prefix}${projects[$k]}\": \"~${VERSION}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${prefix}${projects[$k]}\": \"^.*\"/\"${prefix}${projects[$k]}\": \"^${VERSION}\"/g" ${DESTDIR}/package.json - done -} - -update_demo_shell_js_version(){ - echo "====== UPDATE VERSION OF DEMO-SHELL to alfresco-js-api version ${1} ======" - DESTDIR="$DIR/../demo-shell/" - PACKAGETOCHANGE="alfresco-js-api" - - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \".*\"/\"${PACKAGETOCHANGE}\": \"${1}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \"~.*\"/\"${PACKAGETOCHANGE}\": \"${1}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \"^.*\"/\"${PACKAGETOCHANGE}\": \"${1}\"/g" ${DESTDIR}/package.json -} - -clean_lock_demo_shell(){ - echo "====== clean lock file demo-shell ======" - DESTDIR="$DIR/../demo-shell/" - rm ${DESTDIR}/package-lock.json -} - while [[ $1 == -* ]]; do case "$1" in -h|--help|-\?) show_help; exit 0;; @@ -205,7 +170,7 @@ while [[ $1 == -* ]]; do -nextalpha) next_alpha_mode; shift;; -beta) last_beta_mode; shift;; -nextbeta) next_beta_mode; shift;; - -demoshell) only_demoshell; shift;; + -components) only_components; shift;; -*) shift;; esac done @@ -226,27 +191,28 @@ cd "$DIR/../" projectslength=${#projects[@]} -if $EXEC_COMPONENT == true; then - echo "====== UPDATE COMPONENTS ======" +echo "====== UPDATE COMPONENTS ======" - # use for loop to read all values and indexes - for (( i=0; i<${projectslength}; i++ )); - do - clean_lock ${projects[$i]} - echo "====== UPDATE COMPONENT ${projects[$i]} ======" - update_component_version ${projects[$i]} - update_component_dependency_version ${projects[$i]} +# use for loop to read all values and indexes +for (( i=0; i<${projectslength}; i++ )); +do + echo "====== UPDATE COMPONENT ${projects[$i]} ======" + update_component_version ${projects[$i]} + update_component_dependency_version ${projects[$i]} - if $JS_API == true; then + if $JS_API == true; then - if $DIFFERENT_JS_API == true; then - update_component_js_version ${projects[$i]} ${VERSION_JS_API} - else - update_component_js_version ${projects[$i]} ${VERSION} - fi + if $DIFFERENT_JS_API == true; then + update_component_js_version ${projects[$i]} ${VERSION_JS_API} + else + update_component_js_version ${projects[$i]} ${VERSION} + fi - fi - done + fi +done + + +if $ONLY_COMPONENT == false; then echo "====== UPDATE TOTAL BUILD======" @@ -259,25 +225,12 @@ if $EXEC_COMPONENT == true; then update_total_build_dependency_js_version ${VERSION} fi fi + fi + echo "====== UPDATE DEMO SHELL ======" -clean_lock_demo_shell - -update_demo_shell_dependency_version - -if $JS_API == true; then - if $DIFFERENT_JS_API == true; then - update_demo_shell_js_version ${VERSION_JS_API} - else - update_demo_shell_js_version ${VERSION} - fi -fi - DESTDIR="$DIR/../demo-shell/" sed "${sedi[@]}" "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/g" ${DIR}/../demo-shell/package.json - -if $EXEC_COMPONENT == true; then - sed "${sedi[@]}" "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/g" ${DIR}/../package.json -fi +sed "${sedi[@]}" "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/g" ${DIR}/../package.json diff --git a/tsconfig.json b/tsconfig.json index dc27c2135c..daf9f9eb64 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,6 +25,7 @@ "integration", "scripts", "assets", + "tools", "node_modules" ] } diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000000..1835f6e10e --- /dev/null +++ b/tslint.json @@ -0,0 +1,166 @@ +{ + "rulesDirectory": [ + "node_modules/codelyzer", + "./adf-tslint-rules" + ], + "rules": { + "align": [ + true, + "parameters", + "statements" + ], + "ban": [ + true, + "eval", + { + "name": [ + "fdescribe", + "fit" + ], + "message": "don't focus tests" + } + ], + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "eofline": true, + "forin": true, + "indent": [ + true, + "spaces" + ], + "interface-name": false, + "jsdoc-format": true, + "label-position": true, + "max-line-length": [ + true, + 180 + ], + "member-ordering": [ + true, + "static-before-instance", + "variables-before-functions" + ], + "no-any": false, + "no-arg": true, + "no-bitwise": false, + "no-conditional-assignment": true, + "no-consecutive-blank-lines": true, + "no-console": [ + true, + "log", + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-constructor-vars": false, + "no-debugger": true, + "no-duplicate-variable": true, + "no-empty": false, + "no-eval": true, + "no-inferrable-types": false, + "no-internal-module": true, + "no-require-imports": false, + "no-shadowed-variable": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unused-expression": true, + "no-unused-variable": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "no-var-requires": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "quotemark": [ + true, + "single", + "avoid-escape" + ], + "radix": true, + "semicolon": true, + "switch-default": true, + "trailing-comma": [ + true, + { + "multiline": "never", + "singleline": "never" + } + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef": false, + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "use-strict": false, + "variable-name": [ + true, + "check-format", + "allow-leading-underscore", + "ban-keywords" + ], + "callable-types": true, + "import-blacklist": [ + true, + "rxjs" + ], + "import-spacing": true, + "interface-over-type-literal": true, + "member-access": false, + "no-empty-interface": true, + "no-string-literal": false, + "no-string-throw": true, + "prefer-const": false, + "unified-signatures": true, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-typecast", + "check-type", + "check-typecast", + "check-module" + ], + "component-selector": [ + true, + "element", + "adf", + "kebab-case" + ], + "ordered-imports": false, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": false, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true, + "no-access-missing-member": false, + "adf-file-name": true, + "adf-class-name": true, + "adf-prefix-name": true + } +}