Salesforce DX 学习

a 夏天 提交于 2019-11-29 07:51:13

Salesforce DX 学习

  1. 登录到开发中心 sfdx force:auth:web:login -d -a DevHub -a 创建别名 -d 设置为默认组织

  2. 创建文件夹 mkdir folderName cd folderName

  3. clone
    git clone https://github.com/dreamhouseapp/dreamhouse-sfdx.git

  4. 删除scratch
    sfdx force:org:delete

  5. 一个scratch 配置

     {
       "orgName": "Dreamhouse",
       "edition": "Developer",
       "hasSampleData": "false",
       "settings": {
         "orgPreferenceSettings": {
           "s1DesktopEnabled": true,
           "selfSetPasswordInApi": true,
           "s1EncryptedStoragePref2": false
         }
       }
     }
    
  6. 创建Scratch Org 并设置为默认 sfdx force:org:create -s -f config/project-scratch-def.json -a dreamhouse-org

  7. 打开指定org sfdx force:org:open -u xxx

  8. 将元数据推送到Scratch sfdx force:source:push

  9. 分配权限 sfdx force:user:permset:assign -n xxxx

  10. 导入样本数据 sfdx force:data:tree:import --plan data/sample-data-plan.json

创建一个包

需要在sfdx中设置DevHub为默认,同时需要开启package

  1. sfdx force:package:create --name dreamhouse --description "My Package" --packagetype Unlocked --path force-app --nonamespace --targetdevhubusername DevHub
    • --name is the package name. This name is an alias you can use when running subsequent packaging commands.
    • --path is the directory that contains the contents of the package.
    • --packagetype indicates which kind of package you’re creating, in this case, unlocked.
  2. 创建版本: sfdx force:package:version:create -p dreamhouse -d force-app -k test1234 --wait 10 -v DevHub
    • -p is the package alias that maps to the package ID.
    • -d is the directory that contains the contents of the package.
    • -k is the installation key that protects your package from being installed by unauthorized individuals.
  3. 转换成正式版本:
    sfdx force:package:version:promote -p dreamhouse@1.0.0-1 -v DevHub
  4. 安装到Org中:
    sfdx force:package:install --wait 10 --publishwait 10 --package dreamhouse@1.0.0-1 -k test1234 -r -u MyScratchOrg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!