Skip to content

Commit

Permalink
rebase on npm and update deps/runners as needed (#38)
Browse files Browse the repository at this point in the history
* rebase on npm

* update node version and runners

* update node version and runners part 2

* update node version and runners part 3

* update node version and runners part 4

* update node version and runners part 5

* debug 1

* update deps

* update deps 2
  • Loading branch information
pirog committed Mar 14, 2024
1 parent e98572e commit 372493d
Show file tree
Hide file tree
Showing 13 changed files with 4,986 additions and 3,121 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/pr-leia-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
fail-fast: false
matrix:
os:
- macos-12
- macos-13
- macos-14
- ubuntu-22.04
- windows-2022
node-version:
- '16'
- '18'

steps:
# Install deps and cache
Expand All @@ -26,24 +27,24 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Run a few iterations of leia tests
- name: Run Leia tests
shell: bash
run: |
# Try a basic example
yarn leia examples/basic-example.md --debug
npx leia examples/basic-example.md --debug
# Try globs and ignores
yarn leia "examples/**/*.md" -i "examples/basic-cmd-example.md" -i "examples/exclude-example/**/*.md" -i "examples/stdin-example.md" -i "examples/custom-headers.md" -i "examples/environment.md"
npx leia "examples/**/*.md" -i "examples/basic-cmd-example.md" -i "examples/exclude-example/**/*.md" -i "examples/stdin-example.md" -i "examples/custom-headers.md" -i "examples/environment.md"
# Try custom headers
yarn leia examples/custom-headers.md -s Hello -t Sup -c Goodbye
npx leia examples/custom-headers.md -s Hello -t Sup -c Goodbye
# Try all other options, including legacy ones
yarn leia examples/basic-example.md --retry 2 --split-file --stdin --spawn
npx leia examples/basic-example.md --retry 2 --split-file --stdin --spawn
# Try a comma separated list of headers
yarn leia examples/custom-headers.md -s Blue,No,Yellow,Hello -t Sup -c Goodbye
npx leia examples/custom-headers.md -s Blue,No,Yellow,Hello -t Sup -c Goodbye
# Assess envvars
yarn leia examples/environment.md examples/basic-example.md --retry 4
npx leia examples/environment.md examples/basic-example.md --retry 4
10 changes: 5 additions & 5 deletions .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand All @@ -22,10 +22,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Lint Code
- name: Lint code
run: yarn lint
run: npm run lint
29 changes: 15 additions & 14 deletions .github/workflows/pr-shell-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
fail-fast: false
matrix:
os:
- macos-12
- macos-13
- macos-14
- ubuntu-22.04
- windows-2022
node-version:
- '16'
- '18'

steps:
# Install deps and cache
Expand All @@ -26,28 +27,28 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Run a few iterations of leia tests
- name: Test macOS shells from
if: ${{ runner.os == 'macOS' }}
run: |
yarn leia examples/basic-example.md --debug
yarn leia examples/basic-example.md --shell bash --debug
yarn leia examples/basic-example.md --shell zsh --debug
yarn leia examples/basic-example.md --shell sh --debug
npx leia examples/basic-example.md --debug
npx leia examples/basic-example.md --shell bash --debug
npx leia examples/basic-example.md --shell zsh --debug
npx leia examples/basic-example.md --shell sh --debug
- name: Test Linux shells
if: ${{ runner.os == 'Linux' }}
run: |
yarn leia examples/basic-example.md --debug
yarn leia examples/basic-example.md --shell bash --debug
yarn leia examples/basic-example.md --shell sh --debug
npx leia examples/basic-example.md --debug
npx leia examples/basic-example.md --shell bash --debug
npx leia examples/basic-example.md --shell sh --debug
- name: Test Windows BASH
if: ${{ runner.os == 'Windows' }}
shell: bash
run: yarn leia examples/basic-example.md --debug
run: npx leia examples/basic-example.md --debug
- name: Test Windows CMD
if: ${{ runner.os == 'Windows' }}
run: yarn leia examples/basic-cmd-example.md --debug
run: npx leia examples/basic-cmd-example.md --debug
14 changes: 8 additions & 6 deletions .github/workflows/pr-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ jobs:
env:
TERM: xterm
strategy:
fail-fast: false
matrix:
os:
- macos-12
- macos-13
- macos-14
- ubuntu-22.04
- windows-2022
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand All @@ -24,10 +26,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Run unit tests
- name: Run units tests
run: yarn test:unit
run: npm run test:unit
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand All @@ -26,17 +26,17 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Let's do tests rq just to make sure we dont push something that is fundamentally broken
- name: Lint code
run: yarn lint
run: npm run lint
- name: Run unit tests
run: yarn test:unit
run: npm run test:unit
- name: Run leia tests
run: yarn leia examples/basic-example.md
run: npx leia examples/basic-example.md

- name: Prepare release
uses: lando/prepare-release-action@v2
Expand All @@ -52,4 +52,4 @@ jobs:
echo "::notice title=Published ${{ github.ref_name }} to @${{ github.repository }}@${{ env.PRERELEASE_TAG }}::This is a pre-release published to the '${{ env.PRERELEASE_TAG }}' npm tag"
fi
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_DEPLOY_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_DEPLOY_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ coverage/

# NPM files
node_modules
yarn.lock

# Tests
*.leia.js
Expand Down
8 changes: 5 additions & 3 deletions .lando.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: leia
services:
node:
type: node:14
type: node:18
build:
- yarn
- npm ci
tooling:
node:
service: node
yarn:
npm:
service: node
npx:
service: node
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.0.0-beta.2 - [March 14, 2024](https://github.com/lando/leia/releases/tag/v1.0.0-beta.3)

* Deyarned

## v1.0.0-beta.1 - [August 19, 2023](https://github.com/lando/leia/releases/tag/v1.0.0-beta.1)

* Added more reasonably named environment variables. See [README.md](https://github.com/lando/leia#environment-variables) for details.
Expand Down
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ Leia will
```bash
# With npm
npm install @lando/leia

# With yarn
yarn add @lando/leia
```

## Basics
Expand All @@ -41,7 +38,7 @@ You can invoke `leia` as a command line tool or directly `require` it in a modul
### CLI

```bash
yarn leia
npx leia

Cleverly converts markdown files into mocha cli tests

Expand Down Expand Up @@ -113,7 +110,7 @@ By default our parser will look for a section that beings with the word "Testing
## Testing
```

You can customize the word(s) that `leia` will look for to identify the testing section(s) using the `--test-header` option. You can also run `yarn leia --help` to get a list of default words.
You can customize the word(s) that `leia` will look for to identify the testing section(s) using the `--test-header` option. You can also run `npm leia --help` to get a list of default words.

#### 3. A code block with at least one command and comment

Expand Down Expand Up @@ -179,15 +176,14 @@ We try to log all changes big and small in both [THE CHANGELOG](https://github.c

## Development

* Requires [Node 14+](https://nodejs.org/dist/latest-v14.x/)
* Prefers [Yarn](https://classic.yarnpkg.com/lang/en/docs/install)
* Requires [Node 18+](https://nodejs.org/dist/latest-v18.x/)

```bash
git clone https://github.com/lando/leia.git && cd leia
yarn install
npm install
```

If you dont' want to install Node 14 or Yarn for whatever reason you can install [Lando](https://docs.lando.dev/basics/installation.html) and use that:
If you dont' want to install Node 18 for whatever reason you can install [Lando](https://docs.lando.dev/basics/installation.html) and use that:

```bash
git clone https://github.com/lando/leia.git && cd leia
Expand All @@ -196,18 +192,18 @@ lando start

# Run commands
lando node
lando yarn
lando yarn leia
lando npm install
lando npx leia
```

## Testing

```bash
# Lint the code
yarn lint
npm run lint

# Run unit tests
yarn test:unit
npm run test:unit
```

## Releasing
Expand All @@ -229,7 +225,7 @@ Made with [contributors-img](https://contrib.rocks).
You can still install the older version of Leia eg `leia-parser`.

```bash
yarn add leia-parser
npm install leia-parser
```

And its documentation lives on [here](https://github.com/lando/leia/tree/v0.4.0).
Expand Down
8 changes: 4 additions & 4 deletions examples/test.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Run linting
yarn lint
npm run lint

# Run unit tests
yarn test:unit
npm run test:unit

# Clean up previous test
rm -f test/leia.readme.js

# Get the version of Leia
yarn leia --version
npx leia --version

# Generate tests from this README with some options
yarn leia README.md test -r 6 -o readme.js
npx leia README.md test -r 6 -o readme.js

# Validate the new test was created
cat test/leia.readme.js | grep 'id: leia'
Expand Down
Loading

0 comments on commit 372493d

Please sign in to comment.