Skip to content

Commit 77cb8c3

Browse files
committed
updating monorepo for core lib
1 parent ab0648a commit 77cb8c3

File tree

10 files changed

+124
-2
lines changed

10 files changed

+124
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ yarn.lock
1212
package-lock.json
1313

1414

15+
.claude/settings.local.json

packages/b2c-cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"dependencies": {
1111
"@oclif/core": "^4",
1212
"@oclif/plugin-help": "^6",
13-
"@oclif/plugin-plugins": "^5"
13+
"@oclif/plugin-plugins": "^5",
14+
"@salesforce/b2c-tooling": "workspace:*"
1415
},
1516
"devDependencies": {
1617
"@eslint/compat": "^1",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {Args, Command, Flags} from '@oclif/core'
2+
import {hello} from '@salesforce/b2c-tooling'
23

34
export default class Hello extends Command {
45
static args = {
@@ -17,6 +18,6 @@ hello friend from oclif! (./src/commands/hello/index.ts)
1718
async run(): Promise<void> {
1819
const {args, flags} = await this.parse(Hello)
1920

20-
this.log(`hello ${args.person} from ${flags.from}! (./src/commands/hello/index.ts)`)
21+
this.log(`${hello(args.person, flags.from)} (./src/commands/hello/index.ts)`)
2122
}
2223
}

packages/b2c-tooling/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*-debug.log
2+
*-error.log
3+
**/.DS_Store
4+
/.idea
5+
/dist
6+
/tmp
7+
/node_modules
8+
9+
10+
yarn.lock
11+
package-lock.json
12+
13+

packages/b2c-tooling/package.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "@salesforce/b2c-tooling",
3+
"version": "0.0.0",
4+
"description": "Core tooling library for Salesforce Commerce Cloud B2C CLI",
5+
"author": "Charles Lavery",
6+
"license": "MIT",
7+
"repository": "SalesforceCommerceCloud/b2c-cli",
8+
"keywords": [
9+
"SFCC",
10+
"B2C",
11+
"Commerce Cloud",
12+
"tooling"
13+
],
14+
"type": "module",
15+
"exports": {
16+
".": {
17+
"import": {
18+
"types": "./dist/esm/index.d.ts",
19+
"default": "./dist/esm/index.js"
20+
},
21+
"require": {
22+
"types": "./dist/cjs/index.d.ts",
23+
"default": "./dist/cjs/index.js"
24+
}
25+
}
26+
},
27+
"main": "./dist/cjs/index.js",
28+
"module": "./dist/esm/index.js",
29+
"types": "./dist/esm/index.d.ts",
30+
"files": [
31+
"dist"
32+
],
33+
"scripts": {
34+
"build": "pnpm run build:esm && pnpm run build:cjs",
35+
"build:esm": "tsc -p tsconfig.esm.json",
36+
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
37+
"clean": "shx rm -rf dist",
38+
"lint": "eslint src --ext .ts",
39+
"test": "echo \"Error: no test specified\" && exit 0"
40+
},
41+
"devDependencies": {
42+
"@types/node": "^18",
43+
"eslint": "^9",
44+
"shx": "^0.3.3",
45+
"typescript": "^5"
46+
},
47+
"engines": {
48+
"node": ">=18.0.0"
49+
}
50+
}

packages/b2c-tooling/src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Generates a hello message
3+
* @param person - The person to greet
4+
* @param from - Who is saying hello
5+
* @returns A formatted hello message
6+
*/
7+
export function hello(person: string, from: string): string {
8+
return `hello ${person} from ${from}!`;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "CommonJS",
5+
"moduleResolution": "node",
6+
"outDir": "dist/cjs",
7+
"rootDir": "src"
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "Node16",
5+
"moduleResolution": "node16",
6+
"outDir": "dist/esm",
7+
"rootDir": "src"
8+
}
9+
}

packages/b2c-tooling/tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true,
4+
"strict": true,
5+
"target": "es2022",
6+
"skipLibCheck": true,
7+
"esModuleInterop": true,
8+
"forceConsistentCasingInFileNames": true
9+
},
10+
"include": ["src/**/*"]
11+
}

pnpm-lock.yaml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)