Skip to content

Commit

Permalink
fix(dedupe): update demo based on new API (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd authored Sep 28, 2024
2 parents 877f0c0 + 650f159 commit b6f70d0
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions packages/dedupe/demo/dedupe.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import {definePackage, definedPackageList} from '@alwatr/dedupe';

// Must throw an error
import {deduplicate} from '@alwatr/dedupe';

console.log('define test1 package');
definePackage('@scope/test1');
deduplicate({name: '@scope/test1'});

console.log('define test2 package with `strict`');
deduplicate({name: '@scope/test2', strict: true});

console.log('define test2 package');
definePackage('@scope/test2', 'v1.0.0');

console.log('definedPackageList:', definedPackageList);
// Must shown an warning
setTimeout(() => {
console.log('re-define test1 package');
deduplicate({name: '@scope/test1'});
}, 1000);

console.log('redefine test2 package');
definePackage('@scope/test2');

// Must throw an error
setTimeout(() => {
console.log('re-define test2 package with `strict`');
deduplicate({name: '@scope/test2', strict: true});
}, 1000);

0 comments on commit b6f70d0

Please sign in to comment.