Skip to content

Commit

Permalink
fix: copy language files from module
Browse files Browse the repository at this point in the history
devServer should use local language files for development sans internet. resolves #1068
  • Loading branch information
kevinchappell committed Aug 22, 2020
1 parent d19e562 commit 0fee6c3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
"build:vendor": "babel-node tools/build-vendor",
"build": "webpack --mode production -p --progress --config tools/webpack.config",
"build:all": "npm-run-all build:plugins build:vendor build copy",
"copy": "cp -a dist/* demo/assets/js/ && cp CONTRIBUTING.md docs/contributing.md && cp LICENSE docs/license.md && mkdir -p demo/assets/lang && cp node_modules/formbuilder-languages/*.lang demo/assets/lang/",
"copy": "cp -a dist/* demo/assets/js/ && cp CONTRIBUTING.md docs/contributing.md && cp LICENSE docs/license.md && npm run copy:lang",
"copy:lang": "babel-node tools/copy-language-files",
"deploy:all": "npm-run-all deploy:demo deploy:site",
"deploy:demo": "node tools/deploy-demo.js",
"deploy:site": "node tools/deploy-site.js",
Expand All @@ -92,7 +93,7 @@
"semantic-release": "semantic-release",
"start:devServer": "webpack-dev-server --mode development --open --config tools/webpack.config",
"prestart": "npm run build:vendor",
"start": "npm run start:devServer",
"start": "npm-run-all build:vendor copy:lang start:devServer",
"test": "npm run-script build",
"travis-deploy-once": "travis-deploy-once"
},
Expand Down Expand Up @@ -125,7 +126,7 @@
"eslint-config-prettier": "^4.2.0",
"eslint-loader": "^2.1.2",
"eslint-plugin-prettier": "^3.0.1",
"formbuilder-languages": "^0.1.0",
"formbuilder-languages": "latest",
"fs-extra": "^8.0.1",
"html-webpack-harddisk-plugin": "^1.0.1",
"html-webpack-plugin": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const styles = {
}

export const defaultI18n = {
location: 'https://formbuilder.online/assets/lang/',
location: 'assets/lang/',
}

export const config = {}
10 changes: 10 additions & 0 deletions tools/copy-language-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import path from 'path'
import { ensureDirSync, copySync } from 'fs-extra'
import { resolve } from 'path'

const langsFilesPath = path.dirname(require.resolve('formbuilder-languages'))
const targetDir = resolve(__dirname, '../demo/assets/lang')

ensureDirSync(targetDir)

copySync(langsFilesPath, 'demo/assets/lang/')
4 changes: 1 addition & 3 deletions tools/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ const webpackConfig = {
{
loader: 'postcss-loader',
options: {
plugins: [
autoprefixer(),
],
plugins: [autoprefixer()],
sourceMap: !PRODUCTION,
},
},
Expand Down

0 comments on commit 0fee6c3

Please sign in to comment.