-
Notifications
You must be signed in to change notification settings - Fork 333
chore: Migrated Vite to Rollup, Removed Vite related dependencies #6423
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
base: main
Are you sure you want to change the base?
Changes from all commits
6ab49a6
b206bc4
029097a
cff5273
af871a8
a751e5d
0b5e3e1
16d4ee3
d5d6842
96d4b2a
966cab0
19c33b5
daf03b0
b026311
2952a87
c703b2e
d4e5d95
6b2a8ad
89d3db4
2b64ed6
8e831ff
829e883
933afee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { createApp } from 'vue'; | ||
import App from './App.vue'; | ||
import router from './router'; | ||
import AmplifyUIVue from '@aws-amplify/ui-vue'; | ||
import '@aws-amplify/ui-vue/styles.css'; | ||
|
||
createApp(App).use(router).mount('#app'); | ||
// Create app and register plugins | ||
const app = createApp(App); | ||
app.use(router); | ||
app.use(AmplifyUIVue); | ||
app.mount('#app'); | ||
yuhengshs marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+4
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove these changes, as a reviewer it makes me question whether the changes impact the build artifacts |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ Amplify.configure(aws_exports); | |
placeholder="Zone Info" | ||
name="zoneinfo" | ||
:hideLabel="false" | ||
:required="false" | ||
:disabled="false" | ||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove these changes, as a reviewer it makes me question whether the changes impact the build artifacts |
||
/> | ||
</template> | ||
<template v-slot="{ user, signOut }"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { defineConfig } from 'rollup'; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import externals from 'rollup-plugin-node-externals'; | ||
import vue from 'rollup-plugin-vue'; | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import postcss from 'rollup-plugin-postcss'; | ||
import fs from 'fs-extra'; | ||
|
||
// common config settings | ||
const input = ['src/index.ts']; | ||
const sourceMap = false; | ||
const esmOutputDir = 'dist/esm'; | ||
|
||
// Common output options | ||
const cjsOutput = { | ||
dir: 'dist', | ||
entryFileNames: '[name].cjs', | ||
format: 'cjs', | ||
esModule: true, | ||
generatedCode: { reservedNamesAsProps: false }, | ||
interop: 'auto', | ||
exports: 'named' | ||
}; | ||
|
||
// Common plugins | ||
const commonPlugins = [ | ||
externals({ include: [/node_modules/, /^@aws-amplify/] }), | ||
nodeResolve({ extensions: ['.js', '.ts', '.vue', '.css'] }), | ||
commonjs({ include: /node_modules/ }), | ||
postcss({ extract: false, inject: false }), | ||
vue({ | ||
preprocessStyles: true, | ||
template: { | ||
isProduction: true, | ||
compilerOptions: { | ||
whitespace: 'condense', | ||
isCustomElement: tag => /^amplify-/.test(tag) | ||
} | ||
} | ||
}) | ||
]; | ||
|
||
// Ensure styles are copied | ||
const ensureStyles = () => ({ | ||
name: 'ensure-styles', | ||
writeBundle() { | ||
fs.ensureDirSync('dist/components/primitives'); | ||
fs.copyFileSync( | ||
'src/components/primitives/styles.css', | ||
'dist/components/primitives/styles.css' | ||
); | ||
} | ||
}); | ||
|
||
const config = defineConfig([ | ||
// CJS config | ||
{ | ||
input, | ||
output: cjsOutput, | ||
plugins: [ | ||
...commonPlugins, | ||
typescript({ | ||
check: false, | ||
useTsconfigDeclarationDir: true, | ||
tsconfigOverride: { | ||
compilerOptions: { sourceMap, declaration: true, declarationDir: 'dist', rootDir: 'src' }, | ||
include: ['src/**/*'], | ||
exclude: ['node_modules', '**/__tests__/**', '**/*.test.*', 'scripts/**'] | ||
} | ||
}), | ||
ensureStyles() | ||
], | ||
}, | ||
// ESM config | ||
{ | ||
input, | ||
output: { | ||
dir: esmOutputDir, | ||
format: 'es', | ||
entryFileNames: '[name].mjs', | ||
preserveModules: true, | ||
preserveModulesRoot: 'src' | ||
}, | ||
plugins: [ | ||
...commonPlugins, | ||
typescript({ | ||
check: false, | ||
tsconfigOverride: { | ||
compilerOptions: { sourceMap, declaration: false, rootDir: 'src', outDir: esmOutputDir }, | ||
include: ['src/**/*'], | ||
exclude: ['node_modules', '**/__tests__/**', '**/*.test.*'] | ||
} | ||
}) | ||
], | ||
}, | ||
]); | ||
|
||
export default config; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import fs from 'fs-extra'; | ||
|
||
// Ensure the directory exists | ||
fs.ensureDirSync('dist'); | ||
|
||
// Copy CSS files from the UI package | ||
fs.copySync('../ui/dist/styles.css', 'dist/style.css', { overwrite: true }); | ||
|
||
console.log('CSS files copied successfully'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,21 @@ export { default as AmplifyCheckBox } from './primitives/amplify-check-box.vue'; | |
export { default as AmplifyButton } from './primitives/amplify-button.vue'; | ||
export { default as BaseFormField } from './primitives/base-form-field.vue'; | ||
export { default as BaseFormFields } from './primitives/base-form-fields.vue'; | ||
|
||
// Export all primitive base components | ||
export { default as BaseInput } from './primitives/base-input.vue'; | ||
export { default as BaseLabel } from './primitives/base-label.vue'; | ||
export { default as BaseSelect } from './primitives/base-select.vue'; | ||
export { default as BaseWrapper } from './primitives/base-wrapper.vue'; | ||
export { default as BaseAlert } from './primitives/base-alert.vue'; | ||
export { default as BaseBox } from './primitives/base-box.vue'; | ||
export { default as BaseFieldSet } from './primitives/base-field-set.vue'; | ||
export { default as BaseFooter } from './primitives/base-footer.vue'; | ||
export { default as BaseForm } from './primitives/base-form.vue'; | ||
export { default as BaseHeading } from './primitives/base-heading.vue'; | ||
export { default as BaseSpacer } from './primitives/base-spacer.vue'; | ||
export { default as BaseText } from './primitives/base-text.vue'; | ||
export { default as BaseTwoTabs } from './primitives/base-two-tabs.vue'; | ||
export { default as BaseTwoTabItem } from './primitives/base-two-tab-item.vue'; | ||
Comment on lines
+24
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these new public exports? |
||
|
||
export * from '../types'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,12 +25,29 @@ import { | |
VerifyUser, | ||
} from './components/index'; | ||
|
||
// Import all base primitive components | ||
import BaseInput from './components/primitives/base-input.vue'; | ||
import BaseLabel from './components/primitives/base-label.vue'; | ||
import BaseSelect from './components/primitives/base-select.vue'; | ||
import BaseWrapper from './components/primitives/base-wrapper.vue'; | ||
import BaseAlert from './components/primitives/base-alert.vue'; | ||
import BaseBox from './components/primitives/base-box.vue'; | ||
import BaseFieldSet from './components/primitives/base-field-set.vue'; | ||
import BaseFooter from './components/primitives/base-footer.vue'; | ||
import BaseForm from './components/primitives/base-form.vue'; | ||
import BaseHeading from './components/primitives/base-heading.vue'; | ||
import BaseSpacer from './components/primitives/base-spacer.vue'; | ||
import BaseText from './components/primitives/base-text.vue'; | ||
import BaseTwoTabs from './components/primitives/base-two-tabs.vue'; | ||
import BaseTwoTabItem from './components/primitives/base-two-tab-item.vue'; | ||
|
||
import { useAuthenticator } from './composables/useAuth'; | ||
|
||
import './styles.css'; | ||
|
||
export default { | ||
install: (app: App) => { | ||
// Register main components | ||
app.component('SignIn', SignIn); | ||
app.component('SignUp', SignUp); | ||
app.component('FederatedSignIn', FederatedSignIn); | ||
|
@@ -59,6 +76,22 @@ export default { | |
'AuthenticatorForceNewPasswordFormFields', | ||
AuthenticatorForceNewPasswordFormFields | ||
); | ||
|
||
// Register all base primitive components | ||
app.component('BaseInput', BaseInput); | ||
app.component('BaseLabel', BaseLabel); | ||
app.component('BaseSelect', BaseSelect); | ||
app.component('BaseWrapper', BaseWrapper); | ||
app.component('BaseAlert', BaseAlert); | ||
app.component('BaseBox', BaseBox); | ||
app.component('BaseFieldSet', BaseFieldSet); | ||
app.component('BaseFooter', BaseFooter); | ||
app.component('BaseForm', BaseForm); | ||
app.component('BaseHeading', BaseHeading); | ||
app.component('BaseSpacer', BaseSpacer); | ||
app.component('BaseText', BaseText); | ||
app.component('BaseTwoTabs', BaseTwoTabs); | ||
app.component('BaseTwoTabItem', BaseTwoTabItem); | ||
Comment on lines
+81
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What changed that requires the registaration of these modules? |
||
}, | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": ["src/**/*.ts", "src/**/*.vue"], | ||
"exclude": ["node_modules", "**/__mocks__", "**/__tests__"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
{ | ||
"extends": "@aws-amplify/typescript-config/tsconfig.vue.json", | ||
"include": [ | ||
"__mocks__", | ||
"__tests__", | ||
"*.ts", | ||
"src/**/*.ts", | ||
"src/**/*.tsx", | ||
"src/**/*.vue" | ||
], | ||
"exclude": ["node_modules"] | ||
} | ||
"compilerOptions": { | ||
"noImplicitAny": false, | ||
"skipLibCheck": true, | ||
"strictNullChecks": false, | ||
"types": [ | ||
"node", | ||
"jest", | ||
"@testing-library/jest-dom", | ||
"vite/client" | ||
] | ||
}, | ||
"include": ["__mocks__", "__tests__", "*.ts", "*.mjs", "scripts", "src/**/*.ts", "src/**/*.vue"], | ||
"exclude": ["node_modules", "dist"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these changes, as a reviewer it makes me question whether the changes impact the build artifacts