Skip to content

Commit

Permalink
✨[feat]: 모듈 분리 scaffold 추가 구현
Browse files Browse the repository at this point in the history
*  scaffold 추가
* module path 추가
* stencill 추기
  • Loading branch information
Roy-wonji committed Dec 17, 2023
1 parent 4102005 commit 552c502
Show file tree
Hide file tree
Showing 26 changed files with 705 additions and 80 deletions.
1 change: 1 addition & 0 deletions BeatCounter/.tuist-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.33.3
31 changes: 31 additions & 0 deletions BeatCounter/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
GENERATE = tuist generate
FETCH = tuist fetch
BUILD = tuist build
CLEAN = tuist clean
CURRENT_DATE = $(shell run scripts/current_date.swift)

# Define your targets and dependencies

.PHONY: generate
generate:
TUIST_ROOT_DIR=${PWD} $(GENERATE)

.PHONY: build
build: $(CLEAN) $(FETCH) $(FETCH) TUIST_ROOT_DIR=${PWD} $(GENERATE)

.PHONY: clean
clean:
$(CLEAN)

.PHONY: fetch
fetch:
$(FETCH)

module:
tuist scaffold Module \
--layer ${layer} \
--name ${name} \
--author "서원지"


# Additional targets can be added as needed
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Extension+TargetDependency.swift
// MyPlugin
//
// Created by 서원지 on 12/17/23.
//

import ProjectDescription

public extension TargetDependency {
enum SPM {}
}

public extension TargetDependency.SPM {

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
//
// Project+Template.swift
// MyPlugin
//
// Created by Gordon Choi on 12/10/23.
//

import ProjectDescription

public extension Project {
public enum Environment {
public static let appName = "BeatCounter"
public static let organizationName = "" // and so on
public static let deploymentTarget = DeploymentTarget.iOS(targetVersion: "17.0", devices: [.iphone, .ipad])
public static let bundlePrefix = "com." // and so on
public static let appVersion = "1.0.0"
public static let mainBundleId = "com.BeatCounter"
}
}

public extension Project {
static func makeAppModule(
name: String = Environment.appName,
bundleId: String,
platform: Platform = .iOS,
product: Product,
organizationName: String = Environment.organizationName,
packages: [Package] = [],
deploymentTarget: DeploymentTarget = Environment.deploymentTarget,
settings: Settings,
dependencies: [TargetDependency] = [],
sources: SourceFilesList = .sources,
resources: ResourceFileElements? = nil,
infoPlist: InfoPlist = .default,
entitlements: Entitlements? = nil,
schemes: [Scheme] = []
) -> Project {
let appTarget = Target(
name: name,
platform: platform,
product: product,
bundleId: bundleId,
deploymentTarget: deploymentTarget,
infoPlist: infoPlist,
sources: sources,
resources: resources,
entitlements: entitlements,
scripts: [],
dependencies: dependencies
)

let appDevTarget = Target(
name: "\(name)-Dev",
platform: .iOS,
product: product,
bundleId: "\(bundleId)",
deploymentTarget: deploymentTarget,
infoPlist: infoPlist,
sources: sources,
resources: resources,
entitlements: entitlements,
scripts: [],
dependencies: dependencies

)

let appTestTarget = Target(
name: "\(name)Tests",
platform: platform,
product: .unitTests,
bundleId: "\(bundleId).\(name)Tests",
deploymentTarget: deploymentTarget,
infoPlist: .default,
sources: ["\(name)Tests/Sources/**"],
dependencies: [.target(name: name)]
)

let targets = [appTarget, appDevTarget, appTestTarget]

return Project(
name: name,
organizationName: organizationName,
packages: packages,
settings: settings,
targets: targets,
schemes: schemes
)
}
}


extension Scheme {
public static func makeScheme(target: ConfigurationName, name: String) -> Scheme {
return Scheme(
name: name,
shared: true,
buildAction: .buildAction(targets: ["\(name)"]),
testAction: .targets(
["\(name)Tests"],
configuration: target,
options: .options(coverage: true, codeCoverageTargets: ["\(name)"])
),
runAction: .runAction(configuration: target),
archiveAction: .archiveAction(configuration: target),
profileAction: .profileAction(configuration: target),
analyzeAction: .analyzeAction(configuration: target)
)
}

}


extension String {
public static func appVersion() -> String {
let version: String = "1.0.0"
return version
}

public static func watchAppVersion() -> String {
let version: String = "1.0.0"
return version
}

public static func appBuildVersion() -> String {
let buildVersion: String = "10"
return buildVersion
}

public static func mainBundleID() -> String {
let bundleID = "com.BeatCounter"
return bundleID
}

public static func appBundleID(name: String) -> String {
let bundleID = "com.BeatCounter\(name)"
return bundleID+name
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ResourceFileElements+Templete.swift
// MyPlugin
//
// Created by 서원지 on 12/17/23.
//

import Foundation
import ProjectDescription


public extension ResourceFileElements {
static let resources: ResourceFileElements = "Resources/**"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// SourceFilesList+Template.swift
// MyPlugin
//
// Created by 서원지 on 12/17/23.
//

import Foundation
import ProjectDescription

public extension SourceFilesList {
static let sources: SourceFilesList = "Sources/**"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// Modules.swift
// MyPlugin
//
// Created by 서원지 on 12/17/23.
//

import Foundation
import ProjectDescription

public enum ModulePath {
case Feature(Features)
case Core(Cores)
case Networking(Networkings)
case Shared(Shareds)
}

//MARK: - 앱 모듈
public extension ModulePath {
enum App: String, CaseIterable {
case iOS
case iPad

public static let name: String = "App"
}
}

// MARK: FeatureModule
public extension ModulePath {
enum Features: String, CaseIterable {
case Auth

public static let name: String = "Feature"
}
}

//MARK: - CoreMoudule
public extension ModulePath {
enum Cores: String, CaseIterable {
case Core
case Authorization
case Station

public static let name: String = "Core"
}
}

//MARK: - CoreDomainModule
public extension ModulePath {
enum Networkings: String, CaseIterable {
case Model
case Service
public static let name: String = "Networking"
}
}

public extension ModulePath {
enum Shareds: String, CaseIterable {
case DesignSystem
case Constants
case ThirdParty

public static let name: String = "Shared"
}
}
Loading

0 comments on commit 552c502

Please sign in to comment.