mirror of
https://github.com/discourse/discourse.git
synced 2026-07-31 08:38:27 -05:00
DEV: Prepare for rename of app/assets/javascripts/ -> frontend/
This commit contains all the code changes. A followup will perform the actual move
This commit is contained in:
@@ -278,7 +278,7 @@ jobs:
|
||||
|
||||
- name: Asset Processor Tests
|
||||
if: matrix.build_type == 'frontend' && matrix.target == 'core'
|
||||
working-directory: app/assets/javascripts/asset-processor
|
||||
working-directory: frontend/asset-processor
|
||||
run: pnpm test
|
||||
|
||||
- name: Plugin QUnit
|
||||
@@ -292,8 +292,8 @@ jobs:
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always() && matrix.build_type == 'frontend'
|
||||
with:
|
||||
name: ember-exam-execution-${{ matrix.target }}-${{ matrix.browser }}-frontend-${{ hashFiles('./app/assets/javascripts/discourse/test-execution-*.json') }}
|
||||
path: ./app/assets/javascripts/discourse/test-execution-*.json
|
||||
name: ember-exam-execution-${{ matrix.target }}-${{ matrix.browser }}-frontend-${{ hashFiles('./frontend/discourse/test-execution-*.json') }}
|
||||
path: ./frontend/discourse/test-execution-*.json
|
||||
|
||||
- name: Ember Build for System Tests
|
||||
if: matrix.build_type == 'system'
|
||||
|
||||
+7
-12
@@ -19,28 +19,23 @@ if (fs.existsSync(`${discourseRoot}/node_modules/.yarn-integrity`)) {
|
||||
console.log("cleanup done");
|
||||
}
|
||||
|
||||
const oldAdminPath = `${discourseRoot}/app/assets/javascripts/admin`;
|
||||
if (fs.existsSync(`${oldAdminPath}/node_modules`)) {
|
||||
const oldFrontendPath = `app/assets/javascripts`;
|
||||
if (fs.existsSync(`${discourseRoot}/${oldFrontendPath}`)) {
|
||||
console.log(
|
||||
"Detected old admin node_modules. Performing one-time cleanup..."
|
||||
`[.pnpmfile.cjs] Detected old ${oldFrontendPath} directory. Cleaning up gitignored files...`
|
||||
);
|
||||
|
||||
fs.rmSync(`${oldAdminPath}/node_modules`, {
|
||||
recursive: true,
|
||||
});
|
||||
execSync(`git clean -f -X ${oldFrontendPath}`, { cwd: discourseRoot });
|
||||
|
||||
const anyFiles = !!execSync(
|
||||
`find "${oldAdminPath}" -mindepth 1 -type f -print -quit`,
|
||||
{ encoding: "utf8" }
|
||||
`find "${oldFrontendPath}" -mindepth 1 -type f -print -quit`,
|
||||
{ encoding: "utf8", cwd: discourseRoot }
|
||||
).trim();
|
||||
|
||||
if (!anyFiles) {
|
||||
fs.rmSync(oldAdminPath, {
|
||||
fs.rmSync(oldFrontendPath, {
|
||||
recursive: true,
|
||||
});
|
||||
}
|
||||
|
||||
console.log("admin cleanup done");
|
||||
}
|
||||
|
||||
const pluginBase = `${discourseRoot}/plugins/`;
|
||||
|
||||
+3
-10
@@ -1,5 +1,4 @@
|
||||
app/assets/stylesheets/vendor/
|
||||
app/assets/javascripts/plugins/
|
||||
plugins/**/assets/stylesheets/vendor/
|
||||
plugins/**/assets/javascripts/vendor/
|
||||
plugins/**/config/locales/**/*.yml
|
||||
@@ -10,18 +9,12 @@ config/locales/**/*.yml
|
||||
!config/locales/**/*.en*.yml
|
||||
script/import_scripts/**/*.yml
|
||||
|
||||
app/assets/javascripts/browser-update.js
|
||||
app/assets/javascripts/ember-addons/
|
||||
app/assets/javascripts/discourse/lib/autosize.js
|
||||
lib/javascripts/locale/
|
||||
lib/javascripts/messageformat.js
|
||||
lib/highlight_js/
|
||||
plugins/**/lib/javascripts/locale
|
||||
public/
|
||||
!/app/assets/javascripts/discourse/public
|
||||
!/frontend/discourse/public
|
||||
vendor/
|
||||
app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js
|
||||
app/assets/javascripts/discourse/tests/fixtures
|
||||
frontend/discourse/tests/unit/utils/decorators-test.js
|
||||
frontend/discourse/tests/fixtures
|
||||
spec/
|
||||
node_modules/
|
||||
dist/
|
||||
|
||||
@@ -127,7 +127,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
pluginInfos() {
|
||||
const root = path.resolve("../../../../plugins");
|
||||
const root = path.resolve("../../plugins");
|
||||
const pluginDirectories = fs
|
||||
.readdirSync(root, { withFileTypes: true })
|
||||
.filter(
|
||||
|
||||
@@ -263,7 +263,7 @@ export default {
|
||||
* category: String,
|
||||
* name: String,
|
||||
* definition: (See function `buildShortcut` in
|
||||
* app/assets/javascripts/discourse/app/controllers/keyboard-shortcuts-help.js
|
||||
* frontend/discourse/app/controllers/keyboard-shortcuts-help.js
|
||||
* for definition structure)
|
||||
* }
|
||||
*
|
||||
|
||||
@@ -23,7 +23,7 @@ const { BroccoliMergeFiles } = require("broccoli-merge-files");
|
||||
process.env.BROCCOLI_ENABLED_MEMOIZE = true;
|
||||
|
||||
module.exports = function (defaults) {
|
||||
const discourseRoot = path.resolve("../../../..");
|
||||
const discourseRoot = path.resolve("../..");
|
||||
const vendorJs = discourseRoot + "/vendor/assets/javascripts/";
|
||||
|
||||
// Silence deprecations which we are aware of - see `lib/deprecation-silencer.js`
|
||||
@@ -103,11 +103,10 @@ module.exports = function (defaults) {
|
||||
});
|
||||
|
||||
// WARNING: We should only import scripts here if they are not in NPM.
|
||||
app.import(discourseRoot + "/app/assets/javascripts/polyfills.js");
|
||||
app.import(discourseRoot + "/frontend/polyfills.js");
|
||||
|
||||
app.import(
|
||||
discourseRoot +
|
||||
"/app/assets/javascripts/discourse/public/assets/scripts/module-shims.js"
|
||||
discourseRoot + "/frontend/discourse/public/assets/scripts/module-shims.js"
|
||||
);
|
||||
|
||||
const discoursePluginsTree = app.project
|
||||
|
||||
@@ -734,7 +734,7 @@ class ApplicationController < ActionController::Base
|
||||
raise Discourse::InvalidAccess.new unless SiteSetting.wizard_enabled?
|
||||
end
|
||||
|
||||
# Keep in sync with `NO_DESTINATION_COOKIE` in `app/assets/javascripts/discourse/app/lib/utilities.js`
|
||||
# Keep in sync with `NO_DESTINATION_COOKIE` in `frontend/discourse/app/lib/utilities.js`
|
||||
NO_DESTINATION_COOKIE = %w[/login /signup /session/ /auth/ /uploads/].freeze
|
||||
|
||||
def is_valid_destination_url?(url)
|
||||
|
||||
@@ -58,10 +58,7 @@ class ThemeSettingsMigrationsRunner
|
||||
def self.loader_js_lib_content
|
||||
@loader_js_lib_content ||=
|
||||
File.read(
|
||||
File.join(
|
||||
Rails.root,
|
||||
"app/assets/javascripts/discourse/node_modules/loader.js/dist/loader/loader.js",
|
||||
),
|
||||
File.join(Rails.root, "frontend/discourse/node_modules/loader.js/dist/loader/loader.js"),
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<meta name="discourse/config/environment" content="<%=u discourse_config_environment(testing: true) %>" />
|
||||
|
||||
<style>
|
||||
<%= File.read("#{Rails.root}/app/assets/javascripts/discourse/node_modules/qunit/qunit/qunit.css").html_safe %>
|
||||
<%= File.read("#{Rails.root}/frontend/discourse/node_modules/qunit/qunit/qunit.css").html_safe %>
|
||||
</style>
|
||||
|
||||
<%= discourse_stylesheet_link_tag(:common, theme_id: nil) %>
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ if ARGV.include?("-h") || ARGV.include?("--help")
|
||||
exec "pnpm ember #{command} --help"
|
||||
end
|
||||
|
||||
args = ["--dir=app/assets/javascripts/discourse", "ember", command] + (ARGV - CUSTOM_ARGS)
|
||||
args = ["--dir=frontend/discourse", "ember", command] + (ARGV - CUSTOM_ARGS)
|
||||
|
||||
if !args.include?("test") && !args.include?("build") && !args.include?("--proxy")
|
||||
args << "--proxy"
|
||||
|
||||
@@ -11,7 +11,7 @@ Rails.application.config.assets.version = "2-#{GlobalSetting.asset_url_salt}"
|
||||
# Add additional assets to the asset load path.
|
||||
Rails.application.config.assets.paths.push(
|
||||
"#{Rails.root}/public/javascripts",
|
||||
"#{Rails.root}/app/assets/javascripts/discourse/dist/assets",
|
||||
"#{Rails.root}/frontend/discourse/dist/assets",
|
||||
)
|
||||
|
||||
Rails.application.config.assets.paths.push(
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
{
|
||||
"app/assets/javascripts/discourse/components/*.js": {
|
||||
"frontend/discourse/components/*.js": {
|
||||
"command": "dcomponent"
|
||||
},
|
||||
"app/assets/javascripts/discourse/lib/*.js": {
|
||||
"frontend/discourse/lib/*.js": {
|
||||
"command": "dlib"
|
||||
},
|
||||
"app/assets/javascripts/discourse/routes/*.js": {
|
||||
"frontend/discourse/routes/*.js": {
|
||||
"command": "droute"
|
||||
},
|
||||
"app/assets/javascripts/discourse/controllers/*.js": {
|
||||
"frontend/discourse/controllers/*.js": {
|
||||
"command": "dcontroller"
|
||||
},
|
||||
"app/assets/javascripts/discourse/models/*.js": {
|
||||
"frontend/discourse/models/*.js": {
|
||||
"command": "dmodel"
|
||||
},
|
||||
"app/assets/javascripts/discourse/helpers/*.js": {
|
||||
"frontend/discourse/helpers/*.js": {
|
||||
"command": "dhelper"
|
||||
},
|
||||
"app/assets/javascripts/discourse/templates/*.hbs": {
|
||||
"frontend/discourse/templates/*.hbs": {
|
||||
"command": "dtemplate"
|
||||
},
|
||||
"app/assets/javascripts/discourse/templates/*.hbr": {
|
||||
"frontend/discourse/templates/*.hbr": {
|
||||
"command": "dtemplate"
|
||||
},
|
||||
"app/assets/javascripts/discourse/views/*.js": {
|
||||
"frontend/discourse/views/*.js": {
|
||||
"command": "dview"
|
||||
},
|
||||
"app/serializers/*.rb": {
|
||||
|
||||
+2
-6
@@ -11,18 +11,14 @@ export default [
|
||||
},
|
||||
{
|
||||
ignores: [
|
||||
"app/assets/javascripts/ember-addons/",
|
||||
"lib/javascripts/locale/*",
|
||||
"lib/javascripts/messageformat.js",
|
||||
"lib/javascripts/messageformat-lookup.js",
|
||||
"plugins/**/lib/javascripts/locale",
|
||||
"plugins/discourse-math/public",
|
||||
"public/",
|
||||
"vendor/",
|
||||
"app/assets/javascripts/discourse/tests/fixtures",
|
||||
"frontend/discourse/tests/fixtures",
|
||||
"**/node_modules/",
|
||||
"spec/",
|
||||
"app/assets/javascripts/discourse/dist/",
|
||||
"frontend/discourse/dist/",
|
||||
"tmp/",
|
||||
],
|
||||
},
|
||||
|
||||
+19
-19
@@ -8,31 +8,31 @@
|
||||
"allowJs": true,
|
||||
"paths": {
|
||||
"discourse/admin/*": [
|
||||
"./app/assets/javascripts/discourse/admin/*"
|
||||
"./frontend/discourse/admin/*"
|
||||
],
|
||||
"discourse/*": [
|
||||
"./app/assets/javascripts/discourse/app/*"
|
||||
"./frontend/discourse/app/*"
|
||||
],
|
||||
"discourse/tests/*": [
|
||||
"./app/assets/javascripts/discourse/tests/*"
|
||||
"./frontend/discourse/tests/*"
|
||||
],
|
||||
"admin/*": [
|
||||
"./app/assets/javascripts/discourse/admin/*"
|
||||
"./frontend/discourse/admin/*"
|
||||
],
|
||||
"pretty-text/*": [
|
||||
"./app/assets/javascripts/pretty-text/addon/*"
|
||||
"./frontend/pretty-text/addon/*"
|
||||
],
|
||||
"select-kit/*": [
|
||||
"./app/assets/javascripts/select-kit/addon/*"
|
||||
"./frontend/select-kit/addon/*"
|
||||
],
|
||||
"float-kit/*": [
|
||||
"./app/assets/javascripts/float-kit/addon/*"
|
||||
"./frontend/float-kit/addon/*"
|
||||
],
|
||||
"truth-helpers/*": [
|
||||
"./app/assets/javascripts/truth-helpers/addon/*"
|
||||
"./frontend/truth-helpers/addon/*"
|
||||
],
|
||||
"dialog-holder/*": [
|
||||
"./app/assets/javascripts/dialog-holder/addon/*"
|
||||
"./frontend/dialog-holder/addon/*"
|
||||
],
|
||||
"discourse/plugins/automation/*": [
|
||||
"./plugins/automation/assets/javascripts/*",
|
||||
@@ -213,15 +213,15 @@
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./app/assets/javascripts/discourse/admin",
|
||||
"./app/assets/javascripts/discourse/app",
|
||||
"./app/assets/javascripts/discourse/tests",
|
||||
"./app/assets/javascripts/discourse/admin",
|
||||
"./app/assets/javascripts/pretty-text/addon",
|
||||
"./app/assets/javascripts/select-kit/addon",
|
||||
"./app/assets/javascripts/float-kit/addon",
|
||||
"./app/assets/javascripts/truth-helpers/addon",
|
||||
"./app/assets/javascripts/dialog-holder/addon",
|
||||
"./frontend/discourse/admin",
|
||||
"./frontend/discourse/app",
|
||||
"./frontend/discourse/tests",
|
||||
"./frontend/discourse/admin",
|
||||
"./frontend/pretty-text/addon",
|
||||
"./frontend/select-kit/addon",
|
||||
"./frontend/float-kit/addon",
|
||||
"./frontend/truth-helpers/addon",
|
||||
"./frontend/dialog-holder/addon",
|
||||
"./plugins/automation/assets/javascripts",
|
||||
"./plugins/automation/test/javascripts",
|
||||
"./plugins/chat/assets/javascripts",
|
||||
@@ -312,6 +312,6 @@
|
||||
"./themes/horizon/test"
|
||||
],
|
||||
"exclude": [
|
||||
"app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js"
|
||||
"frontend/discourse/tests/unit/utils/decorators-test.js"
|
||||
]
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,11 +20,11 @@ pre-commit:
|
||||
run: pnpm pprettier --list-different {staged_files}
|
||||
eslint:
|
||||
glob: "*.{js,gjs}"
|
||||
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
|
||||
include: "frontend|plugins/.+?/assets/javascripts"
|
||||
run: pnpm eslint --quiet {staged_files}
|
||||
ember-template-lint:
|
||||
glob: "*.{hbs,gjs}"
|
||||
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
|
||||
include: "frontend|plugins/.+?/assets/javascripts"
|
||||
run: pnpm ember-template-lint {staged_files}
|
||||
yaml-syntax:
|
||||
glob: "*.{yaml,yml}"
|
||||
@@ -48,11 +48,11 @@ fix-staged:
|
||||
run: pnpm pprettier --write {staged_files}
|
||||
eslint:
|
||||
glob: "*.{js,gjs}"
|
||||
include: "app/assets/javascripts|plugins/.+?/assets/javascripts|themes"
|
||||
include: "frontend|plugins/.+?/assets/javascripts|themes"
|
||||
run: pnpm eslint --fix {staged_files}
|
||||
ember-template-lint:
|
||||
glob: "*.{gjs,hbs}"
|
||||
include: "app/assets/javascripts|plugins/.+?/assets/javascripts|themes"
|
||||
include: "frontend|plugins/.+?/assets/javascripts|themes"
|
||||
run: pnpm ember-template-lint --fix {staged_files}
|
||||
stylelint:
|
||||
glob: "*.scss"
|
||||
|
||||
@@ -24,12 +24,7 @@ class AssetProcessor
|
||||
end
|
||||
|
||||
def self.build_asset_processor
|
||||
Discourse::Utils.execute_command(
|
||||
"pnpm",
|
||||
"-C=app/assets/javascripts/asset-processor",
|
||||
"node",
|
||||
"build.js",
|
||||
)
|
||||
Discourse::Utils.execute_command("pnpm", "-C=frontend/asset-processor", "node", "build.js")
|
||||
end
|
||||
|
||||
def self.build_production_asset_processor
|
||||
|
||||
@@ -26,9 +26,7 @@ module Autospec
|
||||
|
||||
watch(%r{\Aspec/fabricators/.+_fabricator\.rb\z}) { "spec" }
|
||||
|
||||
watch(%r{\Aapp/assets/javascripts/pretty-text/.*\.js\.es6\z}) do
|
||||
"spec/components/pretty_text_spec.rb"
|
||||
end
|
||||
watch(%r{\Afrontend/pretty-text/.*\.js\.es6\z}) { "spec/components/pretty_text_spec.rb" }
|
||||
watch(%r{\Aplugins/.*/discourse-markdown/.*\.js\.es6\z}) do
|
||||
"spec/components/pretty_text_spec.rb"
|
||||
end
|
||||
|
||||
@@ -250,9 +250,9 @@ class DiscoursePluginRegistry
|
||||
end
|
||||
|
||||
VENDORED_CORE_PRETTY_TEXT_MAP = {
|
||||
"moment.js" => "app/assets/javascripts/discourse/node_modules/moment/moment.js",
|
||||
"moment.js" => "frontend/discourse/node_modules/moment/moment.js",
|
||||
"moment-timezone.js" =>
|
||||
"app/assets/javascripts/discourse/node_modules/moment-timezone/builds/moment-timezone-with-data.js",
|
||||
"frontend/discourse/node_modules/moment-timezone/builds/moment-timezone-with-data.js",
|
||||
}
|
||||
|
||||
def self.core_asset_for_name(name)
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ class EmberCli < ActiveSupport::CurrentAttributes
|
||||
attribute :request_cache
|
||||
|
||||
def self.dist_dir
|
||||
"#{Rails.root}/app/assets/javascripts/discourse/dist"
|
||||
"#{Rails.root}/frontend/discourse/dist"
|
||||
end
|
||||
|
||||
def self.assets
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module HighlightJs
|
||||
HIGHLIGHTJS_DIR =
|
||||
"#{Rails.root}/app/assets/javascripts/discourse/node_modules/@highlightjs/cdn-assets/"
|
||||
HIGHLIGHTJS_DIR = "#{Rails.root}/frontend/discourse/node_modules/@highlightjs/cdn-assets/"
|
||||
VERSION = 1 # bump to invalidate caches following core changes
|
||||
|
||||
def self.languages
|
||||
|
||||
@@ -266,7 +266,7 @@ module JsLocaleHelper
|
||||
path = "#{Rails.root}/node_modules/@discourse/moment-timezone-names-translations/locales"
|
||||
type = :moment_js_timezones
|
||||
else
|
||||
path = "#{Rails.root}/app/assets/javascripts/discourse/node_modules/moment/locale"
|
||||
path = "#{Rails.root}/frontend/discourse/node_modules/moment/locale"
|
||||
type = :moment_js
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# The server-side implementation of PresenceChannels. See also {PresenceController}
|
||||
# and +app/assets/javascripts/discourse/app/services/presence.js+
|
||||
# and +frontend/discourse/app/services/presence.js+
|
||||
class PresenceChannel
|
||||
class NotFound < StandardError
|
||||
end
|
||||
|
||||
+3
-3
@@ -82,9 +82,9 @@ module PrettyText
|
||||
ctx.attach("__helpers.#{method}", PrettyText::Helpers.method(method))
|
||||
end
|
||||
|
||||
root_path = "#{Rails.root}/app/assets/javascripts"
|
||||
d_node_modules = "#{Rails.root}/app/assets/javascripts/discourse/node_modules"
|
||||
md_node_modules = "#{Rails.root}/app/assets/javascripts/discourse-markdown-it/node_modules"
|
||||
root_path = "#{Rails.root}/frontend"
|
||||
d_node_modules = "#{Rails.root}/frontend/discourse/node_modules"
|
||||
md_node_modules = "#{Rails.root}/frontend/discourse-markdown-it/node_modules"
|
||||
ctx.load("#{d_node_modules}/loader.js/dist/loader/loader.js")
|
||||
ctx.load("#{md_node_modules}/markdown-it/dist/markdown-it.js")
|
||||
ctx.load("#{md_node_modules}/xss/dist/xss.js")
|
||||
|
||||
@@ -183,7 +183,7 @@ task "docker:test" do
|
||||
else
|
||||
@good &&= run_or_fail("bundle exec rake plugin:update_all") unless ENV["SKIP_PLUGINS"]
|
||||
@good &&= run_or_fail("bundle exec rubocop") unless ENV["SKIP_CORE"]
|
||||
@good &&= run_or_fail("pnpm eslint app/assets/javascripts") unless ENV["SKIP_CORE"]
|
||||
@good &&= run_or_fail("pnpm eslint frontend") unless ENV["SKIP_CORE"]
|
||||
@good &&=
|
||||
run_or_fail(
|
||||
"pnpm eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern plugins",
|
||||
@@ -202,7 +202,7 @@ task "docker:test" do
|
||||
puts "Listing prettier offenses in core:"
|
||||
@good &&=
|
||||
run_or_fail(
|
||||
'pnpm pprettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.js"',
|
||||
'pnpm pprettier --list-different "app/assets/stylesheets/**/*.scss" "frontend/**/*.js"',
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ def write_template(path, task_name, template)
|
||||
JS
|
||||
|
||||
basename = File.basename(path)
|
||||
output_path = "#{Rails.root}/app/assets/javascripts/#{path}"
|
||||
output_path = "#{Rails.root}/frontend/#{path}"
|
||||
|
||||
File.write(output_path, "#{header}\n\n#{template}")
|
||||
puts "#{basename} created"
|
||||
|
||||
@@ -113,13 +113,7 @@ task "qunit:test", %i[qunit_path filter] do |_, args|
|
||||
# Bypass `ember test` - it only works properly for the `/tests` path.
|
||||
# We have to trigger a `build` manually so that JS is available for rails to serve.
|
||||
if !reuse_build
|
||||
system(
|
||||
"pnpm",
|
||||
"ember",
|
||||
"build",
|
||||
chdir: "#{Rails.root}/app/assets/javascripts/discourse",
|
||||
exception: true,
|
||||
)
|
||||
system("pnpm", "ember", "build", chdir: "#{Rails.root}/frontend/discourse", exception: true)
|
||||
end
|
||||
|
||||
env["THEME_TEST_PAGES"] = if ENV["THEME_IDS"]
|
||||
@@ -144,7 +138,7 @@ task "qunit:test", %i[qunit_path filter] do |_, args|
|
||||
|
||||
# Print out all env for debugging purposes
|
||||
p env
|
||||
system(env, *cmd, chdir: "#{Rails.root}/app/assets/javascripts/discourse")
|
||||
system(env, *cmd, chdir: "#{Rails.root}/frontend/discourse")
|
||||
|
||||
success &&= $?.success?
|
||||
ensure
|
||||
|
||||
+7
-7
@@ -37,17 +37,17 @@
|
||||
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
|
||||
"lint:css": "pnpm stylelint 'app/assets/stylesheets/**/*.scss' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') 'themes/**/*.scss'",
|
||||
"lint:css:fix": "pnpm stylelint --fix 'app/assets/stylesheets/**/*.scss' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') 'themes/**/*.scss'",
|
||||
"lint:js": "eslint ./app/assets/javascripts $(script/list_bundled_plugins) ./themes --cache --no-error-on-unmatched-pattern",
|
||||
"lint:js:fix": "eslint --fix ./app/assets/javascripts $(script/list_bundled_plugins) ./themes --no-error-on-unmatched-pattern",
|
||||
"lint:hbs": "ember-template-lint 'app/assets/javascripts/**/*.{gjs,hbs}' 'plugins/*/assets/javascripts/**/*.{gjs,hbs}' 'plugins/*/admin/assets/javascripts/**/*.{gjs,hbs}' 'themes/**/*.{gjs,hbs}'",
|
||||
"lint:hbs:fix": "ember-template-lint 'app/assets/javascripts/**/*.{gjs,hbs}' 'plugins/*/assets/javascripts/**/*.{gjs,hbs}' 'plugins/*/admin/assets/javascripts/**/*.{gjs,hbs}' 'themes/**/*.{gjs,hbs}' --fix",
|
||||
"lint:prettier": "pnpm pprettier --list-different 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs,css}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/{assets,admin/assets,test}/javascripts/**/*.{js,gjs,hbs}') 'themes/**/*.{js,gjs,hbs,scss}'",
|
||||
"lint:prettier:fix": "pnpm prettier -w --no-error-on-unmatched-pattern 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs,css}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/{assets,admin/assets,test}/javascripts/**/*.{js,gjs,hbs}') 'themes/**/*.{js,gjs,hbs,scss}'",
|
||||
"lint:js": "eslint ./frontend $(script/list_bundled_plugins) ./themes --cache --no-error-on-unmatched-pattern",
|
||||
"lint:js:fix": "eslint --fix ./frontend $(script/list_bundled_plugins) ./themes --no-error-on-unmatched-pattern",
|
||||
"lint:hbs": "ember-template-lint 'frontend/**/*.{gjs,hbs}' 'plugins/*/assets/javascripts/**/*.{gjs,hbs}' 'plugins/*/admin/assets/javascripts/**/*.{gjs,hbs}' 'themes/**/*.{gjs,hbs}'",
|
||||
"lint:hbs:fix": "ember-template-lint 'frontend/**/*.{gjs,hbs}' 'plugins/*/assets/javascripts/**/*.{gjs,hbs}' 'plugins/*/admin/assets/javascripts/**/*.{gjs,hbs}' 'themes/**/*.{gjs,hbs}' --fix",
|
||||
"lint:prettier": "pnpm pprettier --list-different 'app/assets/stylesheets/**/*.scss' 'frontend/**/*.{js,gjs,hbs,css}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/{assets,admin/assets,test}/javascripts/**/*.{js,gjs,hbs}') 'themes/**/*.{js,gjs,hbs,scss}'",
|
||||
"lint:prettier:fix": "pnpm prettier -w --no-error-on-unmatched-pattern 'app/assets/stylesheets/**/*.scss' 'frontend/**/*.{js,gjs,hbs,css}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/{assets,admin/assets,test}/javascripts/**/*.{js,gjs,hbs}') 'themes/**/*.{js,gjs,hbs,scss}'",
|
||||
"lint:glint": "ember-tsc -p jsconfig.json --noEmit",
|
||||
"lttf:ignore": "lint-to-the-future ignore",
|
||||
"lttf:output": "lint-to-the-future output -o ./lint-progress/",
|
||||
"lint-progress": "pnpm lttf:output && npx html-pages ./lint-progress --no-cache",
|
||||
"ember": "pnpm --dir=app/assets/javascripts/discourse ember",
|
||||
"ember": "pnpm --dir=frontend/discourse ember",
|
||||
"playwright-install": "playwright install --no-shell chromium"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -322,7 +322,7 @@ acceptance(
|
||||
|
||||
// usually this is done automatically by this pretender but we
|
||||
// have to do it manually here because we are overriding the
|
||||
// pretender see app/assets/javascripts/discourse/tests/helpers/create-pretender.js
|
||||
// pretender see frontend/discourse/tests/helpers/create-pretender.js
|
||||
json.user.can_edit = true;
|
||||
|
||||
return helper.response(200, json);
|
||||
|
||||
Generated
+14
-14
@@ -107,7 +107,7 @@ importers:
|
||||
specifier: 5.6.x
|
||||
version: 5.6.3
|
||||
|
||||
app/assets/javascripts/asset-processor:
|
||||
frontend/asset-processor:
|
||||
dependencies:
|
||||
'@babel/core':
|
||||
specifier: ^7.28.4
|
||||
@@ -204,7 +204,7 @@ importers:
|
||||
specifier: ^3.2.4
|
||||
version: 3.2.4(@types/node@24.9.1)(jsdom@25.0.1)(terser@5.44.0)
|
||||
|
||||
app/assets/javascripts/custom-proxy:
|
||||
frontend/custom-proxy:
|
||||
devDependencies:
|
||||
clean-base-url:
|
||||
specifier: ^1.0.0
|
||||
@@ -225,9 +225,9 @@ importers:
|
||||
specifier: ^3.3.2
|
||||
version: 3.3.2
|
||||
|
||||
app/assets/javascripts/deprecation-silencer: {}
|
||||
frontend/deprecation-silencer: {}
|
||||
|
||||
app/assets/javascripts/dialog-holder:
|
||||
frontend/dialog-holder:
|
||||
dependencies:
|
||||
a11y-dialog:
|
||||
specifier: 8.1.4
|
||||
@@ -261,7 +261,7 @@ importers:
|
||||
specifier: 5.99.9
|
||||
version: 5.99.9(@swc/core@1.13.5)(esbuild@0.25.11)
|
||||
|
||||
app/assets/javascripts/discourse:
|
||||
frontend/discourse:
|
||||
dependencies:
|
||||
'@faker-js/faker':
|
||||
specifier: ^10.1.0
|
||||
@@ -673,7 +673,7 @@ importers:
|
||||
specifier: ^1.0.15
|
||||
version: 1.0.15
|
||||
|
||||
app/assets/javascripts/discourse-i18n:
|
||||
frontend/discourse-i18n:
|
||||
dependencies:
|
||||
'@embroider/addon-shim':
|
||||
specifier: ^1.9.0
|
||||
@@ -682,7 +682,7 @@ importers:
|
||||
specifier: ^7.4.0
|
||||
version: 7.4.0
|
||||
|
||||
app/assets/javascripts/discourse-markdown-it:
|
||||
frontend/discourse-markdown-it:
|
||||
dependencies:
|
||||
'@embroider/addon-shim':
|
||||
specifier: ^1.9.0
|
||||
@@ -706,7 +706,7 @@ importers:
|
||||
specifier: ^1.0.15
|
||||
version: 1.0.15
|
||||
|
||||
app/assets/javascripts/discourse-plugins:
|
||||
frontend/discourse-plugins:
|
||||
dependencies:
|
||||
'@babel/core':
|
||||
specifier: ^7.28.4
|
||||
@@ -737,7 +737,7 @@ importers:
|
||||
specifier: 5.99.9
|
||||
version: 5.99.9(@swc/core@1.13.5)(esbuild@0.25.11)
|
||||
|
||||
app/assets/javascripts/discourse-widget-hbs:
|
||||
frontend/discourse-widget-hbs:
|
||||
dependencies:
|
||||
'@babel/core':
|
||||
specifier: ^7.28.4
|
||||
@@ -801,9 +801,9 @@ importers:
|
||||
specifier: 5.99.9
|
||||
version: 5.99.9(@swc/core@1.13.5)(esbuild@0.25.11)
|
||||
|
||||
app/assets/javascripts/ember-cli-progress-ci: {}
|
||||
frontend/ember-cli-progress-ci: {}
|
||||
|
||||
app/assets/javascripts/float-kit:
|
||||
frontend/float-kit:
|
||||
dependencies:
|
||||
'@babel/core':
|
||||
specifier: ^7.28.4
|
||||
@@ -888,7 +888,7 @@ importers:
|
||||
specifier: 5.99.9
|
||||
version: 5.99.9(@swc/core@1.13.5)(esbuild@0.25.11)
|
||||
|
||||
app/assets/javascripts/pretty-text:
|
||||
frontend/pretty-text:
|
||||
dependencies:
|
||||
'@babel/core':
|
||||
specifier: ^7.28.4
|
||||
@@ -964,7 +964,7 @@ importers:
|
||||
specifier: 5.99.9
|
||||
version: 5.99.9(@swc/core@1.13.5)(esbuild@0.25.11)
|
||||
|
||||
app/assets/javascripts/select-kit:
|
||||
frontend/select-kit:
|
||||
dependencies:
|
||||
'@babel/core':
|
||||
specifier: ^7.28.4
|
||||
@@ -1058,7 +1058,7 @@ importers:
|
||||
specifier: 5.99.9
|
||||
version: 5.99.9(@swc/core@1.13.5)(esbuild@0.25.11)
|
||||
|
||||
app/assets/javascripts/truth-helpers:
|
||||
frontend/truth-helpers:
|
||||
dependencies:
|
||||
'@embroider/addon-shim':
|
||||
specifier: ^1.9.0
|
||||
|
||||
+14
-14
@@ -1,15 +1,15 @@
|
||||
packages:
|
||||
- "app/assets/javascripts/custom-proxy"
|
||||
- "app/assets/javascripts/deprecation-silencer"
|
||||
- "app/assets/javascripts/dialog-holder"
|
||||
- "app/assets/javascripts/discourse"
|
||||
- "app/assets/javascripts/discourse-i18n"
|
||||
- "app/assets/javascripts/discourse-markdown-it"
|
||||
- "app/assets/javascripts/discourse-plugins"
|
||||
- "app/assets/javascripts/discourse-widget-hbs"
|
||||
- "app/assets/javascripts/ember-cli-progress-ci"
|
||||
- "app/assets/javascripts/float-kit"
|
||||
- "app/assets/javascripts/pretty-text"
|
||||
- "app/assets/javascripts/select-kit"
|
||||
- "app/assets/javascripts/asset-processor"
|
||||
- "app/assets/javascripts/truth-helpers"
|
||||
- "frontend/custom-proxy"
|
||||
- "frontend/deprecation-silencer"
|
||||
- "frontend/dialog-holder"
|
||||
- "frontend/discourse"
|
||||
- "frontend/discourse-i18n"
|
||||
- "frontend/discourse-markdown-it"
|
||||
- "frontend/discourse-plugins"
|
||||
- "frontend/discourse-widget-hbs"
|
||||
- "frontend/ember-cli-progress-ci"
|
||||
- "frontend/float-kit"
|
||||
- "frontend/pretty-text"
|
||||
- "frontend/select-kit"
|
||||
- "frontend/asset-processor"
|
||||
- "frontend/truth-helpers"
|
||||
|
||||
@@ -15,9 +15,9 @@ DOWNLOAD_TEMP_FILE = "#{__dir__}/../tmp/assets.tar.gz"
|
||||
|
||||
PRE_BUILD_ROOT = "https://get.discourse.org/discourse-assets"
|
||||
|
||||
JS_SOURCE_PATHS = %w[app/assets/javascripts package.json pnpm-lock.yaml]
|
||||
JS_SOURCE_PATHS = %w[frontend package.json pnpm-lock.yaml]
|
||||
|
||||
EMBER_APP_DIR = "app/assets/javascripts/discourse"
|
||||
EMBER_APP_DIR = "frontend/discourse"
|
||||
BUILD_INFO_FILE = "#{EMBER_APP_DIR}/dist/BUILD_INFO.json"
|
||||
|
||||
Dir.chdir("#{__dir__}/..")
|
||||
|
||||
+10
-10
@@ -7,15 +7,15 @@ require "json"
|
||||
Dir.chdir("#{__dir__}/..") # rubocop:disable Discourse/NoChdir because this is not part of the app
|
||||
|
||||
CORE_NAMESPACES = {
|
||||
"discourse/admin/*" => ["app/assets/javascripts/discourse/admin"],
|
||||
"discourse/*" => ["app/assets/javascripts/discourse/app"],
|
||||
"discourse/tests/*" => ["app/assets/javascripts/discourse/tests"],
|
||||
"admin/*" => ["app/assets/javascripts/discourse/admin"], # TODO: remove once all core code is migrated to new import path
|
||||
"pretty-text/*" => ["app/assets/javascripts/pretty-text/addon"],
|
||||
"select-kit/*" => ["app/assets/javascripts/select-kit/addon"],
|
||||
"float-kit/*" => ["app/assets/javascripts/float-kit/addon"],
|
||||
"truth-helpers/*" => ["app/assets/javascripts/truth-helpers/addon"],
|
||||
"dialog-holder/*" => ["app/assets/javascripts/dialog-holder/addon"],
|
||||
"discourse/admin/*" => ["frontend/discourse/admin"],
|
||||
"discourse/*" => ["frontend/discourse/app"],
|
||||
"discourse/tests/*" => ["frontend/discourse/tests"],
|
||||
"admin/*" => ["frontend/discourse/admin"], # TODO: remove once all core code is migrated to new import path
|
||||
"pretty-text/*" => ["frontend/pretty-text/addon"],
|
||||
"select-kit/*" => ["frontend/select-kit/addon"],
|
||||
"float-kit/*" => ["frontend/float-kit/addon"],
|
||||
"truth-helpers/*" => ["frontend/truth-helpers/addon"],
|
||||
"dialog-holder/*" => ["frontend/dialog-holder/addon"],
|
||||
}
|
||||
|
||||
def relative(from, to)
|
||||
@@ -42,7 +42,7 @@ def write_config(package_dir, extras: {})
|
||||
},
|
||||
"include" => namespaces.flat_map { |ns, paths| paths.map { |p| relative(package_dir, p) } },
|
||||
"exclude" => [
|
||||
"app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js", # Native class decorators - unsupported by ts/glint
|
||||
"frontend/discourse/tests/unit/utils/decorators-test.js", # Native class decorators - unsupported by ts/glint
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
require "digest"
|
||||
|
||||
DIST_DIR = File.expand_path("#{__dir__}/../app/assets/javascripts/discourse/dist")
|
||||
DIST_DIR = File.expand_path("#{__dir__}/../frontend/discourse/dist")
|
||||
|
||||
def collect_asset_info
|
||||
files =
|
||||
|
||||
@@ -26,7 +26,7 @@ end
|
||||
|
||||
common_env = { "DISCOURSE_DOWNLOAD_PRE_BUILT_ASSETS" => "0", "LOAD_PLUGINS" => "0" }
|
||||
|
||||
Dir.chdir("#{__dir__}/../app/assets/javascripts/discourse")
|
||||
Dir.chdir("#{__dir__}/../frontend/discourse")
|
||||
FileUtils.rm_rf("dist")
|
||||
|
||||
system({ **common_env, "EMBER_ENV" => "production" }, "#{__dir__}/assemble_ember_build.rb")
|
||||
|
||||
@@ -48,8 +48,8 @@ RSpec.describe "Coding style" do
|
||||
|
||||
describe "non-colocated component templates" do
|
||||
{
|
||||
"discourse" => "app/assets/javascripts/discourse/app/templates/components",
|
||||
"admin" => "app/assets/javascripts/admin/addon/templates/components",
|
||||
"discourse" => "frontend/discourse/app/templates/components",
|
||||
"admin" => "frontend/admin/addon/templates/components",
|
||||
"chat/discourse" => "plugins/chat/assets/javascripts/discourse/templates/components",
|
||||
"chat/admin" => "plugins/chat/assets/javascripts/admin/templates/components",
|
||||
"styleguide" => "plugins/styleguide/assets/javascripts/discourse/templates/components",
|
||||
|
||||
@@ -5,7 +5,7 @@ RSpec.describe "constants match ruby" do
|
||||
|
||||
def parse(file)
|
||||
# mini racer doesn't handle JS modules so we'll do this hack
|
||||
source = File.read("#{Rails.root}/app/assets/javascripts/#{file}")
|
||||
source = File.read("#{Rails.root}/frontend/#{file}")
|
||||
source.gsub!(/^export */, "")
|
||||
ctx.eval(source)
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
RSpec.describe JsLocaleHelper do
|
||||
let(:v8_ctx) do
|
||||
discourse_node_modules = "#{Rails.root}/app/assets/javascripts/discourse/node_modules"
|
||||
discourse_node_modules = "#{Rails.root}/frontend/discourse/node_modules"
|
||||
mf_runtime = "#{discourse_node_modules}/@messageformat/runtime"
|
||||
processor = AssetProcessor.new
|
||||
ctx = MiniRacer::Context.new
|
||||
@@ -13,7 +13,7 @@ RSpec.describe JsLocaleHelper do
|
||||
"@messageformat/runtime": "#{mf_runtime}/esm/runtime.js",
|
||||
"@messageformat/runtime/lib/cardinals": "#{mf_runtime}/esm/cardinals.js",
|
||||
"make-plural/cardinals": "#{discourse_node_modules}/make-plural/cardinals.mjs",
|
||||
"discourse-i18n": "#{Rails.root}/app/assets/javascripts/discourse-i18n/src/index.js",
|
||||
"discourse-i18n": "#{Rails.root}/frontend/discourse-i18n/src/index.js",
|
||||
}.each do |module_name, path|
|
||||
ctx.eval(processor.perform(File.read(path), "", module_name.to_s))
|
||||
end
|
||||
|
||||
@@ -350,7 +350,7 @@ TEXT
|
||||
plugin.send :register_assets!
|
||||
|
||||
expect(DiscoursePluginRegistry.vendored_core_pretty_text.first).to eq(
|
||||
"app/assets/javascripts/discourse/node_modules/moment/moment.js",
|
||||
"frontend/discourse/node_modules/moment/moment.js",
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -577,10 +577,7 @@ TEXT
|
||||
|
||||
expect(locale[:fallbackLocale]).to eq("pt_BR")
|
||||
expect(locale[:moment_js]).to eq(
|
||||
[
|
||||
"pt-br",
|
||||
"#{Rails.root}/app/assets/javascripts/discourse/node_modules/moment/locale/pt-br.js",
|
||||
],
|
||||
["pt-br", "#{Rails.root}/frontend/discourse/node_modules/moment/locale/pt-br.js"],
|
||||
)
|
||||
expect(locale[:moment_js_timezones]).to eq(
|
||||
[
|
||||
@@ -601,7 +598,7 @@ TEXT
|
||||
|
||||
expect(locale[:fallbackLocale]).to be_nil
|
||||
expect(locale[:moment_js]).to eq(
|
||||
["tlh", "#{Rails.root}/app/assets/javascripts/discourse/node_modules/moment/locale/tlh.js"],
|
||||
["tlh", "#{Rails.root}/frontend/discourse/node_modules/moment/locale/tlh.js"],
|
||||
)
|
||||
expect(locale[:plural]).to eq(plural.with_indifferent_access)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user