-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated composer.json to SilverStripe 4.1 stable.
Updated readme. Added changelog, code-of-conduct, contributing, build-tools and license files.
- Loading branch information
Showing
7 changed files
with
159 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Copyright (c) 2018, Roman Schmid | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name of SilverStripe nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY | ||
OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Build Tools | ||
|
||
This module uses [webpack](https://webpack.js.org/) to build JS and CSS files. | ||
This is in line with how the SilverStripe core-modules build their client-assets. | ||
|
||
## Writing CSS | ||
|
||
We use [SASS](http://sass-lang.com/) to write CSS. The build-tools include an auto-prefixer that will add browser-prefixes if needed. | ||
|
||
## Writing JavaScript | ||
|
||
JavaScript should be written as ES6. | ||
Plain JavaScript file should use the `.js` extension, while React components use `.jsx`. | ||
The files will be transpiled to a single (browser consumable) JavaScript file using webpack and babel. | ||
|
||
## Building JS and CSS | ||
|
||
First of all, you need to install the [yarn](https://yarnpkg.com/en/) package manager on your system. | ||
Then do the following: | ||
|
||
```bash | ||
cd ./vendor/bummzack/sortablefile | ||
yarn | ||
``` | ||
|
||
This will install all the npm dependencies in `node_modules` | ||
|
||
#### Development | ||
|
||
During development, you can use the following command to create a development build: | ||
|
||
```bash | ||
yarn run dev | ||
``` | ||
|
||
There's also a "watch" command that will watch your files and build new JS and CSS every time you change a file: | ||
|
||
```bash | ||
yarn run watch | ||
``` | ||
|
||
#### Release | ||
|
||
To create a release build, do: | ||
|
||
```bash | ||
yarn run build | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## 2.0.0 | ||
|
||
First release for SilverStripe 4.1 | ||
|
||
#### What happened to `has_many` support? | ||
|
||
Support for `has_many` relations has been dropped, since it can lead to a very bad user experience if a file can only be added to a single page. | ||
Imagine a user added an image to `Page A`, then adds the same image via _Add from files_ to `Page B`. | ||
The file would then be removed from `Page A`, without any warning or explanation, which is bad UX. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
When having discussions about this module in issues or pull request please adhere to the [SilverStripe Community Code of Conduct](https://docs.silverstripe.org/en/contributing/code_of_conduct). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Contributing to this module | ||
|
||
This module only moves forward as we each build the features we need. We love pull requests! | ||
|
||
### Here is a quick list of ways you can contribute: | ||
|
||
* __Test the latest code__. Install it and try it out. | ||
* __Submit issues and ideas__. These can be bugs, or ideas. Be descriptive and detailed. Its better to discuss and design ideas before writing code. Please first check the [list of existing issues](https://github.com/bummzack/sortablefile/issues) to make sure an identical one doesn't exist already. | ||
|
||
If you would like to contribute code, please [fork this project](https://github.com/bummzack/sortablefile). You | ||
can then make changes in feature branches via git, and submit pull requests, which will be reviewed and merged into the | ||
code base. If merge is not appropriate, instruction will be given on the best action(s) to take. | ||
|
||
## Development Guidelines | ||
|
||
We try to match [SilverStripe's guidelines](http://docs.silverstripe.org/en/contributing/) | ||
as closely as possible. In some ways our approach will differ, but it is a good idea to read their guidelines first. | ||
|
||
### PHP | ||
|
||
Write PSR-2 compliant PHP code and make sure your code matches the SilverStripe coding conventions by running: | ||
|
||
composer run-script lint | ||
|
||
for the above to work, you have to install [php_codesniffer](https://packagist.org/packages/squizlabs/php_codesniffer). | ||
By running the following command, you'd install the package globally: | ||
|
||
composer global require squizlabs/php_codesniffer:^3 | ||
|
||
### JavaScript & CSS | ||
|
||
Read about the [build tools](build-tools.md) involved to contribute CSS and JavaScript. | ||
|
||
* Use BEM for CSS Selectors. | ||
* **Always** create a release build before creating a PR that contains changes to CSS or JavaScript. PRs with development builds will not be accepted. | ||
|
||
## Workflow | ||
|
||
We use [Github Flow](https://guides.github.com/introduction/flow/) which basically means: | ||
|
||
1. Create your own fork | ||
2. Create a feature branch on your fork per feature or unit of work | ||
3. Submit a pull request | ||
|
||
### Branches | ||
|
||
Our branching scheme follows the one used by SilverStripe. `master` will always be the branch for newest development and separate branches will be created for older releases. | ||
|
||
Example: If the current development in `master` goes towards version 3, there will be a `2` and `1` branch for fixes to these older versions. If needed, branches for minor versions can be created as well (eg. a 2.x branch for work on a new minor release). | ||
|
||
### Releases | ||
|
||
Releases follow Semantic Versioning. Patches for specific older versions can be made by creating | ||
a branch from the appropriate tag. | ||
|
||
## Good development practices | ||
|
||
* Write a new unit test for a new bugs or features | ||
* Unit tests MUST pass before submitting new contributions | ||
* Maintain backwards compatibility, or provide migration scripts, and help | ||
* Full support of standard SilverStripe framework features | ||
* Prefer SilverStripe core framework features over 3rd-party add-ons | ||
* Graceful degradation of javascript | ||
* Make use of design patterns | ||
* Comment code thoroughly | ||
* Write and update documentation along with changes | ||
* Major changes need to be backed up with solid reasoning | ||
* Install an [EditorConfig](http://editorconfig.org/#download) plugin for your editor or IDE. |