Skip to content

Commit 7ecd734

Browse files
jongpiejamessimone
andauthored
Initial release of new plugin v1.0.0 (#1)
* Adds a Salesforce CLI plugin that loads `.env` files before every `sf` command via a prerun hook, plus `sf dotenv inspect` and `sf dotenv export` subcommands * The plugin includes `should-log-env` config, `SF_DOTENV_DISABLED` / `SF_DOTENV_FILE` env overrides * The repo has been setup with Jest tests, ESLint/Prettier/Husky tooling, and a few GitHub actions to handle PRs and releases --------- Co-authored-by: James Simone <16430727+jamessimone@users.noreply.github.com>
1 parent ee6dced commit 7ecd734

38 files changed

Lines changed: 20925 additions & 1 deletion

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule:
6+
interval: 'weekly'
7+
allow:
8+
- dependency-type: 'production'
9+
labels:
10+
- 'dependency-update'

.github/workflows/build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
paths-ignore:
7+
- 'README.md'
8+
- 'LICENSE'
9+
- '.gitignore'
10+
- '.npmrc'
11+
- '.prettierrc'
12+
- '.prettierignore'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v5
22+
with:
23+
node-version: '20'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Verify code with ESLint
29+
run: npm run lint:verify
30+
31+
- name: 'Verify formatting with Prettier'
32+
run: npm run prettier:verify
33+
34+
- name: Build
35+
run: npm run build
36+
37+
- name: Test
38+
run: npm run test:coverage

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to NPM
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v5
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v5
19+
with:
20+
node-version: '20'
21+
registry-url: 'https://registry.npmjs.org'
22+
23+
- name: Verify tag matches package.json version
24+
env:
25+
REF_NAME: ${{ github.ref_name }}
26+
run: |
27+
TAG_VERSION="${REF_NAME#v}"
28+
PKG_VERSION="$(node -p "require('./package.json').version")"
29+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
30+
echo "::error::Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)."
31+
exit 1
32+
fi
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Publish to npm
38+
run: npm publish --provenance --access public
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Environment files
2+
.env*
3+
.sfdx
4+
5+
# Dependencies
6+
node_modules/
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
11+
# Build output
12+
lib/
13+
dist/
14+
build/
15+
oclif.manifest.json
16+
17+
# Logs
18+
logs
19+
*.log
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage/
23+
*.lcov
24+
25+
# IDE files (project shared .vscode/settings.json and extensions.json are committed)
26+
.vscode/*
27+
!.vscode/extensions.json
28+
!.vscode/settings.json
29+
.idea/
30+
*.swp
31+
*.swo
32+
*~
33+
34+
# OS generated files
35+
.DS_Store
36+
.DS_Store?
37+
._*
38+
.Spotlight-V100
39+
.Trashes
40+
ehthumbs.db
41+
Thumbs.db
42+
43+

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.lintstagedrc.cjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
'*.{ts,js,json,yml,yaml,md}': (filenames) => filenames.map((filename) => `prettier --write '${filename}'`),
3+
'{src,test}/**/*.ts': (filenames) => {
4+
if (filenames.length === 0) {
5+
return [];
6+
}
7+
8+
const quoted = filenames.map((f) => `"${f}"`).join(' ');
9+
return [`eslint --fix ${quoted}`, 'npm run test'];
10+
},
11+
};

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org

.prettierignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
lib/
6+
coverage/
7+
oclif.manifest.json
8+
9+
# Local IDE / agent state
10+
.claude/
11+
.sfdx/
12+
.vscode/

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"printWidth": 120,
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"trailingComma": "es5",
7+
"useTabs": false
8+
}

0 commit comments

Comments
 (0)