11.0.15 • Published 6 years ago

the-demo-site v11.0.15

Weekly downloads
142
License
Apache-2.0
Repository
github
Last release
6 years ago

the-demo-site

npm Version JS Standard

Demo site of the-framework

Table of Contents

Requirements

This project requires:

Preparing

Install CLI packages if you have not

# Install global dependencies
npm i -g pon pm2 jsdoc mocha

Then, install dependencies and build the project

# Install dependencies and trigger prepare script
npm install

Development

Starting Development Server

# Start server and watch files to compile
pon debug  # Or just `pon d`

Open Project In Browser

# This will the open in your browser
open open  # Or just `pon o`

Production

Setup Server (Ubuntu)

Execute ./misc/setup/setup_ubuntu.sh to install softwares like git, node, nginx, etc.

Setup App

# Setup env
export NODE_ENV=production

# Where you checkout the project
cd /opt/apps/the-demo-site

# Install dependencies and run prepare scripts
yarn install


# Interactive shell to configure local values
pon setting


# Start production server
pon production

Configure Reverse Proxy

# Setup cert files for https
./misc/deploy/01.cert.sh

# Apply https setting for nginx
./misc/deploy/02.vhost.sh

# Configure cert renew with cron
./misc/deploy/03.crontabs.sh

Running Tasks

This project uses Pon as a task runner.

Just pass task name to run.

pon <taskName>

Core Tasks

Tasks defined in Ponfile.js

TaskNameDescriptionCommand
assert:not-prodMake sure that not productionpon assert:not-prod
assetsRun all assets taskspon assets
assets:installInstall asset filespon assets:install
assets:markdownRender markdown assetspon assets:markdown
bShortcut for build taskpon b
buildBuild allpon build
checkCheck allpon check
dbPrepare DBpon db
db:cliOpen database clipon db:cli
db:dropDrop databasepon db:drop
db:dumpDump datapon db:dump
db:loadLoad data from dumpon db:load
db:migrateMigrate datapon db:migrate
db:resetDrop and setup database againpon db:reset
db:seedGenerate test datapon db:seed
db:setupSetup databasepon db:setup
defaultDefault for pon commandpon default
deployDeploy project on productionpon deploy
docGenerate docspon doc
dockerSetup docker infrapon docker
docker:mysqlPrepare mysql docker containerpon docker:mysql
docker:nginxPrepare nginx docker containerpon docker:nginx
docker:redisPrepare redis docker containerpon docker:redis
env:debugSet env variables for debugpon env:debug
env:prodSet env variables for productionpon env:prod
env:testSet env variables for testpon env:test
git:catchupCatch up to latest gitpon git:catchup
git:tagsFetch tags from gitpon git:tags
loc:printPrint locale settingspon loc:print
local:printPrint local settingspon local:print
logsShow app daemon logspon logs
maint:offDisable maintenance modepon maint:off
maint:onEnable maintenance modepon maint:on
pShortcut for prod taskpon p
pkg:fixFix package.jsonpon pkg:fix
pkg:installInstall packagespon pkg:install
pkg:install:forceInstall packages forcefullypon pkg:install:force
pkg:linkLink self packagespon pkg:link
pkg:upgUpgrade packages package.jsonpon pkg:upg
pm2:appRun app with pm2pon pm2:app
pm2:backup:dumpRun backup cron with pm2pon pm2:backup:dump
preShortcut for 'preparetask |pon pre`
preparePrepare projectpon prepare
prodPrepare and start on productionpon prod
prod:compileCompile files for productionpon prod:compile
prod:cssCompile css files for productionpon prod:css
prod:dbPrepare database for productionpon prod:db
prod:jsCompile js files for productionpon prod:js
prod:mapDelete source map files for productionpon prod:map
ps:debugProcess check for debugpon ps:debug
ps:e2eProcess check for e2epon ps:e2e
restartRestart app as daemonpon restart
secret:decDecrypt secret filepon secret:dec
secret:encEncrypt secret filepon secret:enc
settingUpdate project settings with interactive shellpon setting
showShow app daemon statuspon show
startStart app as daemonpon start
stopStop app as daemonpon stop
structRun all struct taskspon struct
struct:chmodChange file permissionspon struct:chmod
struct:compileCompile filespon struct:compile
struct:cpExecute file copypon struct:cp
struct:mkdirGenerate project directoriespon struct:mkdir
struct:pkgPrepare sub packagespon struct:pkg
struct:renderRender coz templatespon struct:render
uiRun all ui taskspon ui
ui:browserBundle browser scriptpon ui:browser
ui:cssCompile stylesheetspon ui:css
ui:css/watchRun css watchpon ui:css/watch
ui:reactCompile react componentspon ui:react

Dev Only Tasks

Tasks defined in Ponfile.dev.js

