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

Improve the init template #5897

Closed
pepicrft opened this issue Feb 8, 2024 · 3 comments · Fixed by #6044
Closed

Improve the init template #5897

pepicrft opened this issue Feb 8, 2024 · 3 comments · Fixed by #6044
Labels
good first issue Good for newcomers type:enhancement New feature or request

Comments

@pepicrft
Copy link
Contributor

pepicrft commented Feb 8, 2024

Our template should include a .mise.toml file with the Tuist tool pointing to the exact version that was used to create the project, and also a skeletonPackage.swift that serves as a starting point for people to add dependencies.

@pepicrft pepicrft added type:bug Something isn't working type:enhancement New feature or request good first issue Good for newcomers and removed type:bug Something isn't working labels Feb 8, 2024
@dxmvsh
Copy link
Contributor

dxmvsh commented Mar 6, 2024

Hi, @pepicrft!

I was working on this issue for a couple of hours and I've succeeded with adding .mise.toml file in init command default template. I have some problems with including skeleton of Package.swift file, because I can't quite understand what kind of code template should be there. I looked through fixtures/ folder for appropriate Package.swift as dependencies adding point and couldn't find anything. Maybe I missed something, would really appreciate any help here 🙏🏿

Since this issue is open for more than a month, I think the requirements might be changed. I can already open PR with .mise.toml file in default template.

@fortmarek
Copy link
Member

fortmarek commented Mar 6, 2024

I think it would be good if the generated Tuist/Package.swift would look something like:

// swift-tools-version: 5.9
import PackageDescription

#if TUIST
    import ProjectDescription
    import ProjectDescriptionHelpers

    let packageSettings = PackageSettings(
        productTypes: [
            // Customize the product types for specific package product
            // Default is .staticFramework
            // "Alamofire": .framework,
        ]
    )
#endif

let package = Package(
    name: "ProjectName",
    dependencies: [
        // Add your own dependencies here:
        // .package(url: "https://github.com/Alamofire/Alamofire", from: "5.0.0"),
    ]
)

Does that answer your question, @dxmvsh? Feel free to open a draft PR, it may be easier to talk over a specific piece of code 🙂

@dxmvsh
Copy link
Contributor

dxmvsh commented Mar 7, 2024

@fortmarek, Thank you for reaching out! It really helped me to successfully add Package.swift template and before that I had to make some corrections:

When tuist build command is executed, it ends up with an error. I guess it couldn't find ProjectDescriptionHelpers module.

The 'swift' command exited with error code 1 and message:
/Users/strong/workspace/trash/NewCo/Tuist/Package.swift:6:12: error: no such module 'ProjectDescriptionHelpers'
    import ProjectDescriptionHelpers
           ^

Consider creating an issue using the following link: https://github.com/tuist/tuist/issues/new/choose�[0m
Program ended with exit code: 1

Removed the import ProjectDescriptionHelpers line and it failed with error that productTypes should be empty dictionary with :.

Changed it to this:

let packageSettings = PackageSettings(
    // Customize the product types for specific package product
    // Default is .staticFramework
    // productTypes: ["Alamofire": .framework,]
    productTypes: [:]
)

Created PR here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type:enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants