Skip to content
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
28 changes: 25 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@ jobs:
#
# This step is not required for syncing your docs to ReadMe!
- name: Rebuild GitHub Action for testing purposes
run: npm ci && npm run build:gha
# We manually invoke `bin/write-gha-pjson.js` here because
# GitHub Actions does not support `pre` scripts for local actions.
run: npm ci && npm run build:gha && bin/write-gha-pjson.js
working-directory: rdme-repo

- name: Run root command
uses: ./rdme-repo/

- name: Run `openapi validate` command
uses: ./rdme-repo/
with:
Expand All @@ -98,11 +103,28 @@ jobs:

- name: Assert that previous validation step failed
if: ${{ steps.openapi-validate-fail.outcome == 'failure' }}
run: echo "The validation in the previous step failed as expected."
run: echo "The previous step failed as expected."

- name: Throw error if previous validation step did not fail
if: ${{ steps.openapi-validate-fail.outcome == 'success' }}
run: echo "::error::Expected validation in previous step to fail" && exit 1
run: echo "::error::Expected previous step to fail" && exit 1

# The `help` command is only available in the CLI.
# This step should fail because `help` does not exist in GitHub Actions
- name: Run `help`
uses: ./rdme-repo/
id: help-fail
continue-on-error: true
with:
rdme: help

- name: Assert that previous step failed
if: ${{ steps.help-fail.outcome == 'failure' }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat

run: echo "The previous step failed as expected."

- name: Throw error if previous step did not fail
if: ${{ steps.help-fail.outcome == 'success' }}
run: echo "::error::Expected previous step to fail" && exit 1

# this is a test to ensure that the rdme github action can run properly
# the way that our users invoke it
Expand Down
101 changes: 49 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-replace": "^6.0.1",
"@rollup/plugin-terser": "^0.4.4",
"@types/configstore": "^6.0.0",
"@types/debug": "^4.1.7",
"@types/js-yaml": "^4.0.5",
Expand All @@ -103,6 +102,7 @@
"openapi-types": "^12.1.3",
"prettier": "^3.0.2",
"rollup": "^4.3.0",
"rollup-plugin-esbuild": "^6.2.0",
"tsx": "^4.19.2",
"type-fest": "^4.3.1",
"typescript": "^5.1.6",
Expand All @@ -112,7 +112,6 @@
"build": "tsc && cp package.json dist/package.json",
"build:docs": "oclif readme --multi --output-dir documentation/commands --no-aliases",
"build:gha": "npm run build && rollup --config",
"build:gha:prod": "npm run build:gha -- --environment PRODUCTION_BUILD",
"lint": "alex . && knip && npm run lint:ts && npm run prettier && npm run schemas:check",
"lint:ts": "eslint . --ext .js,.ts",
"prebuild": "rm -rf dist/ && rm -f src/package.json && ln package.json src/package.json",
Expand All @@ -123,7 +122,7 @@
"schemas:check": "./bin/json-schema-store.js",
"schemas:write": "./bin/json-schema-store.js --update",
"test": "vitest run --coverage",
"version": "npm run build:gha:prod && oclif manifest && npm run build:docs"
"version": "npm run build:gha && oclif manifest && npm run build:docs"
},
"commitlint": {
"extends": [
Expand Down
12 changes: 3 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// @ts-check
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this file be TS?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it requires installing a whole add'l dependency so i opted not to: https://rollupjs.org/command-line-interface/#config-intellisense

import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';
import { defineConfig } from 'rollup';

const isProductionBuild = process.env.PRODUCTION_BUILD === 'true';
import { minify } from 'rollup-plugin-esbuild';

const basePlugins = [
commonjs(),
Expand All @@ -16,14 +15,9 @@ const basePlugins = [
exportConditions: ['node'],
preferBuiltins: true,
}),
minify(),
];

// only minify when doing a "production" build (i.e., for a release)
// it takes a lot longer!
if (isProductionBuild) {
basePlugins.push(terser());
}

export default defineConfig([
{
input: 'bin/run.js',
Expand Down
Loading