Skip to content

Commit

Permalink
chore: add test workflow
Browse files Browse the repository at this point in the history
* chore: add test workflow

* chore: more cleanup
  • Loading branch information
innerdvations authored May 7, 2024
1 parent 65de756 commit c1cf014
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 289 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 'Tests'

on:
push:
branches:
- main
pull_request: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
lint-build:
name: 'lint & build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: lts/*
- run: corepack enable && pnpm --version
- run: pnpm install
- run: pnpm lint
- run: pnpm prettier:check
- run: pnpm test:ts
- run: pnpm build
- uses: actions/upload-artifact@v3
name: Cache build output
with:
name: build-output
path: |
bin/
dist/
# test-unit:
# needs: 'lint-build'
# name: 'test:unit (${{ matrix.node }})'
# runs-on: ubuntu-latest
# strategy:
# # A test failing on windows doesn't mean it'll fail on macos. It's useful to let all tests run to its completion to get the full picture
# fail-fast: false
# matrix:
# node: [18, 20]
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v3
# - uses: actions/setup-node@v4
# with:
# cache: pnpm
# node-version: ${{ matrix.node }}
# - run: corepack enable && pnpm --version
# - run: pnpm install
# - uses: actions/download-artifact@v3
# name: Restore build output
# with:
# name: build-output
# - run: pnpm test:unit
13 changes: 1 addition & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,18 @@
},
"dependencies": {
"@strapi/pack-up": "5.0.0",
"@types/inquirer": "8.2.10",
"@types/prompts": "2.4.9",
"boxen": "5.1.2",
"chalk": "4.1.2",
"chokidar": "3.6.0",
"commander": "8.3.0",
"concurrently": "^8.2.2",
"esbuild": "0.20.2",
"esbuild-register": "3.5.0",
"fsevents": "^2.3.3",
"get-latest-version": "5.1.0",
"git-url-parse": "13.1.1",
"ini": "4.1.2",
"inquirer": "8.2.5",
"lodash": "4.17.21",
"nodemon": "^3.1.0",
"ora": "5.4.1",
"outdent": "0.8.0",
"pkg-up": "3.1.0",
"prettier": "2.8.8",
"prettier-plugin-packagejson": "2.4.14",
"prompts": "2.4.2",
"typescript": "5.4.4",
"yup": "0.32.9"
},
Expand All @@ -90,11 +81,9 @@
"@swc/core": "^1.4.13",
"@swc/jest": "^0.2.36",
"@types/git-url-parse": "9.0.3",
"@types/ini": "4.1.0",
"@types/jest": "^29.5.12",
"@types/nodemon": "^1.19.6",
"@types/prettier": "^2.0.0",
"@types/prompts": "2.4.9",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"eslint": "^8.56.0",
Expand Down
109 changes: 5 additions & 104 deletions pnpm-lock.yaml

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

12 changes: 6 additions & 6 deletions src/cli/commands/plugin/init/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ const PLUGIN_TEMPLATE = defineTemplate(async ({ logger, gitConfig, packagePath }
name: 'repo',
type: 'text',
message: 'git url',
validate(v) {
if (!v) {
validate(val: unknown) {
if (!val) {
return true;
}

try {
const result = gitUrlParse(v);
const result = gitUrlParse(val as any);

repo = { source: result.source, owner: result.owner, name: result.name };

Expand All @@ -133,12 +133,12 @@ const PLUGIN_TEMPLATE = defineTemplate(async ({ logger, gitConfig, packagePath }
type: 'text',
message: 'plugin name',
initial: () => repo?.name ?? '',
validate(v) {
if (!v) {
validate(val: unknown) {
if (!val || typeof val !== 'string') {
return 'package name is required';
}

const match = PACKAGE_NAME_REGEXP.exec(v);
const match = PACKAGE_NAME_REGEXP.exec(val);

if (!match) {
return 'invalid package name';
Expand Down
Loading

0 comments on commit c1cf014

Please sign in to comment.