alexandermendes / semantic-release-react-native

4 stars 4 forks source link

iOS > Parsing of project.pbxproj fails if '[Expo] Configure project' build phase is present #7

Open chriswickham opened 8 months ago

chriswickham commented 8 months ago

I've been experiencing the following error in my Bitbucket pipeline:

[4:35:29 PM] [semantic-release] › ✘  An error occurred while running semantic-release: peg$SyntaxError: Expected "\"", "\\'", "\\\"", "\\n", or [^\\"] but "\\" found.
    at peg$buildStructuredError (/opt/atlassian/pipelines/agent/build/node_modules/pbxproj-dom/parser.js:318:12)
    at Object.peg$parse [as parse] (/opt/atlassian/pipelines/agent/build/node_modules/pbxproj-dom/parser.js:921:11)
    at Xcode.open (/opt/atlassian/pipelines/agent/build/node_modules/pbxproj-dom/xcode.js:16:43)
    at versionIos (/opt/atlassian/pipelines/agent/build/node_modules/semantic-release-react-native/dist/version/ios.js:244:31)
    at /opt/atlassian/pipelines/agent/build/node_modules/semantic-release-react-native/dist/prepare.js:77:34
    at step (/opt/atlassian/pipelines/agent/build/node_modules/semantic-release-react-native/dist/prepare.js:33:23)
    at Object.next (/opt/atlassian/pipelines/agent/build/node_modules/semantic-release-react-native/dist/prepare.js:14:53)
    at /opt/atlassian/pipelines/agent/build/node_modules/semantic-release-react-native/dist/prepare.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/opt/atlassian/pipelines/agent/build/node_modules/semantic-release-react-native/dist/prepare.js:4:12) {
  expected: [
    {
      type: 'class',
      parts: [Array],
      inverted: true,
      ignoreCase: [secure]
    },
    { type: 'literal', text: '\\"', ignoreCase: [secure] },
    { type: 'literal', text: "\\'", ignoreCase: [secure] },
    { type: 'literal', text: '\\n', ignoreCase: [secure] },
    { type: 'literal', text: '"', ignoreCase: [secure] }
  ],
  found: '\\',
  location: {
    start: { offset: 17423, line: 308, column: 125 },
    end: { offset: 17424, line: 308, column: 126 }
  },
  pluginName: 'semantic-release-react-native'
}
peg$SyntaxError: Expected "\"", "\\'", "\\\"", "\\n", or [^\\"] but "\\" found.

This was caused by the presence of \\ on line 308 - a shell script which is responsible for configuring Expo modules.

shellScript = "# This script configures Expo modules and generates the modules provider file.\nbash -l -c \"./Pods/Target\\ Support\\ Files/Pods-Thrive/expo-configure-project.sh\"\n";

I was able to fix this by altering the format as below:

shellScript = "# This script configures Expo modules and generates the modules provider file.\nbash -l -c \"'./Pods/Target Support Files/Pods-Thrive/expo-configure-project.sh'\"\n";

However, this line is generated automatically by xCode and I didn't expect to have to alter lines in this file manually to ensure that this package works correctly.

With Expo being a popular build tool, is there any way that this issue can be rectified? Or a setting introduced to skip changes to the project.pbxproj file for those who are not using it for versioning?

alexandermendes commented 7 months ago

Hopefully fixed by https://github.com/alexandermendes/semantic-release-react-native/commit/8f744f29ec2b89262c333fe7c1fb5c088234e742

alexandermendes commented 7 months ago

Scrap that, it didn't work because patch-package doesn't support published libraries.

khanisak commented 1 month ago

same here, is there any workaround ?