DEV: Merge package.json files (#21172)

This means: a single yarn.lock and removing one of the package.json files
This commit is contained in:
Jarek Radosz 2023-04-20 12:46:12 +02:00 committed by GitHub
parent e002a24eca
commit 49a1e1cd0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 8622 additions and 10692 deletions

View File

@ -79,9 +79,3 @@ jobs:
yarn global add licensee
yarn global upgrade licensee
licensee --errors-only
- name: Check Ember CLI Workspace Licenses
if: ${{ !cancelled() }}
working-directory: ./app/assets/javascripts
run: |
licensee --errors-only

View File

@ -5,14 +5,32 @@
"CC0-1.0",
"CC-BY-3.0",
"CC-BY-4.0",
"Apache-2.0 WITH LLVM-exception"
"Apache-2.0 WITH LLVM-exception",
"ISC"
]
},
"packages": {
"@fortawesome/fontawesome-free": "*",
"component-bind": "1.0.0",
"component-inherit": "0.0.3",
"duplex": "1.0.0",
"ember-template-lint-plugin-discourse": "*",
"glob": "3.1.21",
"indexof": "0.0.1",
"inherits": "1.0.2",
"jsonify": "0.0.0",
"line-stream": "0.0.0",
"messageformat": "0.1.5",
"regenerator-transform": "0.10.1",
"source-map": "0.1.43",
"sourcemap-validator": "1.1.1",
"squoosh": "2.0.0",
"taffydb": "2.6.2"
},
"corrections": true
"corrections": true,
"ignore": [
{
"author": "Discourse"
}
]
}

View File

@ -1,32 +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": {
"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.0",
"messageformat": "0.1.5",
"line-stream": "0.0.0",
"regenerator-transform": "0.10.1",
"source-map": "0.1.43",
"sourcemap-validator": "1.1.1"
},
"corrections": true,
"ignore": [
{
"author": "Discourse"
}
]
}

View File

