Skip to content

Commit

Permalink
Merge pull request #437 from cozy/master
Browse files Browse the repository at this point in the history
chore: version 0.6.9 πŸš‘ πŸš‘
  • Loading branch information
y-lohse authored Oct 24, 2017
2 parents 5e1ba86 + 88a24e0 commit c0ed892
Show file tree
Hide file tree
Showing 130 changed files with 1,543 additions and 636 deletions.
19 changes: 12 additions & 7 deletions config/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')

const SRC_DIR = path.resolve(__dirname, '../src')

module.exports = function (production) {
module.exports = function(production) {
return {
resolve: {
modules: ['node_modules', SRC_DIR],
extensions: ['.js', '.json', '.css'],
alias: {
'redux-cozy-client': path.resolve(SRC_DIR, './lib/redux-cozy-client'),
'cozy-client': path.resolve(SRC_DIR, './lib/cozy-client'),
'react-cozy-helpers': path.resolve(SRC_DIR, './lib/react-cozy-helpers')
}
},
Expand Down Expand Up @@ -44,16 +44,16 @@ module.exports = function (production) {
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: () => [require('autoprefixer')({ browsers: ['last 2 versions'] })]
plugins: () => [
require('autoprefixer')({ browsers: ['last 2 versions'] })
]
}
}
]
})
}
],
noParse: [
/localforage\/dist/
]
noParse: [/localforage\/dist/]
},
plugins: [
new ScriptExtHtmlWebpackPlugin({
Expand All @@ -67,7 +67,12 @@ module.exports = function (production) {
require('postcss-discard-duplicates'),
require('postcss-discard-empty')
].concat(
production ? require('csswring')({preservehacks: true, removeallcomments: true}) : []
production
? require('csswring')({
preservehacks: true,
removeallcomments: true
})
: []
)
})
]
Expand Down
23 changes: 10 additions & 13 deletions config/webpack.config.cozy-ui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict'

const { LoaderOptionsPlugin } = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')

