Skip to content

Commit

Permalink
Merge pull request #16 from kevinchappell/master
Browse files Browse the repository at this point in the history
fix(webpack): absolute url no longer needed in webpack, remove unused files, bithound is dead
  • Loading branch information
kevinchappell authored Aug 13, 2018
2 parents 59044ea + c78a731 commit 293335c
Show file tree
Hide file tree
Showing 8 changed files with 996 additions and 1,041 deletions.
1 change: 0 additions & 1 deletion .bithoundrc

This file was deleted.

3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js: lts/*
node_js:
- "9"
cache:
yarn: true
directories:
Expand Down
3 changes: 0 additions & 3 deletions bower.json

This file was deleted.

47 changes: 25 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"name": "mi18n",
"version": "0.4.1",
"version": "0.4.2",
"description": "A simple yet robust i18n solution for universal JavaScript apps.",
"main": "dist/mi18n.min.js",
"scripts": {
"test": "node node_modules/mocha/bin/mocha --compilers js:babel-core/register src/**/*.test.js",
"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 -p --progress --colors",
"start": "webpack-dev-server -d",
"tag": "babel-node --no-babel-rc --presets=es2015 tools/run tag",
"build": "rm -rf dist/ && webpack --mode production --progress",
"start": "webpack-dev-server --mode development",
"semantic-release": "semantic-release",
"travis-deploy-once": "travis-deploy-once"
},
"engines": {
"node": ">=9.10.0"
},
"repository": {
"url": "https://github.com/Draggable/mi18n",
"type": "git"
Expand Down Expand Up @@ -49,27 +51,28 @@
},
"devDependencies": {
"axios": "^0.18.0",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.0.0",
"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.4.0",
"chai": "^3.5.0",
"compression-webpack-plugin": "^0.4.0",
"eslint": "^3.19.0",
"eslint-config-google": "^0.7.1",
"eslint-config-prettier": "^2.9.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-mocha": "^4.9.0",
"eslint-plugin-prettier": "^2.6.0",
"babel-preset-env": "^1.7.0",
"chai": "^4.1.2",
"compression-webpack-plugin": "^1.1.11",
"eslint": "^5.3.0",
"eslint-config-google": "^0.9.1",
"eslint-config-prettier": "^3.0.1",
"eslint-loader": "^2.1.0",
"eslint-plugin-mocha": "^5.2.0",
"eslint-plugin-prettier": "^2.6.2",
"json-update": "^3.0.0",
"mocha": "^3.2.0",
"replace-in-file": "^2.5.0",
"mocha": "^5.2.0",
"replace-in-file": "^3.4.0",
"semantic-release": "^15.9.8",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.4",
"travis-deploy-once": "^5.0.2"
"travis-deploy-once": "^5.0.2",
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5"
},
"eslintConfig": {
"plugins": [
Expand Down
4 changes: 2 additions & 2 deletions src/mi18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class I18N {
if (!value) {
return
}
const tokens = value.match(/\{[^\}]+?\}/g)
const tokens = value.match(/\{[^}]+?\}/g)
let token

if (args && tokens) {
Expand All @@ -122,7 +122,7 @@ export class I18N {
value = value.replace(_this.makeSafe(tokens[i]), args[token] || '')
}
} else {
value = value.replace(/\{[^\}]+?\}/g, args)
value = value.replace(/\{[^}]+?\}/g, args)
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/mi18n.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('I18N', () => {
override: {
'te-ST': {
testKey: 'Teeesst',
testVars: 'I saw {count} {animals}',
},
},
}
Expand Down Expand Up @@ -44,6 +45,14 @@ describe('I18N', () => {
const str = mi18n.get('testKey')
expect(str).to.equal('Teeesst')
})

it('shall return a string with vars', () => {
const str = mi18n.get('testVars', {
count: 3,
animals: 'chickens'
})
expect(str).to.equal('I saw 3 chickens')
})
})
})
})
Expand Down
8 changes: 5 additions & 3 deletions webpack.config.babel.js → webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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('production')

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

Expand All @@ -27,11 +27,13 @@ const plugins = [
}),
]

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

const webpackConfig = {
mode: PRODUCTION ? 'production' : 'development',
context: resolve(__dirname),
entry: {
mi18n: resolve(__dirname, 'src', 'mi18n.js'),
mi18n: './src/mi18n.js',
},
output: {
path: resolve(__dirname, 'dist'),
Expand Down
Loading

0 comments on commit 293335c

Please sign in to comment.