Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump fstream from 1.0.11 to 1.0.12 #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .editorconfig.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# http://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120

[*.md]
trim_trailing_whitespace = false

[{*.yml,*.js,*.jsx,*.ss,*.scss,*.json}]
indent_size = 2
indent_style = space

[{.travis.yml,package.json}]
# The indent size used in the `package.json` file cannot be changed
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
indent_size = 2
indent_style = space
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/yarn.lock export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
node_modules/
15 changes: 15 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
inherit: true

build:
nodes:
analysis:
tests:
override: [php-scrutinizer-run]

checks:
php:
code_rating: true
duplication: true

filter:
paths: [src/*, tests/*]
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
language: php

dist: trusty

env:
global:
- COMPOSER_ROOT_VERSION=4.0.x-dev

matrix:
include:
- php: 7.1
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1

before_script:
# Init PHP
- phpenv rehash
- phpenv config-rm xdebug.ini

# Install composer dependencies
- composer validate
- composer require --no-update silverstripe/recipe-cms:1.0.6
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile

script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/php; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml tests/php; fi

after_success:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Change Log
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contributing

## Submitting issues

Please don't be scared to raise issues that you find while using this module, but please be sure to perform a quick search through open and closed ticket to see if the same (or similar) issue has already been raised. If you find an existing issue that has been closed, feel free to raise a new issue referencing the old, or you can request that the existing ticket be reopened.

[Raise an issue](https://github.com/silverstripe-terraformers/scaffolded-fields/issues)

## Contributing code

Please try your best to conform to PHPCS coding standard. We won't get mad if you don't, but it will make your pull requests go a lot faster.
12 changes: 12 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright (c)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. 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.

3. Neither the name of the copyright holder 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 HOLDER 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.
74 changes: 72 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,72 @@
# scaffolded-fields
Configure which scaffolded fields are kept and which are removed
# Scaffolded fields

Configure which scaffolded fields are kept and which are removed.

## Overview

SilverStripe CMS creates CMS fields out of the box for you which is great for a quick project start up as you don't have to do anything to define your CMS fields.
This is covered by the field scaffolder which generates these scaffolded fields.
Many projects however, will use customised CMS fields which do not need the scaffolded fields.
On the contrary. scaffolded fields are often a hindrance.

### Most notable cases

* inserting new fields to specific position
* changing the order of scaffolded
* changing the hierarchy of scaffolded

### Conclusion

* customising scaffolded fields takes more effort compared to defining them from scratch
* customising order of the scaffolded fields takes more effort compared to defining it from scratch

In such situations, it's preferable to simply remove scaffolded fields and redefine them in your project code.
This approach makes the CMS fields definition more readable as all fields are defined in one place.
Project code is also easier to maintain as you don't have to support code which looks up scaffolded fields so they could be customised or reordered.

## Installation

```
composer require silverstripe-terraformers/scaffolded-fields dev-master
```

* apply `Terraformers\ScaffoldedFields\Extension` to a data object of your choice
* provide field removal configuration

## Configuration

Specify which fields need to be kept and which should be removed. Configuration is a collection of rules.
Each rule consists of the following:

* property (`db`, `has_one`, `has_many`, `many_many` or `extra`)
* type (`keep` or `remove`), this is not required when `extra` property is used
* fields list of field names that the configuration applies to

#### Example configuration

```yml
DNADesign\Elemental\Models\BaseElement:
extensions:
- Terraformers\ScaffoldedFields\Extension
field_removal:
- # remove all db fields except Title and ShowTitle
property: db
type: keep
fields:
Title
ShowTitle
- # remove all has_one fields
property: has_one
type: keep
- # remove LinkTracking, FileTracking and BackLinkTracking fields from many_many
property: many_many
type: remove
fields:
LinkTracking
FileTracking
BackLinkTracking
- # remove Settings field (not part of any static property)
property: extra
fields:
Settings
```
4 changes: 4 additions & 0 deletions _config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

// You need this file if you don't have anything in the _config folder. If that folder exists
// and is not empty then you can delete this file.
Empty file added _config/config.yml
Empty file.
1 change: 1 addition & 0 deletions client/dist/js/bundle.js

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

1 change: 1 addition & 0 deletions client/dist/js/bundle.js.map

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

Empty file added client/dist/styles/bundle.css
Empty file.
1 change: 1 addition & 0 deletions client/dist/styles/bundle.css.map

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

5 changes: 5 additions & 0 deletions code-of-conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Contributor Code of Conduct

This project adheres to No Code of Conduct. We are all adults. We accept anyone's contributions. Nothing else matters.

For more information please visit the [No Code of Conduct](https://github.com/domgetter/NCoC) homepage.
48 changes: 48 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "terraformers/scaffolded-fields",
"description": "Configure which scaffolded fields are kept and which are removed.",
"type": "silverstripe-vendormodule",
"keywords": [
"silverstripe",
"CMS"
],
"license": "BSD-3-Clause",
"authors": [
{
"name": "SilverStripe Ltd"
},
{
"name": "Silverstripe Terraformers",
"email": "[email protected]"
}
],
"support": {
"issues": "https://github.com/silverstripe-terraformers/scaffolded-fields/issues"
},
"require": {
"php": "^7.1",
"silverstripe/vendor-plugin": "^1.0",
"silverstripe/framework": "^4.0",
"silverstripe/admin": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "^3.0"
},
"autoload": {
"psr-4": {
"Terraformers\\ScaffoldedFields\\": "src/",
"Terraformers\\ScaffoldedFields\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
},
"expose": [
"client/dist"
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
7 changes: 7 additions & 0 deletions docs/en/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Documentation
Add your documentation in the docs/en folder as markdown. Note the "en" refers to the langugae used in the documentation you provide.
If you documentation is vast, you can split it into many markdown files and sub folders.

Look over the [guidance on documentation](https://docs.silverstripe.org/en/contributing/documentation/)

Make sure to remove this readme in your actual module!
73 changes: 73 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "silverstripe-module-skeleton",
"description": "Description of your module",
"main": "./client/src/boot/index.js",
"author": "You",
"engines": {
"node": ">=10.x"
},
"scripts": {
"build": "yarn && yarn lint && NODE_ENV=production webpack -p --bail --progress",
"dev": "NODE_ENV=development webpack --progress",
"watch": "NODE_ENV=development webpack --watch --progress",
"css": "WEBPACK_CHILD=css npm run build",
"test": "jest",
"coverage": "jest --coverage",
"lock": "npm-shrinkwrap --dev",
"lint": "eslint client/src && sass-lint client/src",
"lint-js": "eslint client/src",
"lint-js-fix": "eslint client/src --fix",
"lint-sass": "sass-lint client/src"
},
"dependencies": {
"babel-polyfill": "6.7.4",
"react": "^16.8.3"
},
"devDependencies": {
"@silverstripe/eslint-config": "^0.0.5",
"@silverstripe/webpack-config": "^1.0.0",
"babel-jest": "^23.6.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.10.0",
"jest-cli": "^23.6.0"
},
"babel": {
"presets": [
"env",
"react"
],
"plugins": [
"transform-object-rest-spread"
]
},
"jest": {
"roots": [
"client/src"
],
"modulePaths": [
"client/src",
"../admin/client/src",
"../admin/node_modules",
"../silverstripe/admin/client/src",
"../silverstripe/admin/node_modules",
"../../silverstripe/admin/client/src",
"../../silverstripe/admin/node_modules"
],
"collectCoverageFrom": [
"**/*.{js,jsx}",
"!**/node_modules/**",
"!**/boot/**",
"!**/bundles/**",
"!**/legacy/**",
"!**/vendor/**",
"!**/*-test.{js,jsx}",
"!**/*-story.{js,jsx}"
],
"testMatch": [
"**/tests/**/*-test.js?(x)"
],
"transform": {
".*": "babel-jest"
}
}
}
11 changes: 11 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>

<!-- base rules are PSR-12 -->
<rule ref="PSR12" >
<!-- Current exclusions -->
<!--<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />-->
<!--<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />-->
</rule>
</ruleset>
13 changes: 13 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
<testsuite name="silverstripe-module/skeleton">
<directory>tests/</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
Loading