Skip to content

Commit

Permalink
Add package.json and make the build process automated via gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
moritonal authored and kakaroto committed Jul 8, 2020
1 parent bb2bce6 commit 71f08c3
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ manifest_chrome.json
docs/run.sh
pyj/node_modules/
node_modules/
.idea/
.idea/
build/
88 changes: 87 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const gulp = require('gulp');
const concat = require('gulp-concat');
const clean = require('gulp-clean');
const rename = require("gulp-rename");

const ROLL_RENDERER_DEPS = [
"src/common/utils.js",
Expand Down Expand Up @@ -133,4 +135,88 @@ build = gulp.series(css, ...Object.values(targets));
gulp.task('css', css);
gulp.task('watch', watch);
gulp.task('build', build);
gulp.task('default', gulp.series(build, watch));
gulp.task('default', gulp.series(build, watch));


gulp.task("clean", () => {
return gulp.src(['./dist/', "./build/"], { read: false, allowEmpty: true }).pipe(clean());
});

gulp.task("copy-src", () => {
return gulp.src("./src/**")
.pipe(gulp.dest('./build/base/src/'))
});

gulp.task("copy-dist", gulp.series("build", () => {
return gulp.src("./dist/**")
.pipe(gulp.dest('./build/base/dist/'));
}));

gulp.task("copy-libs", () => {
return gulp.src("./libs/**")
.pipe(gulp.dest('./build/base/libs/'));
});

gulp.task("copy-images", () => {
return gulp.src("images/**")
.pipe(gulp.dest('./build/base/images/'));
});

gulp.task("copy-misc", () => {
return gulp.src(["LICENSE", "LICENSE.MIT", "package.json", "gulpfile.js", "options.*", "*.html", "*.md"])
.pipe(gulp.dest('./build/base/'));
});

gulp.task("build-base", gulp.parallel([
"copy-src",
"copy-dist",
"copy-misc",
"copy-libs",
"copy-images",
]));

// Creates the specific folders for Chrome and Firefox


gulp.task("copy-firefox-from-base", gulp.series("build-base", () => {
return gulp.src("./build/base/**")
.pipe(gulp.dest('./build/firefox/'));
}));

gulp.task("copy-chrome-from-base", gulp.series("build-base", () => {
return gulp.src("./build/base/**")
.pipe(gulp.dest('./build/chrome/'));
}));

// Copies manifests around

gulp.task("firefox-manifest", () => {

return gulp.src("./manifest_ff.json")
.pipe(rename({
basename: "manifest",
}))
.pipe(gulp.dest("./build/firefox/"));
});

gulp.task("chrome-manifest", () => {

return gulp.src("./manifest.json")
.pipe(gulp.dest("./build/chrome/"));
});

// Performs full builds

gulp.task("build-firefox", gulp.series(
gulp.series([
"copy-firefox-from-base",
"firefox-manifest"
])
));

gulp.task("build-chrome", gulp.series(
gulp.series([
"copy-chrome-from-base",
"chrome-manifest"
])
));
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "beyond20",
"version": "1.1.0",
"description": "Beyond20: D&D Beyond & Roll20/Foundry VTT Integration",
"directories": {
"doc": "docs"
},
"scripts": {
"gulp": "gulp",
"clean": "gulp clean",
"build": "run-s clean build:*",
"build:firefox": "gulp build-firefox",
"build:chrome": "gulp build-chrome",
"package": "run-s build package:*",
"package:chrome": "web-ext build --source-dir=./build/chrome/ --artifacts-dir=./build/chrome/web-ext-artifacts/",
"package:firefox": "web-ext build --source-dir=./build/firefox/ --artifacts-dir=./build/firefox/web-ext-artifacts/",
"start:chrome": "web-ext run -t chromium --source-dir ./build/chrome/",
"start:firefox": "web-ext run --source-dir ./build/firefox/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kakaroto/Beyond20.git"
},
"keywords": [],
"author": "",
"license": "GNU",
"bugs": {
"url": "https://github.com/kakaroto/Beyond20/issues"
},
"homepage": "https://beyond20.here-for-more.info",
"devDependencies": {
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"npm-run-all": "^4.1.5",
"web-ext": "^4.2.0",
"gulp-clean": "^0.4.0",
"gulp-rename": "^2.0.0"
}
}

0 comments on commit 71f08c3

Please sign in to comment.