Skip to content

Commit 204aa98

Browse files
committed
Added module template
1 parent da2168b commit 204aa98

File tree

11 files changed

+362
-0
lines changed

11 files changed

+362
-0
lines changed

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This file is copied from config/drupal-module/.editorconfig in https://github.com/itk-dev/devops_itkdev-docker.
2+
# Feel free to edit the file, but consider making a pull request if you find a general issue with the file.
3+
4+
# EditorConfig is awesome: https://editorconfig.org
5+
6+
# top-most EditorConfig file
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = LF
12+
indent_size = 4
13+
indent_style = space
14+
insert_final_newline = true
15+
trim_trailing_whitespace = true
16+
17+
[*.{js,css,scss}]
18+
indent_size = 2
19+
20+
[*.{yml,yaml}]
21+
indent_size = 2
22+
23+
[config/sync/**/*.{yml,yaml}]
24+
indent_size = 2
25+
26+
[*.{php,install,module,theme}]
27+
indent_size = 2

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
COMPOSE_PROJECT_NAME=drupal_config_helper
2+
COMPOSE_DOMAIN=drupal_config_helper.local.itkdev.dk
3+
ITKDEV_TEMPLATE=drupal-module

.github/workflows/changelog.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/changelog.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Changelog
6+
###
7+
### Checks that changelog has been updated
8+
9+
name: Changelog
10+
11+
on:
12+
pull_request:
13+
14+
jobs:
15+
changelog:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 2
24+
25+
- name: Git fetch
26+
run: git fetch
27+
28+
- name: Check that changelog has been updated.
29+
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0

.github/workflows/composer.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/composer.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Composer
6+
###
7+
### Validates composer.json and checks that it's normalized.
8+
###
9+
### #### Assumptions
10+
###
11+
### 1. A docker compose service named `phpfpm` can be run and `composer` can be
12+
### run inside the `phpfpm` service.
13+
### 2. [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize)
14+
### is a dev requirement in `composer.json`:
15+
###
16+
### ``` shell
17+
### docker compose run --rm phpfpm composer require --dev ergebnis/composer-normalize
18+
### ```
19+
###
20+
### Normalize `composer.json` by running
21+
###
22+
### ``` shell
23+
### docker compose run --rm phpfpm composer normalize
24+
### ```
25+
26+
name: Composer
27+
28+
env:
29+
COMPOSE_USER: root
30+
31+
on:
32+
pull_request:
33+
push:
34+
branches:
35+
- main
36+
- develop
37+
38+
jobs:
39+
composer-validate:
40+
runs-on: ubuntu-latest
41+
strategy:
42+
fail-fast: false
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- name: Create docker network
47+
run: |
48+
docker network create frontend
49+
50+
- run: |
51+
docker compose run --rm phpfpm composer validate --strict
52+
53+
composer-normalized:
54+
runs-on: ubuntu-latest
55+
strategy:
56+
fail-fast: false
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Create docker network
61+
run: |
62+
docker network create frontend
63+
64+
- run: |
65+
docker compose run --rm phpfpm composer install
66+
docker compose run --rm phpfpm composer normalize --dry-run
67+
68+
composer-audit:
69+
runs-on: ubuntu-latest
70+
strategy:
71+
fail-fast: false
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Create docker network
76+
run: |
77+
docker network create frontend
78+
79+
- run: |
80+
docker compose run --rm phpfpm composer audit

.github/workflows/markdown.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/markdown.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Markdown
6+
###
7+
### Lints Markdown files (`**/*.md`) in the project.
8+
###
9+
### [markdownlint-cli configuration
10+
### files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration),
11+
### `.markdownlint.jsonc` and `.markdownlintignore`, control what is actually
12+
### linted and how.
13+
###
14+
### #### Assumptions
15+
###
16+
### 1. A docker compose service named `markdownlint` for running `markdownlint`
17+
### (from
18+
### [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli))
19+
### exists.
20+
21+
name: Markdown
22+
23+
on:
24+
pull_request:
25+
push:
26+
branches:
27+
- main
28+
- develop
29+
30+
jobs:
31+
markdown-lint:
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Create docker network
40+
run: |
41+
docker network create frontend
42+
43+
- run: |
44+
docker compose run --rm markdownlint markdownlint '**/*.md'

