Skip to content

Commit

Permalink
Merge pull request #24 from shivjm/use-pnpm-9-and-node-18
Browse files Browse the repository at this point in the history
Use pnpm 9 and Node 18
  • Loading branch information
shivjm authored Apr 23, 2024
2 parents 544fc06 + 5cdd06e commit 80be12d
Show file tree
Hide file tree
Showing 14 changed files with 2,876 additions and 2,227 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ on:
name: publish-to-npmjs

env:
PNPM_VERSION: "6.19.1"
NODE_VERSION: "14.17.3"
PNPM_VERSION: "9.0.4"
NODE_VERSION: "18.17.0"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
uses: pnpm/action-setup@v3
with:
version: "${{ env.PNPM_VERSION }}"
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: "${{ env.NODE_VERSION }}"
Expand All @@ -38,15 +38,15 @@ jobs:
cd packages/$package
pnpm install --frozen-lockfile --filter "$package..."
pnpm run build --filter "$package"
pnpm run -r build --filter "$package"
pnpm publish --no-git-checks --filter "$package"
- name: Generate docs for all packages
# TODO this means updating all docs for all changes, not just
# the current module, regardless of release status; see
# TypeStrong/typedoc#1791
run: |
pnpm install -r --frozen-lockfile
pnpm typedoc
pnpm run -r typedoc
- name: Deploy docs for all packages to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: ${{ github.ref_type == 'tag' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Parse version
id: version
# adapted from
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ on:
- main

env:
PNPM_VERSION: "6.19.1"
NODE_VERSION: "14.17.3"
PNPM_VERSION: "9.0.4"
NODE_VERSION: "18.17.0"

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
uses: pnpm/action-setup@v3
with:
version: "${{ env.PNPM_VERSION }}"
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: "${{ env.NODE_VERSION }}"
Expand All @@ -35,33 +35,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
uses: pnpm/action-setup@v3
with:
version: "${{ env.PNPM_VERSION }}"
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: "${{ env.NODE_VERSION }}"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run build
run: pnpm run build
run: pnpm run -r build
check-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
uses: pnpm/action-setup@v3
with:
version: "${{ env.PNPM_VERSION }}"
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: "${{ env.NODE_VERSION }}"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate docs for all packages
run: pnpm typedoc
run: pnpm run -r typedoc
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
},
"devDependencies": {
"standard-version": "^9.3.2",
"typedoc": "^0.22.7"
"standard-version": "^9.5.0",
"typedoc": "^0.22.18"
}
}
18 changes: 12 additions & 6 deletions packages/micromark-extension-kbd-nested/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
"url": "https://github.com/shivjm/remark-extensions.git"
},
"scripts": {
"build": "rimraf lib && tsc -p tsconfig.build.json",
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.build.cjs.json",
"build:clean": "rimraf lib && npm run build",
"lint": "eslint src/**/*.ts",
"test": "mocha tests/**/*.ts"
"test": "mocha tests/**/*.ts",
"prepublish": "npm run build"
},
"dependencies": {
"micromark-util-character": "^1.1.0",
Expand All @@ -48,12 +50,16 @@
"typescript": "^4.4.4"
},
"engines": {
"node": ">=12",
"pnpm": ">=6"
"node": ">=18",
"pnpm": ">=9"
},
"type": "module",
"publishConfig": {
"main": "lib/index.js",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"typings": "index.d.ts"
}
},
"files": [
"lib/"
]
}
23 changes: 18 additions & 5 deletions packages/micromark-extension-kbd-nested/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ import type {
Effects,
Event,
Extension,
HtmlExtension,
State,
TokenTypeMap,
Tokenizer,
} from "micromark-util-types";
import { codes } from "micromark-util-symbol/codes";
Expand All @@ -67,6 +69,17 @@ export interface IOptions {
}

const MINIMUM_MARKER_LENGTH = 2;
const VARIABLE_MARKER_LENGTH = 2;

declare module "micromark-util-types" {
interface TokenTypeMap {
keyboardSequence: "keyboardSequence";
keyboardSequenceEscape: "keyboardSequenceEscape";
keyboardSequenceMarker: "keyboardSequenceMarker";
keyboardSequenceVariableMarker: "keyboardSequenceVariableMarker";
keyboardSequenceVariable: "keyboardSequenceVariableMarker";
}
}