@ -18,7 +18,7 @@ module.exports = function prettyTextEngine(app) {
const engineTree = babelAddon.transpileTree(namespacedTree);
let markdownIt = funnel("../node_modules/markdown-it/dist", {
let markdownIt = funnel("../../../../node_modules/markdown-it/dist", {
files: ["markdown-it.js"],
});
return concat(mergeTrees([engineTree, markdownIt]), {

View File

@ -14,7 +14,7 @@
"build": "ember build",
"start": "ember serve",
"test": "ember test",
"postinstall": "yarn --silent --cwd .. patch-package"
"postinstall": "yarn --silent --cwd ../../../.. patch-package --patch-dir app/assets/javascripts/patches"
},
"dependencies": {
"@babel/core": "^7.21.4",
@ -103,6 +103,11 @@
"wizard": "1.0.0",
"xss": "^1.0.14"
},
"devDependencies": {
"ember-cached-decorator-polyfill": "^1.0.1",
"ember-cli-deprecation-workflow": "^2.1.0",
"ember-exam": "^8.0.0"
},
"engines": {
"node": "16.* || >= 18",
"npm": "please-use-yarn",
@ -110,10 +115,5 @@
},
"ember": {
"edition": "default"
},
"devDependencies": {
"ember-cached-decorator-polyfill": "^1.0.1",
"ember-cli-deprecation-workflow": "^2.1.0",
"ember-exam": "^8.0.0"
}
}

View File

@ -1,34 +0,0 @@
{
"private": true,
"scripts": {
"postinstall": "patch-package"
},
"workspaces": [
"admin",
"bootstrap-json",
"dialog-holder",
"discourse",
"discourse-common",
"discourse-hbr",
"discourse-plugins",
"discourse-widget-hbs",
"ember-cli-progress-ci",
"ember-production-deprecations",
"pretty-text",
"select-kit",
"truth-helpers",
"wizard"
],
"resolutions": {
"**/babel-plugin-debug-macros": "npm:@discourse/babel-plugin-debug-macros@0.4.0-pre1",
"**/babel-plugin-ember-template-compilation": "2.0.0"
},
"dependencies": {
"patch-package": "^6.5.1",
"postinstall-postinstall": "^2.1.0"
},
"devDependencies": {},
"notes": {
"deps vs devDeps": "this project doesn't use dev dependencies when building the app, so all dependencies affecting the build of the UI (ember-cli, webpack, etc), need to be in 'dependencies', not 'devDependencies' (yarn install --production is used)"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
<meta name="discourse/config/environment" content="<%=u discourse_config_environment(testing: true) %>" />
<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>
<%= discourse_stylesheet_link_tag(:desktop, theme_id: nil) %>

View File

@ -106,7 +106,7 @@ class DiscourseJsProcessor
end
def self.load_file_in_context(ctx, path, wrap_in_module: nil)
contents = File.read("#{Rails.root}/app/assets/javascripts/#{path}")
contents = File.read(path)
contents = <<~JS if wrap_in_module
define(#{wrap_in_module.to_json}, ["exports", "require", "module"], function(exports, require, module){
#{contents}
@ -134,10 +134,10 @@ class DiscourseJsProcessor
JS
# define/require support
load_file_in_context(ctx, "node_modules/loader.js/dist/loader/loader.js")
load_file_in_context(ctx, "#{Rails.root}/node_modules/loader.js/dist/loader/loader.js")
# Babel
load_file_in_context(ctx, "node_modules/@babel/standalone/babel.js")
load_file_in_context(ctx, "#{Rails.root}/node_modules/@babel/standalone/babel.js")
ctx.eval <<~JS
globalThis.rawBabelTransform = function(){
return Babel.transform(...arguments).code;
@ -145,39 +145,42 @@ class DiscourseJsProcessor
JS
# Terser
load_file_in_context(ctx, "node_modules/source-map/dist/source-map.js")
load_file_in_context(ctx, "node_modules/terser/dist/bundle.min.js")
load_file_in_context(ctx, "#{Rails.root}/node_modules/source-map/dist/source-map.js")
load_file_in_context(ctx, "#{Rails.root}/node_modules/terser/dist/bundle.min.js")
# Template Compiler
load_file_in_context(ctx, "node_modules/ember-source/dist/ember-template-compiler.js")
load_file_in_context(
ctx,
"node_modules/babel-plugin-ember-template-compilation/src/plugin.js",
"#{Rails.root}/node_modules/ember-source/dist/ember-template-compiler.js",
)
load_file_in_context(
ctx,
"#{Rails.root}/node_modules/babel-plugin-ember-template-compilation/src/plugin.js",
wrap_in_module: "babel-plugin-ember-template-compilation/index",
)
load_file_in_context(
ctx,
"node_modules/babel-plugin-ember-template-compilation/src/expression-parser.js",
"#{Rails.root}/node_modules/babel-plugin-ember-template-compilation/src/expression-parser.js",
wrap_in_module: "babel-plugin-ember-template-compilation/expression-parser",
)
load_file_in_context(
ctx,
"node_modules/babel-plugin-ember-template-compilation/src/js-utils.js",
"#{Rails.root}/node_modules/babel-plugin-ember-template-compilation/src/js-utils.js",
wrap_in_module: "babel-plugin-ember-template-compilation/js-utils",
)
load_file_in_context(
ctx,
"node_modules/babel-plugin-ember-template-compilation/src/public-types.js",
"#{Rails.root}/node_modules/babel-plugin-ember-template-compilation/src/public-types.js",
wrap_in_module: "babel-plugin-ember-template-compilation/public-types",
)
load_file_in_context(
ctx,
"node_modules/babel-import-util/src/index.js",
"#{Rails.root}/node_modules/babel-import-util/src/index.js",
wrap_in_module: "babel-import-util",
)
load_file_in_context(
ctx,
"node_modules/ember-cli-htmlbars/lib/colocated-babel-plugin.js",
"#{Rails.root}/node_modules/ember-cli-htmlbars/lib/colocated-babel-plugin.js",
wrap_in_module: "colocated-babel-plugin",
)
@ -202,7 +205,7 @@ class DiscourseJsProcessor
# Raw HBS compiler
load_file_in_context(
ctx,
"node_modules/handlebars/dist/handlebars.js",
"#{Rails.root}/node_modules/handlebars/dist/handlebars.js",
wrap_in_module: "handlebars",
)
@ -226,7 +229,7 @@ class DiscourseJsProcessor
# Theme template AST transformation plugins
load_file_in_context(
ctx,
"discourse-js-processor.js",
"#{Rails.root}/app/assets/javascripts/discourse-js-processor.js",
wrap_in_module: "discourse-js-processor",
)

View File

@ -31,9 +31,7 @@ module EmberCli
return @@chunk_infos if defined?(@@chunk_infos)
raw_chunk_infos =
JSON.parse(
File.read("#{Rails.configuration.root}/app/assets/javascripts/discourse/dist/chunks.json"),
)
JSON.parse(File.read("#{Rails.root}/app/assets/javascripts/discourse/dist/chunks.json"))
chunk_infos =
raw_chunk_infos["scripts"]
@ -57,8 +55,7 @@ module EmberCli
def self.ember_version
@version ||=
begin
ember_source_package_raw =
File.read("#{Rails.root}/app/assets/javascripts/node_modules/ember-source/package.json")
ember_source_package_raw = File.read("#{Rails.root}/node_modules/ember-source/package.json")
JSON.parse(ember_source_package_raw)["version"]
end
end

View File

@ -91,22 +91,22 @@ module PrettyText
ctx.attach("__helpers.#{method}", PrettyText::Helpers.method(method))
end
root_path = "#{Rails.root}/app/assets/javascripts/"
ctx_load(ctx, "#{root_path}/node_modules/loader.js/dist/loader/loader.js")
ctx_load(ctx, "#{root_path}/handlebars-shim.js")
ctx_load(ctx, "#{root_path}/node_modules/xss/dist/xss.js")
workspace_path = "#{Rails.root}/app/assets/javascripts/"
ctx.load("#{Rails.root}/node_modules/loader.js/dist/loader/loader.js")
ctx.load("#{workspace_path}handlebars-shim.js")
ctx.load("#{Rails.root}/node_modules/xss/dist/xss.js")
ctx.load("#{Rails.root}/lib/pretty_text/vendor-shims.js")
ctx_load_directory(ctx, "pretty-text/addon")
ctx_load_directory(ctx, "pretty-text/engines/discourse-markdown")
ctx_load(ctx, "#{root_path}/node_modules/markdown-it/dist/markdown-it.js")
ctx.load("#{Rails.root}/node_modules/markdown-it/dist/markdown-it.js")
apply_es6_file(ctx, root_path, "discourse-common/addon/lib/get-url")
apply_es6_file(ctx, root_path, "discourse-common/addon/lib/object")
apply_es6_file(ctx, root_path, "discourse-common/addon/lib/deprecated")
apply_es6_file(ctx, root_path, "discourse-common/addon/lib/escape")
apply_es6_file(ctx, root_path, "discourse-common/addon/utils/watched-words")
apply_es6_file(ctx, root_path, "discourse/app/lib/to-markdown")
apply_es6_file(ctx, root_path, "discourse/app/lib/utilities")
apply_es6_file(ctx, workspace_path, "discourse-common/addon/lib/get-url")
apply_es6_file(ctx, workspace_path, "discourse-common/addon/lib/object")
apply_es6_file(ctx, workspace_path, "discourse-common/addon/lib/deprecated")
apply_es6_file(ctx, workspace_path, "discourse-common/addon/lib/escape")
apply_es6_file(ctx, workspace_path, "discourse-common/addon/utils/watched-words")
apply_es6_file(ctx, workspace_path, "discourse/app/lib/to-markdown")
apply_es6_file(ctx, workspace_path, "discourse/app/lib/utilities")
ctx.load("#{Rails.root}/lib/pretty_text/shims.js")
ctx.eval("__setUnicode(#{Emoji.unicode_replacements_json})")
@ -664,7 +664,7 @@ module PrettyText
end
def self.ctx_load(ctx, *files)
files.each { |file| ctx.load(app_root + file) }
files.each { |file| ctx.load(file) }
end
private

View File

@ -1,10 +1,10 @@
{
"name": "discourse",
"version": "1.0.0",
"main": "index.js",
"repository": "git@github.com:discourse/discourse.git",
"repository": "https://github.com/discourse/discourse",
"author": "Discourse",
"license": "GPL-2.0-only",
"private": true,
"dependencies": {
"@discourse/moment-timezone-names-translations": "^1.0.0",
"@fortawesome/fontawesome-free": "5.15.4",
@ -18,7 +18,9 @@
"magnific-popup": "1.1.0",
"moment": "2.29.4",
"moment-timezone": "0.5.39",
"patch-package": "^6.5.1",
"pikaday": "1.8.2",
"postinstall-postinstall": "^2.1.0",
"squoosh": "discourse/squoosh#dc9649d",
"workbox-cacheable-response": "^4.3.1",
"workbox-core": "^4.3.1",
@ -53,12 +55,34 @@
"lint:js-plugins:fix": "eslint ./plugins",
"lint:hbs": "ember-template-lint app/assets/javascripts/**/*.hbs plugins/**/assets/javascripts/**/*.hbs --no-error-on-unmatched-pattern",
"lint:hbs:fix": "ember-template-lint app/assets/javascripts/**/*.hbs plugins/**/assets/javascripts/**/*.hbs --no-error-on-unmatched-pattern --fix",
"lint:prettier": "yarn pprettier --list-different 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.js' 'app/assets/javascripts/**/*.hbs' 'plugins/**/assets/stylesheets/**/*.scss' 'plugins/**/assets/javascripts/**/*.js' 'plugins/**/assets/javascripts/**/*.hbs'",
"lint:prettier": "yarn pprettier --list-different 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.js' 'app/assets/javascripts/**/*.hbs' 'plugins/**/assets/stylesheets/**/*.scss' 'plugins/**/assets/javascripts/**/*.js' 'plugins/**/assets/javascripts/**/*.hbs'",
"lint:prettier:fix": "yarn prettier -w '{app,plugins/**}/assets/{stylesheets,javascripts}/**/*.{scss,hbs,js}'",
"lttf:ignore": "lint-to-the-future ignore",
"lttf:output": "lint-to-the-future output -o ./lint-progress/",
"lint-progress": "yarn lttf:output && npx html-pages ./lint-progress --no-cache",
"postinstall": "yarn --cwd app/assets/javascripts $(node -e 'if(JSON.parse(process.env.npm_config_argv).original.includes(`--frozen-lockfile`)){console.log(`--frozen-lockfile`)}')"
"postinstall": "patch-package --patch-dir app/assets/javascripts/patches"
},
"workspaces": [
"app/assets/javascripts/admin",
"app/assets/javascripts/bootstrap-json",
"app/assets/javascripts/dialog-holder",
"app/assets/javascripts/discourse",
"app/assets/javascripts/discourse-common",
"app/assets/javascripts/discourse-hbr",
"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/pretty-text",
"app/assets/javascripts/select-kit",
"app/assets/javascripts/truth-helpers",
"app/assets/javascripts/wizard"
],
"resolutions": {
"**/babel-plugin-debug-macros": "npm:@discourse/babel-plugin-debug-macros@0.4.0-pre1",
"**/babel-plugin-ember-template-compilation": "2.0.0",
"**/markdown-it": "13.0.1",
"**/prettier": "2.7.1"
},
"engines": {
"node": "16.* || >= 18",

View File

@ -151,11 +151,7 @@ RSpec.describe DiscourseJsProcessor do
let(:mini_racer) do
ctx = MiniRacer::Context.new
ctx.eval(
File.open(
"#{Rails.root}/app/assets/javascripts/node_modules/handlebars/dist/handlebars.js",
).read,
)
ctx.eval(File.open("#{Rails.root}/node_modules/handlebars/dist/handlebars.js").read)
ctx.eval(helpers)
ctx
end

9111
yarn.lock

File diff suppressed because it is too large Load Diff