module.exports = {
Expand Down Expand Up @@ -31,22 +30,20 @@ module.exports = {
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: () => [require('autoprefixer')({ browsers: ['last 2 versions'] })]
plugins: () => [
require('autoprefixer')({ browsers: ['last 2 versions'] })
]
}
},
'stylus-loader'
{
loader: 'stylus-loader',
options: {
use: [require('cozy-ui/stylus')()]
}
}
]
})
}
]
},
plugins: [
new LoaderOptionsPlugin({
options: {
stylus: {
use: [ require('cozy-ui/stylus')() ]
}
}
})
]
}
}
10 changes: 6 additions & 4 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ module.exports = {
devtool: '#source-map',
externals: ['cozy'],
module: {
rules: [{
test: require.resolve('cozy-bar/dist/cozy-bar.js'),
loader: 'imports-loader?css=./cozy-bar.css'
}]
rules: [
{
test: require.resolve('cozy-bar/dist/cozy-bar.js'),
loader: 'imports-loader?css=./cozy-bar.css'
}
]
},
plugins: [
new DefinePlugin({
Expand Down
4 changes: 1 addition & 3 deletions config/webpack.config.disable-contexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
const { IgnorePlugin } = require('webpack')

module.exports = {
plugins: [
new IgnorePlugin(/^\.\.\/contexts/)
]
plugins: [new IgnorePlugin(/^\.\.\/contexts/)]
}
13 changes: 9 additions & 4 deletions config/webpack.config.manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

const CopyPlugin = require('copy-webpack-plugin')

module.exports = function (production, app) {
module.exports = function(production, app) {
// Method to modify the manifest slug on dev builds. On production builds the
// manifest should be copied without modification.
//
// For dev builds we use the generic "app" slug to share the same application
// domain for each applications.
function transformManifest (buffer) {
if (production) { return buffer }
function transformManifest(buffer) {
if (production) {
return buffer
}

const content = JSON.parse(buffer.toString())
content.slug = 'app'
Expand All @@ -19,7 +21,10 @@ module.exports = function (production, app) {
return {
plugins: [
new CopyPlugin([
{ from: `targets/${app}/manifest.webapp`, transform: transformManifest },
{
from: `targets/${app}/manifest.webapp`,
transform: transformManifest
},
{ from: 'README.md' },
{ from: 'LICENSE' }
])
Expand Down
2 changes: 1 addition & 1 deletion config/webpack.config.pictures.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = function (production) {
module.exports = function(production) {
return {
module: {
rules: [
Expand Down
14 changes: 8 additions & 6 deletions config/webpack.config.preact.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

module.exports = {
module: {
rules: [{
test: /\.jsx$/,
exclude: /node_modules\/(?!(cozy-ui))/,
loader: 'babel-loader'
}]
rules: [
{
test: /\.jsx$/,
exclude: /node_modules\/(?!(cozy-ui))/,
loader: 'babel-loader'
}
]
},
resolve: {
extensions: ['.jsx'],
alias: {
'react': 'preact-compat',
react: 'preact-compat',
'react-dom': 'preact-compat'
}
}
Expand Down
7 changes: 5 additions & 2 deletions config/webpack.config.vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

const CopyPlugin = require('copy-webpack-plugin')

module.exports = function (production, app) {
module.exports = function(production, app) {
return {
plugins: [
new CopyPlugin([
{ from: `targets/${app}/vendor/assets/app-icon.svg`, to: 'public/app-icon.svg' },
{
from: `targets/${app}/vendor/assets/app-icon.svg`,
to: 'public/app-icon.svg'
},
{ from: `targets/${app}/vendor/assets`, ignore: ['.gitkeep'] }
])
]
Expand Down
64 changes: 40 additions & 24 deletions config/webpack.target.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fs = require('fs')
const { DefinePlugin } = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = function (production, app) {
module.exports = function(production, app) {
var entry = {
app: path.resolve(__dirname, `../targets/${app}/web/main`)
}
Expand All @@ -25,32 +25,48 @@ module.exports = function (production, app) {
})
]

if (fs.existsSync(path.resolve(__dirname, `../targets/${app}/web/services.jsx`))) {
if (
fs.existsSync(path.resolve(__dirname, `../targets/${app}/web/services.jsx`))
) {
entry.services = path.resolve(__dirname, `../targets/${app}/web/services`)
plugins.push(new HtmlWebpackPlugin({
template: path.resolve(__dirname, `../targets/${app}/web/services.ejs`),
title: `cozy-${app}`,
filename: 'services.html',
chunks: ['services'],
inject: 'head',
minify: {
collapseWhitespace: true
}
}))
plugins.push(
new HtmlWebpackPlugin({
template: path.resolve(__dirname, `../targets/${app}/web/services.ejs`),
title: `cozy-${app}`,
filename: 'services.html',
chunks: ['services'],
inject: 'head',
minify: {
collapseWhitespace: true
}
})
)
}

if (fs.existsSync(path.resolve(__dirname, `../targets/${app}/web/public/main.jsx`))) {
entry['public/app'] = path.resolve(__dirname, `../targets/${app}/web/public/main`)
plugins.push(new HtmlWebpackPlugin({
template: path.resolve(__dirname, `../targets/${app}/web/public/index.ejs`),
title: `cozy-${app}`,
filename: 'public/index.html',
chunks: ['public/app'],
inject: 'head',
minify: {
collapseWhitespace: true
}
}))
if (
fs.existsSync(
path.resolve(__dirname, `../targets/${app}/web/public/main.jsx`)
)
) {
entry['public/app'] = path.resolve(
__dirname,
`../targets/${app}/web/public/main`
)
plugins.push(
new HtmlWebpackPlugin({
template: path.resolve(
__dirname,
`../targets/${app}/web/public/index.ejs`
),
title: `cozy-${app}`,
filename: 'public/index.html',
chunks: ['public/app'],
inject: 'head',
minify: {
collapseWhitespace: true
}
})
)
}

return {
Expand Down
10 changes: 6 additions & 4 deletions config/webpack.target.mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')

const pkg = require(path.resolve(__dirname, '../package.json'))

module.exports = function (production, app) {
module.exports = function(production, app) {
return {
entry: {
app: [path.resolve(__dirname, `../targets/${app}/mobile/main`)]
Expand All @@ -19,12 +19,14 @@ module.exports = function (production, app) {
new DefinePlugin({
__ALLOW_HTTP__: !production,
__TARGET__: JSON.stringify('mobile'),
__SENTRY_TOKEN__: JSON.stringify('9259817fbb44484b8b7a0a817d968ae4'),
__SENTRY_TOKEN__: production
? JSON.stringify('9259817fbb44484b8b7a0a817d968ae4')
: JSON.stringify('29bd1255b6d544a1b65435a634c9ff67'),
__APP_VERSION__: JSON.stringify(pkg.version)
}),
new ProvidePlugin({
'PouchDB': 'pouchdb',
'pouchdbFind': 'pouchdb-find',
PouchDB: 'pouchdb',
pouchdbFind: 'pouchdb-find',
'cozy.client': 'cozy-client-js/dist/cozy-client.js',
'cozy.bar': 'cozy-bar/dist/cozy-bar.mobile.js'
}),
Expand Down
Loading

0 comments on commit c0ed892

Please sign in to comment.