Skip to content

Commit ab0648a

Browse files
committed
initial
0 parents  commit ab0648a

26 files changed

+7385
-0
lines changed

.gitignore

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

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@salesforce/b2c-cli-root",
3+
"version": "0.0.1",
4+
"description": "Salesforce Commerce Cloud B2C Command Line Tools",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"packageManager": "pnpm@10.17.1"
13+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# test
2+
name: version, tag and github release
3+
4+
on:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
- name: Check if version already exists
15+
id: version-check
16+
run: |
17+
package_version=$(node -p "require('./package.json').version")
18+
exists=$(gh api repos/${{ github.repository }}/releases/tags/v$package_version >/dev/null 2>&1 && echo "true" || echo "")
19+
20+
if [ -n "$exists" ];
21+
then
22+
echo "Version v$package_version already exists"
23+
echo "::warning file=package.json,line=1::Version v$package_version already exists - no release will be created. If you want to create a new release, please update the version in package.json and push again."
24+
echo "skipped=true" >> $GITHUB_OUTPUT
25+
else
26+
echo "Version v$package_version does not exist. Creating release..."
27+
echo "skipped=false" >> $GITHUB_OUTPUT
28+
echo "tag=v$package_version" >> $GITHUB_OUTPUT
29+
fi
30+
env:
31+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
32+
- name: Setup git
33+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
34+
run: |
35+
git config --global user.email ${{ secrets.GH_EMAIL }}
36+
git config --global user.name ${{ secrets.GH_USERNAME }}
37+
- name: Generate oclif README
38+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
39+
id: oclif-readme
40+
run: |
41+
pnpm install
42+
pnpm exec oclif readme
43+
if [ -n "$(git status --porcelain)" ]; then
44+
git add .
45+
git commit -am "chore: update README.md"
46+
git push -u origin ${{ github.ref_name }}
47+
fi
48+
- name: Create Github Release
49+
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
50+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
51+
with:
52+
name: ${{ steps.version-check.outputs.tag }}
53+
tag: ${{ steps.version-check.outputs.tag }}
54+
commit: ${{ github.ref_name }}
55+
token: ${{ secrets.GH_TOKEN }}
56+
skipIfReleaseExists: true
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: publish
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: latest
15+
- run: pnpm install
16+
- run: pnpm run build
17+
- run: pnpm run prepack
18+
- uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c
19+
with:
20+
token: ${{ secrets.NPM_TOKEN }}
21+
- run: pnpm run postpack
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: tests
2+
on:
3+
push:
4+
branches-ignore: [main]
5+
workflow_dispatch:
6+
7+
jobs:
8+
unit-tests:
9+
strategy:
10+
matrix:
11+
os: ['ubuntu-latest', 'windows-latest']
12+
node_version: [lts/-1, lts/*, latest]
13+
fail-fast: false
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node_version }}
20+
cache: pnpm
21+
- run: pnpm install
22+
- run: pnpm run build
23+
- run: pnpm run test

packages/b2c-cli/.gitignore

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

packages/b2c-cli/.mocharc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"require": [
3+
"ts-node/register"
4+
],
5+
"watch-extensions": [
6+
"ts"
7+
],
8+
"recursive": true,
9+
"reporter": "spec",
10+
"timeout": 60000,
11+
"node-option": [
12+
"loader=ts-node/esm",
13+
"experimental-specifier-resolution=node"
14+
]
15+
}

packages/b2c-cli/.prettierrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@oclif/prettier-config"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "attach",
7+
"name": "Attach",
8+
"port": 9229,
9+
"skipFiles": ["<node_internals>/**"]
10+
},
11+
{
12+
"type": "node",
13+
"request": "launch",
14+
"name": "Execute Command",
15+
"skipFiles": ["<node_internals>/**"],
16+
"runtimeExecutable": "node",
17+
"runtimeArgs": ["--loader", "ts-node/esm", "--no-warnings=ExperimentalWarning"],
18+
"program": "${workspaceFolder}/bin/dev.js",
19+
"args": ["hello", "world"]
20+
}
21+
]
22+
}

0 commit comments

Comments
 (0)