Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions apps/next-app-router/next-app-router-4000/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
},
"dependencies": {
"@heroicons/react": "2.1.3",
"@module-federation/nextjs-mf": "workspace:*",
"clsx": "2.1.1",
"date-fns": "3.6.0",
"dinero.js": "2.0.0-alpha.10",
"dinero.js": "2.0.1",
"ms": "3.0.0-canary.1",
"next": "16.1.5",
"react": "19.0.0-rc-cd22717c-20241013",
"react-dom": "19.0.0-rc-cd22717c-20241013",
"server-only": "0.0.1",
"styled-components": "6.1.8",
"use-count-up": "3.0.1",
"vercel": "34.0.0",
"@module-federation/nextjs-mf": "workspace:*"
"vercel": "34.0.0"
},
"devDependencies": {
"@tailwindcss/forms": "0.5.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { toFormat, type Dinero } from 'dinero.js';
import { toSnapshot, type Dinero } from 'dinero.js';

export const ProductCurrencySymbol = ({
dinero,
}: {
dinero: Dinero<number>;
}) => {
let symbol = '';
switch (toFormat(dinero, ({ currency }) => currency.code)) {
switch (toSnapshot(dinero).currency.code) {
case 'GBP': {
symbol = '£';
break;
Expand Down
6 changes: 3 additions & 3 deletions apps/next-app-router/next-app-router-4000/ui/product-deal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ProductCurrencySymbol } from '#/ui/product-currency-symbol';
import { toUnit, type Dinero } from 'dinero.js';
import { toDecimal, type Dinero } from 'dinero.js';

export const ProductDeal = ({
price: priceRaw,
Expand All @@ -10,8 +10,8 @@ export const ProductDeal = ({
amount: Dinero<number>;
};
}) => {
const discount = toUnit(discountRaw.amount);
const price = toUnit(priceRaw);
const discount = toDecimal(discountRaw.amount, ({ value }) => Number(value));
const price = toDecimal(priceRaw, ({ value }) => Number(value));
const percent = Math.round(100 - (discount / price) * 100);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Product } from '#/app/api/products/product';
import { ProductCurrencySymbol } from '#/ui/product-currency-symbol';
import { ProductDeal } from '#/ui/product-deal';
import { ProductLighteningDeal } from '#/ui/product-lightening-deal';
import { multiply, toUnit, type Dinero } from 'dinero.js';
import { multiply, toDecimal, type Dinero } from 'dinero.js';

function isDiscount(obj: any): obj is { percent: number; expires?: number } {
return typeof obj?.percent === 'number';
Expand Down Expand Up @@ -45,7 +45,7 @@ export const ProductPrice = ({
<ProductCurrencySymbol dinero={price} />
</div>
<div className="text-lg font-bold leading-snug text-white">
{toUnit(price)}
{toDecimal(price, ({ value }) => Number(value))}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ProductCurrencySymbol } from '#/ui/product-currency-symbol';
import { allocate, toUnit, up, type Dinero } from 'dinero.js';
import { allocate, toDecimal, type Dinero } from 'dinero.js';

export const ProductSplitPayments = ({ price }: { price: Dinero<number> }) => {
// only offer split payments for more expensive items
if (toUnit(price) < 150) {
if (toDecimal(price, ({ value }) => Number(value)) < 150) {
return null;
}

const [perMonth] = allocate(price, [1, 2]);
return (
<div className="text-sm text-gray-400">
Or <ProductCurrencySymbol dinero={price} />
{toUnit(perMonth, { digits: 0, round: up })}/month for 3 months
{toDecimal(perMonth, ({ value }) => Math.ceil(Number(value)))}/month for 3
months
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Product } from '#/app/api/products/product';
import { dinero, toUnit, up, type DineroSnapshot } from 'dinero.js';
import { dinero, toDecimal, type DineroSnapshot } from 'dinero.js';

export const ProductUsedPrice = ({
usedPrice: usedPriceRaw,
Expand All @@ -12,7 +12,7 @@ export const ProductUsedPrice = ({
<div className="text-sm">
<div className="text-gray-400">More buying choices</div>
<div className="text-gray-200">
${toUnit(usedPrice, { digits: 0, round: up })} (used)
${toDecimal(usedPrice, ({ value }) => Math.ceil(Number(value)))} (used)
</div>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions apps/next-app-router/next-app-router-4001/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
},
"dependencies": {
"@heroicons/react": "2.1.3",
"@module-federation/nextjs-mf": "workspace:*",
"clsx": "2.1.1",
"date-fns": "3.6.0",
"dinero.js": "2.0.0-alpha.10",
"dinero.js": "2.0.1",
"ms": "3.0.0-canary.1",
"next": "16.1.5",
"react": "19.0.0-rc-cd22717c-20241013",
"react-dom": "19.0.0-rc-cd22717c-20241013",
"server-only": "0.0.1",
"styled-components": "6.1.8",
"use-count-up": "3.0.1",
"vercel": "34.0.0",
"@module-federation/nextjs-mf": "workspace:*"
"vercel": "34.0.0"
},
"devDependencies": {
"@tailwindcss/forms": "0.5.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { toFormat, type Dinero } from 'dinero.js';
import { toSnapshot, type Dinero } from 'dinero.js';

export const ProductCurrencySymbol = ({
dinero,
}: {
dinero: Dinero<number>;
}) => {
let symbol = '';
switch (toFormat(dinero, ({ currency }) => currency.code)) {
switch (toSnapshot(dinero).currency.code) {
case 'GBP': {
symbol = '£';
break;
Expand Down
6 changes: 3 additions & 3 deletions apps/next-app-router/next-app-router-4001/ui/product-deal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ProductCurrencySymbol } from '#/ui/product-currency-symbol';
import { toUnit, type Dinero } from 'dinero.js';
import { toDecimal, type Dinero } from 'dinero.js';

export const ProductDeal = ({
price: priceRaw,
Expand All @@ -10,8 +10,8 @@ export const ProductDeal = ({
amount: Dinero<number>;
};
}) => {
const discount = toUnit(discountRaw.amount);
const price = toUnit(priceRaw);
const discount = toDecimal(discountRaw.amount, ({ value }) => Number(value));
const price = toDecimal(priceRaw, ({ value }) => Number(value));
const percent = Math.round(100 - (discount / price) * 100);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Product } from '#/app/api/products/product';
import { ProductCurrencySymbol } from '#/ui/product-currency-symbol';
import { ProductDeal } from '#/ui/product-deal';
import { ProductLighteningDeal } from '#/ui/product-lightening-deal';
import { multiply, toUnit, type Dinero } from 'dinero.js';
import { multiply, toDecimal, type Dinero } from 'dinero.js';

function isDiscount(obj: any): obj is { percent: number; expires?: number } {
return typeof obj?.percent === 'number';
Expand Down Expand Up @@ -45,7 +45,7 @@ export const ProductPrice = ({
<ProductCurrencySymbol dinero={price} />
</div>
<div className="text-lg font-bold leading-snug text-white">
{toUnit(price)}
{toDecimal(price, ({ value }) => Number(value))}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ProductCurrencySymbol } from '#/ui/product-currency-symbol';
import { allocate, toUnit, up, type Dinero } from 'dinero.js';
import { allocate, toDecimal, type Dinero } from 'dinero.js';

export const ProductSplitPayments = ({ price }: { price: Dinero<number> }) => {
// only offer split payments for more expensive items
if (toUnit(price) < 150) {
if (toDecimal(price, ({ value }) => Number(value)) < 150) {
return null;
}

const [perMonth] = allocate(price, [1, 2]);
return (
<div className="text-sm text-gray-400">
Or <ProductCurrencySymbol dinero={price} />
{toUnit(perMonth, { digits: 0, round: up })}/month for 3 months
{toDecimal(perMonth, ({ value }) => Math.ceil(Number(value)))}/month for 3
months
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Product } from '#/app/api/products/product';
import { dinero, toUnit, up, type DineroSnapshot } from 'dinero.js';
import { dinero, toDecimal, type DineroSnapshot } from 'dinero.js';

export const ProductUsedPrice = ({
usedPrice: usedPriceRaw,
Expand All @@ -12,7 +12,7 @@ export const ProductUsedPrice = ({
<div className="text-sm">
<div className="text-gray-400">More buying choices</div>
<div className="text-gray-200">
${toUnit(usedPrice, { digits: 0, round: up })} (used)
${toDecimal(usedPrice, ({ value }) => Math.ceil(Number(value)))} (used)
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"webpack": "^5.40.0"
},
"scripts": {
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && pnpm -C . exec tsdown --config tsdown.config.ts && cp *.md dist",
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && pnpm -C . exec tsdown --config tsdown.config.mts && cp *.md dist",
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\"",
"test": "pnpm exec jest --config jest.config.ts --passWithNoTests",
"pre-release": "pnpm run test && pnpm run build"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/enhanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
},
"scripts": {
"generate:schema": "node src/scripts/compile-schema.js",
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && pnpm -C . exec tsdown --config tsdown.config.ts && cp *.md dist && node -e \"const fs=require('fs');const path=require('path');const src='src';const dst='dist/src';(function w(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){const p=path.join(d,e.name);if(e.isDirectory())w(p);else if(e.name.endsWith('.d.ts')){const rel=path.relative(src,p);const out=path.join(dst,rel);fs.mkdirSync(path.dirname(out),{recursive:true});fs.copyFileSync(p,out);}}})(src);\"",
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && pnpm -C . exec tsdown --config tsdown.config.mts && cp *.md dist && node -e \"const fs=require('fs');const path=require('path');const src='src';const dst='dist/src';(function w(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){const p=path.join(d,e.name);if(e.isDirectory())w(p);else if(e.name.endsWith('.d.ts')){const rel=path.relative(src,p);const out=path.join(dst,rel);fs.mkdirSync(path.dirname(out),{recursive:true});fs.copyFileSync(p,out);}}})(src);\"",
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\"",
"test": "node test/scripts/ensure-reshake-fixtures.js && NODE_OPTIONS=\"--experimental-vm-modules --max-old-space-size=24576\" npx rstest -c rstest.config.ts && NODE_OPTIONS=\"--experimental-vm-modules --max-old-space-size=24576\" npx rstest -c rstest.treeshake.serial.config.ts",
"pre-release": "pnpm run test && pnpm run build"
Expand Down
File renamed without changes.
Loading