Skip to content

Commit cc61df4

Browse files
committed
Initial
0 parents  commit cc61df4

13 files changed

Lines changed: 7015 additions & 0 deletions

File tree

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [colin969]

.github/workflows/main.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Nightly Builds
2+
3+
on:
4+
schedule:
5+
# * is a special character in YAML so you have to quote this string
6+
- cron: '0 0 * * *'
7+
8+
jobs:
9+
create-release:
10+
runs-on: ubuntu-latest
11+
12+
outputs:
13+
upload_url: ${{ steps.create_release.outputs.upload_url }}
14+
date: ${{ steps.current_time_underscores.outputs.formattedTime }}
15+
activity_check: ${{ env.GHA_REPO_ALIVE }}
16+
17+
steps:
18+
- name: Activity check
19+
run: |
20+
:
21+
# Based off https://github.community/t/trigger-workflow-if-there-is-commit-in-last-24-hours/17074/3
22+
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/commits | jq -r '[.[]][0]' > $HOME/commit.json
23+
date="$(jq -r '.commit.committer.date' $HOME/commit.json)"
24+
timestamp=$(date --utc -d "$date" +%s)
25+
author="$(jq -r '.commit.committer.name' $HOME/commit.json)"
26+
url="$(jq -r '.html_url' $HOME/commit.json)"
27+
days=$(( ( $(date --utc +%s) - $timestamp ) / 86400 ))
28+
rm -f $HOME/commit.json
29+
echo "Repository activity : $timestamp $author $url"
30+
alive=0
31+
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
32+
echo "[WARNING] Ignoring activity limits : workflow triggered manually"
33+
alive=1
34+
else
35+
if [ $days -lt 1 ]; then
36+
echo Repository active : $days days
37+
alive=1
38+
else
39+
echo "[WARNING] Repository not updated : event<${{ github.event_name }}> not allowed to modify stale repository"
40+
fi
41+
fi
42+
if [ $alive -eq 1 ]; then
43+
echo ::set-env name=GHA_REPO_ALIVE::true
44+
fi
45+
shell: bash
46+
47+
- name: Get current time
48+
uses: 1466587594/get-current-time@v2
49+
id: current_time_dashes
50+
with:
51+
format: YYYY-MM-DD
52+
53+
- name: Get current time with underscores
54+
uses: 1466587594/get-current-time@v2
55+
id: current_time_underscores
56+
with:
57+
format: YYYY_MM_DD
58+
59+
- name: Create release
60+
if: env.GHA_REPO_ALIVE == 'true'
61+
id: create_release
62+
uses: actions/create-release@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
tag_name: nightly-${{ steps.current_time_dashes.outputs.formattedTime }}
67+
release_name: Nightly ${{ steps.current_time_dashes.outputs.formattedTime }}
68+
prerelease: true
69+
70+
upload-release:
71+
runs-on: ubuntu-latest
72+
needs: create-release
73+
if: needs.create-release.outputs.activity_check == 'true'
74+
steps:
75+
- uses: actions/checkout@v2
76+
- name: Use Node.js 14.x
77+
uses: actions/setup-node@v1
78+
with:
79+
node-version: 14.x
80+
- run: npm install
81+
82+
- name: Build and Package Release
83+
run: |
84+
npm run package
85+
86+
- name: Release Extension Package
87+
uses: actions/upload-release-asset@v1
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
with:
91+
upload_url: ${{ needs.create-release.outputs.upload_url }}
92+
asset_path: ./extension.fplx
93+
asset_name: analytics-ext_nightly_${{ needs.create-release.outputs.date }}.zip
94+
asset_content_type: application/zip
95+

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/dist
2+
/node_modules
3+
/ruffle-standalone
4+
/static/ruffle
5+
/package
6+
/*.zip
7+
extension.fplx
8+
config.json

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 - Colin Berry
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# FPL Analytics
2+
3+
A Flashpoint Launcher extension that sends analytics.
4+
5+
## Building
6+
7+
1) Clone into `\Data\Extensions` in the Flashpoint folder.
8+
9+
2) `npm install`
10+
11+
3) `npm run build` (Use `npm run package` for production versions)
12+
13+
4) Start Flashpoint Launcher
14+
15+
# Options
16+
17+
Analytics can be disabled via the Config page, deletion requests can be started there too.

gulpfile.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const { series } = require('gulp');
2+
const fs = require('fs');
3+
const gulp = require('gulp');
4+
const zip = require('gulp-zip');
5+
const webpack = require('webpack');
6+
const merge = require('merge-stream');
7+
const webpackConfig = require('./webpack.config.js')
8+
9+
const filesToCopy = [
10+
'package.json',
11+
'icon.png',
12+
'LICENSE.md',
13+
'README.md'
14+
];
15+
16+
function clean(cb) {
17+
fs.rmdir('./package', { recursive: true }, (err) => {
18+
if (err) { console.log('Clean', err) }
19+
cb();
20+
});
21+
}
22+
23+
function build(cb) {
24+
webpack({...webpackConfig, mode: 'production' }, (err, stats) => {
25+
if (err) { console.log('Webpack', err) }
26+
console.log(stats.toString({ /* stats options */ }))
27+
cb();
28+
});
29+
}
30+
31+
function stage() {
32+
const streams = filesToCopy.map(file => {
33+
if (fs.existsSync(file)) {
34+
return gulp.src(file).pipe(gulp.dest('package/analytics'));
35+
}
36+
}).filter(s => s != undefined);
37+
return merge([
38+
...streams,
39+
gulp.src('dist/**/*').pipe(gulp.dest('package/analytics/dist')),
40+
gulp.src('static/**/*').pipe(gulp.dest('package/analytics/static')),
41+
]);
42+
}
43+
44+
function package() {
45+
return gulp.src('package/**/*').pipe(zip('extension.fplx')).pipe(gulp.dest('.'));
46+
}
47+
48+
exports.clean = clean;
49+
exports.build = build;
50+
exports.stage = stage;
51+
exports.package = package;
52+
exports.default = series(clean, build, stage, package);

icon.png

12.8 KB
Loading

0 commit comments

Comments
 (0)