Skip to content

Commit

Permalink
fix(ci): add semantic-release, now.sh, Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell committed Aug 13, 2018
1 parent 3f086e9 commit 3582875
Show file tree
Hide file tree
Showing 10 changed files with 4,455 additions and 1,034 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
yarn-error.log
dist
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
language: node_js
node_js: lts/*
cache:
yarn: true
directories:
- ~/.npm
- node_modules
notifications:
email: false
before_deploy:
- yarn install now --no-save
- now rm mi18n --token $NOW_TOKEN --yes || true
deploy:
- provider: script
script: now --public --token $NOW_TOKEN
skip_cleanup: true
on:
master: true
after_success:
- test $TRAVIS_BRANCH = "master" &&
yarn travis-deploy-once "yarn semantic-release"
branches:
except:
- /^v\d+\.\d+\.\d+$/
env:
global:
- secure: Lz+tEVu3T/LTXICa/O58JLvV5ivUdrIPhzFHQbFeceymBOeZxA5+drjLRL1g3goTPnyxyaVpHqOyMPGk1YT27GdmgZIVNAsByYNDXr466gxxu7VMgZkDHKmxZhemgij7wuTzbxWZdmt/UFOgn3SzeTL0ep5hJ20DEl4p4vI9/xB1jckUQVAH5ZFaeOF5UvhV0jmNJR2Z9N0rYlfaUhJlC1N8hnPA4m05wVZO/RC3nIxYW1xXJJZtiHspRyQ0EFqvogFalzxj0nSFcsj0TbSEiWqPhCh7p0iQXrTt+/cgqrh9RXjX+jRAjNHWiW0VLlRxzG+rrANJkCZj9K5dWuOjn3nQz6bI8CH5AtrUweFus53UAPRRZnjIR0Ua3ybyn0Yadfm0YERXz+L2c6iefRhI5ran1I8QW/IAWpv2U1Z1AIVz2BCoXUQK1fU/qAwI2r+miuFQsW/fs8TK4rvHYq/+1Ct6XvoSh/Y6BivEciQN+9bNOF89FnwLyYC4Oo6p1GFGU/bnvtHLUYAPCJg5Yuy5faC/7RwRNWedxJDUk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ev8rBTj9H2cRPqHTPfoylEKbdQUash9riFvPCXLhTw0eFnC61JQFH7oxYFVtKxcawHrDzx+6nJVDBLyt55tTApKQqb/fZa2bf9vvINccnM1EPxu4eWY4SRc4wHHEhplLgXlPKaT+LlWlfP4Kiv19qdxe6FZMkENj2LQulrK1JJwShpnJFTuWLLUbmSeg3Ga7olTw7hQFzqbTjLvqKJ4TtyNatbbbacoqPiwzQx+10NMLtCQCZdCDCDK2JzkXsCOaD8G0ukWCDnEY4qTwdm06C6+f7PCZCLo6H2nOGUb60Yob/rEFzQWMZAVSb7G6jDkBlCgqG8tLqVWCdVWlw1iB4EWksbLOlkrB8oWKaoFlX1uFvgyWaw4WpAcVwno7yhCYzOTfLMqgOUyqBRKeYh4IUYDWpcvSuEnTRaz7waJml1b9Hdga0IuK7yy5iHQRM=
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mi18n v0.4.0
# mi18n v0.4.1

Add multi-lingual support to any JavaScript app or module with this light-weight package.

Expand Down
6 changes: 0 additions & 6 deletions dist/mi18n.min.js

This file was deleted.

Binary file removed dist/mi18n.min.js.gz
Binary file not shown.
3 changes: 3 additions & 0 deletions now.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "mi18n"
}
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
"description": "A simple yet robust i18n solution for universal JavaScript apps.",
"main": "dist/mi18n.min.js",
"scripts": {
"test": "npm run build && node ./node_modules/mocha/bin/mocha --compilers js:babel-core/register ./src/**/*.test.js",
"test:watch": "npm run test -- --reporter min --watch",
"build": "rm -rf ./dist/ && node ./node_modules/webpack/bin/webpack.js -p --progress --colors",
"start": "webpack -d | webpack-dev-server -d",
"tag": "babel-node --no-babel-rc --presets=es2015 tools/run tag"
"test": "node node_modules/mocha/bin/mocha --compilers js:babel-core/register src/**/*.test.js",
"test:watch": "yarn test -- --reporter min --watch",
"build": "rm -rf dist/ && webpack -p --progress --colors",
"start": "webpack-dev-server -d",
"tag": "babel-node --no-babel-rc --presets=es2015 tools/run tag",
"semantic-release": "semantic-release",
"travis-deploy-once": "travis-deploy-once"
},
"repository": {
"url": "http://github.com/draggable/mi18n",
"url": "https://github.com/Draggable/mi18n",
"type": "git"
},
"keywords": [
Expand Down Expand Up @@ -64,8 +66,10 @@
"json-update": "^3.0.0",
"mocha": "^3.2.0",
"replace-in-file": "^2.5.0",
"semantic-release": "^15.9.8",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.4"
"webpack-dev-server": "^2.4.4",
"travis-deploy-once": "^5.0.2"
},
"eslintConfig": {
"plugins": [
Expand Down Expand Up @@ -99,7 +103,8 @@
"quotes": [
2,
"single"
]
],
"require-jsdoc": 1
}
},
"dependencies": {}
Expand Down
6 changes: 4 additions & 2 deletions src/mi18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const DEFAULT_CONFIG = {
}

/**
* Main mi18n class.
* Main mi18n class
* @class I18N
* @classdesc methods and data store for mi18n
*/
export class I18N {
/**
Expand Down Expand Up @@ -176,7 +178,7 @@ export class I18N {
_this.loaded.push(locale)
return resolve(_this.langs[locale])
})
.catch(({ response: { config: { url }, status, statusText } }) => {
.catch(() => {
const lang = _this.applyLanguage.call(_this, locale)
resolve(lang)
})
Expand Down
65 changes: 30 additions & 35 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
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 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('-p');
const PRODUCTION = process.argv.includes('-p')

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

const plugins = [
new MinifyPlugin({
removeDebugger: true
}, {
comments: false
}),
new MinifyPlugin(
{
removeDebugger: true,
},
{
comments: false,
}
),
new BannerPlugin(bannerTemplate),
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: /\.(js)$/,
threshold: 10240,
minRatio: 0.8
})
];
minRatio: 0.8,
}),
]

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

const webpackConfig = {
context: resolve(__dirname, 'dist'),
entry: {
mi18n: resolve(__dirname, 'src/mi18n.js')
mi18n: resolve(__dirname, 'src', 'mi18n.js'),
},
output: {
path: resolve(__dirname, 'dist'),
libraryTarget: 'commonjs2',
filename: '[name].min.js'
filename: '[name].min.js',
},
module: {
rules: [
Expand All @@ -50,24 +48,21 @@ const webpackConfig = {
},
{
test: /\.js$/,
loader: 'babel-loader'
}
]
loader: 'babel-loader',
},
],
},
devtool,
plugins,
resolve: {
modules: [
resolve(__dirname, 'src'),
'node_modules'
],
extensions: ['.js', '.json']
modules: [resolve(__dirname, 'src'), 'node_modules'],
extensions: ['.js', '.json'],
},
devServer: {
inline: true,
contentBase: 'demo/',
noInfo: true
}
};
noInfo: true,
},
}

module.exports = webpackConfig;
module.exports = webpackConfig
Loading

0 comments on commit 3582875

Please sign in to comment.