Repository: expo/expo
File: packages/expo-modules-autolinking/scripts/ios/autolinking_manager.rb (Ruby)

Code before:
      ignore_paths = @options.fetch(:ignorePaths, nil)
      exclude = @options.fetch(:exclude, [])
      args = []

      if !search_paths.nil? && !search_paths.empty?
        args.concat(search_paths)
      end

      if !ignore_paths.nil? && !ignore_paths.empty?
        args.concat(['--ignore-paths'], ignore_paths)
      end

      if !exclude.nil? && !exclude.empty?
        args.concat(['--exclude'], exclude)
      end

      args
    end

    private def node_command_args(command_name)
      eval_command_args = [
        'node',
        '--no-warnings',
        '--eval',
        'require(require.resolve(\'expo-modules-autolinking\', { paths: [\'' +  __dir__ + '\'] }))(process.argv.slice(1))',
        command_name,
        '--platform',
        'apple'
      ]
      return eval_command_args.concat(base_command_args())
    end

    private def resolve_command_args
      resolve_command_args = ['--json']

      project_root = @options.fetch(:projectRoot, nil)
      if project_root
        resolve_command_args.concat(['--project-root', project_root])
      end

      node_command_args('resolve').concat(resolve_command_args)
    end

    public def generate_modules_provider_command_args(target_path)
      command_args = ['--target', target_path]

      if !custom_app_root.nil?
        command_args.concat(['--app-root', custom_app_root])
      end

      node_command_args('generate-modules-provider').concat(

Review comment (bug):
This changes behaviour. Technically, we'd like to just avoid the self-require here, for our monorepo. However, there's little point in this one script resolving from "itself" rather than re-entering `expo` while the Android side doesn't bother doing this

The self-require specifically fails with pnpm in our own monorepo 

Code after:
      ignore_paths = @options.fetch(:ignorePaths, nil)
      exclude = @options.fetch(:exclude, [])
      args = []

      if !search_paths.nil? && !search_paths.empty?
        args.concat(search_paths)
      end

      if !ignore_paths.nil? && !ignore_paths.empty?
        args.concat(['--ignore-paths'], ignore_paths)
      end

      if !exclude.nil? && !exclude.empty?
        args.concat(['--exclude'], exclude)
      end

      args
    end

    private def node_command_args(command_name)
      eval_command_args = [
        'node',
        '--no-warnings',
        '--eval',
        'require(\'expo/bin/autolinking\')',
        'expo-modules-autolinking',
        command_name,
        '--platform',
        'apple'
      ]
      return eval_command_args.concat(base_command_args())
    end

    private def resolve_command_args
      resolve_command_args = ['--json']

      project_root = @options.fetch(:projectRoot, nil)
      if project_root
        resolve_command_args.concat(['--project-root', project_root])
      end

      node_command_args('resolve').concat(resolve_command_args)
    end

    public def generate_modules_provider_command_args(target_path)
      command_args = ['--target', target_path]

      if !custom_app_root.nil?
        command_args.concat(['--app-root', custom_app_root])
      end