const KEYBOARD_TYPE = "keyboardSequence";
const KEYBOARD_TEXT_TYPE = types.codeTextData; // TODO check whether this is okay
Expand All @@ -84,7 +97,7 @@ const DEFAULT_VARIABLE_DELIMITER = codes.slash;
* Extension for micromark to compile keyboard sequences as `<kbd>`
* elements and variable sequences as `<var>` elements. Can be passed
* in `htmlExtensions.` */
export const html: Extension = Object.freeze({
export const html: HtmlExtension = Object.freeze({
enter: {
[KEYBOARD_TYPE]: function (this: CompileContext): void {
this.tag("<kbd>");
Expand Down Expand Up @@ -335,7 +348,7 @@ function makeVariableTokenizer(delimiter: number): Tokenizer {
size++;
effects.consume(delimiter);

if (size === MINIMUM_MARKER_LENGTH) {
if (size === VARIABLE_MARKER_LENGTH) {
effects.exit(KEYBOARD_VARIABLE_MARKER_TYPE);
return gap;
}
Expand Down Expand Up @@ -400,7 +413,7 @@ function makeVariableClosingTokenizer(delimiter: number): Tokenizer {
if (code === delimiter) {
effects.consume(code);
size++;
if (size === MINIMUM_MARKER_LENGTH) {
if (size === VARIABLE_MARKER_LENGTH) {
effects.exit(KEYBOARD_VARIABLE_MARKER_TYPE);
effects.exit(KEYBOARD_VARIABLE_TYPE);

Expand Down Expand Up @@ -483,8 +496,8 @@ function makeConsumeOne(effects: Effects, next: State): (code: Code) => State {
function makeLiteral(
effects: Effects,
next: State,
outerType: string,
escapeType: string,
outerType: keyof TokenTypeMap,
escapeType: keyof TokenTypeMap,
): (code: Code) => State {
return (code: Code) => {
if (code === codes.backslash) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "lib/cjs"
}
}
4 changes: 2 additions & 2 deletions packages/micromark-extension-kbd-nested/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"include": ["src"],
"exclude": ["node_modules", "tests"],
"compilerOptions": {
"outDir": "lib",
"outDir": "lib/esm",
"declaration": true,
"declarationDir": "lib"
"declarationDir": "lib/esm"
}
}
8 changes: 5 additions & 3 deletions packages/remark-kbd-nested/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import remarkRehype from "remark-rehype";
import rehypeStringify from "rehype-stringify";

const output = remark()
.use(remarkKbdNested).
use(remarkRehype)
.use(remarkKbdNested)
.use(remarkRehype)
.use(rehypeStringify)
.processSync("Press ||| ||Ctrl|| + || \| || |||, then || //key// ||.");

Expand All @@ -56,7 +56,7 @@ are passed directly to [micromark-extension-kbd-nested][].

## License

[ISC][license] © [Shiv Jha Mathur][author]
[ISC][LICENSE] © [Shiv Jha Mathur][author]

[test-badge]: https://github.com/shivjm/remark-extensions/actions/workflows/test.yml/badge.svg

Expand All @@ -77,3 +77,5 @@ are passed directly to [micromark-extension-kbd-nested][].
[micromark-extension-kbd-nested]: https://www.npmjs.com/package/micromark-extension-kbd-nested

[license]: ../../license

[author]: https://github.com/shivjm/
18 changes: 12 additions & 6 deletions packages/remark-kbd-nested/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"description": "remark plugin to add support for `kbd` element syntax with configurable delimiters, escaping, and arbitrary nesting",
"main": "src/index.ts",
"scripts": {
"build": "rimraf lib && tsc -p tsconfig.build.json",
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.build.cjs.json",
"build:clean": "rimraf lib && npm run build",
"lint": "eslint src/**/*.ts",
"test": "mocha tests/**/*.ts"
"test": "mocha tests/**/*.ts",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand All @@ -26,12 +28,13 @@
},
"homepage": "https://github.com/shivjm/remark-extensions#readme",
"engines": {
"node": ">=12",
"pnpm": ">=6"
"node": ">=18",
"pnpm": ">=9"
},
"type": "module",
"publishConfig": {
"main": "lib/index.js",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"typings": "index.d.ts"
},
"devDependencies": {
Expand Down Expand Up @@ -59,5 +62,8 @@
},
"dependencies": {
"micromark-extension-kbd-nested": "workspace:^0.5.0"
}
},
"files": [
"lib/"
]
}
7 changes: 7 additions & 0 deletions packages/remark-kbd-nested/tsconfig.build.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "lib/cjs"
}
}
4 changes: 2 additions & 2 deletions packages/remark-kbd-nested/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"include": ["src"],
"exclude": ["node_modules", "tests"],
"compilerOptions": {
"outDir": "lib",
"outDir": "lib/esm",
"declaration": true,
"declarationDir": "lib"
"declarationDir": "lib/esm"
}
}
2 changes: 1 addition & 1 deletion packages/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es6",
"module": "commonjs"
"module": "ES2020"
},
"exclude": ["tests"]
}
Loading

0 comments on commit 80be12d

Please sign in to comment.