Skip to content

Commit

Permalink
chore: packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
doubleface committed Oct 16, 2018
1 parent 03cbe42 commit 402e892
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 38 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.token.json
konnector-dev-config.json*
fixtures/*
data/*

# NPM
node_modules/
Expand Down Expand Up @@ -31,5 +32,3 @@ desktop.ini
# Default
# /!\ KEEP THIS SECTION THE LAST ONE
!.gitkeep

*.pdf
54 changes: 35 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
language: node_js
node_js:
- '8'

- '8'
env:
global:
- GH_USER_EMAIL="[email protected]"
- GH_USER_NAME="cozy-bot"
- DEPLOY_REPOSITORY="[email protected]:konnectors/edg.git"
# Token to access Cozy Registry, you should replace it with a token specific to this konnector
cache:
yarn: true
directories:
- node_modules
- node_modules
branches:
except:
- build
- build-debug
script:
- yarn lint
- yarn build
- yarn lint
- yarn build
- yarn run check
deploy:
# publish dev versions
- provider: script
repo: konnectors/cozy-konnector-template
skip-cleanup: true
script: DEPLOY_BRANCH=build && yarn deploy && yarn cozyPublish
on:
branch: master
# publish stable versions and beta versions based on tags
- provider: script
repo: konnectors/cozy-konnector-template
skip-cleanup: true
script: DEPLOY_BRANCH=build && yarn deploy && yarn cozyPublish
on:
tags: true
- provider: script
skip-cleanup: true
script: DEPLOY_BRANCH=build yarn deploy && yarn cozyPublish
on:
branch: master
- provider: script
skip-cleanup: true
script: DEPLOY_BRANCH=build yarn deploy && yarn cozyPublish
on:
tags: true
before_install:
# run the yarn travisDeployKey command to genrate this
# - openssl aes-256-cbc -K $encrypted_0b21ecdcf920_key -iv $encrypted_0b21ecdcf920_iv
# -in github_deploy_key.enc -out /tmp/github_deploy_key -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/github_deploy_key
- ssh-add /tmp/github_deploy_key
after_deploy:
- rm /tmp/github_deploy_key
- ssh-add -D
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# General code owners
* @taratatach
* @konnectors/maintainers @taratatach
5 changes: 3 additions & 2 deletions manifest.konnector
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"language": "node",
"icon": "icon.png",
"slug": "edg",
"source": "git://github.com/taratatach/cozy-konnector-edg.git",
"source": "git://github.com/konnectors/edg.git",
"editor": "taratatach",
"vendor_link": "https://ael.eauxdegrenoblealpes.fr",
"categories": ["energy"],
Expand Down Expand Up @@ -66,5 +66,6 @@
}
}
}
}
},
"manifest_version": "2"
}
30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"repository": {
"type": "git",
"url": "git+https://github.com/konnectors/cozy-konnector-template.git"
"url": "git+https://github.com/konnectors/edg.git"
},
"keywords": [],
"author": "Cozy Cloud",
Expand All @@ -22,27 +22,31 @@
"start": "node ./src/index.js",
"dev": "cozy-run-dev",
"standalone": "cozy-run-standalone",
"pretest": "npm run clean",
"test": "konitor testit .",
"check": "konitor check .",
"clean": "rm -rf ./data",
"build": "webpack",
"precommit": "yarn lint",
"lint": "eslint --fix .",
"deploy": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build} --repo=${DEPLOY_REPOSITORY:-https://[email protected]/taratatach/cozy-konnector-edg.git}",
"cozyPublish": "cozy-app-publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})"
"deploy": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build} --repo=${DEPLOY_REPOSITORY:-https://[email protected]/konnectors/edg.git}",
"cozyPublish": "cozy-app-publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})",
"travisDeployKey": "./bin/generate_travis_deploy_key"
},
"dependencies": {
"cozy-konnector-libs": "4.4.0"
"cozy-konnector-libs": "4.11.2"
},
"devDependencies": {
"copy-webpack-plugin": "4.5.1",
"cozy-app-publish": "^0.3.6",
"cozy-jobs-cli": "1.0.17",
"eslint": "4.19.1",
"eslint-config-cozy-app": "0.5.1",
"copy-webpack-plugin": "4.5.3",
"cozy-app-publish": "0.8.5",
"cozy-jobs-cli": "1.5.1",
"eslint": "5.7.0",
"eslint-config-cozy-app": "1.1.3",
"git-directory-deploy": "1.5.1",
"husky": "0.14.3",
"konitor": "0.8.2",
"webpack": "4.6.0",
"webpack-cli": "2.0.15"
"husky": "1.1.2",
"konitor": "0.9.0",
"svgo": "1.1.1",
"webpack": "4.20.2",
"webpack-cli": "3.1.2"
}
}
26 changes: 25 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
var path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const fs = require('fs')
const SvgoInstance = require('svgo')

const entry = require('./package.json').main

const svgo = new SvgoInstance()

let iconName
try {
iconName = JSON.parse(fs.readFileSync('manifest.konnector', 'utf8')).icon
// we run optimize only on SVG
if (!iconName.match(/\.svg$/)) iconName = null
} catch (e) {
// console.error(`Unable to read the icon path from manifest: ${e}`)
}
const appIconRX = iconName && new RegExp(`[^/]*/${iconName}`)

module.exports = {
entry,
target: 'node',
Expand All @@ -15,8 +30,17 @@ module.exports = {
{ from: 'manifest.konnector' },
{ from: 'package.json' },
{ from: 'README.md' },
{ from: 'assets' },
{ from: 'assets', transform: optimizeSVGIcon },
{ from: '.travis.yml' },
{ from: 'LICENSE' }
])
]
}

function optimizeSVGIcon(buffer, path) {
if (appIconRX && path.match(appIconRX)) {
return svgo.optimize(buffer).then(resp => resp.data)
} else {
return buffer
}
}

0 comments on commit 402e892

Please sign in to comment.