Skip to content

Commit

Permalink
Initial composer setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirish committed Aug 27, 2022
1 parent 1213af8 commit 00948e5
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 75 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: 'BUG '
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: 'FEATURE '
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

name: "CI"

jobs:
tests:
name: "Tests"

runs-on: "ubuntu-latest"

env:
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip

services:
mysql:
image: "mysql:5.7"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: test_db
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.php_extensions }}"
coverage: "xdebug"

- name: "Start mysql service"
run: "sudo /etc/init.d/mysql start"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
with:
path: "~/.composer/cache"
key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}"
restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install dependencies with composer"
run: "composer install --no-ansi --no-interaction --no-progress"

- name: "Run tests with phpunit/phpunit"
env:
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload coverage results to CodeCov"
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml # optional
flags: unittests # optional

- name: "Run tests with squizlabs/php_codesniffer"
run: "vendor/bin/phpcs -s --report=summary --standard=phpcs.xml.dist --extensions=php,inc --ignore=autoload.php --ignore=vendor/ src/ tests/"
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c)
Copyright (c) Dynamic, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
82 changes: 20 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,21 @@
# SilverStripe supported module skeleton

A useful skeleton to more easily create a [Silverstripe Module](https://docs.silverstripe.org/en/4/developer_guides/extending/modules/) that conform to the
[Module Standard](https://docs.silverstripe.org/en/developer_guides/extending/modules/#module-standard).

This readme contains descriptions of the parts of this module base you should customise to meet you own module needs.
For example, the module name in the H1 above should be you own module name, and the description text you are reading now
is where you should provide a good short explanation of what your module does.

Where possible we have included default text that can be included as is into your module and indicated in
other places where you need to customise it

Below is a template of the sections of your readme.md you should ideally include to met the Module Standard
and help others make use of your modules.

### Steps to prepare this module for your own use:

- Clone this repository into a folder
- Add your name/organisation to `LICENSE.md`
- Update this readme with information about your module. Ensure sections that aren't relevant are deleted and
placeholders are edited where relevant
- Review the README files in the various provided directories. You should replace these with `.gitkeep` or delete the
directories
- Update the module's `composer.json` with your requirements and package name
- Update (or remove) `package.json` with your requirements and package name. Run `yarn` (or remove `yarn.lock`) to
ensure dependencies resolve correctly
- Clear the git history by running `rm -rf .git && git init`
- Add and push to a VCS repository
- Either [publish](https://getcomposer.org/doc/02-libraries.md#publishing-to-packagist) the module on packagist.org, or add a [custom repository](https://getcomposer.org/doc/02-libraries.md#publishing-to-a-vcs) to your main `composer.json`
- Require the module in your main `composer.json`
- If you need to build a JS client
- Ensure that `vendor/silverstripe/admin` is installed with `composer install --prefer-source` instead of the default `--prefer-dist`. You may need to first remove the module from the vendor folder.
- Install third party dependencies in your module AND in `vendor/silverstripe/admin` by running `yarn install` in both locations
- Start developing your module!
# SilverStripe Elemental Locations

A locations block for Silverstripe. Display one or more locations on a map.

## Requirements

* SilverStripe ^4.0
* [Yarn](https://yarnpkg.com/lang/en/), [NodeJS](https://nodejs.org/en/) (6.x) and [npm](https://npmjs.com) (for building
frontend assets)
* Other module
* Other server requirement
* Etc
- dnadesign/silverstripe-elemental: ^4.8

## Installation
Add some installation instructions here, having a 1 line composer copy and paste is useful.
Here is a composer command to create a new module project. Ensure you read the
['publishing a module'](https://docs.silverstripe.org/en/developer_guides/extending/how_tos/publish_a_module/) guide
and update your module's composer.json to designate your code as a SilverStripe module.

```
composer require silverstripe-module/skeleton 4.x-dev
composer require dynamic/silverstripe-elemental-locations
```

**Note:** When you have completed your module, submit it to Packagist or add it as a VCS repository to your
project's composer.json, pointing to the private repository URL.

## License
See [License](license.md)

We have included a 3-clause BSD license you can use as a default. We advocate for the BSD license as
We have included a 3-clause BSD license you can use as a default. We advocate for the BSD license as
it is one of the most permissive and open licenses.

Feel free to alter the [license.md](license.md) to suit if you wan to use an alternative license.
Expand All @@ -67,7 +24,7 @@ You can use [choosealicense.com](http://choosealicense.com) to help pick a suita
## Documentation
* [Documentation readme](docs/en/readme.md)

Add links into your docs/<language> folder here unless your module only requires minimal documentation
Add links into your docs/<language> folder here unless your module only requires minimal documentation
in that case, add here and remove the docs folder. You might use this as a quick table of content if you
mhave multiple documentation pages.

Expand All @@ -84,26 +41,27 @@ Page:
another_config:
- item1
- item2

```

## Maintainers
* Person here <[email protected]>
* Another maintainer <[email protected]>


* [Dynamic](http://www.dynamicagency.com) (<[email protected]>)


## Bugtracker
Bugs are tracked in the issues section of this repository. Before submitting an issue please read over
existing issues to ensure yours is unique.
Bugs are tracked in the issues section of this repository. Before submitting an issue please read over
existing issues to ensure yours is unique.

If the issue does look like a new bug:

- Create a new issue
- Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots
- Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots
and screencasts can help here.
- Describe your environment as detailed as possible: SilverStripe version, Browser, PHP version,
- Describe your environment as detailed as possible: SilverStripe version, Browser, PHP version,
Operating System, any installed SilverStripe modules.

Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker.

## Development and contribution
If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.
21 changes: 9 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
{
"name": "silverstripe-module/skeleton",
"description": "A skeleton for SilverStripe modules.",
"name": "dynamic/silverstripe-elemental-locations",
"description": "A locations block for Silverstripe. Display one or more locations on a map.",
"type": "silverstripe-vendormodule",
"keywords": [
"silverstripe",
"CMS"
],
"license": "BSD-3-Clause",
"require": {
"silverstripe/framework": "^4.0",
"silverstripe/admin": "^1.0"
"dnadesign/silverstripe-elemental": "^4.8",
"symbiote/silverstripe-addressable": "^5.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"silverstripe/recipe-testing": "^2",
"squizlabs/php_codesniffer": "^3.0"
},
"autoload": {
"psr-4": {
"SilverStripeModule\\Skeleton\\": "src/",
"SilverStripeModule\\Skeleton\\Tests\\": "tests/"
"Dynamic\\Elements\\Locations\\": "src/",
"Dynamic\\Elements\\Blog\\Locations\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
},
"expose": [
"client/dist"
]
"dev-master": "1.x-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down

0 comments on commit 00948e5

Please sign in to comment.