Skip to content

Commit

Permalink
init blud
Browse files Browse the repository at this point in the history
  • Loading branch information
m2de committed Oct 5, 2018
0 parents commit 0681fff
Show file tree
Hide file tree
Showing 21 changed files with 369 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
"es2015-rollup"
],
"plugins": [
"transform-object-rest-spread"
]
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
Empty file added .eslintignore
Empty file.
33 changes: 33 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"rules": {
"semi": [
"error",
"never"
],
"indent": [
"error",
4
],
"no-console": 1,
"radix": 0,
"vue/html-indent": ["error", 4]
},
"parserOptions": {
"parser": "babel-eslint",
"ecmaVersion": 6,
"sourceType": "module",
"impliedStrict": true
},
"env": {
"es6": true,
"browser": true,
"node": true
},
"extends": [
"plugin:vue/recommended",
"airbnb-base"
],
"plugins": [
"vue"
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/vendor/
/node_modules/
/dist-js/
.vs
20 changes: 20 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"*.php": [
"./vendor/bin/phpcs"
],
"*.js": [
"eslint"
],
"*.vue": [
"eslint"
],
"*.md": [
"markdownlint"
],
"*.json": [
"jsonlint"
],
".*rc": [
"jsonlint"
]
}
4 changes: 4 additions & 0 deletions .markdownlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"default": true,
"line-length": false
}
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!dist
!readme.md
!license
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 thesold

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Boilerplate repository for creating PHP Laravel and JS Vue NPM Packages

This boilderplate is ready to be published to Packagist and NPM JS.

## Usage

Simply fork this repository and customise. Search and Replace (case-sensitive) `Dewsign` and `NovaBlog` as well as `dewsign` and `nova-blog` to get started.

## Publishing

Always use `npm version (major|minor|patch)` to publish new versions (even when working with PHP). This will automatically create the git tag for you which Packagist will then pick up for version publishing.
31 changes: 31 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "dewsign/nova-blog",
"description": "Boilerplate repository for creating new Laravel or Javascript/Vue NPM packages",
"type": "boilerplate",
"license": "MIT",
"authors": [
{
"name": "Marco Mark",
"email": "m2de@outlook.com"
}
],
"require": {
"php": ">=7.0.0",
"laravel/framework": ">=5.0.0"
},
"require-dev": {
"squizlabs/php_codesniffer": ">=3.1"
},
"autoload": {
"psr-4": {
"Dewsign\\NovaBlog\\": "src-php/"
}
},
"extra":{
"laravel": {
"providers": [
"Dewsign\\NovaBlog\\Providers\\PackageServiceProvider"
]
}
}
}
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@dewsign/nova-blog",
"version": "1.0.0",
"description": "Boilerplate repository for creating new Laravel or Javascript/Vue NPM packages",
"main": "dist-js/index.js",
"scripts": {
"build": "rollup -c",
"watch": "rollup -mwc",
"precommit": "lint-staged",
"prepublish": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dewsign/nova-blog.git"
},
"keywords": [
"boilerplate"
],
"author": "Marco Mark <m2de@outlook.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/dewsign/nova-blog/issues"
},
"homepage": "https://github.com/dewsign/nova-blog#readme",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015-rollup": "^3.0.0",
"eslint": "^5.1.0",
"eslint-config-airbnb-base": "^13.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-vue": "^4.7.0",
"husky": "^0.14.3",
"jsonlint": "^1.6.3",
"lint-staged": "^7.2.0",
"markdownlint-cli": "^0.11.0",
"rollup": "^0.63.2",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-vue": "^4.3.1",
"vue-template-compiler": "^2.5.16"
},
"dependencies": {}
}
58 changes: 58 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0"?>
<ruleset name="PHP PSR-2 Standards">

<!--
The name attribute of the ruleset tag is displayed
when running PHP_CodeSniffer with the -v command line
argument. The description tag below is not displayed anywhere
except in this file, so it can contain information for
developers who may change this file in the future.
-->
<description>The PHP Coding Standards</description>

<!--
If no files or directories are specified on the command line
your custom standard can specify what files should be checked
instead.
Note that specifying any file or directory path
on the command line will ignore all file tags.
-->
<file>*/*.php</file>

<!--
You can hard-code ignore patterns directly into your
custom standard so you don't have to specify the
patterns on the command line.
-->
<exclude-pattern>*/autoload.php</exclude-pattern>
<exclude-pattern>*/docs/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/database/*</exclude-pattern>

<!--
You can hard-code command line values into your custom standard.
Note that this does not work for the command line values:
-v[v][v], -l, -d, -sniffs and -standard
The following tags are equivalent to the command line arguments:
-p
-->
<arg name="report" value="full"/>
<arg name="colors"/>
<arg value="p"/>

<!--
You can hard-code custom php.ini settings into your custom standard.
The following tag sets the memory limit to 128M.
-->
<ini name="memory_limit" value="128M"/>

<!--
Include all sniffs in the PEAR standard. Note that the
path to the standard does not have to be specified as the
PEAR standard exists inside the PHP_CodeSniffer install
directory.
-->
<rule ref="PSR2"/>

</ruleset>
17 changes: 17 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import RollupPluginVue from 'rollup-plugin-vue'
import RollupPluginBabel from 'rollup-plugin-babel'

export default {
input: 'src-js/index.js',
output: {
file: 'dist-js/index.js',
format: 'cjs',
},
external: [
'vue',
],
plugins: [
RollupPluginVue(),
RollupPluginBabel(),
],
}
1 change: 1 addition & 0 deletions src-js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {}
Empty file.
Empty file.
Empty file.
104 changes: 104 additions & 0 deletions src-php/Providers/PackageServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php

namespace Dewsign\NovaBlog\Providers;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class PackageServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot(Router $router)
{
$this->bootViews();
$this->bootAssets();
$this->bootCommands();
$this->publishDatabaseFiles();
$this->registerMiddleware();
}

/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}

/**
* Register the artisan packages' terminal commands
*
* @return void
*/
private function bootCommands()
{
if ($this->app->runningInConsole()) {
$this->commands([
// MyCommand::class,
]);
}
}

/**
* Load custom views
*
* @return void
*/
private function bootViews()
{
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'dewsign');
$this->publishes([
__DIR__.'/../Resources/views' => resource_path('views/vendor/dewsign'),
]);
}

/**
* Define publishable assets
*
* @return void
*/
private function bootAssets()
{
$this->publishes([
__DIR__.'/../Resources/assets/js' => resource_path('assets/js/vendor/dewsign'),
], 'js');
}

/**
* Make middleware available to routes
*
* @param Router $router
* @return void
*/
private function registerMiddleware(Router $router)
{
// $router->aliasMiddleware('name', MyMiddleware::class);
}

private function publishDatabaseFiles()
{
$this->loadMigrationsFrom(__DIR__.'/../Database/migrations');

$this->app->make('Illuminate\Database\Eloquent\Factory')->load(
__DIR__ . '/../Database/factories'
);

$this->publishes([
__DIR__ . '/../Database/factories' => base_path('database/factories')
], 'factories');

$this->publishes([
__DIR__ . '/../Database/migrations' => base_path('database/migrations')
], 'migrations');

$this->publishes([
__DIR__ . '/../Database/seeds' => base_path('database/seeds')
], 'seeds');
}
}
Empty file.
Empty file.

0 comments on commit 0681fff

Please sign in to comment.