Skip to content

Commit 1bb0191

Browse files
authored
Merge pull request #1 from matestack/rails_7_importmap_support
v3.1.0.rc1 release: Rails 7 fixes and importmap support
2 parents 8609bad + 9893f13 commit 1bb0191

File tree

12 files changed

+449
-11
lines changed

12 files changed

+449
-11
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v3.1.0.rc1 Release - 2022-04-08
4+
5+
- supporting Rails 7 importmaps via rollup building an esm module while still supporting webpacker
6+
37
## v3.0.0 Release - 2022-03-04
48

59
- same as v3.0.0.rc3

Dockerfile.dev

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ RUN apk update --no-cache && \
66
apk add build-base postgresql-dev git nodejs yarn tzdata bash sqlite-dev npm && \
77
mkdir -p /app
88

9+
RUN npm install --global rollup
10+
911
WORKDIR /app
1012

1113
COPY ./lib/ /app/lib/

Dockerfile.test

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ RUN apk update --no-cache && \
66
apk add build-base postgresql-dev git nodejs yarn tzdata bash sqlite-dev npm && \
77
mkdir -p /app
88

9+
npm install --global rollup
10+
911
WORKDIR /app
1012

1113
COPY ./lib/ /app/lib/

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
matestack-ui-vuejs (3.0.0.rc2)
4+
matestack-ui-vuejs (3.1.0.rc1)
55
matestack-ui-core (~> 3.0.0.rc1)
66
rails (>= 5.2)
77

dist/matestack-ui-vuejs.esm.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/matestack/ui/vue_js/index.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import Vue from 'vue'
2-
1+
import axios from 'axios'
32
import eventHub from './event_hub'
43
const matestackEventHub = eventHub // for compatibility with 1.x
54

@@ -70,14 +69,18 @@ const registerComponents = function(appInstance){
7069
}
7170

7271
const mount = function(appInstance, elementId='#matestack-ui'){
73-
registerComponents(appInstance)
72+
if (window.matestackAppMounted != true){
73+
window.matestackAppMounted = true
74+
registerComponents(appInstance)
7475

75-
appInstance.mount(elementId)
76+
appInstance.mount(elementId)
77+
}
7678

7779
return appInstance
7880
}
7981

8082
const MatestackUiVueJs = {
83+
axios,
8184
eventHub,
8285
matestackEventHub, // for compatibility with 1.x
8386
componentMixin,

lib/matestack/ui/vue_js/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Matestack
22
module Ui
33
module VueJs
4-
VERSION = '3.0.0'
4+
VERSION = '3.1.0.rc1'
55
end
66
end
77
end

lib/matestack/ui/vuejs.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require "matestack/ui/vue_js"

package.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "matestack-ui-vuejs",
3-
"version": "3.0.0",
4-
"main": "./lib/matestack/ui/vue_js/index.js",
3+
"version": "3.1.0-rc1",
4+
"module": "./dist/matestack-ui-vuejs.esm.js",
55
"files": [
66
"lib/**/*.js",
77
"README",
@@ -14,6 +14,16 @@
1414
"mitt": "^3.0.0",
1515
"vue": "^3.2.26"
1616
},
17+
"devDependencies": {
18+
"@rollup/plugin-node-resolve": "^11.0.1",
19+
"@rollup/plugin-commonjs": "^21.0.3",
20+
"@rollup/plugin-json": "^4.1.0",
21+
"rollup-plugin-terser": "^7.0.2",
22+
"rollup": "^2.35.1"
23+
},
24+
"scripts": {
25+
"build": "rollup --config rollup.config.js"
26+
},
1727
"exports": {
1828
".": "./lib/matestack/ui/vue_js/index.js"
1929
}

rollup.config.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import resolve from "@rollup/plugin-node-resolve"
2+
import commonjs from "@rollup/plugin-commonjs"
3+
import json from '@rollup/plugin-json';
4+
import { terser } from "rollup-plugin-terser"
5+
6+
const terserOptions = {
7+
mangle: true,
8+
compress: true
9+
}
10+
11+
export default [
12+
{
13+
input: "./lib/matestack/ui/vue_js/index.js",
14+
external: ['vue'],
15+
output: [
16+
{
17+
file: "./dist/matestack-ui-vuejs.esm.js",
18+
format: "es",
19+
globals: { vue: 'Vue', axios: 'axios' },
20+
}
21+
],
22+
plugins: [
23+
resolve({ browser: true }),
24+
json(),
25+
commonjs(),
26+
terser(terserOptions)
27+
]
28+
}
29+
]

spec/dummy/app/matestack/demo/vue_js/pages/first_page.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def response
77
plain "play around! --> spec/dummy/app/matestack/demo/vue_js/pages/first_page.rb"
88
end
99

10-
# you can call components on pages:
10+
# you can call components on pages!
1111
Demo::VueJs::Components::StaticComponent.call(foo: "bar")
1212

1313
onclick emit: "foo" do

0 commit comments

Comments
 (0)