Skip to content

Commit

Permalink
fix: remove path normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
ClayChipps committed Oct 13, 2023
1 parent e8108ac commit 191c453
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 41 deletions.
31 changes: 0 additions & 31 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@actions/glob": "^0.4.0",
"@types/xml2js": "^0.4.12",
"file-system": "^2.2.2",
"path": "^0.12.7",
"xml2js": "^0.6.2"
},
"devDependencies": {
Expand Down
13 changes: 4 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as core from '@actions/core'
import * as glob from '@actions/glob'
import {promises as fs} from 'fs'
import * as path from 'path'
import * as xml2js from 'xml2js'

/**
Expand All @@ -16,26 +15,22 @@ export async function run(): Promise<void> {
const projectJsonGlobber = await glob.create('**/sfdx-project.json')

for await (const projectJsonFile of projectJsonGlobber.globGenerator()) {
const filepath = path.normalize(projectJsonFile)

core.debug(`Found sfdx-project.json at ${filepath}`)
core.debug(`Found sfdx-project.json at ${projectJsonFile}`)

const fileData = await fs.readFile(projectJsonFile, 'utf-8')

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

await fs.writeFile(filepath, JSON.stringify(projectJson, null, 2))
await fs.writeFile(projectJsonFile, JSON.stringify(projectJson, null, 2))
}

core.debug(`Rewriting meta.xml...`)

const metadataXmlGlobber = await glob.create('./**/*-meta.xml')

for await (const metadataXmlFile of metadataXmlGlobber.globGenerator()) {
const filepath = path.normalize(metadataXmlFile)

core.debug(`Found meta.xml at ${filepath}`)
core.debug(`Found meta.xml at ${metadataXmlFile}`)

const fileData = await fs.readFile(metadataXmlFile)

Expand All @@ -49,7 +44,7 @@ export async function run(): Promise<void> {
xmlJson.AuraDefinitionBundle.apiVersion = `${apiVersion}.0`
}

await fs.writeFile(filepath, new xml2js.Builder().buildObject(xmlJson))
await fs.writeFile(metadataXmlFile, new xml2js.Builder().buildObject(xmlJson))
}
} catch (error) {
if (error instanceof Error) {
Expand Down

0 comments on commit 191c453

Please sign in to comment.