Skip to content

Commit 9b0f6aa

Browse files
authored
Merge pull request #21 from code-store-platform/feat/esm
Feat/esm
2 parents 9e3fc14 + bfec64f commit 9b0f6aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1705
-3890
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @code.store/arcxp-sdk-ts
22

3+
## 5.0.0
4+
5+
### Major Changes
6+
7+
- ESM + CJS, refactor structure, regenerate types, section utils
8+
39
## 4.49.1
410

511
### Patch Changes

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ src/api/{service}/
6262

6363
```typescript
6464
import type { GlobalType } from '../../types/entity';
65-
import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api';
66-
import type { LocalParamsType } from './types';
65+
import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js';
66+
import type { LocalParamsType } from './types.js';
6767

6868
export class ArcServiceName extends ArcAbstractAPI {
6969
constructor(options: ArcAPIOptions) {
@@ -219,7 +219,7 @@ Ensure types are exported from the service's `types.ts` and re-exported in `src/
219219

220220
```typescript
221221
// In src/index.ts
222-
export * from './api/{service}/types';
222+
export * from './api/{service}/types.js';
223223
```
224224

225225
#### 6. Document Changes
@@ -339,7 +339,7 @@ import type { AGallery } from '../../types/gallery';
339339
import type { AnImage } from '../../types/story';
340340

341341
// Importing local types
342-
import type { GetStoryParams, SearchResponse } from './types';
342+
import type { GetStoryParams, SearchResponse } from './types.js';
343343
```
344344
345345
### Handling Unclear Specifications
@@ -423,7 +423,7 @@ Write tests for new functionality:
423423
424424
```typescript
425425
import { describe, it, expect } from 'vitest';
426-
import { ArcServiceName } from './index';
426+
import { ArcServiceName } from './index.js';
427427

428428
describe('ArcServiceName', () => {
429429
it('should fetch item by id', async () => {

ans-schema.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"id": "https://github.com/washingtonpost/ans-schema",
4+
"title": "Root",
5+
"description": "",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"properties": {
9+
"gallery_root": {
10+
"$ref": "https://raw.githubusercontent.com/washingtonpost/ans-schema/master/src/main/resources/schema/ans/0.10.12/gallery.json"
11+
},
12+
"story_root": {
13+
"$ref": "https://raw.githubusercontent.com/washingtonpost/ans-schema/master/src/main/resources/schema/ans/0.10.12/story.json"
14+
},
15+
"video_root": {
16+
"$ref": "https://raw.githubusercontent.com/washingtonpost/ans-schema/master/src/main/resources/schema/ans/0.10.12/video.json"
17+
}
18+
},
19+
"required": ["gallery_root", "story_root", "video_root"]
20+
}

package.json

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
{
22
"name": "@code.store/arcxp-sdk-ts",
3-
"version": "4.49.1",
3+
"version": "5.0.0",
44
"description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.",
5-
"type": "commonjs",
5+
"type": "module",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.js",
12+
"require": "./dist/index.cjs"
13+
}
14+
},
815
"engines": {
916
"node": ">=22.x",
1017
"pnpm": ">=10.x"
@@ -17,15 +24,14 @@
1724
"dist"
1825
],
1926
"scripts": {
20-
"build": "tsc",
27+
"build": "tsc --noEmit && rollup -c",
2128
"format": "npx @biomejs/biome format --write .",
2229
"check": "npx @biomejs/biome check --write .",
2330
"lint": "tsc --noEmit && npx @biomejs/biome lint --write --unsafe .",
2431
"test": "npx vitest",
2532
"coverage": "npx vitest run --coverage",
26-
"gen:ts": "npx ts-node-dev ./src/scripts/json-schema-to-ts.ts",
27-
"cs": "npx changeset && npx changeset version",
28-
"swaggerToTypes": "npx swagger-typescript-api -p ./tmp/swagger.json -o ./tmp -n swaggerTypes.ts"
33+
"gen:ts": "npx tsx ./src/scripts/json-schema-to-ts.ts",
34+
"cs": "npx changeset && npx changeset version"
2935
},
3036
"keywords": [
3137
"ArcXP",
@@ -49,16 +55,26 @@
4955
"@biomejs/biome": "^1.9.4",
5056
"@changesets/changelog-github": "^0.4.8",
5157
"@changesets/cli": "^2.26.2",
52-
"@types/node": "^20.0.0",
53-
"@types/tap": "^15.0.8",
54-
"@types/uuid": "^9.0.7",
58+
"@rollup/plugin-alias": "^5.1.1",
59+
"@rollup/plugin-commonjs": "^28.0.6",
60+
"@rollup/plugin-json": "^6.1.0",
61+
"@rollup/plugin-node-resolve": "^16.0.2",
62+
"@rollup/plugin-replace": "^6.0.2",
63+
"@rollup/plugin-typescript": "^12.1.4",
64+
"@types/node": "^22.0.0",
65+
"@types/uuid": "^9.0.0",
5566
"@types/ws": "^8.5.5",
5667
"@vitest/coverage-v8": "^3.0.9",
5768
"json-schema-to-typescript": "13.1.1",
5869
"nock": "^14.0.10",
5970
"openapi-typescript": "^6.2.7",
71+
"rollup": "^4.52.4",
72+
"rollup-plugin-auto-external": "^2.0.0",
73+
"rollup-plugin-node-polyfills": "^0.2.1",
74+
"rollup-plugin-polyfill-node": "^0.13.0",
75+
"rollup-plugin-terser": "^7.0.2",
6076
"tap": "^16.3.4",
61-
"ts-node-dev": "^2.0.0",
77+
"tslib": "^2.8.1",
6278
"typescript": "^5.3.3",
6379
"vite": "^7.1.4",
6480
"vitest": "^3.2.4"

0 commit comments

Comments
 (0)