.github/workflows/php.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/drupal-module/php.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Drupal module PHP
6+
###
7+
### Checks that PHP code adheres to the [Drupal coding
8+
### standards](https://www.drupal.org/docs/develop/standards).
9+
###
10+
### #### Assumptions
11+
###
12+
### 1. A docker compose service named `phpfpm` can be run and `composer` can be
13+
### run inside the `phpfpm` service.
14+
### 2. [drupal/coder](https://www.drupal.org/project/coder) is a dev requirement
15+
### in `composer.json`:
16+
###
17+
### ``` shell
18+
### docker compose run --rm phpfpm composer require --dev drupal/coder
19+
### ```
20+
###
21+
### Clean up and check code by running
22+
###
23+
### ``` shell
24+
### docker compose run --rm phpfpm vendor/bin/phpcbf
25+
### docker compose run --rm phpfpm vendor/bin/phpcs
26+
### ```
27+
###
28+
### > [!NOTE]
29+
### > The template adds `.phpcs.xml.dist` as [a configuration file for
30+
### > PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file)
31+
### > and this makes it possible to override the actual configuration used in a
32+
### > project by adding a more important configuration file, e.g. `.phpcs.xml`.
33+
34+
name: PHP
35+
36+
env:
37+
COMPOSE_USER: root
38+
39+
on:
40+
pull_request:
41+
push:
42+
branches:
43+
- main
44+
- develop
45+
46+
jobs:
47+
coding-standards:
48+
name: PHP - Check Coding Standards
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- name: Create docker network
54+
run: |
55+
docker network create frontend
56+
57+
- run: |
58+
docker compose run --rm phpfpm composer install
59+
docker compose run --rm phpfpm vendor/bin/phpcs

.github/workflows/yaml.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/yaml.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### YAML
6+
###
7+
### Validates YAML files.
8+
###
9+
### #### Assumptions
10+
###
11+
### 1. A docker compose service named `prettier` for running
12+
### [Prettier](https://prettier.io/) exists.
13+
###
14+
### #### Symfony YAML
15+
###
16+
### Symfony's YAML config files use 4 spaces for indentation and single quotes.
17+
### Therefore we use a [Prettier configuration
18+
### file](https://prettier.io/docs/configuration), `.prettierrc.yaml`, to make
19+
### Prettier format YAML files in the `config/` folder like Symfony expects.
20+
21+
name: YAML
22+
23+
on:
24+
pull_request:
25+
push:
26+
branches:
27+
- main
28+
- develop
29+
30+
jobs:
31+
yaml-lint:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Create docker network
37+
run: |
38+
docker network create frontend
39+
40+
- run: |
41+
docker compose run --rm prettier '**/*.{yml,yaml}' --check

.markdownlint.jsonc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// This file is copied from config/markdown/.markdownlint.jsonc in https://github.com/itk-dev/devops_itkdev-docker.
2+
// Feel free to edit the file, but consider making a pull request if you find a general issue with the file.
3+
4+
// markdownlint-cli configuration file (cf. https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration)
15
{
26
"default": true,
37
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
@@ -9,5 +13,10 @@
913
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
1014
"no-duplicate-heading": {
1115
"siblings_only": true
16+
},
17+
// https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections#creating-a-collapsed-section
18+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md033.md
19+
"no-inline-html": {
20+
"allowed_elements": ["details", "summary"]
1221
}
1322
}

.markdownlintignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is copied from config/markdown/.markdownlintignore in https://github.com/itk-dev/devops_itkdev-docker.
2+
# Feel free to edit the file, but consider making a pull request if you find a general issue with the file.
3+
4+
# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
5+
vendor/
6+
node_modules/
7+
LICENSE.md
8+
# Drupal
9+
web/*.md
10+
web/core/
11+
web/libraries/
12+
web/*/contrib/

.phpcs.xml.dist

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0"?>
2+
<!-- This file is copied from config/drupal-module/php/.phpcs.xml.dist in https://github.com/itk-dev/devops_itkdev-docker. -->
3+
<!-- Feel free to edit the file, but consider making a pull request if you find a general issue with the file. -->
4+
5+
<ruleset name="PHP_CodeSniffer">
6+
<description>The coding standard.</description>
7+
8+
<file>.</file>
9+
10+
<!-- Exclude generated files -->
11+
<exclude-pattern>node_modules</exclude-pattern>
12+
<exclude-pattern>vendor</exclude-pattern>
13+
<exclude-pattern>*.css</exclude-pattern>
14+
<exclude-pattern>*.js</exclude-pattern>
15+
16+
<arg value="p"/>
17+
18+
<arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,yml"/>
19+
20+
<config name="drupal_core_version" value="11"/>
21+
22+
<rule ref="Drupal">
23+
<!-- <exclude name="Drupal.Files.TxtFileLineLength.TooLong"/> -->
24+
<!-- We want to be able to use "package" and "version" in our custom modules -->
25+
<exclude name="Drupal.InfoFiles.AutoAddedKeys.Project"/>
26+
<exclude name="Drupal.InfoFiles.AutoAddedKeys.Version"/>
27+
<exclude name="Drupal.NamingConventions.ValidEnumCase.NoUpperAcronyms" />
28+
<exclude name="Drupal.NamingConventions.ValidEnumCase.NoUnderscores" />
29+
</rule>
30+
<rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
31+
</ruleset>

0 commit comments

Comments
 (0)