Sha256: 2b894bd41a987b66d30f57aa93fe18037477523431ab1f81819a4ef9827781ea

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

say "Adding alias.js to config/webpack/alias"
copy_file "#{__dir__}/config/alias.js", Rails.root.join("config/webpack/alias/alias.js").to_s

say "Adding alias configuration to config/webpack/environment.js"
insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
  "const alias =  require('./alias/alias')\n",
  after: "require('@rails/webpacker')\n"

insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
  "environment.config.merge(alias)\n",
  before: "module.exports"

  scripts =   <<-eos
  "scripts": {
    "rails server": "rails server",
    "webpack-dev-server": "./bin/webpack-dev-server", 
    "rails assets:precompile": "yarn install; rails assets:precompile",
    "yarn install": "yarn install",
    "yarn test": "jest"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "vue"
    ],
    "moduleNameMapper": {
      "^@/(.*)$": "<rootDir>/app/javascript/parts/$1"
    },
    "transform": {
      "^.+\\\\\\.js$": "<rootDir>/node_modules/babel-jest",
      ".*\\\\\\.(vue)$": "<rootDir>/node_modules/vue-jest"
    },
    "snapshotSerializers": [
      "<rootDir>/node_modules/jest-serializer-vue"
    ]
  },
eos

say "Adding scripts and Jest configuration to package.json"
insert_into_file Rails.root.join("package.json").to_s,
  "#{scripts}",
  after: "\"private\": true,\n"

say "Adding test presets to .babelrc"
babelrc = <<-eos
  "env": {
    "test": {
      "presets": [
        ["env", { "targets": { "node": "current" }}]
      ]
    }
  },
eos

insert_into_file Rails.root.join(".babelrc").to_s,
  "#{babelrc}",
  before: "  \"presets\": ["
  
say "Adding @vue/test-utils and other Jest dependencies"
run "yarn add @vue/test-utils jest jest-serializer-vue vue-jest babel-jest"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vuejs-1.1.0.beta6 lib/install/setup.rb