cable_ready 5.0.0.pre10 → 5.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,7 +42,7 @@ backup(importmap_path) do
42
42
 
43
43
  if !importmap.include?("pin \"cable_ready\"")
44
44
  append_file(importmap_path, <<~RUBY, verbose: false)
45
- pin "cable_ready", to: "cable_ready.min.js", preload: true
45
+ pin "cable_ready", to: "cable_ready.js", preload: true
46
46
  RUBY
47
47
  say "✅ pin CableReady"
48
48
  end
@@ -8,10 +8,14 @@ return if pack_path_missing?
8
8
  lines = package_json.readlines
9
9
  if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus["']:/ }
10
10
  add_package "@hotwired/stimulus@^3.2"
11
+ else
12
+ say "⏩ @hotwired/stimulus npm package is already present. Skipping."
11
13
  end
12
14
 
13
15
  if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus-webpack-helpers["']: ["']\^1.0.1["']/ }
14
16
  add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
17
+ else
18
+ say "⏩ @hotwired/stimulus-webpack-helpers npm package is already present. Skipping."
15
19
  end
16
20
 
17
21
  step_path = "/app/javascript/controllers/"
data/lib/install/vite.rb CHANGED
@@ -8,10 +8,14 @@ return if pack_path_missing?
8
8
  lines = package_json.readlines
