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

fix: wrongly packaging child bundles on MacOS #827

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/commands/pack/macos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ type OclifConfig = {
};
}

const noBundleConfiguration = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist>
`

const scripts = {
preinstall: (config: Interfaces.Config, additionalCLI: string | undefined) => `#!/usr/bin/env bash
sudo rm -rf /usr/local/lib/${config.dirname}
Expand Down Expand Up @@ -149,24 +156,31 @@ the CLI should already exist in a directory named after the CLI that is the root
await Tarballs.build(buildConfig, {platform: 'darwin', pack: false, tarball: flags.tarball})
const scriptsDir = qq.join(buildConfig.tmp, 'macos/scripts')
await qq.emptyDir(buildConfig.dist('macos'))
const noBundleConfigurationPath = qq.join(buildConfig.tmp, 'macos/no-bundle.plist')

const build = async (arch: Interfaces.ArchTypes) => {
const templateKey = templateShortKey('macos', {bin: config.bin, version: config.version, sha: buildConfig.gitSha, arch})
const dist = buildConfig.dist(`macos/${templateKey}`)
const rootDir = buildConfig.workspace({platform: 'darwin', arch})
const writeNoBundleConfiguration = async () => {
await qq.write(noBundleConfigurationPath, noBundleConfiguration)
await qq.chmod(noBundleConfigurationPath, 0o755)
}
const writeScript = async (script: 'preinstall' | 'postinstall' | 'uninstall') => {
const path = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir]
path.push(script)
await qq.write(path, scripts[script](config, flags['additional-cli']))
await qq.chmod(path, 0o755)
}

await writeNoBundleConfiguration();
await writeScript('preinstall')
await writeScript('postinstall')
await writeScript('uninstall')
/* eslint-disable array-element-newline */
const args = [
'--root', rootDir,
'--component-plist', noBundleConfigurationPath,
'--identifier', packageIdentifier,
'--version', config.version,
'--install-location', `/usr/local/lib/${config.dirname}`,
Expand Down