Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
32 changes: 15 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
"LICENSE",
"NOTICE"
],
"dependencies": {
"@cloudscape-design/component-toolkit": "^1.0.0-beta"
},
"peerDependencies": {
"react": ">=16.8.0"
},
Expand Down Expand Up @@ -73,6 +76,9 @@
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix"
],
"package-lock.json": [
"node ./scripts/prepare-package-lock.js"
]
},
"overrides": {
Expand Down
36 changes: 36 additions & 0 deletions scripts/prepare-package-lock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env node
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add it to the build-tools package instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of doing that as a follow up, since there are slightly different versions of this script across packages, but it should be easy to do it right away - I will take a look.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

/* eslint-disable no-undef */

import fs from 'node:fs';

const lockfiles = ['package-lock.json'];

for (const filename of lockfiles) {
unlock(filename);
}

/**
* Remove specific @cloudscape-design/* packages where we should always use the latest minor release.
*/
function unlock(filename) {
const packageLock = JSON.parse(fs.readFileSync(filename));
if (packageLock.lockfileVersion !== 3) {
throw Error('package-lock.json file is not version 3. Use regular npm to update the packages.');
}

Object.keys(packageLock.packages).forEach(dependencyName => {
removeDependencies(dependencyName, packageLock.packages);
});

fs.writeFileSync(filename, JSON.stringify(packageLock, null, 2) + '\n');
console.log(`Removed @cloudscape-design/ dependencies from ${filename} file`);
}

function removeDependencies(dependencyName, packages) {
if (dependencyName.includes('@cloudscape-design/')) {
delete packages[dependencyName];
}
}
2 changes: 1 addition & 1 deletion src/__tests__/stubs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';
import { render as testRender } from '@testing-library/react';
import { UseCollectionResult, CollectionRef } from '../index.js';
import { getTrackableValue } from '../operations/trackby-utils.js';
import { getTrackableValue } from '@cloudscape-design/component-toolkit/internal';

export type Item = { id: string; date?: Date };

Expand Down
Loading
Loading