mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 21:41:03 +08:00
DEV: Merge root JS packages (#25857)
Before this commit, we had a yarn package set up in the root directory and also in `app/assets/javascripts`. That meant two `yarn install` calls and two `node_modules` directories. This commit merges them both into the root location, and updates references to node_modules. A previous attempt can be found at https://github.com/discourse/discourse/pull/21172. This commit re-uses that script to merge the `yarn.lock` files. Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
14
.github/dependabot.yml
vendored
14
.github/dependabot.yml
vendored
@ -52,13 +52,25 @@ updates:
|
|||||||
- "railties"
|
- "railties"
|
||||||
- "sprockets-rails"
|
- "sprockets-rails"
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "npm"
|
||||||
directory: "/app/assets/javascripts/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: daily
|
||||||
time: "08:00"
|
time: "08:00"
|
||||||
timezone: Australia/Sydney
|
timezone: Australia/Sydney
|
||||||
open-pull-requests-limit: 20
|
open-pull-requests-limit: 20
|
||||||
versioning-strategy: increase
|
versioning-strategy: increase
|
||||||
|
ignore: # These are all vendored so need to be updated manually. See lib/tasks/javascript.rake
|
||||||
|
- dependency-name: "ace-builds"
|
||||||
|
- dependency-name: "@json-editor/json-editor"
|
||||||
|
- dependency-name: "chart.js"
|
||||||
|
- dependency-name: "chartjs-plugin-datalabels"
|
||||||
|
- dependency-name: "diffhtml"
|
||||||
|
- dependency-name: "magnific-popup"
|
||||||
|
- dependency-name: "pikaday"
|
||||||
|
- dependency-name: "moment"
|
||||||
|
- dependency-name: "moment-timezone"
|
||||||
|
- dependency-name: "@discourse/moment-timezon-names-translations"
|
||||||
|
- dependency-name: "squoosh"
|
||||||
groups:
|
groups:
|
||||||
babel:
|
babel:
|
||||||
patterns:
|
patterns:
|
||||||
|
6
.github/workflows/licenses.yml
vendored
6
.github/workflows/licenses.yml
vendored
@ -77,9 +77,3 @@ jobs:
|
|||||||
yarn global add licensee
|
yarn global add licensee
|
||||||
yarn global upgrade licensee
|
yarn global upgrade licensee
|
||||||
licensee --errors-only
|
licensee --errors-only
|
||||||
|
|
||||||
- name: Check Ember CLI Workspace Licenses
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
working-directory: ./app/assets/javascripts
|
|
||||||
run: |
|
|
||||||
licensee --errors-only
|
|
||||||
|
@ -5,17 +5,38 @@
|
|||||||
"CC0-1.0",
|
"CC0-1.0",
|
||||||
"CC-BY-3.0",
|
"CC-BY-3.0",
|
||||||
"CC-BY-4.0",
|
"CC-BY-4.0",
|
||||||
"Apache-2.0 WITH LLVM-exception"
|
"Apache-2.0 WITH LLVM-exception",
|
||||||
|
"ISC"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"@fortawesome/fontawesome-free": "*",
|
"@fortawesome/fontawesome-free": "*",
|
||||||
"@glimmer/interfaces": "*",
|
"@glimmer/interfaces": "*",
|
||||||
"@glimmer/syntax": "*",
|
"@glimmer/syntax": "*",
|
||||||
|
"@jspreadsheet/formula": "2.0.2",
|
||||||
|
"cli-table": "0.3.11",
|
||||||
|
"component-bind": "1.0.0",
|
||||||
|
"component-inherit": "0.0.3",
|
||||||
|
"duplex": "1.0.0",
|
||||||
"ember-template-lint-plugin-discourse": "*",
|
"ember-template-lint-plugin-discourse": "*",
|
||||||
|
"glob": "3.1.21",
|
||||||
|
"indexof": "0.0.1",
|
||||||
|
"inherits": "1.0.2",
|
||||||
|
"jsonify": "0.0.1",
|
||||||
|
"jspreadsheet-ce": "4.13.4",
|
||||||
|
"line-stream": "0.0.0",
|
||||||
|
"messageformat": "0.1.5",
|
||||||
|
"regenerator-transform": "0.10.1",
|
||||||
|
"source-map": "0.1.43",
|
||||||
|
"sourcemap-validator": "1.1.1",
|
||||||
"spawn-command": "0.0.2",
|
"spawn-command": "0.0.2",
|
||||||
"squoosh": "2.0.0",
|
"squoosh": "2.0.0",
|
||||||
"taffydb": "2.6.2"
|
"taffydb": "2.6.2"
|
||||||
},
|
},
|
||||||
"corrections": true
|
"corrections": true,
|
||||||
|
"ignore": [
|
||||||
|
{
|
||||||
|
"author": "Discourse"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
"licenses": {
|
|
||||||
"blueOak": "bronze",
|
|
||||||
"spdx": [
|
|
||||||
"CC0-1.0",
|
|
||||||
"CC-BY-3.0",
|
|
||||||
"CC-BY-4.0",
|
|
||||||
"Apache-2.0 WITH LLVM-exception",
|
|
||||||
"ISC"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packages": {
|
|
||||||
"cli-table": "0.3.11",
|
|
||||||
"component-bind": "1.0.0",
|
|
||||||
"component-inherit": "0.0.3",
|
|
||||||
"duplex": "1.0.0",
|
|
||||||
"glob": "3.1.21",
|
|
||||||
"indexof": "0.0.1",
|
|
||||||
"inherits": "1.0.2",
|
|
||||||
"jsonify": "0.0.1",
|
|
||||||
"line-stream": "0.0.0",
|
|
||||||
"messageformat": "0.1.5",
|
|
||||||
"regenerator-transform": "0.10.1",
|
|
||||||
"source-map": "0.1.43",
|
|
||||||
"sourcemap-validator": "1.1.1",
|
|
||||||
"jspreadsheet-ce": "4.13.4",
|
|
||||||
"@jspreadsheet/formula": "2.0.2"
|
|
||||||
},
|
|
||||||
"corrections": true,
|
|
||||||
"ignore": [
|
|
||||||
{
|
|
||||||
"author": "Discourse"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -17,11 +17,11 @@ module.exports = function generateWorkboxTree() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const nodes = workboxDeps.map((name) => {
|
const nodes = workboxDeps.map((name) => {
|
||||||
return funnel(`../node_modules/${name}/build`);
|
return funnel(`../../../../node_modules/${name}/build`);
|
||||||
});
|
});
|
||||||
|
|
||||||
const versions = workboxDeps.map((name) => {
|
const versions = workboxDeps.map((name) => {
|
||||||
return require(`../../node_modules/${name}/package.json`).version;
|
return require(`../../../../../node_modules/${name}/package.json`).version;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Normally Sprockets will create a cachebuster per-file. In this case we need it at the directory level since
|
// Normally Sprockets will create a cachebuster per-file. In this case we need it at the directory level since
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"postinstall": "./run-patch-package"
|
|
||||||
},
|
|
||||||
"workspaces": [
|
|
||||||
"admin",
|
|
||||||
"bootstrap-json",
|
|
||||||
"deprecation-silencer",
|
|
||||||
"dialog-holder",
|
|
||||||
"discourse",
|
|
||||||
"discourse-common",
|
|
||||||
"discourse-hbr",
|
|
||||||
"discourse-i18n",
|
|
||||||
"discourse-markdown-it",
|
|
||||||
"discourse-plugins",
|
|
||||||
"discourse-widget-hbs",
|
|
||||||
"ember-cli-progress-ci",
|
|
||||||
"ember-production-deprecations",
|
|
||||||
"float-kit",
|
|
||||||
"pretty-text",
|
|
||||||
"select-kit",
|
|
||||||
"theme-transpiler",
|
|
||||||
"truth-helpers"
|
|
||||||
],
|
|
||||||
"resolutions": {
|
|
||||||
"**/unset-value": "2.0.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"patch-package": "^8.0.0",
|
|
||||||
"postinstall-postinstall": "^2.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
@ -50,7 +50,7 @@ esbuild
|
|||||||
bundle: true,
|
bundle: true,
|
||||||
minify: true,
|
minify: true,
|
||||||
alias: {
|
alias: {
|
||||||
util: "./app/assets/javascripts/node_modules/@zxing/text-encoding",
|
util: "./node_modules/@zxing/text-encoding",
|
||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
process: `{ "env": {} }`,
|
process: `{ "env": {} }`,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -28,12 +28,7 @@ class ThemeSettingsMigrationsRunner
|
|||||||
|
|
||||||
def self.loader_js_lib_content
|
def self.loader_js_lib_content
|
||||||
@loader_js_lib_content ||=
|
@loader_js_lib_content ||=
|
||||||
File.read(
|
File.read(File.join(Rails.root, "node_modules/loader.js/dist/loader/loader.js"))
|
||||||
File.join(
|
|
||||||
Rails.root,
|
|
||||||
"app/assets/javascripts/node_modules/loader.js/dist/loader/loader.js",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(theme, limit: 100, timeout: 100, memory: 2.megabytes)
|
def initialize(theme, limit: 100, timeout: 100, memory: 2.megabytes)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<meta name="discourse/config/environment" content="<%=u discourse_config_environment(testing: true) %>" />
|
<meta name="discourse/config/environment" content="<%=u discourse_config_environment(testing: true) %>" />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
<%= File.read("#{Rails.root}/app/assets/javascripts/node_modules/qunit/qunit/qunit.css").html_safe %>
|
<%= File.read("#{Rails.root}/node_modules/qunit/qunit/qunit.css").html_safe %>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<%= discourse_stylesheet_link_tag(:desktop, theme_id: nil) %>
|
<%= discourse_stylesheet_link_tag(:desktop, theme_id: nil) %>
|
||||||
|
@ -41,8 +41,7 @@ class EmberCli < ActiveSupport::CurrentAttributes
|
|||||||
def self.ember_version
|
def self.ember_version
|
||||||
@version ||=
|
@version ||=
|
||||||
begin
|
begin
|
||||||
ember_source_package_raw =
|
ember_source_package_raw = File.read("#{Rails.root}/node_modules/ember-source/package.json")
|
||||||
File.read("#{Rails.root}/app/assets/javascripts/node_modules/ember-source/package.json")
|
|
||||||
JSON.parse(ember_source_package_raw)["version"]
|
JSON.parse(ember_source_package_raw)["version"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module HighlightJs
|
module HighlightJs
|
||||||
HIGHLIGHTJS_DIR ||= "#{Rails.root}/app/assets/javascripts/node_modules/@highlightjs/cdn-assets/"
|
HIGHLIGHTJS_DIR ||= "#{Rails.root}/node_modules/@highlightjs/cdn-assets/"
|
||||||
VERSION ||= 1 # bump to invalidate caches following core changes
|
VERSION ||= 1 # bump to invalidate caches following core changes
|
||||||
|
|
||||||
def self.languages
|
def self.languages
|
||||||
|
@ -332,9 +332,7 @@ module JsLocaleHelper
|
|||||||
@ctx ||=
|
@ctx ||=
|
||||||
begin
|
begin
|
||||||
ctx = MiniRacer::Context.new(timeout: 15_000, ensure_gc_after_idle: 2000)
|
ctx = MiniRacer::Context.new(timeout: 15_000, ensure_gc_after_idle: 2000)
|
||||||
ctx.load(
|
ctx.load("#{Rails.root}/node_modules/messageformat/messageformat.js")
|
||||||
"#{Rails.root}/app/assets/javascripts/node_modules/messageformat/messageformat.js",
|
|
||||||
)
|
|
||||||
ctx
|
ctx
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
@ -66,10 +66,12 @@ module PrettyText
|
|||||||
end
|
end
|
||||||
|
|
||||||
root_path = "#{Rails.root}/app/assets/javascripts"
|
root_path = "#{Rails.root}/app/assets/javascripts"
|
||||||
ctx.load("#{root_path}/node_modules/loader.js/dist/loader/loader.js")
|
node_modules = "#{Rails.root}/node_modules"
|
||||||
ctx.load("#{root_path}/node_modules/markdown-it/dist/markdown-it.js")
|
md_node_modules = "#{Rails.root}/app/assets/javascripts/discourse-markdown-it/node_modules"
|
||||||
|
ctx.load("#{node_modules}/loader.js/dist/loader/loader.js")
|
||||||
|
ctx.load("#{md_node_modules}/markdown-it/dist/markdown-it.js")
|
||||||
ctx.load("#{root_path}/handlebars-shim.js")
|
ctx.load("#{root_path}/handlebars-shim.js")
|
||||||
ctx.load("#{root_path}/node_modules/xss/dist/xss.js")
|
ctx.load("#{node_modules}/xss/dist/xss.js")
|
||||||
ctx.load("#{Rails.root}/lib/pretty_text/vendor-shims.js")
|
ctx.load("#{Rails.root}/lib/pretty_text/vendor-shims.js")
|
||||||
|
|
||||||
ctx_load_directory(
|
ctx_load_directory(
|
||||||
|
29
package.json
29
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discourse",
|
"name": "discourse",
|
||||||
"version": "1.0.0",
|
"private": true,
|
||||||
"repository": "https://github.com/discourse/discourse",
|
"repository": "https://github.com/discourse/discourse",
|
||||||
"author": "Discourse",
|
"author": "Discourse",
|
||||||
"license": "GPL-2.0-only",
|
"license": "GPL-2.0-only",
|
||||||
@ -32,7 +32,9 @@
|
|||||||
"magnific-popup": "1.1.0",
|
"magnific-popup": "1.1.0",
|
||||||
"moment": "2.29.4",
|
"moment": "2.29.4",
|
||||||
"moment-timezone": "0.5.43",
|
"moment-timezone": "0.5.43",
|
||||||
|
"patch-package": "^8.0.0",
|
||||||
"pikaday": "1.8.2",
|
"pikaday": "1.8.2",
|
||||||
|
"postinstall-postinstall": "^2.1.0",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"puppeteer-core": "^21.0.3",
|
"puppeteer-core": "^21.0.3",
|
||||||
"squoosh": "discourse/squoosh#dc9649d",
|
"squoosh": "discourse/squoosh#dc9649d",
|
||||||
@ -52,7 +54,30 @@
|
|||||||
"lttf:ignore": "lint-to-the-future ignore",
|
"lttf:ignore": "lint-to-the-future ignore",
|
||||||
"lttf:output": "lint-to-the-future output -o ./lint-progress/",
|
"lttf:output": "lint-to-the-future output -o ./lint-progress/",
|
||||||
"lint-progress": "yarn lttf:output && npx html-pages ./lint-progress --no-cache",
|
"lint-progress": "yarn lttf:output && npx html-pages ./lint-progress --no-cache",
|
||||||
"postinstall": "yarn --cwd app/assets/javascripts $(node -e 'const argv = JSON.parse(process.env.npm_config_argv).original; const passthrough = [`--frozen-lockfile`, `-s`].filter(arg => argv.includes(arg)); console.log(passthrough.join(` `));')"
|
"postinstall": "./app/assets/javascripts/run-patch-package && rm -rf app/assets/javascripts/node_modules"
|
||||||
|
},
|
||||||
|
"workspaces": [
|
||||||
|
"app/assets/javascripts/admin",
|
||||||
|
"app/assets/javascripts/bootstrap-json",
|
||||||
|
"app/assets/javascripts/deprecation-silencer",
|
||||||
|
"app/assets/javascripts/dialog-holder",
|
||||||
|
"app/assets/javascripts/discourse",
|
||||||
|
"app/assets/javascripts/discourse-common",
|
||||||
|
"app/assets/javascripts/discourse-hbr",
|
||||||
|
"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/ember-production-deprecations",
|
||||||
|
"app/assets/javascripts/float-kit",
|
||||||
|
"app/assets/javascripts/pretty-text",
|
||||||
|
"app/assets/javascripts/select-kit",
|
||||||
|
"app/assets/javascripts/theme-transpiler",
|
||||||
|
"app/assets/javascripts/truth-helpers"
|
||||||
|
],
|
||||||
|
"resolutions": {
|
||||||
|
"**/unset-value": "2.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.* || >= 18",
|
"node": "16.* || >= 18",
|
||||||
|
@ -159,11 +159,7 @@ RSpec.describe DiscourseJsProcessor do
|
|||||||
|
|
||||||
let(:mini_racer) do
|
let(:mini_racer) do
|
||||||
ctx = MiniRacer::Context.new
|
ctx = MiniRacer::Context.new
|
||||||
ctx.eval(
|
ctx.eval(File.open("#{Rails.root}/node_modules/handlebars/dist/handlebars.js").read)
|
||||||
File.open(
|
|
||||||
"#{Rails.root}/app/assets/javascripts/node_modules/handlebars/dist/handlebars.js",
|
|
||||||
).read,
|
|
||||||
)
|
|
||||||
ctx.eval(helpers)
|
ctx.eval(helpers)
|
||||||
ctx
|
ctx
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ require "mini_racer"
|
|||||||
|
|
||||||
RSpec.describe JsLocaleHelper do
|
RSpec.describe JsLocaleHelper do
|
||||||
let(:v8_ctx) do
|
let(:v8_ctx) do
|
||||||
node_modules = "#{Rails.root}/app/assets/javascripts/node_modules/"
|
node_modules = "#{Rails.root}/node_modules/"
|
||||||
|
|
||||||
transpiler = DiscourseJsProcessor::Transpiler.new
|
transpiler = DiscourseJsProcessor::Transpiler.new
|
||||||
discourse_i18n =
|
discourse_i18n =
|
||||||
|
Reference in New Issue
Block a user