decidim 0.24.3 → 0.25.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Rakefile +28 -8
- data/babel.config.json +30 -0
- data/decidim-core/lib/decidim/webpacker/configuration.rb +89 -0
- data/decidim-core/lib/decidim/webpacker/postcss.config.js +16 -0
- data/decidim-core/lib/decidim/webpacker/runner.rb +24 -0
- data/decidim-core/lib/decidim/webpacker/webpack/base.js +6 -0
- data/decidim-core/lib/decidim/webpacker/webpack/custom.js +97 -0
- data/decidim-core/lib/decidim/webpacker/webpack/development.js +7 -0
- data/decidim-core/lib/decidim/webpacker/webpack/production.js +7 -0
- data/decidim-core/lib/decidim/webpacker/webpack/test.js +7 -0
- data/decidim-core/lib/decidim/webpacker/webpacker.yml +65 -0
- data/docs/README.adoc +1 -1
- data/docs/modules/configure/pages/initializer.adoc +31 -0
- data/docs/modules/customize/assets/images/modified_user_menu.png +0 -0
- data/docs/modules/customize/assets/images/original_user_menu.png +0 -0
- data/docs/modules/customize/pages/code.adoc +4 -1
- data/docs/modules/customize/pages/images.adoc +2 -2
- data/docs/modules/customize/pages/javascript.adoc +8 -3
- data/docs/modules/customize/pages/menu.adoc +56 -0
- data/docs/modules/customize/pages/styles.adoc +6 -3
- data/docs/modules/develop/pages/components.adoc +30 -0
- data/docs/modules/develop/pages/guide_migrate_webpacker_app.adoc +175 -0
- data/docs/modules/develop/pages/guide_migrate_webpacker_module.adoc +121 -0
- data/docs/modules/develop/pages/maps.adoc +2 -2
- data/docs/modules/develop/pages/newsletter_templates.adoc +1 -1
- data/docs/modules/develop/pages/releases.adoc +3 -1
- data/docs/modules/develop/pages/testing.adoc +11 -0
- data/docs/modules/develop/pages/view_models_aka_cells.adoc +1 -12
- data/docs/modules/install/pages/manual.adoc +46 -43
- data/docs/modules/services/pages/elections_bulletin_board.adoc +19 -16
- data/docs/modules/services/pages/social_providers.adoc +1 -1
- data/lib/decidim/gem_manager.rb +39 -18
- data/lib/decidim/version.rb +1 -1
- data/lib/decidim.rb +0 -4
- data/lib/tasks/decidim_tasks.rake +92 -0
- data/package-lock.json +36038 -0
- data/package.json +71 -0
- data/packages/browserslist-config/index.js +7 -0
- data/packages/browserslist-config/package.json +13 -0
- data/packages/core/node_modules/uuid/AUTHORS +5 -0
- data/packages/core/node_modules/uuid/CHANGELOG.md +119 -0
- data/packages/core/node_modules/uuid/LICENSE.md +21 -0
- data/packages/core/node_modules/uuid/README.md +276 -0
- data/packages/core/node_modules/uuid/bin/uuid +65 -0
- data/packages/core/node_modules/uuid/index.js +8 -0
- data/packages/core/node_modules/uuid/lib/bytesToUuid.js +26 -0
- data/packages/core/node_modules/uuid/lib/md5-browser.js +216 -0
- data/packages/core/node_modules/uuid/lib/md5.js +25 -0
- data/packages/core/node_modules/uuid/lib/rng-browser.js +34 -0
- data/packages/core/node_modules/uuid/lib/rng.js +8 -0
- data/packages/core/node_modules/uuid/lib/sha1-browser.js +89 -0
- data/packages/core/node_modules/uuid/lib/sha1.js +25 -0
- data/packages/core/node_modules/uuid/lib/v35.js +57 -0
- data/packages/core/node_modules/uuid/package.json +49 -0
- data/packages/core/node_modules/uuid/v1.js +109 -0
- data/packages/core/node_modules/uuid/v3.js +4 -0
- data/packages/core/node_modules/uuid/v4.js +29 -0
- data/packages/core/node_modules/uuid/v5.js +3 -0
- data/packages/core/package.json +53 -0
- data/packages/dev/package.json +15 -0
- data/packages/elections/package.json +17 -0
- data/packages/eslint-config/index.js +278 -0
- data/packages/eslint-config/package.json +24 -0
- data/packages/stylelint-config/index.js +160 -0
- data/packages/stylelint-config/package.json +16 -0
- data/packages/webpacker/index.js +6 -0
- data/packages/webpacker/package.json +50 -0
- data/packages/webpacker/src/override-config.js +52 -0
- metadata +92 -44
data/lib/decidim/gem_manager.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support/core_ext/module/delegation"
|
3
4
|
require "open3"
|
4
5
|
|
5
6
|
module Decidim
|
@@ -53,9 +54,9 @@ module Decidim
|
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
|
-
def
|
57
|
+
def replace_gem_version
|
57
58
|
Dir.chdir(@dir) do
|
58
|
-
|
59
|
+
replace_file(
|
59
60
|
"lib/#{name.tr("-", "/")}/version.rb",
|
60
61
|
/def self\.version(\s*)"[^"]*"/,
|
61
62
|
"def self.version\\1\"#{version}\""
|
@@ -63,6 +64,16 @@ module Decidim
|
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
67
|
+
def replace_package_version
|
68
|
+
Dir.chdir(@dir) do
|
69
|
+
replace_file(
|
70
|
+
"package.json",
|
71
|
+
/^ "version": "[^"]*"/,
|
72
|
+
" \"version\": \"#{semver_friendly_version(version)}\""
|
73
|
+
)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
66
77
|
def short_name
|
67
78
|
name.gsub(/decidim-/, "")
|
68
79
|
end
|
@@ -85,14 +96,12 @@ module Decidim
|
|
85
96
|
end
|
86
97
|
|
87
98
|
def replace_versions
|
88
|
-
replace_file(
|
89
|
-
"package.json",
|
90
|
-
/^ "version": "[^"]*"/,
|
91
|
-
" \"version\": \"#{semver_friendly_version}\""
|
92
|
-
)
|
93
|
-
|
94
99
|
all_dirs do |dir|
|
95
|
-
new(dir).
|
100
|
+
new(dir).replace_gem_version
|
101
|
+
end
|
102
|
+
|
103
|
+
package_dirs do |dir|
|
104
|
+
new(dir).replace_package_version
|
96
105
|
end
|
97
106
|
end
|
98
107
|
|
@@ -129,6 +138,14 @@ module Decidim
|
|
129
138
|
end
|
130
139
|
end
|
131
140
|
|
141
|
+
def run_packages(command, out: $stdout)
|
142
|
+
package_dirs do |dir|
|
143
|
+
status = new(dir).run(command, out: out)
|
144
|
+
|
145
|
+
break unless status || ENV["FAIL_FAST"] == "false"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
132
149
|
def version
|
133
150
|
@version ||= File.read(version_file).strip
|
134
151
|
end
|
@@ -146,20 +163,26 @@ module Decidim
|
|
146
163
|
dirs.each { |dir| yield(dir) }
|
147
164
|
end
|
148
165
|
|
166
|
+
def package_dirs
|
167
|
+
dirs = Dir.glob("#{root}/packages/*")
|
168
|
+
|
169
|
+
dirs.each { |dir| yield(dir) }
|
170
|
+
end
|
171
|
+
|
149
172
|
def plugins
|
150
173
|
Dir.glob("#{root}/decidim-*/")
|
151
174
|
end
|
152
175
|
|
176
|
+
def semver_friendly_version(a_version)
|
177
|
+
a_version.gsub(/\.pre/, "-pre").gsub(/\.dev/, "-dev").gsub(/.rc(\d*)/, "-rc\\1")
|
178
|
+
end
|
179
|
+
|
153
180
|
private
|
154
181
|
|
155
182
|
def root
|
156
183
|
File.expand_path(File.join("..", ".."), __dir__)
|
157
184
|
end
|
158
185
|
|
159
|
-
def semver_friendly_version
|
160
|
-
version.gsub(/\.pre/, "-pre").gsub(/\.dev/, "-dev").gsub(/.rc(\d*)/, "-rc\\1")
|
161
|
-
end
|
162
|
-
|
163
186
|
def version_file
|
164
187
|
File.join(root, ".decidim-version")
|
165
188
|
end
|
@@ -167,6 +190,8 @@ module Decidim
|
|
167
190
|
|
168
191
|
private
|
169
192
|
|
193
|
+
delegate :plugins, :replace_file, :semver_friendly_version, :version, to: :class
|
194
|
+
|
170
195
|
def interpolated_in_folder(command)
|
171
196
|
Dir.chdir(@dir) do
|
172
197
|
yield command.gsub("%version", version).gsub("%name", name)
|
@@ -178,11 +203,7 @@ module Decidim
|
|
178
203
|
end
|
179
204
|
|
180
205
|
def name
|
181
|
-
|
182
|
-
end
|
183
|
-
|
184
|
-
def version
|
185
|
-
self.class.version
|
206
|
+
plugins.map { |name| File.expand_path(name) }.include?(@dir) ? folder_name : "decidim"
|
186
207
|
end
|
187
208
|
end
|
188
209
|
end
|
data/lib/decidim/version.rb
CHANGED
data/lib/decidim.rb
CHANGED
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def ensure_log_goes_to_stdout
|
4
|
+
old_logger = Webpacker.logger
|
5
|
+
Webpacker.logger = ActiveSupport::Logger.new($stdout)
|
6
|
+
yield
|
7
|
+
ensure
|
8
|
+
Webpacker.logger = old_logger
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :decidim do
|
12
|
+
namespace :webpacker do
|
13
|
+
desc "Install deps with npm"
|
14
|
+
task :npm_install do
|
15
|
+
Dir.chdir(File.join(__dir__, "../..")) do
|
16
|
+
system "npm install"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Compile JavaScript packs using webpack for production with digests"
|
21
|
+
task compile: [:npm_install, :environment] do
|
22
|
+
Webpacker.with_node_env("production") do
|
23
|
+
ensure_log_goes_to_stdout do
|
24
|
+
if Decidim.webpacker.commands.compile
|
25
|
+
# Successful compilation!
|
26
|
+
puts "SUCCESS"
|
27
|
+
Dir.chdir(File.join(__dir__, "../..")) do
|
28
|
+
system "cp -r public/* #{Rails.root.join("public")}"
|
29
|
+
end
|
30
|
+
else
|
31
|
+
# Failed compilation
|
32
|
+
puts "FAIL"
|
33
|
+
exit!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def npm_install_available?
|
42
|
+
rails_major = Rails::VERSION::MAJOR
|
43
|
+
rails_minor = Rails::VERSION::MINOR
|
44
|
+
|
45
|
+
rails_major > 5 || (rails_major == 5 && rails_minor >= 1)
|
46
|
+
end
|
47
|
+
|
48
|
+
def enhance_assets_precompile
|
49
|
+
# npm:install was added in Rails 5.1
|
50
|
+
deps = npm_install_available? ? [] : ["decidim:webpacker:npm_install"]
|
51
|
+
Rake::Task["assets:precompile"].enhance(deps) do
|
52
|
+
Rake::Task["decidim:webpacker:compile"].invoke
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Compile packs after we've compiled all other assets during precompilation
|
57
|
+
skip_webpacker_precompile = %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"])
|
58
|
+
|
59
|
+
unless skip_webpacker_precompile
|
60
|
+
if Rake::Task.task_defined?("assets:precompile")
|
61
|
+
enhance_assets_precompile
|
62
|
+
else
|
63
|
+
Rake::Task.define_task("assets:precompile" => "decidim:webpacker:compile")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
namespace :decidim do
|
68
|
+
namespace :assets do
|
69
|
+
desc "Remove 'node_modules' folder"
|
70
|
+
task rm_node_modules: :environment do
|
71
|
+
Dir.chdir(File.join(__dir__, "../..")) do
|
72
|
+
puts "Removing node_modules folder"
|
73
|
+
system "rm -rf node_modules"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def enhance_assets_clean
|
80
|
+
# npm:install was added in Rails 5.1
|
81
|
+
Rake::Task["assets:clean"].enhance([]) do
|
82
|
+
Rake::Task["decidim:assets:rm_node_modules"].invoke
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
unless skip_webpacker_precompile
|
87
|
+
if Rake::Task.task_defined?("assets:clean")
|
88
|
+
enhance_assets_clean
|
89
|
+
else
|
90
|
+
Rake::Task.define_task("assets:clean" => "decidim:assets:rm_node_modules")
|
91
|
+
end
|
92
|
+
end
|