From 37fe413c529d72c21a51009e1da08b7ae1e1b880 Mon Sep 17 00:00:00 2001 From: Michael Dyrynda Date: Wed, 14 Aug 2019 09:17:07 +0930 Subject: [PATCH 1/7] Update PHP, JavaScript dependencies for InertiaJS 0.1 release --- composer.json | 2 +- src/InertiaJsPreset.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 48513a5..e41b7f4 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "laravel/framework": "^5.8", - "inertiajs/inertia-laravel": "dev-master" + "inertiajs/inertia-laravel": "^0.1" }, "require-dev": { "orchestra/testbench": "^3.8" diff --git a/src/InertiaJsPreset.php b/src/InertiaJsPreset.php index cb48697..e8b9baf 100644 --- a/src/InertiaJsPreset.php +++ b/src/InertiaJsPreset.php @@ -23,8 +23,8 @@ protected static function updatePackageArray(array $packages) { return array_merge([ '@babel/plugin-syntax-dynamic-import' => '^7.2.0', - 'inertia' => 'github:inertiajs/inertia', - 'inertia-vue' => 'inertiajs/inertia-vue', + '@inertiajs/inertia' => '^0.1', + '@inertiajs/inertia-vue' => '^0.1', 'vue-template-compiler' => '^2.6.10', ], $packages); } @@ -32,7 +32,6 @@ protected static function updatePackageArray(array $packages) protected static function updateBootstrapping() { copy(__DIR__.'/inertiajs-stubs/.babelrc', base_path('.babelrc')); - copy(__DIR__.'/inertiajs-stubs/webpack.mix.js', base_path('webpack.mix.js')); copy(__DIR__.'/inertiajs-stubs/resources/js/app.js', resource_path('js/app.js')); From 9a902c5fee53f5f85569a4f336df836a878fbf79 Mon Sep 17 00:00:00 2001 From: Michael Dyrynda Date: Wed, 14 Aug 2019 09:17:32 +0930 Subject: [PATCH 2/7] Move babel configuration to webpack.mix.json --- src/InertiaJsPreset.php | 1 - src/inertiajs-stubs/.babelrc | 3 --- src/inertiajs-stubs/webpack.mix.js | 3 +++ 3 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 src/inertiajs-stubs/.babelrc diff --git a/src/InertiaJsPreset.php b/src/InertiaJsPreset.php index e8b9baf..0e5b96e 100644 --- a/src/InertiaJsPreset.php +++ b/src/InertiaJsPreset.php @@ -31,7 +31,6 @@ protected static function updatePackageArray(array $packages) protected static function updateBootstrapping() { - copy(__DIR__.'/inertiajs-stubs/.babelrc', base_path('.babelrc')); copy(__DIR__.'/inertiajs-stubs/webpack.mix.js', base_path('webpack.mix.js')); copy(__DIR__.'/inertiajs-stubs/resources/js/app.js', resource_path('js/app.js')); diff --git a/src/inertiajs-stubs/.babelrc b/src/inertiajs-stubs/.babelrc deleted file mode 100644 index a9b68d1..0000000 --- a/src/inertiajs-stubs/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["@babel/plugin-syntax-dynamic-import"] -} diff --git a/src/inertiajs-stubs/webpack.mix.js b/src/inertiajs-stubs/webpack.mix.js index b503b02..765a245 100644 --- a/src/inertiajs-stubs/webpack.mix.js +++ b/src/inertiajs-stubs/webpack.mix.js @@ -11,3 +11,6 @@ mix.sass('resources/sass/app.scss', 'public/css') }, }, }) + .babelConfig({ + plugins: ['@babel/plugin-syntax-dynamic-import'] + }) From e79cb57c0f0440b31d4f32160592e2472362b7c2 Mon Sep 17 00:00:00 2001 From: Michael Dyrynda Date: Wed, 14 Aug 2019 09:19:07 +0930 Subject: [PATCH 3/7] Swap js/sass lines in webpack config --- src/inertiajs-stubs/webpack.mix.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inertiajs-stubs/webpack.mix.js b/src/inertiajs-stubs/webpack.mix.js index 765a245..394043a 100644 --- a/src/inertiajs-stubs/webpack.mix.js +++ b/src/inertiajs-stubs/webpack.mix.js @@ -1,8 +1,8 @@ const mix = require('laravel-mix') const path = require('path') -mix.sass('resources/sass/app.scss', 'public/css') - .js('resources/js/app.js', 'public/js').webpackConfig({ +mix.js('resources/js/app.js', 'public/js') + .sass('resources/sass/app.scss', 'public/css') output: { chunkFilename: 'js/[name].[contenthash].js' }, resolve: { alias: { From c95ecddf82a6711378cc0b320730a886854d25e2 Mon Sep 17 00:00:00 2001 From: Michael Dyrynda Date: Wed, 14 Aug 2019 09:20:01 +0930 Subject: [PATCH 4/7] Tweak output filename chunking configuration --- src/inertiajs-stubs/webpack.mix.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/inertiajs-stubs/webpack.mix.js b/src/inertiajs-stubs/webpack.mix.js index 394043a..3d0dc55 100644 --- a/src/inertiajs-stubs/webpack.mix.js +++ b/src/inertiajs-stubs/webpack.mix.js @@ -3,7 +3,8 @@ const path = require('path') mix.js('resources/js/app.js', 'public/js') .sass('resources/sass/app.scss', 'public/css') - output: { chunkFilename: 'js/[name].[contenthash].js' }, + .webpackConfig({ + output: { chunkFilename: 'js/[name].js?id=[chunkhash]' }, resolve: { alias: { 'vue$': 'vue/dist/vue.runtime.js', From 070fd4eeee1ba3db761f9b135206408e614d82c5 Mon Sep 17 00:00:00 2001 From: Michael Dyrynda Date: Wed, 14 Aug 2019 09:20:18 +0930 Subject: [PATCH 5/7] Use the ES module version of the Vue runtime --- src/inertiajs-stubs/webpack.mix.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inertiajs-stubs/webpack.mix.js b/src/inertiajs-stubs/webpack.mix.js index 3d0dc55..c2375bb 100644 --- a/src/inertiajs-stubs/webpack.mix.js +++ b/src/inertiajs-stubs/webpack.mix.js @@ -7,7 +7,7 @@ mix.js('resources/js/app.js', 'public/js') output: { chunkFilename: 'js/[name].js?id=[chunkhash]' }, resolve: { alias: { - 'vue$': 'vue/dist/vue.runtime.js', + 'vue$': 'vue/dist/vue.runtime.esm.js', '@': path.resolve('resources/js'), }, }, From 840636ccb34462f13b50d89674f8a1dea06163e0 Mon Sep 17 00:00:00 2001 From: Michael Dyrynda Date: Wed, 14 Aug 2019 09:20:31 +0930 Subject: [PATCH 6/7] Update Inertia import to use named exports from 0.1 --- src/inertiajs-stubs/resources/js/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/inertiajs-stubs/resources/js/app.js b/src/inertiajs-stubs/resources/js/app.js index 3f747c8..fcd45b4 100644 --- a/src/inertiajs-stubs/resources/js/app.js +++ b/src/inertiajs-stubs/resources/js/app.js @@ -1,14 +1,14 @@ require('./bootstrap') -import Inertia from 'inertia-vue' +import { InertiaApp } from '@inertiajs/inertia-vue' import Vue from 'vue' -Vue.use(Inertia) +Vue.use(InertiaApp) let app = document.getElementById('app') new Vue({ - render: h => h(Inertia, { + render: h => h(InertiaApp, { props: { initialPage: JSON.parse(app.dataset.page), resolveComponent: (name) => { From 8c0b6c876a71b72c523ff5d0e8204b580bff6795 Mon Sep 17 00:00:00 2001 From: Michael Dyrynda Date: Wed, 14 Aug 2019 11:00:28 +0930 Subject: [PATCH 7/7] add patch number to package merge, which npm will otherwise rewrite --- src/InertiaJsPreset.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/InertiaJsPreset.php b/src/InertiaJsPreset.php index 0e5b96e..690d396 100644 --- a/src/InertiaJsPreset.php +++ b/src/InertiaJsPreset.php @@ -23,8 +23,8 @@ protected static function updatePackageArray(array $packages) { return array_merge([ '@babel/plugin-syntax-dynamic-import' => '^7.2.0', - '@inertiajs/inertia' => '^0.1', - '@inertiajs/inertia-vue' => '^0.1', + '@inertiajs/inertia' => '^0.1.0', + '@inertiajs/inertia-vue' => '^0.1.0', 'vue-template-compiler' => '^2.6.10', ], $packages); }