diff --git a/Rakefile b/Rakefile index efde3b4..5e291e2 100644 --- a/Rakefile +++ b/Rakefile @@ -2,8 +2,23 @@ require "decidim/dev/common_rake" +def js_configuration(path) + babel_file_path = File.join(Dir.pwd, "babel.config.json") + + Dir.chdir(path) do + FileUtils.cp(babel_file_path, "babel.config.json") + system("yarn add @babel/plugin-proposal-private-methods") + system("yarn add @babel/plugin-proposal-private-property-in-object") + end +end + desc "Generates a dummy app for testing" -task test_app: "decidim:generate_external_test_app" +task test_app: "decidim:generate_external_test_app" do + ENV["RAILS_ENV"] = "test" + js_configuration("spec/decidim_dummy_app") +end desc "Generates a development app." -task development_app: "decidim:generate_external_development_app" +task development_app: "decidim:generate_external_development_app" do + js_configuration("development_app") +end diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000..551d4be --- /dev/null +++ b/babel.config.json @@ -0,0 +1,28 @@ +{ + "presets": [ + [ + "@babel/preset-env", { + "forceAllTransforms": true, + "useBuiltIns": "entry", + "corejs": 3, + "modules": false + } + ], + ["@babel/preset-react"] + ], + "plugins": [ + "@babel/plugin-transform-classes", + [ + "@babel/plugin-transform-runtime", + { + "helpers": false, + "regenerator": true, + "corejs": false + } + ], + [ "@babel/plugin-transform-regenerator", { "async": false }], + [ "@babel/plugin-proposal-private-property-in-object", { "loose": true }], + ["@babel/plugin-proposal-private-methods", { "loose": true }], + ["@babel/plugin-proposal-class-properties", { "loose": true }] + ] +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + +