Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: formatting, switch bundling to tsup(rollup), formatting, ship … #201

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
package-lock.json
pnpm-lock.yaml
yarn.lock
31 changes: 31 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
root: true,
env: {
node: true,
es6: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
rules: {
'no-trailing-spaces': 'error',
quotes: [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
},
overrides: [
{
// enable the rule specifically for TypeScript files
files: ['*.ts', '*.mts'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/indent': 'off',
},
},
],
}
12 changes: 0 additions & 12 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* text=auto
* text=auto eol=lf

/.github export-ignore
/tests export-ignore
Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Bug report"
name: 'Bug report'
about: "Report something that's broken. Please ensure your version is still supported: https://laravel.com/docs/releases#support-policy"
---

Expand All @@ -16,5 +16,4 @@ about: "Report something that's broken. Please ensure your version is still supp

### Description:


### Steps To Reproduce:
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/2_Feature_request.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
name: "Feature request"
name: 'Feature request'
about: 'For ideas or feature requests, please make a pull request or open an issue'
---
56 changes: 28 additions & 28 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: codeql

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '44 23 * * 1'

Expand All @@ -28,40 +28,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
/inertia-helpers/
/npm-debug.log
/package-lock.json
.eslintcache
/pnpm-lock.yaml
/yarn.lock
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
src/dev-server-index.html
22 changes: 22 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
semi: false,
trailingComma: 'all',
singleQuote: true,
tabWidth: 2,
printWidth: 120,
overrides: [
{
files: ['*.yml'],
options: {
singleQuote: true,
},
},
{
files: ['*.json'],
options: {
singleQuote: false,
quoteProps: 'preserve',
},
},
],
}
76 changes: 33 additions & 43 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,25 @@ npm install --save-dev @vitejs/plugin-react
Create a `vite.config.js` file in the root of your project:

```js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
// import react from '@vitejs/plugin-react';
// import vue from '@vitejs/plugin-vue';

export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/app.js',
]),
// react(),
// vue({
// template: {
// transformAssetUrls: {
// base: null,
// includeAbsolute: false,
// },
// },
// }),
],
});
plugins: [
laravel(['resources/css/app.css', 'resources/js/app.js']),
// react(),
// vue({
// template: {
// transformAssetUrls: {
// base: null,
// includeAbsolute: false,
// },
// },
// }),
],
})
```

If you are building an SPA, you will get a better developer experience by removing the CSS entry point above and [importing your CSS from Javascript](#importing-your-css-from-your-javascript-entry-points).
Expand All @@ -68,18 +65,13 @@ If you are migrating aliases from your `webpack.mix.js` file to your `vite.confi

```js
export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/app.js',
]),
],
resolve: {
alias: {
'@': '/resources/js'
}
}
});
plugins: [laravel(['resources/css/app.css', 'resources/js/app.js'])],
resolve: {
alias: {
'@': '/resources/js',
},
},
})
```

For your convenience, the Laravel Vite plugin automatically adds an `@` alias for your `/resources/js` directory. If you do not need to customize your aliases, you may omit this section from your `vite.config.js` file.
Expand Down Expand Up @@ -184,11 +176,10 @@ The entry points should match those used in your `vite.config.js`.

#### React

If you are using React and hot-module replacement, you will need to include an additional directive *before* the `@vite` directive:
If you are using React and hot-module replacement, you will need to include an additional directive _before_ the `@vite` directive:

```html
@viteReactRefresh
@vite('resources/js/app.jsx')
@viteReactRefresh @vite('resources/js/app.jsx')
```

This loads a React "refresh runtime" in development mode only, which is required for hot module replacement to work correctly.
Expand Down Expand Up @@ -248,7 +239,6 @@ Next, if you are using the Vapor asset helper in your application, you only need

If you want to use the asset helper with your Vite project, you will also need to ensure you have updated to the latest version:


```sh
npm install laravel-vapor@latest
```
Expand Down Expand Up @@ -303,17 +293,17 @@ rm webpack.ssr.mix.js
In most cases, you won't need a dedicated SSR configuration file when using Vite. You can specify your SSR entry point by passing a configuration option to the Laravel plugin:

```js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'

export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.js',
ssr: 'resources/js/ssr.js',
}),
],
});
plugins: [
laravel({
input: 'resources/js/app.js',
ssr: 'resources/js/ssr.js',
}),
],
})
```

You may wish to add the following additional scripts to your `package.json`:
Expand Down
Loading