Guia de Release 2GP
Arquitetura
Seção intitulada “Arquitetura”flowchart TB
subgraph DEVHUB["Dev Hub (Production)<br/>hello@tucario.com"]
PM["Package Manager<br/>(2GP packages)"]
NS["Namespace Registry<br/>(linked)"]
NS --> PM
end
DEVHUB --> NSORG
subgraph NSORG["Namespace Org (Dev Org)<br/>michal@tucario.com.flexifree<br/>Namespace: tucariofts"]
end
Pré-requisitos
Seção intitulada “Pré-requisitos”1. Dev Hub (Production)
Seção intitulada “1. Dev Hub (Production)”- Dev Hub habilitado: Setup > Dev Hub > Enable
- Namespace conectado: App Launcher > Namespace Registries > Link Namespace
2. Namespace Org (Partner Developer Org)
Seção intitulada “2. Namespace Org (Partner Developer Org)”- Namespace registrado (uma vez, irreversível)
- Setup > Package Manager > Edit > Namespace Prefix
3. Ambiente Local
Seção intitulada “3. Ambiente Local”- Salesforce CLI instalado
- Autorização para ambas as orgs
Referência Rápida (Copy-Paste)
Seção intitulada “Referência Rápida (Copy-Paste)”# 1. Check orgssf org list
# 2. Check packagessf package list --target-dev-hub DevHub
# 3. Check versionssf package version list --packages FlexibleTeamShare --target-dev-hub DevHub
# 4. Create new version (BETA)sf package version create --package FlexibleTeamShare --installation-key-bypass --wait 20 --code-coverage --target-dev-hub DevHub --definition-file config/package-scratch-def.json
# 5. Test install (replace ID and org alias)sf package install --package 04tXXXXXXXXXXXXXXX --target-org TestOrg --wait 10
# 6. Promote to RELEASED (IRREVERSIBLE!)sf package version promote --package 04tXXXXXXXXXXXXXXX --target-dev-hub DevHubComandos
Seção intitulada “Comandos”Autorização de Org
Seção intitulada “Autorização de Org”# Dev Hub (production)sf org login web --alias DevHub --set-default-dev-hub
# Namespace Org (dev org with namespace)sf org login web --alias FlexiFREEVerificar Orgs Conectadas
Seção intitulada “Verificar Orgs Conectadas”sf org listVerificar Pacotes Existentes
Seção intitulada “Verificar Pacotes Existentes”sf package list --target-dev-hub DevHubVerificar Versões do Pacote
Seção intitulada “Verificar Versões do Pacote”sf package version list --packages FlexibleTeamShare --target-dev-hub DevHubCriando Nova Versão do Pacote
Seção intitulada “Criando Nova Versão do Pacote”1. Atualizar Versão em sfdx-project.json (opcional)
Seção intitulada “1. Atualizar Versão em sfdx-project.json (opcional)”{ "packageDirectories": [ { "versionName": "ver 0.2", "versionNumber": "0.2.0.NEXT", "path": "force-app", "default": true, "package": "FlexibleTeamShare" } ], "namespace": "tucariofts"}2. Criar Versão do Pacote (beta)
Seção intitulada “2. Criar Versão do Pacote (beta)”sf package version create \ --package FlexibleTeamShare \ --installation-key-bypass \ --wait 20 \ --code-coverage \ --target-dev-hub DevHub \ --definition-file config/package-scratch-def.json3. Testar Instalação
Seção intitulada “3. Testar Instalação”sf package install \ --package 04tXXXXXXXXXXXXXXX \ --target-org TestOrg \ --wait 104. Promover para Released (Production)
Seção intitulada “4. Promover para Released (Production)”sf package version promote \ --package 04tXXXXXXXXXXXXXXX \ --target-dev-hub DevHubPublicando no AppExchange
Seção intitulada “Publicando no AppExchange”- Faça login na Partner Community
- Publishing > Listings > New Listing
- Adicione versão do pacote promovida
- Preencha detalhes do listing
- Envie para revisão
Solução de Problemas
Seção intitulada “Solução de Problemas””Not available for deploy for this organization” (Translations)
Seção intitulada “”Not available for deploy for this organization” (Translations)”Scratch org não tem Translation Workbench habilitado.
Solução: Use --definition-file config/package-scratch-def.json que inclui:
{ "orgName": "Package Build Org", "edition": "Enterprise", "settings": { "languageSettings": { "enableTranslationWorkbench": true, "enableEndUserLanguages": true, "enablePlatformLanguages": true } }}“No such column” (FLS errors)
Seção intitulada ““No such column” (FLS errors)”Use WITH SYSTEM_MODE em vez de WITH USER_MODE em queries SOQL.
”You cannot deploy to a required field”
Seção intitulada “”You cannot deploy to a required field””Remova campos obrigatórios de permission sets (campos obrigatórios não precisam de FLS).