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

Feature/203 vite #298

Merged
merged 52 commits into from
Apr 6, 2023
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
bdc8eb0
#203 replaces webpack with vite
patric-eberle Jan 15, 2023
5b9e59e
#203 applies additional changes for Vite migration
patric-eberle Jan 26, 2023
9f17ebc
#203 fixes type issues
patric-eberle Jan 26, 2023
bd5e5b5
#203 resolves TS issues
patric-eberle Jan 26, 2023
7f8b9b5
#203 fixes vue import
patric-eberle Jan 31, 2023
4f34f29
#203 extends eslint scope
patric-eberle Jan 31, 2023
87910cd
Merge remote-tracking branch 'origin/develop' into feature/203_vite
patric-eberle Jan 31, 2023
653357b
#203 renames image type definition
patric-eberle Jan 31, 2023
122fb99
#203 extends vite configuration for multiple entry points
patric-eberle Feb 1, 2023
a5fa978
#203 fixes type script issues, fixes broken price test, moves lint-st…
patric-eberle Feb 8, 2023
cdde001
#203 fixes broken build configuration
patric-eberle Feb 8, 2023
a75e718
#203 removes webpack and jest related packages, updates tests to use …
patric-eberle Feb 8, 2023
6b96dcc
#203 updates githook pre-push
patric-eberle Feb 8, 2023
da00c3c
#203 fixes handling of themes
patric-eberle Feb 8, 2023
7d81f7e
#203 applies eslint fixes
patric-eberle Feb 8, 2023
a3cf4ec
#203 applies stylelint fixes
patric-eberle Feb 8, 2023
e4c1018
#203 removes deprecated configurations, fixes TS issues, enables read…
patric-eberle Feb 8, 2023
fc0f254
#203 updates todos in readme
patric-eberle Feb 8, 2023
7841541
Merge remote-tracking branch 'origin/develop' into feature/203_vite
patric-eberle Feb 8, 2023
76ada1e
Merge remote-tracking branch 'origin/develop' into feature/203_vite
patric-eberle Feb 9, 2023
6ff5d6d
#203: fixes a type issue in the Google Maps demo
patric-eberle Feb 9, 2023
ad12097
Merge remote-tracking branch 'origin/develop' into feature/203_vite
patric-eberle Feb 9, 2023
7cbd16e
#203 fixes typing issues with e-checkbox
patric-eberle Feb 9, 2023
665baa1
Merge remote-tracking branch 'origin/develop' into feature/203_vite
patric-eberle Feb 9, 2023
a5860fb
#203 fixes typing issue with e-picture
patric-eberle Feb 9, 2023
054f9f0
Merge remote-tracking branch 'origin/develop' into feature/203_vite
patric-eberle Feb 10, 2023
4bf1350
#203 v-outside-click cleanup and bugfix
patric-eberle Feb 10, 2023
d0e91a9
#203 raises version of package.json to 8.0.0
patric-eberle Feb 10, 2023
128b586
#203 Creates new folders for organizing components and elements.
Feb 13, 2023
22fbb3b
203: fixes storybook component imports.
MB-web Feb 13, 2023
f430f2c
#203 Fixes linting issues - imports FieldStates - adds type definition
Feb 13, 2023
88e679d
Merge remote-tracking branch 'origin/feature/203_vite_update_vue3' in…
MB-web Feb 13, 2023
0eaac6c
#203 uninstalls additional webpack related packages, fixes TS and ESL…
patric-eberle Feb 14, 2023
1f60f4a
#203 updates package.md, removes additional packages
patric-eberle Feb 14, 2023
9d35810
#203 fixes typescript issue, adds
patric-eberle Feb 14, 2023
dd530c5
#203 re-adds jsdom because it is required for vite, updates dependencies
patric-eberle Feb 14, 2023
9c53d51
#203 adds missing return types
patric-eberle Feb 14, 2023
1a505b2
#203 removes viewport.currentViewport fallback
patric-eberle Feb 15, 2023
1dc9236
Updates lastDependencyUpdate in package.json.
MB-web Feb 15, 2023
5769c50
#203 updates story blueprint
patric-eberle Feb 15, 2023
5617dc7
Merge remote-tracking branch 'origin/feature/203_vite' into feature/2…
patric-eberle Feb 15, 2023
1aa8787
Removes obsolete IE11 fix from l-default.
MB-web Feb 15, 2023
960f018
Applies modal improvements from reference project.
MB-web Feb 16, 2023
f5c91fb
Updates svg-sprite configuration to remove additional spacing on inli…
patric-eberle Feb 23, 2023
d04a328
fixes id selector in outside-click directive.
MB-web Mar 29, 2023
aa6fdbe
Fixes invalid attribute name on c-modal
patric-eberle Apr 6, 2023
385daed
Merge pull request #303 from valantic/feature/modal-improvements
patric-eberle Apr 6, 2023
2d93388
Merge remote-tracking branch 'origin/develop' into feature/203_vite
patric-eberle Apr 6, 2023
d65631b
#203 fixes merge issues
patric-eberle Apr 6, 2023
3c985f0
#203 fixes missing imports
patric-eberle Apr 6, 2023
cc77f83
#203 fixes typing issues
patric-eberle Apr 6, 2023
39609b9
Merge remote-tracking branch 'origin/feature/203_vite' into feature/2…
patric-eberle Apr 6, 2023
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
11 changes: 6 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/dist/
/*.js
/*.ts
/test/unit/coverage/
#/*.js
#/*.ts
#/test/unit/coverage/
/node_modules/
/blueprints
/src/setup/lib
#/blueprints
#/src/setup/lib
!.storybook
86 changes: 64 additions & 22 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -2,48 +2,90 @@
module.exports = {
root: true,
parserOptions: {
requireConfigFile: false, // Fixes an exception on sub folder eslintrc.js files
parser: '@typescript-eslint/parser', // Don't use on upper scope as documented by ESLint. The Vue plugin already defines itself as parser.
requireConfigFile: false,
// Fixes an exception on sub folder eslintrc.js files
parser: '@typescript-eslint/parser',
// Don't use on upper scope as documented by ESLint. The Vue plugin already defines itself as parser.
sourceType: 'module',
},
env: {
browser: true,
},
extends: [
'valantic/vue3',
'@vue/typescript'
'@vue/typescript',
'plugin:storybook/recommended',
],
// Uses eslint-import-resolver-webpack
settings: {
'import/resolver': 'webpack',
'import/resolver': {
vite: {
configPath: './vite.config.ts',
},
},
},
globals: {
'google': 'readonly' // Fixes `no-undef` for `google` namespace. (types are loaded by `@types/google.maps`)
google: 'readonly', // Fixes `no-undef` for `google` namespace. (types are loaded by `@types/google.maps`)
},
// add your custom rules here
rules: {
'vue/no-unsupported-features': ['error', {
version: ">= 3.2",
version: '>= 3.2',
}],

// Fix and enable again
'import/extensions': 'off',
'vue/require-emit-validator': 'off',

// TODO: move to eslint-config-valantic
"@typescript-eslint/no-empty-interface": [
"error",
{
"allowSingleExtends": true,
},
],
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'max-lines': ['error', {
max: 1000,
skipBlankLines: true,
skipComments: true,
}],
'@typescript-eslint/no-empty-interface': ['error', {
allowSingleExtends: true,
}],
'no-undefined': 'off', // Conflicts with 'undefined' fallback of TypeScript definitions.
'@typescript-eslint/explicit-function-return-type': ['error', {
allowTypedFunctionExpressions: true,
}],
},
overrides: [
{
'files': ['tests/**/*.*'],
'rules': {
'vue/require-name-property': 'off'
}
}
]
overrides: [{
files: ['tests/**/*.*'],
env: {
jest: true,
},
rules: {
'vue/require-name-property': 'off',
},
}, {
files: ['blueprints/**/*.*'],
env: {
jest: true, // Is required because of unit test blueprint.

},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
// Allow unused variables in blueprints.
'@typescript-eslint/no-empty-interface': 'off', // Allow empty interfaces in blueprints.
'@typescript-eslint/explicit-function-return-type': 'off',

},
}, {
files: ['src/styleguide/**/*.*'],
rules: {
'vue/no-bare-strings-in-template': 'off',
'vue/multi-word-component-names': 'off',
'vue/match-component-file-name': 'off',
},
}, {
files: ['src/stories/**/*.*'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
},
}],
};
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
.LSOverride
.eslintcache
.stylelintcache
report.*.json