TaskNameDescriptionCommand
cShortcut for clean taskpon c
cleanClean allpon clean
clean:cacheCleanup cache filespon clean:cache
clean:publicCleanup public filespon clean:public
clean:shimCleanup shim filespon clean:shim
dShortcut for debug taskpon d
debugStart debuggingpon debug
debug:serverRun server for debugpon debug:server
debug:watchWatch files for debugpon debug:watch
doc:pondocGenerate pondoc filepon doc:pondoc
doc:pondoc:devGenerate pondoc filepon doc:pondoc:dev
dsShortcut for debug:server taskpon ds
eShortcut for e2e taskpon e
e2eRun e2e testpon e2e
e2e:installInstall drivers for E2Epon e2e:install
e2e:listenListen for E2E testspon e2e:listen
e2e:storyRun stories for E2E testspon e2e:story
elShortcut for e2e:listen taskpon el
fShortcut for format taskpon f
formatFormat source codespon format
format:clientFormat client filespon format:client
format:confFormat conf filespon format:conf
format:e2eFormat e2e filespon format:e2e
format:jsonFormat json filespon format:json
format:miscFormat misc filespon format:misc
format:serverFormat server filespon format:server
git:changelogGenerate changelog filepon git:changelog
icon:genGenerate iconspon icon:gen
lShortcut for lint taskpon l
lintLint allpon lint
lint:healthHealth checkpon lint:health
lint:locValidate localespon lint:loc
lint:rulesLint by rulespon lint:rules
oShortcut for open taskpon o
openOpen projectpon open
open:appOpen app in browserpon open:app
open:repoOpen homepage field in package.jsonpon open:repo
orShortcut for open taskpon or
preparePrepare projectpon prepare
startStart serverpon start
stopStop serverpon stop
tShortcut for test taskpon t
testRun all tesspon test
test:clientRun client testspon test:client
test:serverRun server testspon test:server
test:supportCheck compatibilitypon test:support
uShortcut for upgrade taskpon u
upgradeUpgrade packagepon upgrade
wShortcut for watch taskpon w
watchRun watchespon watch

For more information, try pon -l

Database

Database Resource

Console to database

pon db:cli

In the console, you can access database resources via ClayResource class

Terminal Example

Welcome to the-db prompt!
DB Env: { dialect: 'mysql', host: 'localhost', port: '6002', database: 'thedemosite_dev', username: 'thedemosite_dev', root_username: 'root', hooks: null }
DB Resources: [ 'TheDBSchema', 'TheDBLog', 'Alias', 'History', 'Profile', 'Role', 'Sign', 'User' ]

the-db> User.count()  # Evaluate One-line Javascript in the terminal
106
the-db> (await User.first()).name  # Using async interface
'superadmin-71d5acfe'
the-db>

E2E (End-to-End) Test

Set Up Servers

Run app server with debug mode

pon debug:server # Or just `pon ds`

Then, run e2e server (In other tab)

pon e2e:listen # Or just `pon el`

Run E2E Test

To run all tests,

pon e2e # Or just `pon e`

To run single tests,

# List available test stories
pon -l e2e:story

# Example to run one of stories
pon e2e:story/signInOut 

Trouble Shooting

First Things You Should Try

When something goes funny, the first thing to do is clean and build

# Clean up files and build again (aka. `pon c b`)
pon clean build

Docker Containers Seam to Be Dead

To Re-create docker containers,

# Remove docker containers and restart again
pon docker:*/remove docker

Misc

Provided Urls

  • /about/app
  • /about/privacy-policy
  • /about/terms-of-use
  • /account/mypage
  • /account/password
  • /account/profile
  • /account/quit
  • /account/recover/reset
  • /account/recover/send
  • /account/verify/confirm
  • /admin
  • /admin/users
  • /a/:key
  • /build/bundle.css
  • /css/flatpickr.min.css
  • /css/fontawesome-all.css
  • /css/normalize.css
  • /css/theme.css
  • /errors/forbidden
  • /errors/not-found
  • /images/app-icon.png
  • /build/bundle.js
  • /build/external.js
  • /RootServiceWorker.js
  • /js/es5-shim.min.js
  • /manifest/:lang/manifest.json
  • /v11.0.15
  • /v11.0.15/bundle.css
  • /v11.0.15/bundle.js
  • /v11.0.15/external.js
  • /sign/please
  • /sign/signin
  • /sign/signout
  • /sign/signup
  • /

Project Structure

Directory structure of this project

Directory PathDescription
assetsStatic file directory
binExecutable files
clientClient side scripts
client/clientRPC Client
client/scenesClient logic without ui
client/shimGenerated shim files
client/storeClient side data store
client/testClient tests
client/uiUser interfaces
confConfiguration of project
docDocuments
doc/guidesGuides for README
e2eEnd-to-end testing scripts
miscMisc files
publicPublic directory to serve static files. Auto-generated
serverServer side scripts
server/controllersController classes to handle RPC
server/dbDatabase modules
server/envEnv dependant variables
server/serverHTTP Server modules
server/servicesDatabase access wrappers
server/testServer tests
testProject tests
tmpTemporary files. Can be deleted anytime.
varVar files

