Skip to content

Commit

Permalink
Merge branch 'develop' into feat/nested-category-delete-endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
olivermrbl authored Jan 10, 2023
2 parents c16773b + f6c81da commit 4a0a731
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-hats-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/medusa-js": patch
---

Changes build process from using `tsc` to `rollup`. This change ensures that the package works with modern build tools such as Vite@4 and esbuild.
14 changes: 10 additions & 4 deletions packages/medusa-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
"name": "@medusajs/medusa-js",
"version": "1.3.5",
"description": "Client for Medusa Commerce Rest API",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"files": [
"dist/**/*"
],
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc --build",
"build": "rollup -c --bundleConfigAsCjs",
"prepare": "cross-env NODE_ENV=production yarn run build",
"test": "jest --passWithNoTests"
},
"author": "Oliver Juhl",
"license": "MIT",
"dependencies": {
"axios": "^0.24.0",
"axios": "0.26.1",
"form-data": "^4.0.0",
"qs": "^6.10.3",
"retry-axios": "^2.6.0"
Expand All @@ -33,9 +34,14 @@
},
"devDependencies": {
"@medusajs/medusa": "^1.7.1",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/jest": "^26.0.19",
"cross-env": "^7.0.3",
"jest": "^26.6.3",
"rollup": "^3.9.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.34.1",
"typescript": "^4.1.3"
},
"gitHead": "cd1f5afa5aa8c0b15ea957008ee19f1d695cbd2e",
Expand Down
34 changes: 34 additions & 0 deletions packages/medusa-js/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import commonjs from "@rollup/plugin-commonjs"
import resolve from "@rollup/plugin-node-resolve"
import { defineConfig } from "rollup"
import { terser } from "rollup-plugin-terser"
import typescript from "rollup-plugin-typescript2"

const packageJson = require("./package.json")

export default defineConfig({
input: "src/index.ts",
external: ["@medusajs/medusa"],
output: [
{
file: packageJson.main,
format: "cjs",
sourcemap: true,
},
{
file: packageJson.module,
format: "esm",
sourcemap: true,
},
],
plugins: [
terser(),
resolve({
browser: true,
}),
commonjs(),
typescript({
useTsconfigDeclarationDir: true,
}),
],
})
12 changes: 6 additions & 6 deletions packages/medusa-js/src/resources/admin/sales-channels.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {
AdminDeleteSalesChannelsChannelProductsBatchReq,
AdminDeleteSalesChannelsChannelStockLocationsReq,
AdminGetSalesChannelsParams,
AdminPostSalesChannelsChannelProductsBatchReq,
AdminPostSalesChannelsChannelStockLocationsReq,
AdminPostSalesChannelsReq,
AdminSalesChannelsRes,
AdminPostSalesChannelsSalesChannelReq,
AdminSalesChannelsDeleteRes,
AdminSalesChannelsListRes,
AdminDeleteSalesChannelsChannelProductsBatchReq,
AdminPostSalesChannelsChannelProductsBatchReq,
AdminPostSalesChannelsChannelStockLocationsReq,
AdminDeleteSalesChannelsChannelStockLocationsReq,
AdminSalesChannelsRes,
} from "@medusajs/medusa"
import qs from "qs"
import { ResponsePromise } from "../../typings"
import BaseResource from "../base"
import qs from "qs"

class AdminSalesChannelsResource extends BaseResource {
/** retrieve a sales channel
Expand Down
8 changes: 5 additions & 3 deletions packages/medusa-js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"compilerOptions": {
"lib": ["es5", "es6"],
"rootDir": "src",
"module": "esnext",
"target": "es5",
"lib": ["es6", "dom", "es2016", "es2017"],
"outDir": "./dist",
"declarationDir": "./dist",
"esModuleInterop": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Expand All @@ -17,6 +19,6 @@
"allowJs": true,
"skipLibCheck": true
},
"include": ["src"],
"include": ["src/**/*"],
"exclude": ["node_modules", " **/tests/*"]
}
Loading

0 comments on commit 4a0a731

Please sign in to comment.