Skip to content

Commit

Permalink
feat: add project json parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ClayChipps committed Oct 13, 2023
1 parent 797779b commit 6674132
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
16 changes: 16 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ export async function run(): Promise<void> {
try {
const apiVersion = core.getInput('api-version')

const projectJsonFiles = globSync('./**/sfdx-project.json')

for (const projectJsonFile of projectJsonFiles) {
const filepath = path.normalize(path.join(process.cwd(), projectJsonFile))
fs.readFile(projectJsonFile, 'utf-8', (readError, data) => {
if (readError) {
throw new Error(readError?.message)
}

const projectJson = JSON.parse(data)
projectJson.sourceApiVersion = `${apiVersion}.0`

fs.writeFile(
filepath,
JSON.stringify(projectJson, null, 2),
writeError => {
if (writeError) {
throw new Error(writeError?.message)
}
}
)
})
}

const metadataXmlFiles = globSync('./**/*-meta.xml')

for (const metadataXmlFile of metadataXmlFiles) {
Expand Down

0 comments on commit 6674132

Please sign in to comment.