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: Use Vite #458

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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: 1 addition & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
module.exports = {
root: true,
env: {
node: true
es2021: true
},
extends: [
'plugin:vue/vue3-recommended',
'@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
plugins: [
'modules-newline'
],
Expand Down
2 changes: 0 additions & 2 deletions docs/css/app.f50cfb40.css

This file was deleted.

1 change: 0 additions & 1 deletion docs/css/app.f50cfb40.css.map

This file was deleted.

Binary file removed docs/favicon.ico
Binary file not shown.
Binary file removed docs/img/icons/android-chrome-192x192.png
Binary file not shown.
Binary file removed docs/img/icons/android-chrome-512x512.png
Binary file not shown.
Binary file removed docs/img/icons/android-chrome-maskable-192x192.png
Binary file not shown.
Binary file removed docs/img/icons/android-chrome-maskable-512x512.png
Binary file not shown.
Binary file removed docs/img/icons/apple-touch-icon-120x120.png
Binary file not shown.
Binary file removed docs/img/icons/apple-touch-icon-152x152.png
Binary file not shown.
Binary file removed docs/img/icons/apple-touch-icon-180x180.png
Binary file not shown.
Binary file removed docs/img/icons/apple-touch-icon-60x60.png
Binary file not shown.
Binary file removed docs/img/icons/apple-touch-icon-76x76.png
Binary file not shown.
Binary file removed docs/img/icons/apple-touch-icon.png
Binary file not shown.
Binary file removed docs/img/icons/favicon-16x16.png
Binary file not shown.
Binary file removed docs/img/icons/favicon-32x32.png
Binary file not shown.
Binary file removed docs/img/icons/msapplication-icon-144x144.png
Binary file not shown.
Binary file removed docs/img/icons/mstile-150x150.png
Binary file not shown.
3 changes: 0 additions & 3 deletions docs/img/icons/safari-pinned-tab.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/index.html

This file was deleted.

2 changes: 0 additions & 2 deletions docs/js/app.9aa20de9.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/app.9aa20de9.js.map

This file was deleted.

10 changes: 0 additions & 10 deletions docs/js/chunk-vendors.779bea67.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/chunk-vendors.779bea67.js.map

This file was deleted.

1 change: 0 additions & 1 deletion docs/manifest.json

This file was deleted.

26 changes: 0 additions & 26 deletions docs/precache-manifest.8cfa412f9fa7b4a54dc7179631b9253b.js

This file was deleted.

2 changes: 0 additions & 2 deletions docs/robots.txt

This file was deleted.

34 changes: 0 additions & 34 deletions docs/service-worker.js

This file was deleted.

9 changes: 5 additions & 4 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="icon" href="/favicon.ico">
<title>
<%= htmlWebpackPlugin.options.title %>
vue-command
</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script type="module" src="/src/main.js"></script>
</head>

<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
<strong>We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
Expand Down
20 changes: 7 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@
"dist/*.js.map"
],
"scripts": {
"build": "yarn lint; yarn build:lib; yarn build:docs",
"build:docs": "vue-cli-service build --dest docs",
"build:lib": "vue-cli-service build --target lib --name vue-command ./src/library.js",
"dev": "vite",
"build": "vite build",
"lint": "vue-cli-service lint",
"serve": "vue-cli-service serve",
"test": "vue-cli-service test:unit"
},
"dependencies": {
"core-js": "^3.26.1",
"lodash": "^4.17.21",
"register-service-worker": "^1.7.2",
"vue": "^3.0.0"
Expand All @@ -56,26 +53,23 @@
"@semantic-release/github": "^8.0.7",
"@semantic-release/npm": "^9.0.1",
"@semantic-release/release-notes-generator": "^10.0.3",
"@vue/cli-plugin-babel": "~4.5.13",
"@vue/cli-plugin-eslint": "~4.5.13",
"@vitejs/plugin-vue": "^1.6.1",
"@vue/cli-plugin-pwa": "~4.5.13",
"@vue/cli-plugin-unit-jest": "~4.5.13",
"@vue/cli-service": "~4.5.13",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-standard": "^5.1.2",
"@vue/test-utils": "^2.2.6",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint": "8",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-modules-newline": "^0.0.6",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^7.20.0",
"eslint-plugin-vue": "8",
"husky": "^8.0.2",
"sass": "^1.56.2",
"sass-loader": "^8.0.2",
"semantic-release": "^19.0.5",
"vite": "^2.5.4",
"vue-jest": "^5.0.0-0"
},
"husky": {
Expand All @@ -84,4 +78,4 @@
"pre-push": "yarn test"
}
}
}
}
4 changes: 2 additions & 2 deletions src/components/VueCommand.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ import {
defaultParser,
newDefaultHistory,
newDefaultEventResolver
} from '@/library'
} from '../library'
import {
and,
or,
newEventBus,
PUBLISH_SYMBOL
} from '@/utils'
} from '../utils'
import {
eq,
size,
Expand Down
4 changes: 2 additions & 2 deletions src/components/VueCommandQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ import {
and,
or,
xor
} from '@/utils'
} from '../utils'
import {
defaultParser,
createStdout,
createQuery,
listFormatter
} from '@/library'
} from '../library'
import {
head,
isEmpty,
Expand Down
8 changes: 4 additions & 4 deletions src/hosted/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@

<script lang="js">
import { ref } from 'vue'
import VueCommand from '@/components/VueCommand'
import VueCommand from '../library'
import {
createStdout,
createQuery,
listFormatter,
newDefaultHistory,
tableFormatter
} from '@/library'
import NanoEditor from '@/hosted/NanoEditor.vue'
import ChuckNorris from '@/hosted/ChuckNorris.vue'
} from '../library'
import NanoEditor from './NanoEditor.vue'
import ChuckNorris from './ChuckNorris.vue'

const PROMPT = 'neil@moon~$'

Expand Down
8 changes: 4 additions & 4 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
markRaw,
onMounted
} from 'vue'
import VueCommand from '@/components/VueCommand'
import VueCommandQuery from '@/components/VueCommandQuery'
import VueCommand from './components/VueCommand.vue'
import VueCommandQuery from './components/VueCommandQuery.vue'
import {
forEach,
isFunction
Expand All @@ -29,13 +29,13 @@ export const createCommandNotFound = (command, notFoundText = 'command not found
// soon as the component has been mounted
export const createStdout = (formatterOrText, name = 'VueCommandStdout') => markRaw(defineComponent({
name,
setup () {
setup() {
// This tears down the component automatically
const exit = inject('exit')
onMounted(exit)
},

render () {
render() {
if (isFunction(formatterOrText)) {
// This is automatically called with the bound arguments
return formatterOrText()
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This mounts the documentation and not the library
import { createApp } from 'vue'
import HostedApp from '@/hosted/App.vue'
import '@/registerServiceWorker'
import HostedApp from './hosted/App.vue'
import './registerServiceWorker'

const app = createApp(HostedApp)

Expand Down
28 changes: 28 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/library.js'),
name: 'vue-command',
fileName: 'vue-command',
},
outDir: './dist',
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
},
},
},

plugins: [vue()],
resolve: {
extensions: ['.mjs', '.js', '.json', '.vue']
}
})
Loading