Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/taro-platform-ascf/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class AscfApp extends TaroPlatformBase {
close () {
this.modifyTemplate(pluginOptions)
this.modifyWebpackConfig()
this.generateProjectConfig('ascf.config.json', 'ascf.config.json')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

避免硬编码文件名,改用 this.projectConfigJson 以兼容自定义 projectConfigName

类中已定义 projectConfigJson = this.config.projectConfigName || 'ascf.config.json'(见行 14)。此处硬编码 'ascf.config.json' 会忽略调用方通过 config.projectConfigName 的覆盖,破坏可配置性。建议改为使用类属性,或直接依赖默认参数。

建议修改如下:

-        this.generateProjectConfig('ascf.config.json', 'ascf.config.json')
+        this.generateProjectConfig(this.projectConfigJson, this.projectConfigJson)

如果 generateProjectConfig 支持无参且默认取 this.projectConfigJson,也可简化为:

  • 直接调用 this.generateProjectConfig()(仅作说明,不作为本 diff 的必改项)。
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
this.generateProjectConfig('ascf.config.json', 'ascf.config.json')
@@ packages/taro-platform-ascf/src/program.ts
this.generateProjectConfig(this.projectConfigJson, this.projectConfigJson)
🤖 Prompt for AI Agents
In packages/taro-platform-ascf/src/program.ts around line 40 (class defines
projectConfigJson = this.config.projectConfigName || 'ascf.config.json' at line
14), the call this.generateProjectConfig('ascf.config.json', 'ascf.config.json')
hardcodes the filename and ignores caller-provided config.projectConfigName;
change the call to use the class property (this.projectConfigJson) instead of
the string literal, or if generateProjectConfig supports no arguments, call
this.generateProjectConfig() so the method uses the default projectConfigJson;
ensure both parameters (if still required) are replaced with
this.projectConfigJson to preserve configurability.

}
})
}
Expand Down
Loading