generated from RPG-Made-Simple/FVTT-ModuleTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed from javascript to typescript
- Loading branch information
Showing
22 changed files
with
7,641 additions
and
679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
/module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { src, series, dest, parallel } from 'gulp'; | ||
|
||
const fs = require('fs'); | ||
const sourcemaps = require('gulp-sourcemaps'); | ||
const jsonMinify = require('gulp-json-minify'); | ||
const browserify = require('browserify'); | ||
const source = require('vinyl-source-stream'); | ||
const tsify = require('tsify'); | ||
const uglify = require('gulp-uglify'); | ||
const buffer = require('vinyl-buffer'); | ||
|
||
const scriptSource = './src'; | ||
const langSource = './lang' | ||
|
||
const packageDir = './module'; | ||
const langDir = packageDir.concat('/lang'); | ||
|
||
function clean() { | ||
// Clean package dir | ||
if (fs.existsSync(packageDir)) { | ||
try { | ||
fs.rmSync(packageDir, { recursive: true, force: true }); | ||
} catch (error) { | ||
return Promise.reject(error); | ||
} | ||
} | ||
|
||
return Promise.resolve('Successfully cleaned'); | ||
} | ||
|
||
|
||
function tsBundle() { | ||
return browserify({ | ||
baseDir: scriptSource, | ||
debug: true, | ||
entries: [scriptSource.concat('/module.ts')], | ||
}) | ||
.plugin(tsify) | ||
.bundle() | ||
.pipe(source('module.min.js')) | ||
.pipe(buffer()) | ||
.pipe(sourcemaps.init({ loadMaps: true })) | ||
.pipe(uglify()) | ||
.pipe(dest(packageDir)); | ||
} | ||
|
||
function langBundle() { | ||
return src(langSource.concat('/*.json')) | ||
.pipe(jsonMinify()) | ||
.pipe(dest(langDir)); | ||
} | ||
|
||
function moduleJsonBundle() { | ||
return src('./module.json') | ||
.pipe(jsonMinify()) | ||
.pipe(dest(packageDir)); | ||
} | ||
|
||
function publish() { | ||
|
||
} | ||
|
||
const buildTask = process.env.NODE_ENV === 'production' ? | ||
series( | ||
parallel( | ||
tsBundle, | ||
langBundle, | ||
moduleJsonBundle, | ||
), | ||
publish, | ||
) : | ||
series( | ||
clean, | ||
parallel( | ||
tsBundle, | ||
langBundle, | ||
moduleJsonBundle, | ||
), | ||
); | ||
|
||
exports.build = buildTask; | ||
exports.clean = clean; | ||
exports.default = buildTask; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,6 @@ | |
] | ||
}, | ||
"esmodules": [ | ||
"./module/scripts/module.js" | ||
"./module/module.min.js" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.