Skip to content

Commit 2cd8cba

Browse files
authored
feat!: esm (#811)
* feat!: esm * test: generated nuts vs. ts-node * chore: __filename * test: nut fixes for esm * chore: dep bumps * test: none of that experimental stuff * chore: bump deps for testkit windows hangs
1 parent e20edc8 commit 2cd8cba

File tree

118 files changed

+720
-690
lines changed

Some content is hidden

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

118 files changed

+720
-690
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.cjs/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@ oclif.manifest.json
4747

4848
# ignore generated nut tests
4949
test/nuts/generated/
50+
51+
oclif.lock

.lintstagedrc.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'**/*.{js,json,md}?(x)': () => 'npm run reformat',
3+
};

.lintstagedrc.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

.mocharc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"require": "ts-node/register,source-map-support/register",
2+
"require": ["ts-node/register"],
33
"watch-extensions": "ts",
44
"watch-files": ["src", "test"],
55
"recursive": true,
66
"reporter": "spec",
7-
"timeout": 10000
7+
"timeout": 10000,
8+
"node-option": ["loader=ts-node/esm"]
89
}

DEVELOPING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
1. Build and lint the code: `yarn build`
3030
1. Create a branch off main for new work: `git checkout -b <branch_name>` _Suggestion: use branch_name format of initials/work-title_. For external contributors, please fork the main branch of the repo instead and PR the fork to the main branch.
3131
1. Make code changes and build: `yarn build`
32-
1. Run changed commands: `./bin/dev project:deploy:start --help`
32+
1. Run changed commands: `./bin/dev.js project:deploy:start --help`
3333
1. Write tests and run: `yarn test` (unit) and/or `yarn test:nuts` (NUTs)
3434
1. Show all changed files: `git status`
3535
1. Add all files to staging: `git add .`
@@ -93,7 +93,7 @@ If there are conflict errors in the tests then we need to make a similar modific
9393

9494
## Running Commands
9595

96-
To run your modified plugin commands locally, use `./bin/dev` or `./bin/dev.cmd` file, which uses ts-node to execute the plugin's TypeScript commands.
96+
To run your modified plugin commands locally, use `./bin/dev.js` or `./bin/dev.cmd` file, which uses ts-node to execute the plugin's TypeScript commands.
9797

9898
```bash
9999
# Run using local dev file.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ yarn install
4444
yarn build
4545
```
4646

47-
To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
47+
To use your plugin, run using the local `./bin/dev.js` or `./bin/dev.cmd` file.
4848

4949
```bash
5050
# Run using local run file.
51-
./bin/dev deploy
51+
./bin/dev.js deploy
5252
```
5353

5454
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.

bin/dev

Lines changed: 0 additions & 21 deletions
This file was deleted.

bin/dev.cmd

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@echo off
2-
set NODE_ENV=development
3-
node "%~dp0\dev" %*
2+
3+
node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*

bin/dev.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
2+
// eslint-disable-next-line node/shebang
3+
async function main() {
4+
const { execute } = await import('@oclif/core');
5+
await execute({ development: true, dir: import.meta.url });
6+
}
7+
8+
await main();

0 commit comments

Comments
 (0)