-
Notifications
You must be signed in to change notification settings - Fork 156
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: Peer dependency script experiment #2450
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env node | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
const { execSync } = require('child_process'); | ||
const path = require('path'); | ||
const os = require('os'); | ||
|
||
const args = process.argv.slice(2); | ||
if (args.length < 1) { | ||
console.error('Usage: install-peer-dependency.js <package-name>:<target-branch>'); | ||
process.exit(1); | ||
} | ||
const [packageName, targetBranch] = args[0].split(':'); | ||
const targetRepository = `https://github.com/cloudscape-design/${packageName}.git`; | ||
const nodeModulesPackagePath = path.join(__dirname, '..', 'node_modules', '@cloudscape-design', packageName); | ||
const tempDir = path.join(os.tmpdir(), `temp-${packageName}`); | ||
|
||
// Clone the repository and checkout the branch | ||
console.log(`Cloning ${packageName}:${targetBranch}...`); | ||
execCommand(`git clone ${targetRepository} ${tempDir}`); | ||
process.chdir(tempDir); | ||
execCommand(`git checkout ${targetBranch}`); | ||
|
||
// Install dependencies and build | ||
console.log(`Installing dependencies and building ${packageName}...`); | ||
execCommand('npm install'); | ||
execCommand('npm run build'); | ||
|
||
// Remove existing peer dependency in node_modules | ||
console.log(`Removing existing ${packageName} from node_modules...`); | ||
execCommand(`rm -rf ${nodeModulesPackagePath}`); | ||
|
||
// Copy built peer dependency to node_modules | ||
console.log(`Copying built ${targetRepository} to node_modules...`); | ||
execCommand(`mkdir -p ${nodeModulesPackagePath}`); | ||
execCommand(`cp -R ${tempDir}/lib/* ${nodeModulesPackagePath}`); | ||
|
||
// Clean up | ||
console.log('Cleaning up...'); | ||
execCommand(`rm -rf ${tempDir}`); | ||
|
||
console.log(`${packageName} has been successfully installed from branch ${targetBranch}!`); | ||
|
||
function execCommand(command, options = {}) { | ||
try { | ||
execSync(command, { stdio: 'inherit', ...options }); | ||
|
||
} catch (error) { | ||
console.error(`Error executing command: ${command}`); | ||
console.error(`Error message: ${error.message}`); | ||
console.error(`Stdout: ${error.stdout && error.stdout.toString()}`); | ||
console.error(`Stderr: ${error.stderr && error.stderr.toString()}`); | ||
throw error; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import { | |
PropertyFilterProperty, | ||
PropertyFilterToken, | ||
} from '@cloudscape-design/collection-hooks'; | ||
import { PropertyFilterTokenGroup } from '@cloudscape-design/collection-hooks/cjs/interfaces'; | ||
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. These are temporary changes just to prove that the PR indeed fetches code from the collection-hooks branch: cloudscape-design/collection-hooks#74 |
||
|
||
export interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport, FormFieldControlProps { | ||
/** | ||
|
@@ -212,6 +213,7 @@ export interface PropertyFilterProps extends BaseComponentProps, ExpandToViewpor | |
|
||
export namespace PropertyFilterProps { | ||
export type Token = PropertyFilterToken; | ||
export type TokenGroup = PropertyFilterTokenGroup; | ||
export type JoinOperation = PropertyFilterOperation; | ||
export type ComparisonOperator = PropertyFilterOperator; | ||
export type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>; | ||
|
@@ -304,6 +306,7 @@ export namespace PropertyFilterProps { | |
// Re-exported namespace interfaces to use module-style imports internally | ||
|
||
export type Token = PropertyFilterProps.Token; | ||
export type TokenGroup = PropertyFilterProps.TokenGroup; | ||
export type JoinOperation = PropertyFilterProps.JoinOperation; | ||
export type ComparisonOperator = PropertyFilterProps.ComparisonOperator; | ||
export type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>; | ||
|
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.
This part is shaky. In collection-hooks we package the distribution to the
lib
folder entirely. In other packages we might use the root folder ordist
. We can either parametrise this line or make all packages better consistent.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.
This is not an issue. We standardised everything to package to lib folder 👍🏻
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.
Where it might be an issue is some packages produce multiple artifacts in the lib folder. E.g. test-utils, theming-core, components, board-components, code-view