Setup
Requirements
We recommend to use nvm to control the version of Node.JS
Initialization
We recommend to initial a new Goji project by create-goji-app.
For npm users,
npm create goji-app my-goji-app
cd my-goji-app
npm install
For yarn users,
yarn create goji-app my-goji-app
cd my-goji-app
yarn
The Goji project will be created in folder
my-goji-app
, you can change it if you'd like.
The project folder's structure looks like this.
my-goji-app/
├── goji.config.js
├── package.json
└── src
├── app.config.ts
├── app.css
├── app.ts
├── pages
│ └── index
│ ├── index.config.ts
│ ├── index.css
│ └── index.tsx
└── project.config.json
Start development
To start a Goji project, you can run npm run start [target]
for development mode, or run
npm run build [target]
for production mode.
yarn users should run
yarn start [target]
oryarn build [target]
The target
filed defaults to wechat
and could be set to one of this list.
Platform | target |
---|---|
WeChat Mini Program | wechat |
Baidu Smart Program | baidu |
Alipay Mini Program | alipay |
Toutiao Micro App | toutiao |
QQ Mini Program | qq |
WeChat Mini Program
Run
npm run start wechat
inmy-goji-app
folder.Open WeChat Devtools and login by scan the QR code.
Import the project located at
my-goji-app/dist/wechat
. You should correct theappid
according to your real project or just use a test account.
- You should see the demo project. The dev tool will auto-reload if any source code changed.
After developing the code, you can run npm run build wechat
to bundle the code and then preview or
upload the mini program. Please note uploading code requires a real appid
rather than a test
account.
Other mini program
Basically the steps are same as WeChat Mini Program. You should download the different dev tools from their official website.