Skip to content

Commit 15d016d

Browse files
committed
execution conditions; typescript module syntax
1 parent a6b83c5 commit 15d016d

28 files changed

Lines changed: 96 additions & 70 deletions

AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11

2+
- this is a monorepo project; packages:
3+
- ./packages/b2c-cli - the command line interface built with oclif
4+
- ./packages/b2c-tooling - the SDK/library for B2C Commerce operations; support the CLI and can be used standalone
5+
26
## Setup/Packaging
37

48
- use `pnpm` over `npm` for package management
59
- the `pnpm run test` commands also run the linter after tests
610
- use `pnpm run -r format` (or individually in packages) to format code with prettier
11+
- use `exports` field in package.json files to define public API surface for packages; use `development` field for nodejs --conditions for development ergonomics (packages/b2c-cli/bin/dev.js will use this condition)
712

813
## Documentation
914

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
- Separate CLI and SDK
77
- Logging
8+
- redaction
89
- Localization Support
10+
- supply chain security
911

1012
## CLI
1113

packages/b2c-cli/bin/dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S node --import tsx
1+
#!/usr/bin/env -S node --conditions development --import tsx
22

33
import {execute} from '@oclif/core';
44

packages/b2c-cli/src/commands/_test/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default class Test extends BaseCommand<typeof Test> {
3333
username: 'testuser',
3434
password: 'secret123',
3535
client_secret: 'abc123xyz', // eslint-disable-line camelcase
36-
token: 'Bearer eyJhbGciOiJIUzI1NiJ9.test',
36+
accessToken: 'eyJhbGciOiJIUzI1NiJ9.test',
3737
},
3838
'This should have redacted fields',
3939
);

packages/b2c-cli/src/i18n/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* this.log(t('commands.sites.list.fetching', 'Fetching sites from {{hostname}}...', { hostname }))
1010
*/
1111

12-
import {registerTranslations, t as toolingT, TOptions} from '@salesforce/b2c-tooling';
12+
import {registerTranslations, t as toolingT, type TOptions} from '@salesforce/b2c-tooling';
1313
import {locales} from './locales/index.js';
1414

1515
/** The namespace used by b2c-cli messages */

packages/b2c-cli/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ export {
1010
// Config utilities
1111
loadConfig,
1212
findDwJson,
13-
ResolvedConfig,
14-
LoadConfigOptions,
1513
} from '@salesforce/b2c-tooling/cli';
14+
export type {ResolvedConfig, LoadConfigOptions} from '@salesforce/b2c-tooling/cli';

packages/b2c-cli/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"rootDir": "src",
66
"skipLibCheck": true,
77
"esModuleInterop": true,
8-
"forceConsistentCasingInFileNames": true
8+
"forceConsistentCasingInFileNames": true,
9+
"verbatimModuleSyntax": true
910
},
1011
"include": ["./src/**/*"]
1112
}

packages/b2c-tooling/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"type": "module",
1515
"exports": {
1616
".": {
17+
"development": "./src/index.ts",
1718
"import": {
1819
"types": "./dist/esm/index.d.ts",
1920
"default": "./dist/esm/index.js"
@@ -24,6 +25,7 @@
2425
}
2526
},
2627
"./auth": {
28+
"development": "./src/auth/index.ts",
2729
"import": {
2830
"types": "./dist/esm/auth/index.d.ts",
2931
"default": "./dist/esm/auth/index.js"
@@ -34,6 +36,7 @@
3436
}
3537
},
3638
"./instance": {
39+
"development": "./src/instance/index.ts",
3740
"import": {
3841
"types": "./dist/esm/instance/index.d.ts",
3942
"default": "./dist/esm/instance/index.js"
@@ -44,6 +47,7 @@
4447
}
4548
},
4649
"./platform": {
50+
"development": "./src/platform/index.ts",
4751
"import": {
4852
"types": "./dist/esm/platform/index.d.ts",
4953
"default": "./dist/esm/platform/index.js"
@@ -54,6 +58,7 @@
5458
}
5559
},
5660
"./operations/code": {
61+
"development": "./src/operations/code/index.ts",
5762
"import": {
5863
"types": "./dist/esm/operations/code/index.d.ts",
5964
"default": "./dist/esm/operations/code/index.js"
@@ -64,6 +69,7 @@
6469
}
6570
},
6671
"./operations/jobs": {
72+
"development": "./src/operations/jobs/index.ts",
6773
"import": {
6874
"types": "./dist/esm/operations/jobs/index.d.ts",
6975
"default": "./dist/esm/operations/jobs/index.js"
@@ -74,6 +80,7 @@
7480
}
7581
},
7682
"./operations/sites": {
83+
"development": "./src/operations/sites/index.ts",
7784
"import": {
7885
"types": "./dist/esm/operations/sites/index.d.ts",
7986
"default": "./dist/esm/operations/sites/index.js"
@@ -84,6 +91,7 @@
8491
}
8592
},
8693
"./cli": {
94+
"development": "./src/cli/index.ts",
8795
"import": {
8896
"types": "./dist/esm/cli/index.d.ts",
8997
"default": "./dist/esm/cli/index.js"
@@ -94,6 +102,7 @@
94102
}
95103
},
96104
"./logging": {
105+
"development": "./src/logging/index.ts",
97106
"import": {
98107
"types": "./dist/esm/logging/index.d.ts",
99108
"default": "./dist/esm/logging/index.js"

packages/b2c-tooling/src/auth/api-key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AuthStrategy} from './types.js';
1+
import type {AuthStrategy} from './types.js';
22

33
export class ApiKeyStrategy implements AuthStrategy {
44
constructor(

packages/b2c-tooling/src/auth/basic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AuthStrategy} from './types.js';
1+
import type {AuthStrategy} from './types.js';
22

33
export class BasicAuthStrategy implements AuthStrategy {
44
private encoded: string;

0 commit comments

Comments
 (0)