Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: convert project to use a new source behavior #1015

Merged
merged 23 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9a48e5c
feat(wip): decompose command
mshanemc May 15, 2024
752ca32
feat: convert a project to use a new sourceBehaviorOption
mshanemc May 17, 2024
d0cc74f
chore: snapshot/schema
mshanemc May 17, 2024
af5efd6
feat: error for behavior change with no matching types
mshanemc May 17, 2024
cb156f0
refactor: rename the command from design
mshanemc May 20, 2024
a6aad08
chore: ut a function
mshanemc May 20, 2024
0463142
test: add a nut, fix bugs that uncovers
mshanemc May 21, 2024
3085af4
chore: bump sdr for renamed prop
mshanemc May 21, 2024
0d6b613
feat: normalize paths for consistency
mshanemc May 21, 2024
eeea4df
test: more nut for preset conversion
mshanemc May 21, 2024
88c02df
Merge remote-tracking branch 'origin/main' into sm/presets-conversion…
mshanemc May 21, 2024
68a6548
test: remove redundant nut
mshanemc May 21, 2024
bd5e7d8
test: win ut only
mshanemc May 21, 2024
da93e05
refactor: calc preset dir once
mshanemc May 21, 2024
e42b798
test: windows ut again
mshanemc May 21, 2024
eaf7a2b
test: restore full test suite
mshanemc May 21, 2024
cb32aa1
fix: edit the messages for "project convert source-behavior" (#1018)
jshackell-sfdc May 24, 2024
87fc4d1
Merge remote-tracking branch 'origin/main' into sm/presets-conversion…
mshanemc May 24, 2024
eefa739
fix: change behavior shortchar
mshanemc May 24, 2024
bfdff8d
chore: snapshot/schema
mshanemc May 24, 2024
845baa5
chore: main conflicts
iowillhoit May 28, 2024
6f95895
Update messages/convert.source-behavior.md
mshanemc May 28, 2024
5490000
chore: pr suggestions
mshanemc May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
needs: yarn-lockfile-check
uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main
windows-unit-tests:
needs: linux-unit-tests
# needs: linux-unit-tests
mshanemc marked this conversation as resolved.
Show resolved Hide resolved
uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main
nuts:
needs: linux-unit-tests
# needs: linux-unit-tests
mshanemc marked this conversation as resolved.
Show resolved Hide resolved
uses: salesforcecli/github-workflows/.github/workflows/nut.yml@main
secrets: inherit
strategy:
Expand Down
8 changes: 8 additions & 0 deletions command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
],
"plugin": "@salesforce/plugin-deploy-retrieve"
},
{
"alias": [],
"command": "project:convert:source-behavior",
"flagAliases": [],
"flagChars": ["o", "p"],
"flags": ["behavior", "dry-run", "flags-dir", "json", "preserve-temp-dir", "target-org"],
"plugin": "@salesforce/plugin-deploy-retrieve"
},
{
"alias": ["force:source:delete"],
"command": "project:delete:source",
Expand Down
60 changes: 60 additions & 0 deletions messages/convert.source-behavior.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# summary

Enable a sourceBehaviorOption in sfdx-project.json and update your project source to use it.

# description

Makes local changes to your project based on the chosen sourceBehaviorOption.

# flags.behavior.summary

Which sourceBehaviorOption to enable.

# examples

- Switch the project to use decomposed custom labels
<%= config.bin %> <%= command.id %> --behavior DecomposeCustomLabels

- Without changing any existing files, see what the command would have produced.
<%= config.bin %> <%= command.id %> --behavior DecomposeCustomLabels --dry-run

# flags.dry-run.summary

Explain what the command would do.

# flags.dry-run.description

Doesn't modify existing files. Lists files that would be deleted, explains modifications to sfdx-project.json, and outputs the resulting modifications to a new folder for review.

# flags.preserve-temp-dir.summary

Don't delete the metadata API format temp dir that this command creates. Useful for debugging.

# error.trackingNotSupported

The project has a target-org that uses source tracking. This operation will cause changes to the local project that can't be properly tracked.

# error.trackingNotSupported.actions

- Get any changes or data you need from the org
- Delete the org (`sf org delete scratch` or `sf org delete sandbox`)
- Run the command again
- Create a new org and deploy the modified source

# error.packageDirectoryNeedsMainDefault

The package directory %s does not have a main/default structure.
The command will move metadata into main/default which doesn't seem like what you'd want.

# error.packageDirectoryNeedsMainDefault.actions

- Update %s to have all its metadata inside main/default.
- Run the command again.

# success.dryRun

Files were created in %s outside your package directories for inspection.

# error.noTargetTypes

The project contains no packageDirectories with metadata that matches the specified behavior %s.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"@salesforce/core": "^7.3.9",
"@salesforce/kit": "^3.1.1",
"@salesforce/plugin-info": "^3.2.7",
"@salesforce/sf-plugins-core": "^9.0.10",
"@salesforce/source-deploy-retrieve": "^11.5.0",
"@salesforce/sf-plugins-core": "^9.0.7",
"@salesforce/source-deploy-retrieve": "^11.6.0",
"@salesforce/source-tracking": "^6.2.3",
"@salesforce/ts-types": "^2.0.9",
"chalk": "^5.3.0"
Expand All @@ -21,6 +21,7 @@
"@salesforce/cli-plugins-testkit": "^5.3.4",
"@salesforce/dev-scripts": "^9.1.2",
"@salesforce/plugin-command-reference": "^3.0.83",
"@salesforce/schemas": "^1.9.0",
"@salesforce/source-testkit": "^2.2.10",
"@salesforce/ts-sinon": "^1.4.19",
"cross-env": "^7.0.3",
Expand Down
31 changes: 31 additions & 0 deletions schemas/project-convert-source__behavior.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/SourceBehaviorResult",
"definitions": {
"SourceBehaviorResult": {
"type": "object",
"properties": {
"sourceBehaviorOptions": {
"type": "array",
"items": {
"type": "string"
}
},
"deletedFiles": {
"type": "array",
"items": {
"type": "string"
}
},
"createdFiles": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["sourceBehaviorOptions", "deletedFiles", "createdFiles"],
"additionalProperties": false
}
}
}
10 changes: 5 additions & 5 deletions schemas/project-delete-source.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
},
"FileResponseSuccess": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand All @@ -459,11 +460,11 @@
"enum": ["Created", "Changed", "Unchanged", "Deleted"]
}
},
"required": ["fullName", "state", "type"],
"additionalProperties": false
"required": ["fullName", "state", "type"]
},
"FileResponseFailure": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand Down Expand Up @@ -492,11 +493,11 @@
"enum": ["Warning", "Error"]
}
},
"required": ["error", "fullName", "problemType", "state", "type"],
"additionalProperties": false
"required": ["error", "fullName", "problemType", "state", "type"]
},
"MetadataApiDeployStatus": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
Expand Down Expand Up @@ -598,7 +599,6 @@
"status",
"success"
],
"additionalProperties": false,
"description": "Raw response returned from a checkDeployStatus call to the Metadata API"
},
"CoverageResultsFileInfo": {
Expand Down
8 changes: 4 additions & 4 deletions schemas/project-deploy-cancel.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
},
"FileResponseSuccess": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand All @@ -157,11 +158,11 @@
"enum": ["Created", "Changed", "Unchanged", "Deleted"]
}
},
"required": ["fullName", "state", "type"],
"additionalProperties": false
"required": ["fullName", "state", "type"]
},
"FileResponseFailure": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand Down Expand Up @@ -190,8 +191,7 @@
"enum": ["Warning", "Error"]
}
},
"required": ["error", "fullName", "problemType", "state", "type"],
"additionalProperties": false
"required": ["error", "fullName", "problemType", "state", "type"]
},
"RequestStatus": {
"type": "string",
Expand Down
8 changes: 4 additions & 4 deletions schemas/project-deploy-quick.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
},
"FileResponseSuccess": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand All @@ -157,11 +158,11 @@
"enum": ["Created", "Changed", "Unchanged", "Deleted"]
}
},
"required": ["fullName", "state", "type"],
"additionalProperties": false
"required": ["fullName", "state", "type"]
},
"FileResponseFailure": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand Down Expand Up @@ -190,8 +191,7 @@
"enum": ["Warning", "Error"]
}
},
"required": ["error", "fullName", "problemType", "state", "type"],
"additionalProperties": false
"required": ["error", "fullName", "problemType", "state", "type"]
},
"RequestStatus": {
"type": "string",
Expand Down
8 changes: 4 additions & 4 deletions schemas/project-deploy-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
},
"FileResponseSuccess": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand All @@ -157,11 +158,11 @@
"enum": ["Created", "Changed", "Unchanged", "Deleted"]
}
},
"required": ["fullName", "state", "type"],
"additionalProperties": false
"required": ["fullName", "state", "type"]
},
"FileResponseFailure": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand Down Expand Up @@ -190,8 +191,7 @@
"enum": ["Warning", "Error"]
}
},
"required": ["error", "fullName", "problemType", "state", "type"],
"additionalProperties": false
"required": ["error", "fullName", "problemType", "state", "type"]
},
"RequestStatus": {
"type": "string",
Expand Down
8 changes: 4 additions & 4 deletions schemas/project-deploy-resume.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
},
"FileResponseSuccess": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand All @@ -157,11 +158,11 @@
"enum": ["Created", "Changed", "Unchanged", "Deleted"]
}
},
"required": ["fullName", "state", "type"],
"additionalProperties": false
"required": ["fullName", "state", "type"]
},
"FileResponseFailure": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand Down Expand Up @@ -190,8 +191,7 @@
"enum": ["Warning", "Error"]
}
},
"required": ["error", "fullName", "problemType", "state", "type"],
"additionalProperties": false
"required": ["error", "fullName", "problemType", "state", "type"]
},
"RequestStatus": {
"type": "string",
Expand Down
8 changes: 4 additions & 4 deletions schemas/project-deploy-start.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
},
"FileResponseSuccess": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand All @@ -157,11 +158,11 @@
"enum": ["Created", "Changed", "Unchanged", "Deleted"]
}
},
"required": ["fullName", "state", "type"],
"additionalProperties": false
"required": ["fullName", "state", "type"]
},
"FileResponseFailure": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand Down Expand Up @@ -190,8 +191,7 @@
"enum": ["Warning", "Error"]
}
},
"required": ["error", "fullName", "problemType", "state", "type"],
"additionalProperties": false
"required": ["error", "fullName", "problemType", "state", "type"]
},
"RequestStatus": {
"type": "string",
Expand Down
8 changes: 4 additions & 4 deletions schemas/project-deploy-validate.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
},
"FileResponseSuccess": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand All @@ -157,11 +158,11 @@
"enum": ["Created", "Changed", "Unchanged", "Deleted"]
}
},
"required": ["fullName", "state", "type"],
"additionalProperties": false
"required": ["fullName", "state", "type"]
},
"FileResponseFailure": {
"type": "object",
"additionalProperties": false,
"properties": {
"fullName": {
"type": "string"
Expand Down Expand Up @@ -190,8 +191,7 @@
"enum": ["Warning", "Error"]
}
},
"required": ["error", "fullName", "problemType", "state", "type"],
"additionalProperties": false
"required": ["error", "fullName", "problemType", "state", "type"]
},
"RequestStatus": {
"type": "string",
Expand Down
Loading
Loading