alchemy_cms 6.1.4 → 6.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ffc03e16f129a444f6adfcdf851012f04cdbca01d1bf10e8e4edae163383be2
4
- data.tar.gz: c40cc3dd8deb37fa7cae8c78de08438c184d2200cce480fce1785cc5ca62f210
3
+ metadata.gz: 82d0b26e8224a3bb1da650ec70e232be87c79369b0245fde310c3cd753740aaa
4
+ data.tar.gz: b5c4037e32b190ae4516991098c91540c93beab4c246906dbc6d19fa826b768c
5
5
  SHA512:
6
- metadata.gz: 141196b0c09257888ebe8408513ab5fb2bbebdcb5eaa4b8871fbec81afde8d6323021ca7d97dc2f880a44151860b618501b92f42e0649164ac6affdac01ca384
7
- data.tar.gz: fc764011dd71971b3ec970bc0c86f8a5fc4f3b288f5e9596facb69dab8a5ad35805743dfe4c128682419b356504e6ab8b27b0db3e9d1da43d676b6a309615ba2
6
+ metadata.gz: f89042c022abe8827138c41571b8dfdf83654c0c7159899fc57c622f3a08ad3c5c9b8d17398a6980e0844f2d88de38cd7bb62923b43512674bc5e5cd57caa349
7
+ data.tar.gz: 5109000000bdcaadcb08b7173814ff4a5d90aede3bb5787612f6a3604b9c95df089322ac6a761c6bcdbef71c25ad1e077657efbbc79c9e05fd49be68800e9c94
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.1.6 (2023-06-30)
4
+
5
+ - [6.1] Allow to create element with warning in definition [#2508](https://github.com/AlchemyCMS/alchemy_cms/pull/2508) ([tvdeyen](https://github.com/tvdeyen))
6
+ - [6.1] Allow authors to link to all pages again [#2505](https://github.com/AlchemyCMS/alchemy_cms/pull/2505) ([tvdeyen](https://github.com/tvdeyen))
7
+ - install generator: Add option to force patched babel config [#2495](https://github.com/AlchemyCMS/alchemy_cms/pull/2495) ([tvdeyen](https://github.com/tvdeyen))
8
+ - Remove memory leak in ingredients migrator [#2493](https://github.com/AlchemyCMS/alchemy_cms/pull/2493) ([tvdeyen](https://github.com/tvdeyen))
9
+
10
+ ## 6.1.5 (2023-05-26)
11
+
12
+ - [6.1] Fix page seeder [#2482](https://github.com/AlchemyCMS/alchemy_cms/pull/2482) ([tvdeyen](https://github.com/tvdeyen))
13
+
3
14
  ## 6.1.4 (2023-05-18)
4
15
 
5
16
  - [6.1] Revert "Preload related objects in Alchemy::PagesController" [#2473](https://github.com/AlchemyCMS/alchemy_cms/pull/2473) ([tvdeyen](https://github.com/tvdeyen))
data/Rakefile CHANGED
@@ -48,7 +48,7 @@ namespace :alchemy do
48
48
  bin/rake db:create && \
49
49
  bin/rake db:environment:set && \
50
50
  bin/rake db:migrate:reset && \
51
- bin/rails g alchemy:install --skip --skip-demo-files --auto-accept --skip-db-create && \
51
+ bin/rails g alchemy:install --skip --skip-demo-files --auto-accept --skip-db-create --force-babel-config && \
52
52
  yarn link @alchemy_cms/admin && \
53
53
  RAILS_ENV=test bin/webpack && \
54
54
  cd -
@@ -8,9 +8,7 @@ module Alchemy
8
8
  # Returns all pages as json object
9
9
  #
10
10
  def index
11
- language = Alchemy::Language.find_by(id: params[:language_id]) || Alchemy::Language.current
12
11
  @pages = Alchemy::Page.accessible_by(current_ability, :index)
13
- @pages = @pages.where(language: language)
14
12
  @pages = @pages.includes(*page_includes)
15
13
  @pages = @pages.ransack(params[:q]).result
16
14
 
@@ -46,6 +46,7 @@ module Alchemy
46
46
  "compact",
47
47
  "message",
48
48
  "deprecated",
49
+ "warning",
49
50
  ].freeze
50
51
 
51
52
  # All Elements that share the same page version and parent element and are fixed or not are considered a list.
@@ -45,8 +45,8 @@ module Alchemy
45
45
  e.public? && !e.restricted?
46
46
  end
47
47
 
48
- can :read, Alchemy::Page, Alchemy::Page.published.not_restricted do |p|
49
- p.public? && !p.restricted?
48
+ can :read, Alchemy::Page, Alchemy::Page.published.not_restricted.from_current_site do |p|
49
+ p.public? && !p.restricted? && p.site == Alchemy::Site.current
50
50
  end
51
51
  end
52
52
  end
@@ -72,8 +72,8 @@ module Alchemy
72
72
  e.public?
73
73
  end
74
74
 
75
- can :read, Alchemy::Page, Alchemy::Page.published do |p|
76
- p.public?
75
+ can :read, Alchemy::Page, Alchemy::Page.published.from_current_site do |p|
76
+ p.public? && p.site == Alchemy::Site.current
77
77
  end
78
78
  end
79
79
  end
@@ -82,7 +82,11 @@ module Alchemy
82
82
  end
83
83
 
84
84
  def page_yml
85
- @_page_yml ||= YAML.load_file(page_seeds_file)
85
+ @_page_yml ||= YAML.safe_load(
86
+ page_seeds_file.read,
87
+ permitted_classes: [Date],
88
+ aliases: true
89
+ )
86
90
  end
87
91
 
88
92
  def contentpages
@@ -99,7 +103,9 @@ module Alchemy
99
103
 
100
104
  def create_page(draft, attributes = {})
101
105
  children = draft.delete("children") || []
102
- page = Alchemy::Page.create!(draft.merge(attributes))
106
+ page = Alchemy::Page.new(draft.merge(attributes))
107
+ page.versions.build
108
+ page.save!
103
109
  log "Created page: #{page.name}"
104
110
  children.each do |child|
105
111
  create_page(child, parent: page, language: page.language)
@@ -8,28 +8,27 @@ module Alchemy::Upgrader::Tasks
8
8
 
9
9
  no_tasks do
10
10
  def create_ingredients(verbose: !Rails.env.test?)
11
- Alchemy::Deprecation.silence do
12
- elements_with_ingredients = Alchemy::ElementDefinition.all.select { |d| d.key?(:ingredients) }
13
- if ENV["ONLY"]
14
- elements_with_ingredients = elements_with_ingredients.select { |d| d[:name].in? ENV["ONLY"].split(",") }
15
- end
16
- # eager load all elements that have ingredients defined but no ingredient records yet.
17
- all_elements = Alchemy::Element
18
- .named(elements_with_ingredients.map { |d| d[:name] })
19
- .preload(contents: :essence)
20
- .left_outer_joins(:ingredients).where(alchemy_ingredients: { id: nil })
21
- .to_a
22
- elements_with_ingredients.map do |element_definition|
23
- elements = all_elements.select { |e| e.name == element_definition[:name] }
24
- if elements.any?
25
- puts "-- Creating ingredients for #{elements.count} #{element_definition[:name]}(s)" if verbose
26
- elements.each do |element|
27
- MigrateElementIngredients.call(element)
28
- print "." if verbose
11
+ Rails.logger.silence do
12
+ Alchemy::Deprecation.silence do
13
+ elements_with_ingredients = Alchemy::ElementDefinition.all.select { |d| d.key?(:ingredients) }
14
+ if ENV["ONLY"]
15
+ elements_with_ingredients = elements_with_ingredients.select { |d| d[:name].in? ENV["ONLY"].split(",") }
16
+ end
17
+ elements_with_ingredients.each do |element_definition|
18
+ elements = Alchemy::Element
19
+ .named(element_definition[:name])
20
+ .left_outer_joins(:ingredients).where(alchemy_ingredients: { id: nil })
21
+ count = elements.count
22
+ if count.positive?
23
+ puts "-- Creating ingredients for #{elements.count} #{element_definition[:name]}(s)" if verbose
24
+ elements.preload(contents: :essence).find_each.with_index(1) do |element, index|
25
+ MigrateElementIngredients.call(element)
26
+ puts "\e[H\e[2J #{index}/#{count}" if verbose
27
+ end
28
+ puts "\n" if verbose
29
+ elsif verbose
30
+ puts "-- No #{element_definition[:name]} elements found for migration."
29
31
  end
30
- puts "\n" if verbose
31
- elsif verbose
32
- puts "-- No #{element_definition[:name]} elements found for migration."
33
32
  end
34
33
  end
35
34
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "6.1.4"
4
+ VERSION = "6.1.6"
5
5
 
6
6
  def self.version
7
7
  VERSION
@@ -0,0 +1,64 @@
1
+ module.exports = function (api) {
2
+ var validEnv = ["development", "test", "production"]
3
+ var currentEnv = api.env()
4
+ var isDevelopmentEnv = api.env("development")
5
+ var isProductionEnv = api.env("production")
6
+ var isTestEnv = api.env("test")
7
+
8
+ if (!validEnv.includes(currentEnv)) {
9
+ throw new Error(
10
+ "Please specify a valid `NODE_ENV` or " +
11
+ '`BABEL_ENV` environment variables. Valid values are "development", ' +
12
+ '"test", and "production". Instead, received: ' +
13
+ JSON.stringify(currentEnv) +
14
+ "."
15
+ )
16
+ }
17
+
18
+ return {
19
+ presets: [
20
+ isTestEnv && [
21
+ "@babel/preset-env",
22
+ {
23
+ targets: {
24
+ node: "current"
25
+ }
26
+ }
27
+ ],
28
+ (isProductionEnv || isDevelopmentEnv) && [
29
+ "@babel/preset-env",
30
+ {
31
+ forceAllTransforms: true,
32
+ useBuiltIns: "entry",
33
+ corejs: 3,
34
+ modules: false,
35
+ exclude: ["transform-typeof-symbol"]
36
+ }
37
+ ]
38
+ ].filter(Boolean),
39
+ plugins: [
40
+ "babel-plugin-macros",
41
+ "@babel/plugin-syntax-dynamic-import",
42
+ isTestEnv && "babel-plugin-dynamic-import-node",
43
+ "@babel/plugin-transform-destructuring",
44
+ [
45
+ "@babel/plugin-proposal-object-rest-spread",
46
+ {
47
+ useBuiltIns: true
48
+ }
49
+ ],
50
+ [
51
+ "@babel/plugin-transform-runtime",
52
+ {
53
+ helpers: false
54
+ }
55
+ ],
56
+ [
57
+ "@babel/plugin-transform-regenerator",
58
+ {
59
+ async: false
60
+ }
61
+ ]
62
+ ].filter(Boolean)
63
+ }
64
+ }
@@ -23,6 +23,11 @@ module Alchemy
23
23
  default: false,
24
24
  desc: "Skip running the webpacker installer."
25
25
 
26
+ class_option :force_babel_config,
27
+ type: :boolean,
28
+ default: false,
29
+ desc: "Force installing a patched babel config."
30
+
26
31
  class_option :skip_db_create,
27
32
  type: :boolean,
28
33
  default: false,
@@ -113,6 +118,13 @@ module Alchemy
113
118
  end
114
119
  end
115
120
 
121
+ # We need to force the babel.config.js file, because webpacker has an invalid one
122
+ def copy_babel_config
123
+ if options[:force_babel_config]
124
+ copy_file "babel.config.js", app_root.join("babel.config.js"), force: true
125
+ end
126
+ end
127
+
116
128
  def add_npm_package
117
129
  run "yarn add @alchemy_cms/admin@~#{Alchemy.version}"
118
130
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "6.1.4",
3
+ "version": "6.1.6",
4
4
  "description": "AlchemyCMS",
5
5
  "browser": "package/admin.js",
6
6
  "files": [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.4
4
+ version: 6.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2023-05-18 00:00:00.000000000 Z
16
+ date: 2023-06-30 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer
@@ -1393,6 +1393,7 @@ files:
1393
1393
  - lib/generators/alchemy/install/files/all.js
1394
1394
  - lib/generators/alchemy/install/files/application.html.erb
1395
1395
  - lib/generators/alchemy/install/files/article.scss
1396
+ - lib/generators/alchemy/install/files/babel.config.js
1396
1397
  - lib/generators/alchemy/install/install_generator.rb
1397
1398
  - lib/generators/alchemy/install/templates/dragonfly.rb.tt
1398
1399
  - lib/generators/alchemy/install/templates/elements.yml.tt