Skip to content

Commit

Permalink
fix(now): deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell committed Aug 13, 2018
1 parent 293335c commit 31eac82
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 241 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ notifications:
before_deploy:
- yarn add now --no-save
- now rm mi18n --token $NOW_TOKEN --yes || true
- cp dist/* demo/
deploy:
- provider: script
script: now --public --token $NOW_TOKEN
script: yarn deploy
skip_cleanup: true
on:
master: true
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# mi18n Changelog

- v0.4.3 - Fix now.sh deploy
- v0.4.2 - Add semantic release script, fix deploy bug, update changelog.md
- v0.4.1 - Change `preloaded` to override, fix bug where overrides would replace loaded languages
- v0.3.4 - Merge pull request #8 from kevinchappell/chore/update-test
Expand Down
3 changes: 0 additions & 3 deletions demo/site.js

This file was deleted.

7 changes: 6 additions & 1 deletion now.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"name": "mi18n"
"name": "mi18n",
"alias": "mi18n",
"type": "static",
"files": [
"demo"
]
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"test": "node node_modules/mocha/bin/mocha --require babel-core/register src/**/*.test.js",
"test:watch": "yarn test -- --reporter min --watch",
"build": "rm -rf dist/ && webpack --mode production --progress",
"deploy": "now demo/ --public --token $NOW_TOKEN -A ../now.json && now alias",
"build": "rm -rf dist/ && webpack --env.production --progress",
"start": "webpack-dev-server --mode development",
"semantic-release": "semantic-release",
"travis-deploy-once": "travis-deploy-once"
Expand Down Expand Up @@ -54,7 +55,6 @@
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-loader": "^7.1.5",
"babel-minify-webpack-plugin": "^0.3.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"chai": "^4.1.2",
Expand All @@ -67,9 +67,10 @@
"eslint-plugin-prettier": "^2.6.2",
"json-update": "^3.0.0",
"mocha": "^5.2.0",
"replace-in-file": "^3.4.0",
"replace-in-file": "^3.4.2",
"semantic-release": "^15.9.8",
"travis-deploy-once": "^5.0.2",
"uglifyjs-webpack-plugin": "^1.2.7",
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5"
Expand Down
23 changes: 6 additions & 17 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,12 @@ const pkg = require('./package.json')
const { resolve } = require('path')
const { BannerPlugin } = require('webpack')
const CompressionPlugin = require('compression-webpack-plugin')
const MinifyPlugin = require('babel-minify-webpack-plugin')

const PRODUCTION = process.argv.includes('production')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')

const bannerTemplate = [`${pkg.name} - ${pkg.homepage}`, `Version: ${pkg.version}`, `Author: ${pkg.author}`].join('\n')

const plugins = [
new MinifyPlugin(
{
removeDebugger: true,
},
{
comments: false,
}
),
new UglifyJsPlugin(),
new BannerPlugin(bannerTemplate),
new CompressionPlugin({
asset: '[path].gz[query]',
Expand All @@ -27,10 +18,8 @@ const plugins = [
}),
]

const devtool = PRODUCTION ? false : 'inline-source-map'

const webpackConfig = {
mode: PRODUCTION ? 'production' : 'development',
const webpackConfig = env => ({
mode: env.production ? 'production' : 'development',
context: resolve(__dirname),
entry: {
mi18n: './src/mi18n.js',
Expand All @@ -54,7 +43,7 @@ const webpackConfig = {
},
],
},
devtool,
devtool: env.production && 'inline-source-map',
plugins,
resolve: {
modules: [resolve(__dirname, 'src'), 'node_modules'],
Expand All @@ -65,6 +54,6 @@ const webpackConfig = {
contentBase: 'demo/',
noInfo: true,
},
}
})

module.exports = webpackConfig
Loading

0 comments on commit 31eac82

Please sign in to comment.