Merge branch 'fix-frontend-dir' into 'develop'

fix: frontend directory structre and other minor fixes

See merge request kailash/listmonk!1
This commit is contained in:
Kailash Nadh 2019-05-27 11:51:34 +00:00
commit 4f9bb269a3
39 changed files with 50 additions and 53 deletions

4
.gitignore vendored
View File

@ -1,8 +1,6 @@
frontend/node_modules/ frontend/node_modules/
frontend/my/node_modules/
frontend/.cache/ frontend/.cache/
frontend/yarn.lock frontend/yarn.lock
frontend/my/yarn.lock
.vscode/ .vscode/
config.toml config.toml

View File

@ -1,5 +1,5 @@
BIN := listmonk BIN := listmonk
STATIC := config.toml.sample schema.sql queries.sql public email-templates frontend/my/build:/frontend STATIC := config.toml.sample schema.sql queries.sql public email-templates frontend/build:/frontend
HASH := $(shell git rev-parse --short HEAD) HASH := $(shell git rev-parse --short HEAD)
COMMIT_DATE := $(shell git show -s --format=%ci ${HASH}) COMMIT_DATE := $(shell git show -s --format=%ci ${HASH})
@ -8,20 +8,20 @@ VERSION := ${HASH} (${COMMIT_DATE})
.PHONY: build-frontend .PHONY: build-frontend
build-frontend: build-frontend:
cd frontend/my && yarn install && yarn build cd frontend && yarn install && yarn build
.PHONY: quickdev .PHONY: quickdev
quickdev: quickdev:
@ if [ ! -d "frontend/my/node_modules" ]; then \ @ if [ ! -d "frontend/node_modules" ]; then \
echo "Installing frontend deps"; \ echo "Installing frontend deps"; \
cd frontend/my && yarn install; \ cd frontend && yarn install; \
fi fi
@ if [ ! -d "frontend/my/build" ]; then \ @ if [ ! -d "frontend/build" ]; then \
echo "Creating build directory"; \ echo "Creating build directory"; \
mkdir -p frontend/my/build; \ mkdir -p frontend/build; \
echo "Building frontend assets"; \ echo "Building frontend assets"; \
cd frontend/my && yarn build; \ cd frontend && yarn build; \
fi fi
@ echo -e "\nBuilding go binary\n" @ echo -e "\nBuilding go binary\n"

View File

@ -15,7 +15,7 @@ There are two independent components, the Go backend and the React frontend. In
### 2. Run the frontend ### 2. Run the frontend
`cd frontend/my` and `yarn start` `cd frontend` and `yarn start`
### 3. Setup an Nginx proxy endpoint ### 3. Setup an Nginx proxy endpoint

View File

@ -35,7 +35,7 @@ upload_uri = "/uploads"
# Maximum concurrent workers that will attempt to send messages # Maximum concurrent workers that will attempt to send messages
# simultaneously. This should depend on the number of CPUs the # simultaneously. This should depend on the number of CPUs the
# machine has and also the number of simultaenous e-mails the # machine has and also the number of simultaenous e-mails the
# mail server will # mail server will
concurrency = 100 concurrency = 100
# The number of errors (eg: SMTP timeouts while e-mailing) a running # The number of errors (eg: SMTP timeouts while e-mailing) a running
@ -51,6 +51,7 @@ port = 5432
user = "listmonk" user = "listmonk"
password = "" password = ""
database = "listmonk" database = "listmonk"
ssl_mode = "disable"
# TQekh4quVgGc3HQ # TQekh4quVgGc3HQ

View File

@ -2,3 +2,4 @@
"presets": ["env", "react"], "presets": ["env", "react"],
"plugins": [["transform-react-jsx", { "pragma": "h" }]] "plugins": [["transform-react-jsx", { "pragma": "h" }]]
} }

View File

@ -1,34 +0,0 @@
{
"name": "my",
"version": "0.1.0",
"private": true,
"dependencies": {
"antd": "^3.6.5",
"axios": "^0.18.0",
"bizcharts": "^3.2.5-beta.4",
"dayjs": "^1.7.5",
"react": "^16.4.1",
"react-app-rewire-less": "^2.1.3",
"react-app-rewired": "^1.6.2",
"react-dom": "^16.4.1",
"react-quill": "^1.3.1",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-app-rewired start",
"build": "GENERATE_SOURCEMAP=false PUBLIC_URL=/frontend/ react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"devDependencies": {
"babel-plugin-import": "^1.11.0",
"eslint-plugin-prettier": "^3.0.1",
"less-plugin-npm-import": "^2.1.0",
"prettier": "1.15.3"
}
}

View File

