Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brad-ps committed May 2, 2024
0 parents commit ae45660
Show file tree
Hide file tree
Showing 39 changed files with 454 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# For more information about the properties used in this file,
# please see the EditorConfig documentation:
# https://editorconfig.org/

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

[*.md]
trim_trailing_whitespace = false

[*.{yml,js,json,css,scss}]
indent_size = 2

[composer.json]
indent_size = 4
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@silverstripe/eslint-config/.eslintrc');
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/tests export-ignore
/client/src export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
9 changes: 9 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# CI

The `ci.yml` file uses [`silverstripe/gha-ci`](https://github.com/silverstripe/gha-ci/) which does its best to identify which types of tests need to be run for your project, against which version of `silverstripe/installer`, with which PHP versions.

If you find it isn't quite getting it right, there are configuration options available for you to define exactly what jobs you want to be run. See the readme of the gha-ci repository for more information.

It is recommended that you make this run on a cron, referred to in GitHub Actions as a "schedule". See [the GitHub Actions documentation](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule) for details.

Make sure to remove this readme in your actual module!
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
/vendor/
.DS_Store
composer.lock
*.js.map
*.css.map
yarn-error.log
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

- Maintenance on this module is a shared effort of those who use it
- To contribute improvements to the code, ensure you raise a pull request and discuss with the module maintainers
- Please follow the Silverstripe CMS [code contribution guidelines](https://docs.silverstripe.org/en/contributing/code/) and [Module Standard](https://docs.silverstripe.org/en/developer_guides/extending/modules/#module-standard)
- Supply documentation that follows the [GitHub Flavored Markdown](https://help.github.com/articles/markdown-basics/) conventions
- When having discussions about this module in issues or pull request please adhere to the [Silverstripe CMS Community Code of Conduct](https://docs.silverstripe.org/en/project_governance/code_of_conduct/)

## Contributor license agreement

By supplying code to this module in patches, tickets and pull requests, you agree to assign copyright
of that code to MODULE_COPYRIGHT_HOLDER_HERE., on the condition that these code changes are released under the
same BSD license as the original module. We ask for this so that the ownership in the license is clear
and unambiguous. By releasing this code under a permissive license such as BSD, this copyright assignment
won't prevent you from using the code in any way you see fit.
12 changes: 12 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright (c) 2024 PS/digital
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.
92 changes: 92 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<<<<<<< HEAD
# Silverstripe CMS supported module skeleton

A useful skeleton to more easily create a [Silverstripe CMS Module](https://docs.silverstripe.org/en/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

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 Silversripe CMS module.

- 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 ultimately delete these README files when you have added your code
- 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 install` (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 your css or js and are using components, injector, scss variables, etc from `silverstripe/admin`:
- Ensure that `silverstripe/admin` is installed with `composer install --prefer-source` instead of the default `--prefer-dist` (you can use `composer reinstall silverstripe/admin --prefer-source` if you already installed it)
- If you are relying on additional dependencies from `silverstripe/admin` instead of adding them as dependencies in your `package.json` file, you need to install third party dependencies in `silverstripe/admin` by running `yarn install` in the `vendor/silverstripe/admin/` directory.
- Start developing your module!

## License

See [License](LICENSE.md)

This module template defaults to using the "BSD-3-Clause" license. The BSD-3 license is one of the most
permissive open-source license and is used by most Silverstripe CMS module.

To publish your module under a different license:

- update the [`license.md`](LICENSE.md) file
- update the `license' key in your [`composer.json`](composer.json).

You can use [choosealicense.com](https://choosealicense.com) to help you pick a suitable license for your project.

You do not need to keep this section in your README file - the `LICENSE.md` file is sufficient.

## Installation

Replace `silverstripe-module/skeleton` in the command below with the composer name of your module.

```sh
composer require silverstripe-module/skeleton
```

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

## Documentation

- [Documentation readme](docs/en/README.md)

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.

## Example configuration

If your module makes use of the config API in Silverstripe CMS it's a good idea to provide an example config
here that will get the module working out of the box and expose the user to the possible configuration options.
Though note that in many cases simply linking to the documentation is enough.

Provide a syntax-highlighted code examples where possible.

```yaml
Page:
config_option: true
another_config:
- item1
- item2
```
=======
# user-help
>>>>>>> f19b33180babf8c59913929095060d00f67907b9
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.
1 change: 1 addition & 0 deletions _config/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# see https://docs.silverstripe.org/en/developer_guides/configuration/configuration/
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/styles/bundle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.example-component{display:block}
7 changes: 7 additions & 0 deletions client/src/boot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# JavaScript bundle entrypoint

Put your initialisation scripts in here.

See the [Silverstripe CMS javascript documentation](https://docs.silverstripe.org/en/developer_guides/customising_the_admin_interface/javascript_development/)

Make sure to remove this readme in your actual module!
6 changes: 6 additions & 0 deletions client/src/boot/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* global window */
import registerComponents from 'boot/registerComponents';

window.document.addEventListener('DOMContentLoaded', () => {
registerComponents();
});
9 changes: 9 additions & 0 deletions client/src/boot/registerComponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Injector from 'lib/Injector';
import ExampleComponent from 'components/ExampleComponent/ExampleComponent';

export default () => {
Injector.component.registerMany({
// List your React components here so Injector is aware of them
ExampleComponent
});
};
7 changes: 7 additions & 0 deletions client/src/bundles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# JavaScript bundles

Put your bundle.js file here, pointing to your boot files and legacy scripts.

See the [Silverstripe CMS javascript documentation](https://docs.silverstripe.org/en/developer_guides/customising_the_admin_interface/javascript_development/)

Make sure to remove this readme in your actual module!
5 changes: 5 additions & 0 deletions client/src/bundles/bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Include any legacy Entwine wrappers
import 'entwine/example-file';

// Include boot entrypoint
import 'boot';
7 changes: 7 additions & 0 deletions client/src/components/ExampleComponent/ExampleComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

const ExampleComponent = () => (
<div className="example-component">This is an example</div>
);

export default ExampleComponent;
3 changes: 3 additions & 0 deletions client/src/components/ExampleComponent/ExampleComponent.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.example-component {
display: block;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

/* global jest, test, expect */

import React from 'react';
import ExampleComponent from '../ExampleComponent';
import { render } from '@testing-library/react';

test('ExampleComponent renders', async () => {
const { container } = render(<ExampleComponent/>);
const options = container.querySelectorAll('.example-component');
expect(options).toHaveLength(1);
});
7 changes: 7 additions & 0 deletions client/src/components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# React components

Put any React components in here.

See the [Silverstripe CMS react documentation](https://docs.silverstripe.org/en/developer_guides/customising_the_admin_interface/reactjs_redux_and_graphql/)

Make sure to remove this readme in your actual module!
8 changes: 8 additions & 0 deletions client/src/entwine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Entwine wrappers

Put any Entwine wrappers in here to render React components in non-React controlled areas, or
to interact with parts of the Silverstripe CMS that are not React driven yet.

See the [Silverstripe CMS enwtine documentation](https://docs.silverstripe.org/en/developer_guides/customising_the_admin_interface/jquery_entwine/)

Make sure to remove this readme in your actual module!
8 changes: 8 additions & 0 deletions client/src/entwine/example-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

/* global jQuery */

(function ($) {
$(document).ready(() => {
// your code here.
});
}(jQuery));
5 changes: 5 additions & 0 deletions client/src/styles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SCSS bundles

Put your SCSS bundle files here, importing variable sheets and each of the SCSS stylesheets.

Make sure to remove this readme in your actual module!
1 change: 1 addition & 0 deletions client/src/styles/admin/pages/_pages.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// There would be some css changes relevant to something in the CMS pages admin
8 changes: 8 additions & 0 deletions client/src/styles/bundle.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Import core variables from silverstripe/admin
@import 'variables';

// Import your SCSS stylesheets using relative paths from "components"
@import '../components/ExampleComponent/ExampleComponent.scss';

// Import other legacy SCSS stylesheets that don't relate to react components
@import 'admin/pages/pages';
32 changes: 32 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "plasticstudio/user-help",
"description": "Provides editable help features for users",
"type": "silverstripe-vendormodule",
"keywords": [
"silverstripe",
"CMS"
],
"license": "BSD-3-Clause",
"require": {
"silverstripe/recipe-cms": "~4 || ^5",
"silverstripe/framework": "^4 || ^5",
"silverstripe/admin": "^1 || ^2"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.7"
},
"autoload": {
"psr-4": {
"SilverStripeModule\\Skeleton\\": "src/",
"SilverStripeModule\\Skeleton\\Tests\\": "tests/php/"
}
},
"extra": {
"expose": [
"client/dist"
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
8 changes: 8 additions & 0 deletions docs/en/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Documentation

Add your documentation in the `docs/en/` folder as markdown. Note the "en/" part of the path refers to the language (English in this case) used in the documentation you provide.
If your 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!
Loading

0 comments on commit ae45660

Please sign in to comment.