Skip to content

Commit

Permalink
build: repo basic structure [EDS-269] (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevoss authored Jul 17, 2024
1 parent 5a657c6 commit ea7abf8
Show file tree
Hide file tree
Showing 16 changed files with 4,450 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/log-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Log Test

on: [workflow_dispatch]

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
log-test:
name: Log action test
runs-on: ubuntu-latest
if: startsWith( github.repository, 'elementor/' )
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Log action
uses: ./actions/log
with:
message: 'Hello, Universe!'
29 changes: 29 additions & 0 deletions .github/workflows/pr-name-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PR Linter
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pr_name_lint:
name: PR Name Linter
runs-on: ubuntu-latest
if: startsWith( github.repository, 'elementor/' )
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install Dependencies
run: npm install -g @commitlint/config-conventional@19 @commitlint/cli@19

- name: Run PR name linter
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
28 changes: 28 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR Checks

on: [pull_request]

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
name: Lint, Test and Build
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: 20.x

- name: Install Deps
run: npm ci

- name: Run Lint
run: npm run lint
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
.vscode/
.idea/
log/
.DS_Store/
tmp/

*.log
*.map
.env
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/coverage/**
**/dist/**
**/__snapshots__/**
package-lock.json
15 changes: 15 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"useTabs": true,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "all",
"overrides": [
{
"files": "*.md",
"options": {
"useTabs": false,
"tabWidth": 2
}
}
]
}
14 changes: 14 additions & 0 deletions actions/log/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Log
description: Log a message to the console

inputs:
message:
description: 'The message to log'
required: true

runs:
using: 'composite'
steps:
- name: Log message
shell: bash
run: npx zx@8 ./dist/index.js --message="${{inputs.message}}"
14 changes: 14 additions & 0 deletions actions/log/dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env zx

// actions/log/index.ts
import { echo, minimist } from "zx";
var args = minimist(process.argv.slice(2), {
string: ["message"],
default: {
message: "Hello, World!"
},
alias: {
m: "message"
}
});
echo(args.message);
15 changes: 15 additions & 0 deletions actions/log/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env zx

import { echo, minimist } from 'zx';

const args = minimist(process.argv.slice(2), {
string: ['message'],
default: {
message: 'Hello, World!',
},
alias: {
m: 'message',
},
});

echo(args.message);
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
extends: ['@commitlint/config-conventional'],
};
18 changes: 18 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';

export default [
{ files: ['**/*.{js,mjs,cjs,ts}'] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
ignores: [
'**/coverage/**',
'**/dist/**',
'**/node_modules/**',
'**/__snapshots__/**',
],
},
];
Loading

0 comments on commit ea7abf8

Please sign in to comment.