Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

feat: move to esm #22

Merged
merged 4 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
module.exports = {
extends: ['eslint-config-salesforce-typescript', 'plugin:sf-plugin/recommended'],
rules: {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ node_modules
.idea

oclif.manifest.json
oclif.lock
5 changes: 2 additions & 3 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"require": "ts-node/register,source-map-support/register",
"watch-extensions": "ts",
"watch-files": ["src", "test"],
"require": "ts-node/register",
"loader": "ts-node/esm",
"recursive": true,
"reporter": "spec",
"timeout": 5000
Expand Down
21 changes: 0 additions & 21 deletions bin/dev

This file was deleted.

3 changes: 0 additions & 3 deletions bin/dev.cmd

This file was deleted.

8 changes: 8 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
// eslint-disable-next-line node/shebang
async function main() {
const {execute} = await import('@oclif/core')
await execute({development: true, dir: import.meta.url})
}

await main()
3 changes: 0 additions & 3 deletions bin/run

This file was deleted.

3 changes: 0 additions & 3 deletions bin/run.cmd

This file was deleted.

7 changes: 7 additions & 0 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node
async function main() {
const {execute} = await import('@oclif/core')
await execute({dir: import.meta.url})
}

await main()
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,24 @@
"name": "Cristian Dominguez",
"url": "https://github.com/cristiand391"
},
"type": "module",
"bugs": "https://github.com/cristiand391/sf-plugin-api/issues",
"dependencies": {
"@oclif/core": "^2.15.0",
"@salesforce/core": "^5.3.3",
"@salesforce/sf-plugins-core": "^3.1.27",
"chalk": "^4",
"got": "11.8.6",
"@oclif/core": "^3.10.1",
"@salesforce/core": "^5.3.17",
"@salesforce/sf-plugins-core": "^4.0.0",
"chalk": "^5.3.0",
"got": "^13.0.0",
"proxy-agent": "^6.3.1"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^4.0.12",
"@salesforce/ts-sinon": "^1.4.14",
"@swc/core": "^1.3.11",
"@oclif/plugin-command-snapshot": "^5.0.1",
"@types/chai": "^4.3.4",
"@types/inquirer": "^9.0.3",
"@types/mocha": "^10.0.1",
"@types/sinon": "^10.0.13",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.1",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"chai": "^4.3.6",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
Expand All @@ -39,12 +38,13 @@
"prettier": "^3.0.1",
"shx": "0.3.4",
"sinon": "^15.0.3",
"strip-ansi": "^7.1.0",
"ts-node": "^10.9.1",
"typescript": "^4.8.4",
"typescript": "^5.2.2",
"wireit": "^0.10.0"
},
"engines": {
"node": ">=16"
"node": ">=18"
},
"prettier": {
"singleQuote": true
Expand All @@ -64,7 +64,6 @@
"sf"
],
"license": "BSD-3-Clause",
"main": "lib/index.js",
"oclif": {
"commands": "./lib/commands",
"bin": "sf",
Expand All @@ -85,6 +84,7 @@
"postpack": "shx rm -f oclif.manifest.json",
"prepack": "oclif manifest .",
"test": "wireit",
"test:run": "wireit",
"version": "oclif readme"
},
"wireit": {
Expand Down Expand Up @@ -135,7 +135,7 @@
]
},
"test:deprecation-policy": {
"command": "\"./bin/dev\" snapshot:compare",
"command": "ts-node \"./bin/dev.js\" snapshot:compare",
"files": [
"src/**/*.ts"
],
Expand Down
2 changes: 1 addition & 1 deletion src/commands/org/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFile } from 'node:fs/promises';
import { EOL } from 'node:os';
import got, { Headers, Method } from 'got';
import * as chalk from 'chalk';
import chalk from 'chalk';
import { ProxyAgent } from 'proxy-agent';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { SfError, Org } from '@salesforce/core';
Expand Down
1 change: 0 additions & 1 deletion src/index.ts

This file was deleted.

9 changes: 4 additions & 5 deletions test/commands/org/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import nock = require('nock');
import { TestContext, MockTestOrgData } from '@salesforce/core/lib/testSetup';
import { TestContext, MockTestOrgData } from '@salesforce/core/lib/testSetup.js';
import { SfError } from '@salesforce/core';
import { expect } from 'chai';
import stripAnsi = require('strip-ansi');
import { stdout } from '@oclif/core';
import { OrgApi } from '../../../src/commands/org/api';
import stripAnsi from 'strip-ansi';
import { OrgApi } from '../../../src/commands/org/api.js';

describe('org api', () => {
const $$ = new TestContext();
Expand All @@ -16,7 +15,7 @@ describe('org api', () => {

beforeEach(async () => {
await $$.stubAuths(testOrg);
stdoutSpy = $$.SANDBOX.stub(stdout, 'write');
stdoutSpy = $$.SANDBOX.stub(process.stdout, 'write');
});

afterEach(() => {
Expand Down
1 change: 1 addition & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"include": ["./**/*.ts"],
"compilerOptions": {
"module": "nodenext",
"strict": true,
"noEmit": true,
"skipLibCheck": true,
Expand Down
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"compilerOptions": {
"strict": true,
"module": "commonjs",
"module": "nodenext",
"target": "ES2021",
"lib": ["ES2021"],
"moduleResolution": "node",
"moduleResolution": "nodenext",
"skipLibCheck": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"outDir": "lib",
"rootDir": "src",
"allowSyntheticDefaultImports": true
},
"ts-node": { "esm": true },
"include": ["./src/**/*.ts"]
}
Loading