Skip to content
Snippets Groups Projects
Commit 54299815 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

feat: konnector init

parents
No related branches found
No related tags found
1 merge request!1feat: konnector init
# editorconfig.org
# editorconfig is a unified configuration file that all editors can take
# into account
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
# Connector config
.account
.token.json
konnector-dev-config.json*
fixtures/*
data/*
# NPM
node_modules/
npm-debug.log
yarn-error.log
# Build
build/
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
desktop.ini
# Editors / IDEs
.floo
.flooignore
.idea/
# Default
# /!\ KEEP THIS SECTION THE LAST ONE
!.gitkeep
build
node_modules
package.json
language: node_js
node_js:
- '12.22.11'
env:
global:
- MATTERMOST_CHANNEL=publication
# Token to access Cozy Registry, you should replace it with a token specific to this konnector
- secure: CQ44ZVjPAIVRvGgMcduSAX4VmaOrzF3nrJXPFUsNQ2tMVVdaAlI1zTNkdfntqigZgz6Mpk9x+2FcA8qrkNzQ4cW0lPP9f5dBtSH1xetfpXDFKprW4bqzmhgXSXJFTOYxkChOBPmCYJr+Vv4XqDkv/dBEPdfRSgvVyd5YxHSd5HBU91rKyR+Hox7LTnhmlXleLIs11EQgp7RK+L28MBCtCqAa2niFlKKRlqupm2FSpZzxCh9qeY0wKCQzPE+QZUm4waJ1SUGKQwbzAfyOxu2O6rwzaTSknfdJoSX6AMxjRTWBC9c3VfUGM3wjVJIqMhiUj2FQhVIjiDyX/W60/q3UMC5WYzSvEDDfhnKCPwiUKSU7HvSxx9q2YP34evxKo7KPahz9zLlQZvW+GBMyI9hbMDBTALuQVVzhftsvqfrogyYhkEPviiYiVADWNxhacsbUjRA5svXnZvtmCPo7fLFwel/krgC5Z8AwAY0YxWjSHNVScUkieSDCrlxrC09vTtG60unt9gtXbD5ruUkDLWSUwHBv2p0WY1TdP+2Vlf3yYfBvEVbqi59AxG+T17bq7Xv3QZnkrwC+UOCNCeg+gHPv+fRpUaYWzCO4uaoY/nlJa7RulQFhGca3A//6xRo/KgWw9JJnOXJelNjE9oHCUu9xShotUZKOF+O93V/BRqs9ITo=
cache:
yarn: true
directories:
- node_modules
branches:
except:
- build
- build-debug
script:
- yarn lint
- yarn build
deploy:
- 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
# General code owners
* @konnectors/maintainers
How to contribute to Cozy Connector?
====================================
Thank you for your interest in contributing to Cozy! There are many ways to contribute, and we appreciate all of them.
Security Issues
---------------
If you discover a security issue, please bring it to our attention right away! Please **DO NOT** file a public issue, instead send your report privately to security AT cozycloud DOT cc.
Security reports are greatly appreciated and we will publicly thank you for it. We currently do not offer a paid security bounty program, but are not ruling it out in the future.
Bug Reports
-----------
While bugs are unfortunate, they're a reality in software. We can't fix what we don't know about, so please report liberally. If you're not sure if something is a bug or not, feel free to file a bug anyway.
Opening an issue is as easy as following [this link][issues] and filling out the fields. Here are some things you can write about your bug:
- A short summary
- What did you try, step by step?
- What did you expect?
- What did happen instead?
- What is the version of the Cozy Connector?
Pull Requests
-------------
Please keep in mind that:
- Pull-Requests point to the `master` branch
- You need to cover your code and feature by tests
- You may add documentation in the `/docs` directory to explain your choices if needed
- We recommend to use [task lists][checkbox] to explain steps / features in your Pull-Request description
- You do __not__ need to build app to submit a PR
### Workflow
Pull requests are the primary mechanism we use to change Cozy. GitHub itself has some [great documentation][pr] on using the Pull Request feature. We use the _fork and pull_ model described there.
- [ ] clone the repository with `git clone`
- [ ] add a remote to your profile with `git remote add fork`
- [ ] create a new branch for the work with `git checkout --branch my-branch origin/master`
- [ ] add some changes with `git add --patch .`
- [ ] create at least one commit with `git commit --message '{fix,feat,chore,test,doc}: a 70 character long description of the changes'`
- [ ] check styleguide, formating, linting and tests
- [ ] push to your remote with `git push fork my-branch`
- [ ] create a Pull-Request with a detailed description
Writing documentation
---------------------
Documentation improvements are very welcome. We try to keep a good documentation in the `/docs` folder. But, you know, we are developers, we can forget to document important stuff that look obvious to us. And documentation can always be improved.
Community
---------
You can help us by making our community even more vibrant. For example, you can write a blog post, take some videos, answer the questions on [the forum][forum], organize new meetups, and speak about what you like in Cozy!
[issues]: ../../issues
[pr]: https://help.github.com/categories/collaborating-with-issues-and-pull-requests/
[forum]: https://forum.cozy.io/
This diff is collapsed.
[Cozy][cozy] <YOUR SUPER NEW KONNECTOR NAME>
=======================================
What's Cozy?
------------
![Cozy Logo](https://cdn.rawgit.com/cozy/cozy-guidelines/master/templates/cozy_logo_small.svg)
[Cozy] is a personal data platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you.
What is this konnector about ?
------------------------------
This konnector retrieves your <SOME DATA> and <SOME OTHER DATA> from <SERVICE>
<YOUR DESCRIPTION HERE>
### Open a Pull-Request
If you want to work on this konnector and submit code modifications, feel free to open pull-requests!
</br>See :
* the [contributing guide][contribute] for more information about how to properly open pull-requests.
* the [konnectors development guide](https://docs.cozy.io/en/tutorials/konnector/)
### Run and test
Create a `konnector-dev-config.json` file at the root with your test credentials :
```javascript
{
"COZY_URL": "http://cozy.tools:8080",
"fields": {"login":"zuck.m@rk.fb", "password":"123456"}
}
```
Then :
```sh
yarn
yarn standalone
```
For running the konnector connected to a Cozy server and more details see [konnectors tutorial](https://docs.cozy.io/en/tutorials/konnector/)
### Cozy-konnector-libs
This connector uses [cozy-konnector-libs](https://github.com/cozy/cozy-konnector-libs). It brings a bunch of helpers to interact with the Cozy server and to fetch data from an online service.
### Maintainer
The lead maintainers for this konnector is <YOUR NAME>
### Get in touch
You can reach the Cozy Community by:
- [Konnectors tutorial](https://docs.cozy.io/en/tutorials/konnector/)
- Chatting with us on IRC [#cozycloud on Libera.Chat][libera]
- Posting on our [Forum]
- Posting issues on the [Github repos][github]
- Say Hi! on [Twitter]
License
-------
<YOUR KONNECTOR NAME> is developed by <your name> and distributed under the [AGPL v3 license][agpl-3.0].
[cozy]: https://cozy.io "Cozy Cloud"
[agpl-3.0]: https://www.gnu.org/licenses/agpl-3.0.html
[libera]: https://web.libera.chat/#cozycloud
[forum]: https://forum.cozy.io/
[github]: https://github.com/cozy/
[nodejs]: https://nodejs.org/
[standard]: https://standardjs.com
[twitter]: https://twitter.com/mycozycloud
[webpack]: https://webpack.js.org
[yarn]: https://yarnpkg.com
[travis]: https://travis-ci.org
[contribute]: CONTRIBUTING.md
assets/icon.png

11.9 KiB

{
"presets": [
["cozy-app", {
"node": true,
"react": false,
"lib": true
}]
]
}
#!/bin/bash
set -e
if [ -z "$GITHUB_TOKEN" ]; then
echo ""
echo "GITHUB_TOKEN environment variable is missing"
echo ""
echo "TRAVIS DEPLOY KEY GENERATOR"
echo ""
echo "What it does : generate a new private and public key, add the public key as a deploy key
with write access to the origin remote github repository, encrypt the private key as
github_deploy_key.enc and add the configuration necessary to use it in .travis.yml file"
echo ""
echo "Use it like this:"
echo ""
echo " GITHUB_TOKEN=\`cat ~/secret/GITHUB_TOKEN\` ./generate_travis_deploy_key"
echo ""
echo "where ~/secret/GITHUB_TOKEN is a file containing a github token with write access to the current repository : (origin)"
echo ""
echo "You must have the travis executable installed on your system and available in the PATH"
echo ""
exit
fi
url="$(git config --get remote.origin.url)"
owner="$(echo $url | cut -d: -f2 | cut -d/ -f1)"
reponame="$(echo $url | cut -d/ -f2 | cut -d. -f1)"
# generate a new private and public key
ssh-keygen -t rsa -b 4096 -f github_deploy_key -N '' -C $url -q 1>/dev/null
pubkey="$(cat github_deploy_key.pub)"
# add the PUBLIC key to the github repository as a deploy key with write access
curl https://api.github.com/repos/$owner/$reponame/keys -H "Authorization: token $GITHUB_TOKEN" --data @- << EOF
{
"title": "travis deploy key",
"key": "$pubkey",
"read_only": false
}
EOF
# Synchronize Travis to get latest repo
travis sync --pro
# use travis to encrypt the private key as github_deploy_key.enc and remove the private key
travis encrypt-file github_deploy_key --pro --add --no-interactive -w /tmp/github_deploy_key -f
git add github_deploy_key.enc
# cleaning
rm github_deploy_key
rm github_deploy_key.pub
param([String]$github_token = $env:GITHUB_TOKEN)
$ErrorActionPreference = "Stop"
function cut {
param(
[Parameter(ValueFromPipeline = $True)] [string]$inputobject,
[string]$delimiter,
[int]$fieldIndex
)
process {
return ($inputobject -split $delimiter)[$fieldIndex - 1]
}
}
if (!$github_token) {
echo ""
echo "GITHUB_TOKEN environment variable is missing"
echo ""
echo "TRAVIS DEPLOY KEY GENERATOR"
echo ""
echo "What it does : generate a new private and public key, add the public key as a deploy key
with write access to the origin remote github repository, encrypt the private key as
github_deploy_key.enc and add the configuration necessary to use it in .travis.yml file"
echo ""
echo "Use it like this:"
echo ""
echo " $env:GITHUB_TOKEN=""GITHUB_TOKEN"""
echo " .\generate_travis_deploy_key.ps1"
echo ""
echo "Or like this:"
echo ""
echo " .\generate_travis_deploy_key.ps1 ""GITHUB_TOKEN"""
echo ""
echo "where ""GITHUB_TOKEN"" is a github token with write access to the current repository : (origin)"
echo ""
echo "You must have the travis executable installed on your system and available in the PATH"
echo ""
echo "You also must be authenticated on travis cli (travis login --auto)"
echo ""
exit
}
$url = "$(git config --get remote.origin.url)"
$owner = "$(echo $url | cut -d / -f 4)"
$reponame = "$(echo $url | cut -d / -f 5 | cut -d \. -f 1)"
# generate a new private and public key
ssh-keygen -t rsa -b 4096 -f github_deploy_key -N System.String -C "$url" -q
$pubkey = "$(cat github_deploy_key.pub)"
# add the PUBLIC key to the github repository as a deploy key with write access
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
curl https://api.github.com/repos/$owner/$reponame/keys -H @{"Authorization" = "token $github_token"} -Method "POST" -Body @"
{
"title": "travis deploy key",
"key": "$pubkey",
"read_only": false
}
"@
# use travis to encrypt the private key as github_deploy_key.enc and remove the private key
travis encrypt-file github_deploy_key --pro --add --no-interactive -w /tmp/github_deploy_key -f
git add github_deploy_key.enc
# cleaning
rm github_deploy_key
rm github_deploy_key.pub
File added
{
"version": "1.0.0",
"name": "Connector template",
"type": "konnector",
"language": "node",
"icon": "icon.png",
"slug": "template",
"source": "git@github.com:konnectors/template.git",
"editor": "Cozy",
"vendor_link": "Link to the target website",
"categories": ["others"],
"fields": {
"login": {
"type": "text"
},
"password": {
"type": "password"
}
},
"folders": [{"defaultDir": "$administrative/$konnector/$account"}],
"data_types": [
"bill"
],
"screenshots": [],
"permissions": {
"bank operations": {
"type": "io.cozy.bank.operations"
},
"bills": {
"type": "io.cozy.bills"
},
"files": {
"type": "io.cozy.files"
},
"accounts": {
"type": "io.cozy.accounts"
}
},
"developer": {
"name": "Cozy Cloud",
"url": "https://cozy.io"
},
"langs": ["fr", "en"],
"locales": {
"fr": {
"short_description": "Récupère la liste de livres",
"long_description": "Récupère la liste de livre sur le site exemple",
"permissions": {
"bank operations": {
"description": "Utilisé pour relier les factures à des operations bancaires"
},
"bills": {
"description": "Utilisé pour sauver les données des factures"
},
"files": {
"description": "Utilisé pour sauvegarder les factures"
},
"accounts": {
"description": "Utilisé pour obtenir les données du compte"
}
}
},
"en": {
"short_description": "Fetch a list of books",
"long_description": "Fetch a list of books from the example website",
"permissions": {
"bank operations": {
"description": "Required to link bank operations to bills"
},
"bills": {
"description": "Required to save the bills data"
},
"files": {
"description": "Required to save the bills"
},
"accounts": {
"description": "Required to get the account's data"
}
}
}
},
"banksTransactionRegExp": "\\bbooks\\b",
"manifest_version": "2"
}
{
"name": "cozy-konnector-template",
"version": "1.0.0",
"description": "",
"repository": {
"type": "git",
"url": "git@github.com:konnectors/template.git"
},
"keywords": [],
"author": "Cozy Cloud",
"license": "AGPL-3.0",
"main": "./src/index.js",
"eslintConfig": {
"extends": [
"cozy-app"
]
},
"eslintIgnore": [
"build",
"data"
],
"husky": {
"hooks": {
"pre-commit": "yarn lint"
}
},
"scripts": {
"start": "node ./src/index.js",
"dev": "cozy-konnector-dev",
"standalone": "cozy-konnector-standalone",
"pretest": "npm run clean",
"clean": "rm -rf ./data",
"build": "webpack",
"lint": "eslint --fix .",
"deploy": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build} --repo=${DEPLOY_REPOSITORY:-$npm_package_repository_url}",
"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.52.1"
},
"devDependencies": {
"cozy-jobs-cli": "1.17.6",
"cozy-konnector-build": "1.3.1"
}
}
{
"extends": ["cozy-konnector"]
}
const {
BaseKonnector,
requestFactory,
scrape,
log,
utils
} = require('cozy-konnector-libs')
const request = requestFactory({
// The debug mode shows all the details about HTTP requests and responses. Very useful for
// debugging but very verbose. This is why it is commented out by default
// debug: true,
// Activates [cheerio](https://cheerio.js.org/) parsing on each page
cheerio: true,
// If cheerio is activated do not forget to deactivate json parsing (which is activated by
// default in cozy-konnector-libs
json: false,
// This allows request-promise to keep cookies between requests
jar: true
})
const VENDOR = 'template'
const baseUrl = 'http://books.toscrape.com'
module.exports = new BaseKonnector(start)
// The start function is run by the BaseKonnector instance only when it got all the account
// information (fields). When you run this connector yourself in "standalone" mode or "dev" mode,
// the account information come from ./konnector-dev-config.json file
// cozyParameters are static parameters, independents from the account. Most often, it can be a
// secret api key.
async function start(fields, cozyParameters) {
log('info', 'Authenticating ...')
if (cozyParameters) log('debug', 'Found COZY_PARAMETERS')
await authenticate.bind(this)(fields.login, fields.password)
log('info', 'Successfully logged in')
// The BaseKonnector instance expects a Promise as return of the function
log('info', 'Fetching the list of documents')
const $ = await request(`${baseUrl}/index.html`)
// cheerio (https://cheerio.js.org/) uses the same api as jQuery (http://jquery.com/)
log('info', 'Parsing list of documents')
const documents = await parseDocuments($)
// Here we use the saveBills function even if what we fetch are not bills,
// but this is the most common case in connectors
log('info', 'Saving data to Cozy')
await this.saveBills(documents, fields, {
// This is a bank identifier which will be used to link bills to bank operations. These
// identifiers should be at least a word found in the title of a bank operation related to this
// bill. It is not case sensitive.
identifiers: ['books']
})
}
// This shows authentication using the [signin function](https://github.com/konnectors/libs/blob/master/packages/cozy-konnector-libs/docs/api.md#module_signin)
// even if this in another domain here, but it works as an example
function authenticate(username, password) {
return this.signin({
url: `http://quotes.toscrape.com/login`,
formSelector: 'form',
formData: { username, password },
// The validate function will check if the login request was a success. Every website has a
// different way to respond: HTTP status code, error message in HTML ($), HTTP redirection
// (fullResponse.request.uri.href)...
validate: (statusCode, $, fullResponse) => {
log(
'debug',
fullResponse.request.uri.href,
'not used here but should be useful for other connectors'
)
// The login in toscrape.com always works except when no password is set
if ($(`a[href='/logout']`).length === 1) {
return true
} else {
// cozy-konnector-libs has its own logging function which format these logs with colors in
// standalone and dev mode and as JSON in production mode
log('error', $('.error').text())
return false
}
}
})
}
// The goal of this function is to parse a HTML page wrapped by a cheerio instance
// and return an array of JS objects which will be saved to the cozy by saveBills
// (https://github.com/konnectors/libs/blob/master/packages/cozy-konnector-libs/docs/api.md#savebills)
function parseDocuments($) {
// You can find documentation about the scrape function here:
// https://github.com/konnectors/libs/blob/master/packages/cozy-konnector-libs/docs/api.md#scrape
const docs = scrape(
$,
{
title: {
sel: 'h3 a',
attr: 'title'
},
amount: {
sel: '.price_color',
parse: normalizePrice
},
fileurl: {
sel: 'img',
attr: 'src',
parse: src => `${baseUrl}/${src}`
}
},
'article'
)
return docs.map(doc => ({
...doc,
// The saveBills function needs a date field
// even if it is a little artificial here (these are not real bills)
date: new Date(),
currency: 'EUR',
filename: `${utils.formatDate(new Date())}_${VENDOR}_${doc.amount.toFixed(
2
)}EUR${doc.vendorRef ? '_' + doc.vendorRef : ''}.jpg`,
vendor: VENDOR
}))
}
// Convert a price string to a float
function normalizePrice(price) {
return parseFloat(price.replace('£', '').trim())
}
const {
BaseKonnector,
scrape,
saveBills,
log,
utils,
errors
} = require('cozy-konnector-libs')
const Browser = require('cozy-konnector-libs/dist/libs/CozyBrowser')
const browser = new Browser()
const cheerio = require('cheerio')
const VENDOR = 'template'
const baseUrl = 'http://books.toscrape.com'
module.exports = new BaseKonnector(start)
// The start function is run by the BaseKonnector instance only when it got all the account
// information (fields). When you run this connector yourself in "standalone" mode or "dev" mode,
// the account information come from ./konnector-dev-config.json file
// cozyParameters are static parameters, independents from the account. Most often, it can be a
// secret api key.
async function start(fields, cozyParameters) {
log('info', 'Authenticating ...')
if (cozyParameters) log('debug', 'Found COZY_PARAMETERS')
await authenticate(fields.login, fields.password)
log('info', 'Successfully logged in')
log('info', 'Fetching the list of documents')
await browser.visit(`${baseUrl}/index.html`)
const $ = cheerio.load(browser.html())
log('info', 'Parsing list of documents')
const documents = await parseDocuments($)
// Here we use the saveBills function even if what we fetch are not bills,
// but this is the most common case in connectors
log('info', 'Saving data to Cozy')
await saveBills(documents, fields, {
// This is a bank identifier which will be used to link bills to bank operations. These
// identifiers should be at least a word found in the title of a bank operation related to this
// bill. It is not case sensitive.
identifiers: ['books'],
sourceAccount: this.accountId,
sourceAccountIdentifier: fields.login
})
}
// This shows authentication using the [signin function](https://github.com/konnectors/libs/blob/master/packages/cozy-konnector-libs/docs/api.md#module_signin)
// even if this in another domain here, but it works as an example
async function authenticate(username, password) {
await browser.visit('http://quotes.toscrape.com/login')
await browser.fill('#username', username)
await browser.fill('#password', password)
await browser.pressButton(`[type=submit]`)
if (
!browser.redirected ||
browser.location._url !== 'http://quotes.toscrape.com/'
) {
log('error', browser.query('.error').innerHTML)
throw new Error(errors.LOGIN_FAILED)
}
}
// The goal of this function is to parse a HTML page wrapped by a cheerio instance
// and return an array of JS objects which will be saved to the cozy by saveBills
// (https://github.com/konnectors/libs/blob/master/packages/cozy-konnector-libs/docs/api.md#savebills)
function parseDocuments($) {
// You can find documentation about the scrape function here:
// https://github.com/konnectors/libs/blob/master/packages/cozy-konnector-libs/docs/api.md#scrape
const docs = scrape(
$,
{
title: {
sel: 'h3 a',
attr: 'title'
},
amount: {
sel: '.price_color',
parse: normalizePrice
},
fileurl: {
sel: 'img',
attr: 'src',
parse: src => `${baseUrl}/${src}`
}
},
'article'
)
return docs.map(doc => ({
...doc,
// The saveBills function needs a date field
// even if it is a little artificial here (these are not real bills)
date: new Date(),
currency: 'EUR',
filename: `${utils.formatDate(new Date())}_${VENDOR}_${doc.amount.toFixed(
2
)}EUR${doc.vendorRef ? '_' + doc.vendorRef : ''}.jpg`,
vendor: VENDOR,
metadata: {
// It can be interesting to add the date of import. This is not mandatory but may be
// useful for debugging or data migration
importDate: new Date(),
// Document version, useful for migration after change of document structure
version: 1
}
}))
}
// Convert a price string to a float
function normalizePrice(price) {
return parseFloat(price.replace('£', '').trim())
}
var path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const webpack = require('webpack')
const fs = require('fs')
const SvgoInstance = require('svgo')
const entry = require('./package.json').main
const readManifest = () =>
JSON.parse(fs.readFileSync(path.join(__dirname, './manifest.konnector')))
const svgo = new SvgoInstance({
plugins: [
{
inlineStyles: { onlyMatchedOnce: false }
}
]
})
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',
mode: 'none',
output: {
path: path.join(__dirname, 'build'),
filename: 'index.js'
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'manifest.konnector' },
{ from: 'package.json' },
{ from: 'README.md' },
{ from: 'assets', transform: optimizeSVGIcon },
{ from: '.travis.yml' },
{ from: 'LICENSE' }
]
}),
new webpack.DefinePlugin({
__WEBPACK_PROVIDED_MANIFEST__: JSON.stringify(readManifest())
})
],
module: {
// to ignore the warnings like :
// WARNING in ../libs/node_modules/bindings/bindings.js 76:22-40
// Critical dependency: the request of a dependency is an expression
// Since we cannot change this dependency. I think it won't hide more important messages
exprContextCritical: false
}
}
function optimizeSVGIcon(buffer, path) {
if (appIconRX && path.match(appIconRX)) {
return svgo.optimize(buffer).then(resp => resp.data)
} else {
return buffer
}
}
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment