goodbye gulp, you won't be missed

This commit is contained in:
flash 2016-11-01 18:00:42 +01:00
parent 93ff094f15
commit 13e78189f4
15 changed files with 97 additions and 75 deletions

1
.gitignore vendored
View file

@ -17,6 +17,7 @@
# Compiled/copied assets
/public/js
/public/css
/resources/assets/typescript/*.d.ts
# User assets
/uploads/*

View file

@ -1,31 +1,35 @@
# Sakura
![StyleCI](https://styleci.io/repos/45261697/shield)
![SensioLabsInsight](https://insight.sensiolabs.com/projects/6c9b3813-0f50-406c-ab26-665e11876bc9/mini.png)
## Requirements
- PHP 7.0.0 or newer
- A database engine compatible with your PHP install and Laravel/Illuminate's database abstraction layer, MySQL 5.7 recommended.
- [Composer](https://getcomposer.org/)
- [NPM from NodeJS](https://nodejs.org/)
I will include a full list of required extensions later.
## Development setup
## Installing
### Backend
Copy config.example.ini, set everything up to your liking (database is most important). I'd also recommend setting `show_errors` to `true` for development. Then run the following commands in the root.
```
composer install
php mahou database-install
php mahou database-migrate
php mahou setup
```
After that you can either use `php mahou serve` to use the built in development server or serve the public folder through your webserver of choice.
## Contributing
### Frontend
To compile the LESS and TypeScript assets you need to have the individual compiler installed, both are available from npm and can be installed through the following command:
```
npm install -g less typescript
```
After that install the required libraries by running `npm install` and from then on to compile the files you need to run `build.sh`.
If your editor yells at you that it can't find certain namespaces try running `build.sh` since that generates the required typings (.d.ts files).
## Contributing
Right now I'm not accepting big PRs because of a set of big things not being fully implemented yet, bug fix PRs are more than welcome though!
## License
Sakura is licensed under the Apache License version 2. Check the [LICENSE file](https://github.com/flashwave/sakura/blob/master/LICENSE) for the full thing or if you just want a quick summary [click here](https://i.flash.moe/vlcsnap-2016-03-09-17h45m55s452.png).
Sakura is licensed under the Apache License version 2. Check the [LICENSE file](https://github.com/flashwave/sakura/blob/master/LICENSE) for the full thing.

64
build.sh Normal file
View file

@ -0,0 +1,64 @@
#!/bin/sh
ASSETS_PATH='./resources/assets'
ASSETS_LESS="$ASSETS_PATH/less"
ASSETS_TS="$ASSETS_PATH/typescript"
LESS_ENTRY_FILE='main.less'
PUBLIC_DIR='./public'
PUBLIC_CSS="$PUBLIC_DIR/css"
PUBLIC_JS="$PUBLIC_DIR/js"
NODE_PATH='./node_modules'
NODE_DEST="$PUBLIC_JS/libs.js"
NODE_IMPORT=(
'turbolinks/dist/turbolinks.js'
)
# delete old files, using find to avoid errors
echo "=> Cleanup"
find $ASSETS_TS -type f -name "*.d.ts" -delete -print
find $PUBLIC_CSS -type f -name "*.css" -delete -print
find $PUBLIC_JS -type f -name "*.js" -delete -print
echo
# styles
echo
echo "=> LESS"
for STYLE_DIR in $ASSETS_LESS/*/; do
STYLE_NAME=`basename $STYLE_DIR | tr '[A-Z]' '[a-z]'`
echo "==> $STYLE_NAME"
lessc --verbose $STYLE_DIR/$LESS_ENTRY_FILE $PUBLIC_CSS/$STYLE_NAME.css
echo
done
# scripts
echo
echo "=> TypeScript"
for SCRIPT_DIR in $ASSETS_TS/*/; do
SCRIPT_NAME=`basename $SCRIPT_DIR`
SCRIPT_NAME_LOWER=`echo $SCRIPT_NAME | tr '[A-Z]' '[a-z]'`
echo "==> $SCRIPT_NAME"
find $SCRIPT_DIR -name "*.ts" | xargs tsc \
-d \
-t es5 \
--listFiles \
--listEmittedFiles \
--noImplicitAny \
--removeComments \
--outFile $PUBLIC_JS/$SCRIPT_NAME_LOWER.js
mv -v $PUBLIC_JS/$SCRIPT_NAME_LOWER.d.ts $ASSETS_TS/$SCRIPT_NAME.d.ts
echo
done
# node imports
echo
echo "=> NPM imports"
echo "Creating $NODE_DEST"
touch $NODE_DEST
for FILE in $NODE_IMPORT; do
echo "==> $FILE"
cat "$NODE_PATH/$FILE" >> $NODE_DEST
done

View file

@ -1,16 +0,0 @@
var
elixir = require('laravel-elixir'),
elixirTypscript = require('elixir-typescript'),
nodePath = '../../../node_modules/';
elixir(function(mix) {
mix
.less('aitemu/master.less', 'public/css/aitemu.css')
.less('yuuno/master.less', 'public/css/yuuno.css')
.typescript('Sakura/**/*.ts', 'public/js/app.js')
.typescript('Aitemu/**/*.ts', 'public/js/aitemu.js')
.typescript('Yuuno/**/*.ts', 'public/js/yuuno.js')
.scripts([
nodePath + 'turbolinks/dist/turbolinks.js',
], 'public/js/libraries.js');
});

