-
Notifications
You must be signed in to change notification settings - Fork 42
Post milestone3m #744
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
Draft
SharonStrats
wants to merge
17
commits into
main
Choose a base branch
from
post-milestone3m
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Post milestone3m #744
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
96842f8
foundation of shared select component
SharonStrats 21d4030
Add a select webcomponent
SharonStrats 45abfa7
export select webcomponent
SharonStrats 41845b7
minor adj to select
SharonStrats 2367666
fix typescript errors test file
SharonStrats 24aceee
move arrowicon file
SharonStrats b67db1c
combobox web component
SharonStrats a1cd4d3
tests
SharonStrats f2403c7
lint fix
SharonStrats 9711f44
cleanup
SharonStrats fe509c0
photoCapture web component
SharonStrats 84053fd
lint fix
SharonStrats 5c2b0fa
refactor: add manifest-driven v2 component build and export sync
SharonStrats 0da9a83
add button web comp
SharonStrats 1ea3dcb
refactor: reorganize v2 components into grouped source folders
SharonStrats b1cfdc0
remove first comp button
SharonStrats 8a567c0
lint fix
SharonStrats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| export const v2Components = [ | ||
| { | ||
| sourceDir: 'header', | ||
| sourcePath: 'layout/header', | ||
| exportNames: ['header', 'layout/header'] | ||
| }, | ||
| { | ||
| sourceDir: 'loginButton', | ||
| sourcePath: 'auth/loginButton', | ||
| exportNames: ['login-button', 'auth/login-button'] | ||
| }, | ||
| { | ||
| sourceDir: 'signupButton', | ||
| sourcePath: 'auth/signupButton', | ||
| exportNames: ['auth/signup-button', 'signup-button'] | ||
| }, | ||
| { | ||
| sourceDir: 'photoCapture', | ||
| sourcePath: 'media/photoCapture', | ||
| exportNames: ['media/photo-capture', 'photo-capture'] | ||
| }, | ||
| { | ||
| sourceDir: 'button', | ||
| sourcePath: 'actions/button', | ||
| exportNames: ['actions/button', 'button'] | ||
| }, | ||
| { | ||
| sourceDir: 'footer', | ||
| sourcePath: 'layout/footer', | ||
| exportNames: ['footer', 'layout/footer'] | ||
| }, | ||
| { | ||
| sourceDir: 'select', | ||
| sourcePath: 'forms/select', | ||
| exportNames: ['forms/select', 'select'] | ||
| }, | ||
| { | ||
| sourceDir: 'combobox', | ||
| sourcePath: 'forms/combobox', | ||
| exportNames: ['forms/combobox', 'combobox'] | ||
| } | ||
| ] | ||
|
|
||
| export const componentEntries = Object.fromEntries( | ||
| v2Components.map(({ sourceDir, sourcePath = sourceDir }) => [ | ||
| sourceDir, | ||
| { | ||
| import: `./src/v2/components/${sourcePath}/index.ts` | ||
| } | ||
| ]) | ||
| ) | ||
|
|
||
| export const componentExports = Object.fromEntries( | ||
| v2Components.flatMap(({ sourceDir, exportNames }) => | ||
| exportNames.map(exportName => [ | ||
| `./components/${exportName}`, | ||
| { | ||
| types: `./dist/components/${sourceDir}/index.d.ts`, | ||
| import: `./dist/components/${sourceDir}/index.esm.js`, | ||
| require: `./dist/components/${sourceDir}/index.js` | ||
| } | ||
| ]) | ||
| ) | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { readFileSync, writeFileSync } from 'fs' | ||
| import path from 'path' | ||
| import { componentExports } from './component-manifest.mjs' | ||
|
|
||
| const packageJsonPath = path.resolve(process.cwd(), 'package.json') | ||
| const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) | ||
|
|
||
| const preservedExports = Object.fromEntries( | ||
| Object.entries(packageJson.exports || {}).filter(([subpath]) => !subpath.startsWith('./components/')) | ||
| ) | ||
|
|
||
| packageJson.exports = { | ||
| ...preservedExports, | ||
| ...componentExports | ||
| } | ||
|
|
||
| writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { spawn } from 'child_process' | ||
| import { existsSync, watch } from 'fs' | ||
| import path from 'path' | ||
|
|
||
| const scriptsDir = path.resolve(process.cwd(), 'scripts') | ||
| const manifestFile = 'component-manifest.mjs' | ||
| const syncScript = path.resolve(scriptsDir, 'sync-component-exports.mjs') | ||
| let syncTimer = null | ||
| let running = false | ||
| let rerunRequested = false | ||
|
|
||
| const runSync = () => { | ||
| if (running) { | ||
| rerunRequested = true | ||
| return | ||
| } | ||
|
|
||
| running = true | ||
| rerunRequested = false | ||
|
|
||
| const child = spawn(process.execPath, [syncScript], { | ||
| stdio: 'inherit' | ||
| }) | ||
|
|
||
| child.on('exit', code => { | ||
| running = false | ||
|
|
||
| if (code !== 0) { | ||
| console.error(`sync-component-exports exited with code ${code}`) | ||
| } | ||
|
|
||
| if (rerunRequested) { | ||
| runSync() | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| const scheduleSync = () => { | ||
| clearTimeout(syncTimer) | ||
| syncTimer = setTimeout(() => { | ||
| runSync() | ||
| }, 150) | ||
| } | ||
|
|
||
| if (!existsSync(scriptsDir)) { | ||
| throw new Error(`Missing expected directory: ${scriptsDir}`) | ||
| } | ||
|
|
||
| console.log(`Watching ${path.join(scriptsDir, manifestFile)} for export manifest changes...`) | ||
|
|
||
| runSync() | ||
|
|
||
| watch(scriptsDir, (eventType, filename) => { | ||
| if (!filename) return | ||
| if (filename === manifestFile) { | ||
| scheduleSync() | ||
| } | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.