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

WIP vue 3 update #1013

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
04deeab
WIP(vue): vue 3 upgrade
cowills Mar 23, 2021
520b9f9
WIP(undo): broken vue 3 update work
cowills Apr 5, 2021
689c669
Update CdrTooltip.vue
cowills Apr 13, 2021
78a8ced
Update CdrPopup.vue
cowills Apr 13, 2021
6baac13
Update CdrPopover.vue
cowills Apr 13, 2021
578cebe
Update CdrPagination.vue
cowills Apr 13, 2021
7e535c3
fix(ts): disable typescript for migration simplicity
cowills Apr 20, 2021
3474f6c
chore(deps): update dependencies to latest
cowills Apr 20, 2021
052e442
chore(icon): update icon
cowills Apr 20, 2021
be190b3
chore(alert): clean up alert
cowills Apr 20, 2021
0c9fba7
chore(button): update button
cowills Apr 20, 2021
ed7854f
chore(flexgrid): delete flex grid
cowills Apr 20, 2021
e3ec39f
chore(caption): update caption tests
cowills Apr 20, 2021
ccffd70
chore(card): update card snapshot
cowills Apr 20, 2021
2ee371e
chore(text): update text snapshots
cowills Apr 21, 2021
6e30ae3
chore(quote): update quote snapshots, add modifier class
cowills Apr 21, 2021
cc86528
fix(image): update image snapshots
cowills Apr 21, 2021
24e1b4c
chore(grid): update grid, snapshots
cowills Apr 21, 2021
d96e51a
chore(link): add mapClasses to link, fix tests
cowills Apr 21, 2021
7a67a0e
chore(list): update list snapshots
cowills Apr 21, 2021
5f34fe5
chore(chip): update chipgroup, chips snapshots, disable tests broken …
cowills Apr 22, 2021
2af4a13
chore(dev): semi-functioning dev environment
cowills Apr 22, 2021
2169dac
chore(table): update table tests
cowills Apr 22, 2021
658f5df
fix(icon): fix icon spritesheet option
cowills Apr 22, 2021
2467bb5
chore(breadcrumb): update breadcrumb
cowills Apr 23, 2021
6a07d47
chore(form): update formGroup, formError
cowills Apr 23, 2021
cb5ae40
chore(form): clean up private form components
cowills Apr 23, 2021
b029155
chore(input): update input, clean up tests, pull in numeric attrs
cowills Apr 26, 2021
0dfa76b
chore(rating): clean up rating, fix tests
cowills Apr 26, 2021
b9d4c0c
chore(build): eradicate typescript
cowills Apr 27, 2021
5bc8b23
WIP(wip): wip vue 3 upgrade
cowills Apr 27, 2021
613b93e
chore(checkbox): update checkbox tests
cowills Apr 27, 2021
25b592f
WIP(vue3): wip form
cowills Apr 27, 2021
d833d8d
10.0.0-alpha.0
cowills Apr 27, 2021
0bba5cc
fix(lint): fix linting issues
cowills Apr 28, 2021
ef45537
fix(dev): resolve dev env issues
cowills Apr 28, 2021
214c550
fix(build): fix CSS scoping for prod build
cowills Apr 28, 2021
5342af8
fix(accordion): fix accordion, add changes from next, improve accordi…
cowills Apr 28, 2021
f6b9c1a
chore(test): clean up test warnings
cowills Apr 29, 2021
c9ca9df
chore(select): update select, fix tests
cowills Apr 29, 2021
cf6384a
chore(radio): clean up radio tests
cowills Apr 30, 2021
14a48cb
chore(popup): update popup tests
cowills Apr 30, 2021
831f128
chore(tabs): clean up tab panel
cowills Apr 30, 2021
f8f9659
chore(popover): update popover formatting, tests
cowills May 4, 2021
c24ffda
chore(popups): clean up tooltips, fix bugs in popover/popup
cowills May 4, 2021
ddcf808
chore(modal): update modal
cowills May 6, 2021
7cd21b4
WIP(pagination): wip pagination migration
cowills May 10, 2021
3a5eb16
chore(pagination): update pagination
cowills May 11, 2021
974017e
chore(tabs): update tabpanel
cowills May 11, 2021
42229be
WIP(vue3): wip vue 3 work
cowills May 12, 2021
154a433
fix(test): fix handling of provide/inject in tests
cowills May 13, 2021
7db9a9b
WIP(tabs): wip tabs migration
cowills May 13, 2021
bed9e5b
fix(accordion): fix accordion style logic
cowills May 13, 2021
5c522c5
fix(dev): fix dev router, tabs example
cowills May 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
['compositionsdir', resolve('src/compositions')],
['mixinsdir', resolve('src/mixins')],
],
extensions: ['.vue', '.json', '.js', '.jsx']
extensions: ['.vue', '.json', '.js']
},
},
},
Expand All @@ -44,8 +44,8 @@ module.exports = {
// don't require .vue extension when importing
'import/extensions': ['error', 'always', {
js: 'never',
jsx: 'never',
vue: 'never'
vue: 'never',
ts: 'never',
}],
// allow optionalDependencies
'import/no-extraneous-dependencies': ['error', {
Expand All @@ -55,6 +55,7 @@ module.exports = {
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'vue/require-default-prop': 0,
'vue/attributes-order': 0,
'vue/no-multiple-template-root': 0,
'max-len': ['error', {
'code': 100,
'ignoreComments': true,
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/node.js.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ public/*.js
public/*.map
public/*.css
src/**/package-lock\.json
unmigrated/
32 changes: 32 additions & 0 deletions VUE-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[] accordion
[] alert
[] breadcrumb
[] button
[] caption
[] card
[] checkbox
[] formGroup
[] grid
[] icon
[] image
[] input
[] link
[] list
[] modal
[] pagination
[] popover
[] quote
[] radio
[] rating
[] select
[] table
[] tabs
[] text
[] tooltip



NICE TO HAVE TODOS:

buildclass refactor. one function that can build any cedar class. make classes consistent. define types.
make clsx available in every template
4 changes: 1 addition & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable */

module.exports = function (api) {

const env = process.env.NODE_ENV;
const babelEnv = process.env.BABEL_ENV;

Expand Down Expand Up @@ -36,7 +35,6 @@ module.exports = function (api) {
"@babel/preset-env",
presetEnvConfig,
],
"@vue/babel-preset-jsx"
];

const plugins = [
Expand All @@ -46,7 +44,7 @@ module.exports = function (api) {
"corejs": 3,
"useESModules": babelEnv === 'esm',
}
]
],
];

return {
Expand Down
3 changes: 1 addition & 2 deletions build/extract-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const packageJson = require('../package.json')

const env = process.env.NODE_ENV;


buildCss({
srcPath: './src/css/reset.scss',
outPath: './dist/style/reset.css',
Expand Down Expand Up @@ -61,7 +60,7 @@ function buildCss({ srcPath, outPath, scopeClasses }) {
plugins.push(postcssModules({
generateScopedName: function (name) {
// scope classes for components
return `${name}_${packageJson.version}`;
return `${name}_${packageJson.version.replace(/\./g, '-')}`;
},
getJSON: function noop() {}
// Passing a noop as getJSON makes it so postcss-modules does not output a JSON
Expand Down
61 changes: 41 additions & 20 deletions build/rollup-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import copyPlugin from 'rollup-plugin-copy';
import vue from 'rollup-plugin-vue';
import babel from 'rollup-plugin-babel';
import postcssImport from 'postcss-import';
// import postcssModules from 'postcss-modules';
import packageJson from '../package.json';

const env = process.env.NODE_ENV;
Expand All @@ -20,11 +21,11 @@ function generateScopedName(name, filename, css) {
// don't scope anything in the `css/main.scss` (reset, utils, type, etc.)
if (filename.match(/main\.scss/) || env === 'test') return name;
// scope classes for components
return `${name}_${packageJson.version}`;
return `${name}_${packageJson.version.replace(/\./g, '-')}`;
}

// plugin configs
let postcssExtract = false;
let postcssExtract = 'dist/cedar-compiled.css';
let copyOutput = 'public';
const copyTargets = [
{ src: 'static/star-null.svg', dest: 'dist/svg' },
Expand All @@ -38,7 +39,6 @@ const copyTargets = [

// prod only options
if (env === 'prod') {
postcssExtract = 'dist/cedar-compiled.css';
copyOutput = 'dist';
}

Expand All @@ -48,10 +48,26 @@ if (env !== 'test') {
{
src: 'static/cdr-fonts.css',
dest: `${copyOutput}`,
},

);
}

if (env === 'dev') {
copyTargets.push(
{
src: 'dist/cedar-compiled.css',
dest: 'public/',
},
{
src: 'dist/style/reset.css',
dest: 'public/',
}
);
}



const plugins = [
(env == 'test' || env == 'dev') && alias({
entries: {
Expand All @@ -62,31 +78,36 @@ const plugins = [
mixinsdir: resolve('src/mixins'),
},
customResolver: nodeResolve({
extensions: ['.json', '.js', '.jsx', '.scss', '.vue'],
extensions: ['.json', '.js', , '.scss', '.vue'],
}),
}),
nodeResolve({
mainFields: ['module', 'jsnext:main', 'main'],
extensions: ['.mjs', '.js', '.jsx', '.json'],
extensions: ['.mjs', '.js', '.vue', '.json'],
}),
env !== 'prod' && vue({
style: {
postcssModulesOptions: {
generateScopedName,
},
},
data: {
// this gets prepended in all components <style>
scss() {
return `$cdr-warn: false;
@import "${resolve('node_modules/@rei/cdr-tokens/dist/scss/cdr-tokens.scss')}";
@import "${resolve('src/css/settings/_index.scss')}";`;
},
vue({
// style: {
// postcssModulesOptions: {
// generateScopedName,
// },
// },
// data: {
// // this gets prepended in all components <style>
// scss() {
// return `$cdr-warn: false;
// @import "${resolve('node_modules/@rei/cdr-tokens/dist/scss/cdr-tokens.scss')}";
// @import "${resolve('src/css/settings/_index.scss')}";`;
// },
// },
// https://github.com/vuejs/rollup-plugin-vue/blob/cd652cd92e7d21bda00f32e47530a8946963a1cc/docs/migrating.md
// css: false, // TODO: THIS WILL auto inject styles!!!!! might make dev simpler!!!!
preprocessStyles: true,
cssModulesOptions: {
generateScopedName,
},
template: {
isProduction: env === 'prod',
},
styleInjector: `~${resolve('build/style-injector.mjs')}`,
}),
postcss({
config: true,
Expand All @@ -109,7 +130,7 @@ const plugins = [
runtimeHelpers: true, // ????
}),
commonjs({
extensions: ['.js', '.jsx']
extensions: ['.js', '.vue']
}),
copyPlugin({
targets: copyTargets,
Expand Down
54 changes: 0 additions & 54 deletions build/style-injector.mjs

This file was deleted.

38 changes: 23 additions & 15 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
const config = {
verbose: true,
collectCoverage: true,
collectCoverageFrom: [
'src/components/**/*.{js,jsx}',
'src/mixins/**/*.{js,jsx}',
'src/utils/**/*.{js,jsx}',
'!src/components/**/examples/**/*.{js,jsx}', // not component examples
'!src/components/icon/{comps,build}/**/*.{js,jsx}', // not icon components
'!**/*.backstop.js', // not backstop files
'!**/node_modules/**', // not node_modules
],
coverageDirectory: 'coverage',
collectCoverage: false,
// collectCoverageFrom: [
// 'src/components/**/*.{js,vue}',
// 'src/mixins/**/*.{js}',
// 'src/utils/**/*.{js}',
// '!src/components/**/examples/**/*.{js,vue}', // not component examples
// '!src/components/icon/{comps,build}/**/*.{js,vue}', // not icon components
// '!**/*.backstop.js', // not backstop files
// '!**/node_modules/**', // not node_modules
// ],
// coverageDirectory: 'coverage',
moduleFileExtensions: [
'js',
'json',
'jsx',
'vue',
'ts'
],
moduleNameMapper: {
'distdir(.*)$': '<rootDir>/dist/$1',
'componentdir(.*)$': '<rootDir>/src/components/$1',
},
modulePathIgnorePatterns: [
Expand All @@ -26,12 +26,20 @@ const config = {
'<rootDir>/templates/__tests__',
],
transform: {
'^.+\\.(js|jsx)?$': 'babel-jest',
'.+\\.(css|styl|less|sass|scss)$': '<rootDir>/node_modules/jest-css-modules-transform',
'.+\\.(css|styl|less|sass|scss)$': '<rootDir>/node_modules/jest-css-modules-transform',
".*\\.(vue|ts)$": "vue-jest",
'^.+\\.(js|vue)?$': 'babel-jest',
},
transformIgnorePatterns: [
'<rootDir>/node_modules/(?!(lodash-es|@rei\/cdr-tokens)/.*)', // https://stackoverflow.com/questions/42260218/jest-setup-syntaxerror-unexpected-token-export
],
"globals": {
"vue-jest": {
"babelConfig": {
"configFile": "./babel.config.js"
},
}
}
};

module.exports = config;
Loading