9
9
  if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus["']:/ }
10
10
  add_package "@hotwired/stimulus@^3.2"
11
+ else
12
+ say "⏩ @hotwired/stimulus npm package is already present. Skipping."
11
13
  end
12
14
 
13
15
  if !lines.index { |line| line =~ /^\s*["']stimulus-vite-helpers["']: ["']\^3["']/ }
14
16
  add_package "stimulus-vite-helpers@^3"
17
+ else
18
+ say "⏩ @stimulus-vite-helpers npm package is already present. Skipping."
15
19
  end
16
20
 
17
21
  step_path = "/app/javascript/controllers/"
@@ -8,26 +8,38 @@ return if pack_path_missing?
8
8
  lines = package_json.readlines
9
9
  if !lines.index { |line| line =~ /^\s*["']webpack["']: ["']\^4.46.0["']/ }
10
10
  add_package "webpack@^4.46.0"
11
+ else
12
+ say "⏩ webpack npm package is already present. Skipping."
11
13
  end
12
14
 
13
15
  if !lines.index { |line| line =~ /^\s*["']webpack-cli["']: ["']\^3.3.12["']/ }
14
16
  add_package "webpack-cli@^3.3.12"
17
+ else
18
+ say "⏩ webpack-cli npm package is already present. Skipping."
15
19
  end
16
20
 
17
21
  if !lines.index { |line| line =~ /^\s*["']@rails\/webpacker["']: ["']\^5.4.3["']/ }
18
22
  add_package "@rails/webpacker@^5.4.3"
23
+ else
24
+ say "⏩ @rails/webpacker npm package is already present. Skipping."
19
25
  end
20
26
 
21
27
  if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus["']:/ }
22
28
  add_package "@hotwired/stimulus@^3.2"
29
+ else
30
+ say "⏩ @hotwired/stimulus npm package is already present. Skipping."
23
31
  end
24
32
 
25
33
  if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus-webpack-helpers["']: ["']\^1.0.1["']/ }
26
34
  add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
35
+ else
36
+ say "⏩ @hotwired/stimulus-webpack-helpers npm package is already present. Skipping."
27
37
  end
28
38
 
29
39
  if !lines.index { |line| line =~ /^\s*["']webpack-dev-server["']: ["']\^3.11.3["']/ }
30
40
  add_dev_package "webpack-dev-server@^3.11.3"
41
+ else
42
+ say "⏩ @webpack-dev-server is already present. Skipping."
31
43
  end
32
44
 
33
45
  step_path = "/app/javascript/controllers/"
@@ -1,11 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- include Rails.application.routes.url_helpers
4
-
5
3
  CR_STEPS = {
6
4
  "action_cable" => "Action Cable",
7
- "webpacker" => "CableReady using Webpacker",
8
- "shakapacker" => "CableReady using Shakapacker",
5
+ "webpacker" => "Install CableReady using Webpacker",
6
+ "shakapacker" => "Install CableReady using Shakapacker",
9
7
  "npm_packages" => "Install CableReady npm package",
10
8
  "importmap" => "Install CableReady using importmaps",
11
9
  "esbuild" => "Install CableReady using esbuild",
@@ -13,11 +11,11 @@ CR_STEPS = {
13
11
  "initializers" => "Generate and configure initializer",
14
12
  "development" => "development environment configuration",
15
13
  "spring" => "Disable spring gem. Spring has been removed from Rails 7",
16
- "mrujs" => "Swap out UJS for mrujs",
14
+ "mrujs" => "Swap out Rails UJS for mrujs",
17
15
  "broadcaster" => "Make CableReady::Broadcaster available to channels, controllers, jobs and models",
18
16
  "updatable" => "Include CableReady::Updatable in Active Record model classes",
19
- "vite" => "CableReady using Vite",
20
- "compression" => "Compress WebSockets traffic with gzip"
17
+ "vite" => "Install CableReady using Vite",
18
+ "compression" => "Compress WebSocket traffic with gzip"
21
19
  }
22
20
 
23
21
  CR_BUNDLERS = {
@@ -219,7 +217,7 @@ namespace :cable_ready do
219
217
  end
220
218
 
221
219
  desc <<~DESC
222
- Re-run specific CableReady install steps
220
+ Run specific CableReady install steps
223
221
 
224
222
  #{CR_STEPS.sort.map { |step, description| "#{step.ljust(20)} #{description}" }.join("\n")}
225
223
  DESC
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cable_ready",
3
- "version": "5.0.0-pre10",
3
+ "version": "5.0.0-rc2",
4
4
  "description": "CableReady helps you create great real-time user experiences by making it simple to trigger client-side DOM changes from server-side Ruby.",
5
5
  "keywords": [
6
6
  "ruby",
@@ -35,13 +35,14 @@
35
35
  "javascript/*"
36
36
  ],
37
37
  "scripts": {
38
- "lint": "yarn run prettier-standard:check",
39
- "format": "yarn run prettier-standard:format",
40
- "prettier-standard:check": "yarn run prettier-standard --check ./javascript/**/*.js rollup.config.js",
41
- "prettier-standard:format": "yarn run prettier-standard ./javascript/**/*.js rollup.config.js",
38
+ "lint": "yarn run format --check",
39
+ "format": "yarn run prettier-standard ./javascript/**/*.js rollup.config.mjs",
42
40
  "build": "yarn rollup -c",
43
41
  "watch": "yarn rollup -wc",
44
- "test": "web-test-runner javascript/test/**/*.test.js"
42
+ "test": "web-test-runner javascript/test/**/*.test.js",
43
+ "docs:dev": "vitepress dev docs",
44
+ "docs:build": "vitepress build docs && cp ./docs/_redirects ./docs/.vitepress/dist",
45
+ "docs:preview": "vitepress preview docs"
45
46
  },
46
47
  "dependencies": {
47
48
  "morphdom": "2.6.1"
@@ -53,9 +54,12 @@
53
54
  "@rollup/plugin-terser": "^0.4.0",
54
55
  "@web/dev-server-esbuild": "^0.3.3",
55
56
  "@web/dev-server-rollup": "^0.3.21",
56
- "@web/test-runner": "^0.15.0",
57
+ "@web/test-runner": "^0.15.1",
57
58
  "prettier-standard": "^16.4.1",
58
- "rollup": "^3.15.0",
59
- "sinon": "^15.0.1"
59
+ "rollup": "^3.19.1",
60
+ "sinon": "^15.0.2",
61
+ "vite": "^4.1.4",
62
+ "vitepress": "^1.0.0-alpha.56",
63
+ "vitepress-plugin-search": "^1.0.4-alpha.19"
60
64
  }
61
65
  }
data/rollup.config.mjs CHANGED
@@ -14,13 +14,6 @@ const pretty = () => {
14
14
  })
15
15
  }
16
16
 
17
- const minify = () => {
18
- return terser({
19
- mangle: true,
20
- compress: true
21
- })
22
- }
23
-
24
17
  const esConfig = {
25
18
  format: 'es',
26
19
  inlineDynamicImports: true
@@ -43,22 +36,10 @@ const output = distFolders
43
36
  file: `${distFolder}/${baseName}.js`,
44
37
  plugins: [pretty()]
45
38
  },
46
- {
47
- ...esConfig,
48
- file: `${distFolder}/${baseName}.min.js`,
49
- sourcemap: true,
50
- plugins: [minify()]
51
- },
52
39
  {
53
40
  ...umdConfig,
54
41
  file: `${distFolder}/${baseName}.umd.js`,
55
42
  plugins: [pretty()]
56
- },
57
- {
58
- ...umdConfig,
59
- file: `${distFolder}/${baseName}.umd.min.js`,
60
- sourcemap: true,
61
- plugins: [minify()]
62
43
  }
63
44
  ])
64
45
  .flat()