# IntelliJ project files
.idea
@@ -25,5 +24,6 @@ npm-debug.log
.nvmrc

# Project
/storybook-static/
.env
/stats/
report.*.json
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run jest
npm run test
9 changes: 9 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
'*.{js,ts,vue}': [
() => 'vue-tsc --noEmit',
'eslint --config .eslintrc.fix.js --fix',
],
'*.{css,vue,scss}': [
'stylelint --config .stylelintrc.fix.js --fix',
],
};
36 changes: 0 additions & 36 deletions .storybook/main.js

This file was deleted.

36 changes: 36 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* eslint-disable import/no-import-module-exports */
import { UserConfig, mergeConfig, UserConfigExport } from 'vite';
import { alias } from '../vite.config';

module.exports = {
stories: [ // @see https://storybook.js.org/docs/react/configure/overview#configure-story-loading
'../src/stories/**/*.stories.mdx', // Currently not supported because of a bug in the vite builder. @see https://github.com/storybookjs/builder-vite/pull/556
{
directory: '../src/stories/elements/',
titlePrefix: 'Elements/',
files: '*.stories.js',
},
{
directory: '../src/stories/components/',
titlePrefix: 'Components/',
files: '*.stories.@(js|jsx|ts|tsx)',
},
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/preset-scss',
],
framework: '@storybook/vue3',
core: {
builder: '@storybook/builder-vite',
},
staticDirs: ['../static'],
async viteFinal(config: UserConfig): Promise<UserConfigExport> {
return mergeConfig(config, {
resolve: {
alias,
},
});
},
};
12 changes: 5 additions & 7 deletions .storybook/preview.js → .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/* eslint-disable import/prefer-default-export */
import '../src/setup/scss/themes/theme-01.scss';
import '@/setup/styles.scss'
import '../src/setup/styles.scss';
import { app } from '@storybook/vue3';
import vuePlugins from '../src/setup/plugins';