View file

@ -1,13 +1,6 @@
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"dependencies": {
"elixir-typescript": "^2.0.0",
"gulp": "^3.9.1",
"laravel-elixir": "^5.0.0",
"turbolinks": "^5.0.0"
}
}

View file

@ -1,22 +0,0 @@
/// <reference path="Sakura/AJAX.ts" />
/// <reference path="Sakura/Changelog.ts" />
/// <reference path="Sakura/Comments.ts" />
/// <reference path="Sakura/Config.ts" />
/// <reference path="Sakura/Cookies.ts" />
/// <reference path="Sakura/Dialogue.ts" />
/// <reference path="Sakura/DialogueButton.ts" />
/// <reference path="Sakura/DialogueType.ts" />
/// <reference path="Sakura/Dictionary.ts" />
/// <reference path="Sakura/DOM.ts" />
/// <reference path="Sakura/Friend.ts" />
/// <reference path="Sakura/HTTPMethod.ts" />
/// <reference path="Sakura/IChangelogAction.ts" />
/// <reference path="Sakura/IChangelogChange.ts" />
/// <reference path="Sakura/IChangelogContributor.ts" />
/// <reference path="Sakura/IChangelogDate.ts" />
/// <reference path="Sakura/IChangelogRelease.ts" />
/// <reference path="Sakura/IFriendResponse.ts" />
/// <reference path="Sakura/INotification.ts" />
/// <reference path="Sakura/KeyValuePair.ts" />
/// <reference path="Sakura/Notifications.ts" />
/// <reference path="Sakura/TimeAgo.ts" />

View file

@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true
}
}

View file

@ -1,5 +0,0 @@
/// <reference path="Yuuno/Busy.ts" />
/// <reference path="Yuuno/BusyMode.ts" />
/// <reference path="Yuuno/Main.ts" />
/// <reference path="Yuuno/Notifications.ts" />
/// <reference path="Yuuno/Ybabstat.ts" />

View file

@ -1,4 +1,4 @@
/// <reference path="../Sakura.ts" />
/// <reference path="../Sakura.d.ts" />
namespace Yuuno
{

View file

@ -1,5 +1,3 @@
/// <reference path="../Sakura.ts" />
namespace Yuuno
{
export class Notifications extends Sakura.Notifications

View file

@ -1,5 +1,3 @@
/// <reference path="../Sakura.ts" />
namespace Yuuno
{
export class Ybabstat

View file

@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true
}
}

View file

@ -1,9 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"rootDir": "resources/assets/typescript"
}
}