some updates

This commit is contained in:
flash 2017-03-19 15:56:19 +01:00
parent 3895ead151
commit 5205daccfb
8 changed files with 35 additions and 70 deletions

2
.gitignore vendored
View file

@ -1,7 +1,7 @@
node_modules/* node_modules/*
vendor/* vendor/*
public/app.* public/app.*
config.ini .apikey
[Tt]humbs.db [Tt]humbs.db
desktop.ini desktop.ini
$RECYCLE.BIN/ $RECYCLE.BIN/

19
build.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# delete old files, using find to avoid errors
echo "=> Cleanup"
rm -v ./public/app.js
rm -v ./public/app.css
# styles
echo
echo "=> LESS"
lessc --verbose ./src/less/app.less ./public/app.css
# scripts
echo
echo "=> TypeScript"
tsc \
-p ./src/typescript/tsconfig.json \
--listFiles \
--listEmittedFiles

View file

@ -1,2 +0,0 @@
api_key = your api key here
endpoint = https://ws.audioscrobbler.com/2.0/

View file

@ -1,53 +0,0 @@
// aliases
var gulp = require('gulp'),
less = require('gulp-less'),
ts = require('gulp-typescript'),
concat = require('gulp-concat'),
jsmin = require('gulp-minify'),
path = require('path');
// variables
var destination = './public',
less_sources = './src/less/**/*.less',
less_watch = less_sources,
ts_config = './tsconfig.json',
ts_sources = './src/typescript/**/*.ts',
ts_watch = ts_sources;
// default task
gulp.task('default', ['less', 'typescript']);
// watcher
gulp.task('watch', function () {
gulp.watch(less_watch, ['less']);
gulp.watch(ts_watch, ['typescript']);
});
// less
gulp.task('less', function () {
return gulp.src(less_sources)
.pipe(less({
paths: [
path.join(__dirname, 'less', 'includes')
],
compress: true
}))
.pipe(concat('app.css'))
.pipe(gulp.dest(destination));
});
// typescript
gulp.task('typescript', function () {
var tsProject = ts.createProject(ts_config);
return gulp.src(ts_sources)
.pipe(ts(tsProject))
.pipe(jsmin({
ext: {
src: '-',
min: '.js'
},
noSource: true
}))
.pipe(gulp.dest(destination));
});

View file

@ -1,10 +0,0 @@
{
"private": true,
"dependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.0.5",
"gulp-minify": "0.0.11",
"gulp-typescript": "^2.13.0"
}
}

View file

@ -14,13 +14,13 @@ if (!file_exists('../vendor/autoload.php')) {
require_once '../vendor/autoload.php'; require_once '../vendor/autoload.php';
if (!file_exists('../config.ini')) { if (!file_exists('../.apikey')) {
die(view(['error' => 'Configuration missing! Make a copy of config.example.ini named config.ini and set your API key.'])); die(view(['error' => 'API key file missing! Create a file called ".apikey" in the root directory and place your last.fm api key in there.']));
} }
$config = parse_ini_file('../config.ini'); $api_key = trim(file_get_contents('../.apikey'));
$auth = new AuthApi('setsession', ['apiKey' => $config['api_key']]); $auth = new AuthApi('setsession', ['apiKey' => $api_key]);
$user = new UserApi($auth); $user = new UserApi($auth);
$now = $user->getRecentTracks(['user' => (isset($_GET['u']) ? $_GET['u'] : ''), 'limit' => '1']); $now = $user->getRecentTracks(['user' => (isset($_GET['u']) ? $_GET['u'] : ''), 'limit' => '1']);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"noImplicitAny": false,
"removeComments": true,
"outFile": "../../public/app.js"
},
"filesGlob": [
"**/*.ts"
]
}