discourse/lib/tasks/documentation.rake
David Taylor 451581d50a
DEV: Remove unmaintained tidy-jsdoc dependency (#25110)
This was used by chat's HTML documentation experiment. That documentation experiment isn't being actively used/updated, but may be revisited in future. Therefore, this commit updates the jsdoc config to remove the custom theme, but keeps it functional (with the default jsdoc theme).
2024-01-03 10:30:54 +00:00

35 lines
1.2 KiB
Ruby

# frozen_string_literal: true
require "fileutils"
task "documentation" do
generate_chat_documentation
end
def generate_chat_documentation
destination = File.join(Rails.root, "documentation/chat/frontend/")
config = File.join(Rails.root, ".jsdoc")
files = %w[
plugins/chat/assets/javascripts/discourse/lib/collection.js
plugins/chat/assets/javascripts/discourse/pre-initializers/chat-plugin-api.js
plugins/chat/assets/javascripts/discourse/services/chat-api.js
]
`yarn --silent jsdoc --readme plugins/chat/README.md -c #{config} #{files.join(" ")} -d #{destination}`
require "open3"
require "yard"
YARD::Templates::Engine.register_template_path(
File.join(Rails.root, "documentation", "yard-custom-template"),
)
files = %w[
plugins/chat/app/services/base.rb
plugins/chat/app/services/update_user_last_read.rb
plugins/chat/app/services/trash_channel.rb
plugins/chat/app/services/update_channel.rb
plugins/chat/app/services/update_channel_status.rb
]
cmd =
"bundle exec yardoc -p documentation/yard-custom-template -t default -r plugins/chat/README.md --output-dir documentation/chat/backend #{files.join(" ")}"
Open3.popen3(cmd) { |_, stderr| puts stderr.read }
end