What is .*.bud Files?

This project contains a lot of .*.bud files, which is used by coz file generator. Bud file tells coz to how files should to generate, like path,tmpl,data,mode, etc.

Configuring Secret Values

Secret values are stored in secrets.json These values can be encoded/decoded by pon tasks

# Decode values inside secrets.json
pon secret:dec
# Encode values inside secrets.json
pon secret:enc

License

This software is released under the Apache-2.0 License.

Links

11.0.15

6 years ago

11.0.13

6 years ago

11.0.12

6 years ago

11.0.6

6 years ago

11.0.5

6 years ago

11.0.4

6 years ago

11.0.3

6 years ago

11.0.1

6 years ago

11.0.0

6 years ago

9.11.17

6 years ago

9.11.16

6 years ago

9.11.12

6 years ago

9.11.10

6 years ago

9.11.9

6 years ago

9.11.8

6 years ago

9.11.7

6 years ago

9.11.1

6 years ago

9.11.0

6 years ago

9.8.0

6 years ago

9.7.2

6 years ago

9.7.1

6 years ago

9.7.0

6 years ago

9.5.0

6 years ago

9.4.0

6 years ago

9.3.0

6 years ago

9.1.1

6 years ago

9.0.2

6 years ago

8.1.5

6 years ago

8.1.4

6 years ago

8.1.3

6 years ago

8.1.2

6 years ago

8.1.1

6 years ago

8.1.0

6 years ago

8.0.4

6 years ago

8.0.3

6 years ago

8.0.1

6 years ago

8.0.0

6 years ago

7.78.0

6 years ago

7.77.0

6 years ago

7.76.2

6 years ago

7.76.0

6 years ago

7.75.0

6 years ago

7.74.0

6 years ago

7.63.0

6 years ago

7.62.0

6 years ago

7.61.0

6 years ago

7.60.0

6 years ago

7.51.0

6 years ago

7.50.0

6 years ago

7.40.0

6 years ago

7.35.0

6 years ago

7.34.0

6 years ago

7.33.0

6 years ago

7.32.0

6 years ago

7.30.0

6 years ago

7.29.0

6 years ago

7.28.0

6 years ago

7.26.1

6 years ago

7.25.0

6 years ago

7.24.0

6 years ago

7.23.0

6 years ago

7.22.0

6 years ago

7.21.0

6 years ago

7.20.1

6 years ago

7.20.0

6 years ago

7.18.1

6 years ago

7.18.0

6 years ago

7.17.1

6 years ago

7.17.0

6 years ago

7.16.0

6 years ago

7.14.1

6 years ago

7.14.0

6 years ago

7.13.0

6 years ago

7.11.0

6 years ago

7.10.1

6 years ago

7.10.0

6 years ago

7.8.0

6 years ago

7.7.4

6 years ago

7.7.3

6 years ago

7.7.2

6 years ago

7.7.1

6 years ago

7.6.1

6 years ago

7.6.0

6 years ago

7.5.0

6 years ago

7.4.2

6 years ago

7.4.1

6 years ago

7.4.0

6 years ago

7.3.4

6 years ago

7.3.3

6 years ago

7.3.2

6 years ago

7.2.3

6 years ago

7.2.1

6 years ago

7.1.0

6 years ago

7.0.1

6 years ago

7.0.0

6 years ago

6.5.0

6 years ago

6.4.0

6 years ago

6.3.0

6 years ago

6.2.0

6 years ago

6.1.9

6 years ago

6.1.8

6 years ago

6.1.7

6 years ago

6.1.6

6 years ago

6.1.5

6 years ago

6.1.4

6 years ago

6.1.3

6 years ago

6.1.2

7 years ago

6.1.1

7 years ago

6.1.0

7 years ago

6.0.6

7 years ago

6.0.5

7 years ago

6.0.4

7 years ago

6.0.3

7 years ago

6.0.2

7 years ago

6.0.1

7 years ago

6.0.0

7 years ago

5.3.4

7 years ago

5.3.3

7 years ago

5.3.2

7 years ago

5.3.1

7 years ago

5.3.0

7 years ago

5.2.9

7 years ago

5.2.8

7 years ago

5.2.7

7 years ago

5.2.6

7 years ago

5.2.5

7 years ago

5.2.4

7 years ago

5.2.3

7 years ago

5.2.2

7 years ago

5.2.1

7 years ago

5.2.0

7 years ago

5.1.2

7 years ago

5.1.1

7 years ago

5.1.0

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago