Skip to content

Commit

Permalink
feat!: migrate to ESM
Browse files Browse the repository at this point in the history
BREAKING CHANGES: ESM and node 18 minimum
  • Loading branch information
mdonnalley committed Oct 12, 2023
1 parent f371f9b commit f3fbea7
Show file tree
Hide file tree
Showing 31 changed files with 2,284 additions and 1,052 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
11 changes: 0 additions & 11 deletions .editorconfig

This file was deleted.

8 changes: 0 additions & 8 deletions .eslintrc

This file was deleted.

8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": ["oclif", "oclif-typescript", "prettier"],
"rules": {
"unicorn/prefer-module": "off",
"unicorn/no-array-reduce": "off",
"no-useless-constructor": "off"
}
}
7 changes: 5 additions & 2 deletions .git2gus/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"productTag": "a1aB0000000ce2IIAQ",
"defaultBuild": "offcore.tooling.55",
"issueTypeLabels": { "enhancement": "USER STORY", "bug": "BUG P3" },
"defaultBuild": "offcore.tooling.59",
"issueTypeLabels": {
"enhancement": "USER STORY",
"bug": "BUG P3"
},
"hideWorkItemUrl": true,
"statusWhenClosed": "CLOSED"
}
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

9 changes: 6 additions & 3 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: automerge
on:
workflow_dispatch:
schedule:
- cron: '17 2,5,8,11 * * *'
- cron: '42 2,5,8,11 * * *'

jobs:
automerge:
uses: oclif/github-workflows/.github/workflows/automerge.yml@main
secrets: inherit
uses: salesforcecli/github-workflows/.github/workflows/automerge.yml@main
secrets:
SVC_CLI_BOT_GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
with:
mergeMethod: squash
28 changes: 28 additions & 0 deletions .github/workflows/create-github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: create-github-release

on:
push:
branches:
- main
# point at specific branches, or a naming convention via wildcard
- prerelease/**
tags-ignore:
- '*'
workflow_dispatch:
inputs:
prerelease:
type: string
description: 'Name to use for the prerelease: beta, dev, etc. NOTE: If this is already set in the package.json, it does not need to be passed in here.'

jobs:
release:
# this job will throw if prerelease is true but it doesn't have a prerelease-looking package.json version
uses: salesforcecli/github-workflows/.github/workflows/create-github-release.yml@main
secrets:
SVC_CLI_BOT_GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
with:
prerelease: ${{ inputs.prerelease }}
# If this is a push event, we want to skip the release if there are no semantic commits
# However, if this is a manual release (workflow_dispatch), then we want to disable skip-on-empty
# This helps recover from forgetting to add semantic commits ('fix:', 'feat:', etc.)
skip-on-empty: ${{ github.event_name == 'push' }}
2 changes: 1 addition & 1 deletion .github/workflows/failureNotifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: failureNotifications
on:
workflow_run:
workflows:
- version, tag and github release
- create-github-release
- publish
types:
- completed
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/manualRelease.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/onPushToMain.yml

This file was deleted.

22 changes: 18 additions & 4 deletions .github/workflows/onRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: publish

on:
release:
types: [released]
types: [published]
# support manual release in case something goes wrong and needs to be repeated or tested
workflow_dispatch:
inputs:
Expand All @@ -11,9 +11,23 @@ on:
type: string
required: true
jobs:
# parses the package.json version and detects prerelease tag (ex: beta from 4.4.4-beta.0)
getDistTag:
outputs:
tag: ${{ steps.distTag.outputs.tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- uses: salesforcecli/github-workflows/.github/actions/getPreReleaseTag@main
id: distTag

npm:
uses: oclif/github-workflows/.github/workflows/npmPublish.yml@main
uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
needs: [getDistTag]
with:
tag: latest
tag: ${{ needs.getDistTag.outputs.tag || 'latest' }}
githubTag: ${{ github.event.release.tag_name || inputs.tag }}
secrets: inherit
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ on:
workflow_dispatch:

jobs:
unit-tests:
uses: oclif/github-workflows/.github/workflows/unitTest.yml@main
yarn-lockfile-check:
uses: salesforcecli/github-workflows/.github/workflows/lockFileCheck.yml@main
linux-unit-tests:
needs: yarn-lockfile-check
uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main
windows-unit-tests:
needs: linux-unit-tests
uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
/lib
/node_modules
/tmp

oclif.lock
oclif.manifest.json
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

yarn commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged --concurrent false
5 changes: 5 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*.json": ["prettier --write"],
"*.md": ["prettier --write"],
"+(src|test)/**/*.+(ts|js)": ["eslint --fix", "prettier --write"]
}
13 changes: 4 additions & 9 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{
"require": [
"test/helpers/init.js",
"ts-node/register",
"source-map-support/register"
],
"watch-extensions": [
"ts"
],
"require": ["ts-node/register"],
"watch-extensions": ["ts"],
"recursive": true,
"reporter": "spec",
"timeout": 60000
"timeout": 60000,
"node-option": ["loader=ts-node/esm"]
}
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@oclif/prettier-config"
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
@oclif/plugin-help
===================
# @oclif/plugin-help

A CLI command to invoke the standard help functionality from [oclif/core](https://github.com/oclif/core).

[![Version](https://img.shields.io/npm/v/@oclif/plugin-help.svg)](https://npmjs.org/package/@oclif/plugin-help)
[![CircleCI](https://circleci.com/gh/oclif/plugin-help/tree/main.svg?style=svg)](https://circleci.com/gh/oclif/plugin-help/tree/main)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/oclif/plugin-help?branch=main&svg=true)](https://ci.appveyor.com/project/heroku/plugin-help/branch/main)
[![Known Vulnerabilities](https://snyk.io/test/npm/@oclif/plugin-help/badge.svg)](https://snyk.io/test/npm/@oclif/plugin-help)
[![Downloads/week](https://img.shields.io/npm/dw/@oclif/plugin-help.svg)](https://npmjs.org/package/@oclif/plugin-help)
[![License](https://img.shields.io/npm/l/@oclif/plugin-help.svg)](https://github.com/oclif/plugin-help/blob/main/package.json)
19 changes: 0 additions & 19 deletions bin/dev

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()
5 changes: 0 additions & 5 deletions bin/run

This file was deleted.

9 changes: 9 additions & 0 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

// eslint-disable-next-line node/shebang
async function main() {
const {execute} = await import('@oclif/core')
await execute({dir: import.meta.url})
}

await main()
53 changes: 31 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,61 @@
"author": "Salesforce",
"bugs": "https://github.com/oclif/plugin-help/issues",
"dependencies": {
"@oclif/core": "^2.15.0"
"@oclif/core": "^3.0.8"
},
"devDependencies": {
"@oclif/plugin-plugins": "^2.4.7",
"@oclif/test": "^2.1.0",
"@commitlint/config-conventional": "^17.7.0",
"@oclif/prettier-config": "^0.2.1",
"@oclif/test": "^3.0.2",
"@types/chai": "^4.3.6",
"@types/mocha": "^9.1.0",
"@types/mocha": "^10.0.2",
"@types/node": "^18",
"chai": "^4.3.10",
"eslint": "^7.3.1",
"eslint-config-oclif": "^4.0.0",
"eslint-config-oclif-typescript": "^1.0.3",
"mocha": "^9.2.2",
"oclif": "^3.17.2",
"commitlint": "^17.7.2",
"eslint": "^8.51.0",
"eslint-config-oclif": "^5.0.0",
"eslint-config-oclif-typescript": "^3.0.5",
"eslint-config-prettier": "^9.0.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"mocha": "^10.2.0",
"oclif": "^4.0.2",
"prettier": "^3.0.3",
"shx": "^0.3.4",
"ts-node": "^9.1.1",
"typescript": "^4.6.3"
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"engines": {
"node": ">=12.0.0"
"node": ">=18.0.0"
},
"exports": "./lib/index.js",
"files": [
"oclif.manifest.json",
"/lib"
"/lib",
"/oclif.lock"
],
"homepage": "https://github.com/oclif/plugin-help",
"keywords": [
"oclif-plugin"
],
"license": "MIT",
"main": "./lib/index.js",
"oclif": {
"commands": "./lib/commands",
"bin": "oclif",
"devPlugins": [
"@oclif/plugin-plugins"
]
"flexibleTaxonomy": true,
"topicSeparator": " "
},
"repository": "oclif/plugin-help",
"scripts": {
"build": "shx rm -rf lib && tsc",
"lint": "eslint . --ext .ts --config .eslintrc",
"pretest": "yarn build && tsc --noEmit",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"lint": "eslint . --ext .ts",
"postpack": "shx rm oclif.manifest.json",
"posttest": "yarn lint",
"prepack": "yarn run build && oclif manifest .",
"postpack": "shx rm oclif.manifest.json"
"prepare": "husky install",
"pretest": "yarn build && tsc --noEmit",
"test": "mocha --forbid-only \"test/**/*.test.ts\""
},
"type": "module",
"types": "./lib/index.d.ts"
}
}
Loading

0 comments on commit f3fbea7

Please sign in to comment.