Skip to content

Commit

Permalink
Merge branch 'release/6.0.0'
Browse files Browse the repository at this point in the history
* release/6.0.0: (405 commits)
  wip
  wip
  wip
  Apply fixes from StyleCI (#844)
  wip
  wip
  wip
  wip
  wip
  wip
  Apply fixes from StyleCI (#841)
  wip
  wip
  wip
  wip
  wip
  wip
  wip
  Apply fixes from StyleCI (#838)
  wip
  ...
  • Loading branch information
austintoddj committed Sep 21, 2020
2 parents 1b097a4 + 6834b19 commit 3490183
Show file tree
Hide file tree
Showing 248 changed files with 15,729 additions and 7,682 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

[{*.yml,yaml}]
[*.{yml,yaml}]
indent_size = 2
91 changes: 91 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
module.exports = {
root: true,
env: {
node: true,
browser: true,
es6: true,
},
extends: ['plugin:vue/essential', 'eslint:recommended', 'prettier/vue', 'plugin:prettier/recommended'],
rules: {
curly: 'error',
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-mixed-operators': 'error',
'no-param-reassign': 'error',
'sort-imports-es6-autofix/sort-imports-es6': [
2,
{
ignoreCase: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
'vue/attribute-hyphenation': ['error', 'always'],
'vue/attributes-order': [
2,
{
order: [
'GLOBAL', // id
'DEFINITION', // is
'UNIQUE', // ref, key, slot
'CONDITIONALS', // v-if, v-else-if, v-else, v-show, v-cloak
'LIST_RENDERING', // v-for
'OTHER_ATTR', // all unspecified bound & unbound attributes
'BINDING', // v-model
'RENDER_MODIFIERS', // v-pre, v-once
'CONTENT', // v-html, v-text
'EVENTS', // v-on
],
},
],
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
'vue/html-end-tags': 'error',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'always',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
'vue/name-property-casing': ['error', 'kebab-case'],
'vue/no-multi-spaces': 'error',
'vue/order-in-components': [
'error',
{
order: [
'el',
'name',
'parent',
'functional',
['delimiters', 'comments'],
['components', 'directives', 'filters'],
'extends',
'mixins',
'inheritAttrs',
'model',
['props', 'propsData'],
'data',
'computed',
'watch',
'LIFECYCLE_HOOKS',
'methods',
['template', 'render'],
'renderError',
],
},
],
'vue/require-prop-types': ['error'],
'vue/require-valid-default-prop': ['error'],
},
globals: {},
parserOptions: {
ecmaVersion: 2018,
parser: 'babel-eslint',
},
plugins: ['vue', 'sort-imports-es6-autofix'],
};
8 changes: 7 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

/.github export-ignore
/tests export-ignore
.editorconfig export-ignore
.eslintrc.js export-ignore
.gitattributes export-ignore
.gitpod.yml export-ignore
.gitignore export-ignore
.editorconfig export-ignore
.prettierignore export-ignore
.prettierrc export-ignore
.workspace.json export-ignore
Dockerfile export-ignore
phpunit.xml.dist export-ignore
139 changes: 82 additions & 57 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contributing Guide

Hi! I'm really excited that you are interested in contributing to Canvas. The following guide will help you get your environment set up to begin making changes.
Hi! I'm really excited that you are interested in contributing to Canvas. The following guide will help you get
your environment set up to begin making changes.

## Table of Contents

- [OS Tools](#before-you-get-started)
- [Development Setup](#development-setup)
- [Git](#git)
- [Database](#database)
- [Authentication](#authentication)
- [Directories](#directories)
- [Installation](#installation)
- [Developing](#developing)
Expand All @@ -24,6 +24,12 @@ composer-link() {composer config repositories.local '{"type": "path", "url": "'$

## Development Setup

You can open a completely prebuilt, ready-to-code development environment using Gitpod.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/austintoddj/canvas/tree/develop)

Alternatively, see instructions below to manually setting up an environment on your own machine.

### Git

Fork the project on [https://github.com/austintoddj/canvas](https://github.com/austintoddj/canvas) to your own account. Then clone the fork with the following command:
Expand Down Expand Up @@ -52,19 +58,6 @@ Now update your `.env` file to reflect the new database:
DB_CONNECTION=sqlite
```

### Authentication

> Note: It's assumed we're developing on Laravel 6.* since that's the current LTS
From your Laravel app, create the authentication system and run the following commands:

```bash
composer require laravel/ui

php artisan ui vue --auth
php artisan migrate
```

### Directories

From your Laravel app, link the local version of Canvas using the `composer-link()` function:
Expand All @@ -79,68 +72,100 @@ composer require austintoddj/canvas @dev
Now that the projects are linked, run the following installation steps:

```bash
# Install the Canvas package
php artisan canvas:install

# Link the storage directory
php artisan storage:link
php artisan canvas:ui
```

Statistics are a core component to the app, so it's best to have a large dataset in place when developing. To generate some, add the following snippets to your Laravel app:

Create a new class named `CanvasTrackingDataSeeder` and add this to the `run()` method:
Statistics are a core component to the app, so it's best to have a large dataset in place when developing. To
generate some, add the following factories to your Laravel app:

```php
\Illuminate\Support\Facades\DB::table('canvas_views')->truncate();
\Illuminate\Support\Facades\DB::table('canvas_visits')->truncate();

factory(\Canvas\View::class, 2500)->create();
factory(\Canvas\Visit::class, 2500)->create();
<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

class CanvasVisitFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = \Canvas\Models\Visit::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'post_id' => \Canvas\Models\Post::all()->pluck('id')->random(),
'ip' => $this->faker->ipv4,
'agent' => $this->faker->userAgent,
'referer' => $this->faker->url,
'created_at' => today()->subDays(rand(0, 60))->toDateTimeString(),
'updated_at' => today()->subDays(rand(0, 60))->toDateTimeString(),
];
}
}
```

In the `run()` method of the `DatabaseSeeder`:

```php
$this->call(CanvasTrackingDataSeeder::class);
```

Create a new factory named `ViewFactory` and add this definition:
<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

class CanvasViewFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = \Canvas\Models\View::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'post_id' => \Canvas\Models\Post::all()->pluck('id')->random(),
'ip' => $this->faker->ipv4,
'agent' => $this->faker->userAgent,
'referer' => $this->faker->url,
'created_at' => today()->subDays(rand(0, 60))->toDateTimeString(),
'updated_at' => today()->subDays(rand(0, 60))->toDateTimeString(),
];
}
}

```php
$factory->define(\Canvas\View::class, function (\Faker\Generator $faker) {
$timestamp = today()->subDays(rand(0, 60))->toDateTimeString();

return [
'post_id' => \Canvas\Post::all()->pluck('id')->random(),
'ip' => $faker->ipv4,
'agent' => $faker->userAgent,
'referer' => $faker->url,
'created_at' => $timestamp,
'updated_at' => $timestamp,
];
});
```

Create a new factory named `VisitFactory` and add this definition:
In the `run()` method of the `DatabaseSeeder`:

```php
$factory->define(\Canvas\Visit::class, function (\Faker\Generator $faker) {
$timestamp = today()->subDays(rand(0, 60))->toDateTimeString();

return [
'post_id' => \Canvas\Post::all()->pluck('id')->random(),
'ip' => $faker->ipv4,
'agent' => $faker->userAgent,
'referer' => $faker->url,
'created_at' => $timestamp,
'updated_at' => $timestamp,
];
});
\Database\Factories\CanvasViewFactory::new()->count(850)->create();
\Database\Factories\CanvasVisitFactory::new()->count(500)->create();
```

You can now run `php artisan db:seed` and you will have a substantial amount of views for each post.

### Developing

Instead of making and compiling frontend changes in the package, then having to re-publish the assets in the Laravel app again and again, we can utilize a symlink:
Instead of making and compiling frontend changes in the package, then having to re-publish the assets in the
Laravel app again and again, we can utilize a symlink:

```bash
# remove the existing assets from the Laravel app
Expand Down
Binary file removed .github/HEADER.png
Binary file not shown.
16 changes: 10 additions & 6 deletions .github/SPONSORS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
## Sponsors

[Canvas](https://cnvs.io) is a freely available, open source project that gives something back to the greater [Laravel](https://laravel.com) community. Since blog platforms dominate so much of the Internet today, it makes sense that there should be a simple, easy-to-use package that can drop into your application with little to no effort.
[Canvas](https://trycanvas.app) is a freely available, open source project that gives something back to the greater
[Laravel](https://laravel.com) community. Since blog platforms dominate so much of the Internet today, it makes
sense that there should be a simple, easy-to-use package that can drop into your application with little to no effort.

**Financial contributions will never be required to maintain this project**, they are however very much appreciated. If you've ever used Canvas in your daily work, either personally or professionally, and feel that it has made your life easier, consider supporting the project by buying a cup of coffee.
**Financial contributions will never be required to maintain this project**, they are however very much appreciated
. If you've ever used Canvas in your daily work, either personally or professionally, and feel that it has made your
life easier, consider [supporting the project](https://github.com/sponsors/austintoddj) for the price of a coffee.

If you haven't already, [star the repo](https://github.com/austintoddj/canvas/stargazers) to show your support, it makes a huge difference. Thank you in advance. :-)

Expand All @@ -14,16 +18,16 @@ If you haven't already, [star the repo](https://github.com/austintoddj/canvas/st

<tr>
<td align="center" valign="center">
<a href="https://www.jetbrains.com"><img width="180px" src="https://github.com/austintoddj/art/blob/master/sponsors/jetbrains.png?raw=true"></a>
<a href="https://www.jetbrains.com"><img width="180px" src="assets/jetbrains.png"></a>
</td>
<td align="center" valign="center">
<a href="https://digitalocean.com/?refcode=41cb45b3c7db"><img width="180px" src="https://github.com/austintoddj/art/blob/master/sponsors/digitalocean.png?raw=true"></a>
<a href="https://digitalocean.com/?refcode=41cb45b3c7db"><img width="180px" src="assets/digitalocean.png"></a>
</td>
<td align="center" valign="center">
<a href="https://www.navicat.com"><img width="180px" src="https://github.com/austintoddj/art/blob/master/sponsors/navicat.png?raw=true"></a>
<a href="https://www.navicat.com"><img width="180px" src="assets/navicat.png"></a>
</td>
<td align="center" valign="center">
<a href="https://readme.io"><img width="180px" src="https://github.com/austintoddj/art/blob/master/sponsors/readme.png?raw=true"></a>
<a href="https://readme.io"><img width="180px" src="assets/readme.png"></a>
</td>
</tr>

Expand Down
Loading

0 comments on commit 3490183

Please sign in to comment.