@ -1,6 +1,34 @@
{ {
"name": "my",
"version": "0.1.0",
"private": true,
"dependencies": { "dependencies": {
"create-react-app": "^1.5.2", "antd": "^3.6.5",
"react": "^16.4.1" "axios": "^0.18.0",
"bizcharts": "^3.2.5-beta.4",
"dayjs": "^1.7.5",
"react": "^16.4.1",
"react-app-rewire-less": "^2.1.3",
"react-app-rewired": "^1.6.2",
"react-dom": "^16.4.1",
"react-quill": "^1.3.1",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-app-rewired start",
"build": "GENERATE_SOURCEMAP=false PUBLIC_URL=/frontend/ react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"devDependencies": {
"babel-plugin-import": "^1.11.0",
"eslint-plugin-prettier": "^3.0.1",
"less-plugin-npm-import": "^2.1.0",
"prettier": "1.15.3"
} }
} }

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 244 B

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 244 B

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

2
go.mod
View File

@ -9,7 +9,7 @@ require (
github.com/jordan-wright/email v0.0.0-20181027021455-480bedc4908b github.com/jordan-wright/email v0.0.0-20181027021455-480bedc4908b
github.com/knadh/goyesql v1.1.1 github.com/knadh/goyesql v1.1.1
github.com/knadh/stuffbin v0.0.0-20190103171338-6379e949be48 github.com/knadh/stuffbin v0.0.0-20190103171338-6379e949be48
github.com/labstack/echo v3.3.5+incompatible github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.2.7 // indirect github.com/labstack/gommon v0.2.7 // indirect
github.com/lib/pq v1.0.0 github.com/lib/pq v1.0.0
github.com/mattn/go-colorable v0.0.9 // indirect github.com/mattn/go-colorable v0.0.9 // indirect

2
go.sum
View File

@ -23,6 +23,8 @@ github.com/knadh/stuffbin v0.0.0-20190103171338-6379e949be48 h1:lRb28d0+iiVwqF7L
github.com/knadh/stuffbin v0.0.0-20190103171338-6379e949be48/go.mod h1:afUOPBWr6bZ09aS3wbSOqXVGaO6rKcyvXYTcuG9LYpI= github.com/knadh/stuffbin v0.0.0-20190103171338-6379e949be48/go.mod h1:afUOPBWr6bZ09aS3wbSOqXVGaO6rKcyvXYTcuG9LYpI=
github.com/labstack/echo v3.3.5+incompatible h1:9PfxPUmasKzeJor9uQTaXLT6WUG/r+vSTmvXxvv3JO4= github.com/labstack/echo v3.3.5+incompatible h1:9PfxPUmasKzeJor9uQTaXLT6WUG/r+vSTmvXxvv3JO4=
github.com/labstack/echo v3.3.5+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= github.com/labstack/echo v3.3.5+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s=
github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg=
github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s=
github.com/labstack/gommon v0.2.7 h1:2qOPq/twXDrQ6ooBGrn3mrmVOC+biLlatwgIu8lbzRM= github.com/labstack/gommon v0.2.7 h1:2qOPq/twXDrQ6ooBGrn3mrmVOC+biLlatwgIu8lbzRM=
github.com/labstack/gommon v0.2.7/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4= github.com/labstack/gommon v0.2.7/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4=
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=

View File

@ -101,7 +101,7 @@ func initFileSystem(binPath string) (stuffbin.FileSystem, error) {
// The frontend app's static assets are aliased to /frontend // The frontend app's static assets are aliased to /frontend
// so that they are accessible at localhost:port/frontend/static/ ... // so that they are accessible at localhost:port/frontend/static/ ...
"frontend/my/build:/frontend", "frontend/build:/frontend",
} }
fs, err = stuffbin.NewLocalFS("/", files...) fs, err = stuffbin.NewLocalFS("/", files...)
@ -148,7 +148,8 @@ func main() {
viper.GetInt("db.port"), viper.GetInt("db.port"),
viper.GetString("db.user"), viper.GetString("db.user"),
viper.GetString("db.password"), viper.GetString("db.password"),
viper.GetString("db.database")) viper.GetString("db.database"),
viper.GetString("db.ssl_mode"))
if err != nil { if err != nil {
logger.Fatalf("error connecting to DB: %v", err) logger.Fatalf("error connecting to DB: %v", err)
} }

View File

@ -79,9 +79,9 @@ type Queries struct {
} }
// connectDB initializes a database connection. // connectDB initializes a database connection.
func connectDB(host string, port int, user, pwd, dbName string) (*sqlx.DB, error) { func connectDB(host string, port int, user, pwd, dbName string, sslMode string) (*sqlx.DB, error) {
db, err := sqlx.Connect("postgres", db, err := sqlx.Connect("postgres",
fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s", host, port, user, pwd, dbName)) fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=%s", host, port, user, pwd, dbName, sslMode))
if err != nil { if err != nil {
return nil, err return nil, err
} }