Skip to content

Commit

Permalink
feat: build locales from uploadcare-widget (#52)
Browse files Browse the repository at this point in the history
* remove hardcoded languages
* build available locales with rollup
* fix linter
  • Loading branch information
jeetiss authored Nov 5, 2019
1 parent 7fa0afe commit 284c7a9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ yarn-error.log
dist
en
e2e_test
locales.js
32 changes: 0 additions & 32 deletions locales.js

This file was deleted.

13 changes: 13 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import replace from 'rollup-plugin-replace'
import uploadcare from 'uploadcare-widget'

export default [
// esm build width all locales
Expand Down Expand Up @@ -71,5 +72,17 @@ export default [
}),
babel()
]
},

{
input: 'src/langs.js',
output: {
format: 'esm',
file: 'locales.js',
sourcemap: false
},
plugins: [
replace({ __LANGS__: JSON.stringify(uploadcare.locales) })
]
}
]
3 changes: 1 addition & 2 deletions src/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ const Dialog = props => {
setState({
opened: true,
sourse: 'natural'
})
}
})}
>
Open panel
</button>
Expand Down
2 changes: 2 additions & 0 deletions src/langs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line no-undef
export default __LANGS__

0 comments on commit 284c7a9

Please sign in to comment.