// @see https://storybook.js.org/docs/vue/writing-stories/decorators#context-for-mocking
vuePlugins.forEach(([plugin, pluginOptions]) => {
app.use(plugin, pluginOptions);
});

vuePlugins.forEach(({ plugin, options }) => app.use(plugin, options));

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
};
5 changes: 3 additions & 2 deletions .svg-sprite.json
Original file line number Diff line number Diff line change
@@ -2,14 +2,15 @@
"dest": "src/assets/",
"shape": {
"spacing": {
"box": "icon"
"box": "content"
}
},
"mode": {
"stack": {
"sprite": "icons.svg",
"bust": false,
"dest": "."
"dest": ".",
"rootviewbox": false
}
}
}
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -867,10 +867,23 @@ package.json:
}
```

## Vite integration todos
* [ ] Check again, why we need to use `.value` on some vue-i18n properties (e.g. i18n.global.locale.value). Source: https://vue-i18n.intlify.dev/guide/advanced/lazy.html#lazy-loading
* [ ] Check if module polyfill is required: https://vitejs.dev/config/build-options.html#build-modulepreload
* [ ] CSS Prefixing
* [ ] Apply new ESLint rules to valantic config.
* [ ] Should there be basic styles for form elements (if no class applied)?
* [ ] cmd + click in PhpStorm leads to Interface instead of implementation.
* [ ] Update README
* [ ] Check "Vite Inspect"
* [ ] Refactor storybook stories to TS.
* [ ] @typescript-eslint still required?
* [ ] Update package.md

## Roadmap
* [ ] Implement dual build (ES5/ES2015+)
* [ ] Add 'dangerous' flag for components that use v-html in Storybook.
* [ ] Add 'development' flag for components in Storybook.
* [ ] Add 'development' flag for components in Storybook.
* [ ] Add custom elements option to the "initial data" section.

## License
11 changes: 2 additions & 9 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -2,15 +2,8 @@ module.exports = {
presets: [
['@babel/preset-env', {
useBuiltIns: 'entry',
corejs: 3.8
corejs: 3.8,
}],
'@babel/preset-typescript',
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
],
env: {
test: {
plugins: ['transform-require-context']
}
}
};
7 changes: 0 additions & 7 deletions blueprints/.eslintrc.js

This file was deleted.

8 changes: 3 additions & 5 deletions blueprints/c-component.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import component from '@/components/c-component'; // TODO: Update source

@@ -7,13 +8,10 @@ describe('component | c-component', () => { // TODO: update title
});

it('renders (has bem block name on wrapper element)', () => {

const wrapper = mount(component, {
global: {
// remove if not needed
plugins: [],
// remove if not needed
props: {}
plugins: [], // remove if not needed
props: {}, // remove if not needed
},
});

4 changes: 2 additions & 2 deletions blueprints/pinia-store.ts
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ interface IMyStoreActions { // TODO: update <MyStore>.
// Add types for the store actions.
}

export interface IMyStore {} // TODO: update <MyStore>.
export type TMyStoreStore = Store<string, IMyStoreState, IMyStoreGetters, IMyStoreActions>;

const storeName: string = 'MyStore'; // TODO: update <MyStore>.
const storeName = 'MyStore'; // TODO: update <MyStore>.

export default defineStore<typeof storeName, IMyStoreState, IMyStoreGetters, IMyStoreActions>(storeName, {
state: (): IMyStoreState => ({}),
1 change: 1 addition & 0 deletions blueprints/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from 'vitest';
import plugin from '@/plugins/plugin'; // TODO: update source

describe('plugin | plugin', () => { // TODO: update title
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Vue template</title>

<script>
// Initial data demo
window.initialData = {
session: {},
breadcrumb: {},
@@ -33,6 +35,8 @@
];
*/
</script>

<script type="module" src="/src/main.ts" defer></script>
</head>
<body>
<div id="app">
Loading