Even more cleanup
This commit is contained in:
parent
e48b045a9d
commit
38f1482c98
6 changed files with 5 additions and 10668 deletions
24
gulpfile.js
24
gulpfile.js
|
@ -18,10 +18,8 @@ const semver = require('semver');
|
||||||
const name = path.basename(path.resolve('.'));
|
const name = path.basename(path.resolve('.'));
|
||||||
const sourceDirectory = './src';
|
const sourceDirectory = './src';
|
||||||
const distDirectory = './dist';
|
const distDirectory = './dist';
|
||||||
const stylesDirectory = `${sourceDirectory}/styles`;
|
|
||||||
const stylesExtension = 'css';
|
|
||||||
const sourceFileExtension = 'js';
|
const sourceFileExtension = 'js';
|
||||||
const staticFiles = ['assets', 'fonts', 'lang', 'packs', 'templates', 'module.json'];
|
const staticFiles = ['lang', 'templates', 'module.json'];
|
||||||
const getDownloadURL = (version) =>
|
const getDownloadURL = (version) =>
|
||||||
`https://git.f3l.de/ghost/darkness-dependent-vision/-/jobs/artifacts/${version}/download?job=build`;
|
`https://git.f3l.de/ghost/darkness-dependent-vision/-/jobs/artifacts/${version}/download?job=build`;
|
||||||
|
|
||||||
|
@ -37,13 +35,6 @@ async function buildCode() {
|
||||||
return build.write(rollupConfig.output);
|
return build.write(rollupConfig.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Build style sheets
|
|
||||||
*/
|
|
||||||
function buildStyles() {
|
|
||||||
return gulp.src(`${stylesDirectory}/${name}.${stylesExtension}`).pipe(gulp.dest(`${distDirectory}/styles`));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy static files
|
* Copy static files
|
||||||
*/
|
*/
|
||||||
|
@ -60,7 +51,6 @@ async function copyFiles() {
|
||||||
*/
|
*/
|
||||||
function buildWatch() {
|
function buildWatch() {
|
||||||
gulp.watch(`${sourceDirectory}/**/*.${sourceFileExtension}`, { ignoreInitial: false }, buildCode);
|
gulp.watch(`${sourceDirectory}/**/*.${sourceFileExtension}`, { ignoreInitial: false }, buildCode);
|
||||||
gulp.watch(`${stylesDirectory}/**/*.${stylesExtension}`, { ignoreInitial: false }, buildStyles);
|
|
||||||
gulp.watch(
|
gulp.watch(
|
||||||
staticFiles.map((file) => `${sourceDirectory}/${file}`),
|
staticFiles.map((file) => `${sourceDirectory}/${file}`),
|
||||||
{ ignoreInitial: false },
|
{ ignoreInitial: false },
|
||||||
|
@ -78,10 +68,6 @@ function buildWatch() {
|
||||||
async function clean() {
|
async function clean() {
|
||||||
const files = [...staticFiles, 'module'];
|
const files = [...staticFiles, 'module'];
|
||||||
|
|
||||||
if (fs.existsSync(`${stylesDirectory}/${name}.${stylesExtension}`)) {
|
|
||||||
files.push('styles');
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(' ', chalk.yellow('Files to clean:'));
|
console.log(' ', chalk.yellow('Files to clean:'));
|
||||||
console.log(' ', chalk.blueBright(files.join('\n ')));
|
console.log(' ', chalk.blueBright(files.join('\n ')));
|
||||||
|
|
||||||
|
@ -169,7 +155,6 @@ function getTargetVersion(currentVersion, release) {
|
||||||
*/
|
*/
|
||||||
function bumpVersion(cb) {
|
function bumpVersion(cb) {
|
||||||
const packageJson = fs.readJSONSync('package.json');
|
const packageJson = fs.readJSONSync('package.json');
|
||||||
const packageLockJson = fs.existsSync('package-lock.json') ? fs.readJSONSync('package-lock.json') : undefined;
|
|
||||||
const manifest = getManifest();
|
const manifest = getManifest();
|
||||||
|
|
||||||
if (!manifest) cb(Error(chalk.red('Manifest JSON not found')));
|
if (!manifest) cb(Error(chalk.red('Manifest JSON not found')));
|
||||||
|
@ -198,11 +183,6 @@ function bumpVersion(cb) {
|
||||||
packageJson.version = targetVersion;
|
packageJson.version = targetVersion;
|
||||||
fs.writeJSONSync('package.json', packageJson, { spaces: 2 });
|
fs.writeJSONSync('package.json', packageJson, { spaces: 2 });
|
||||||
|
|
||||||
if (packageLockJson) {
|
|
||||||
packageLockJson.version = targetVersion;
|
|
||||||
fs.writeJSONSync('package-lock.json', packageLockJson, { spaces: 2 });
|
|
||||||
}
|
|
||||||
|
|
||||||
manifest.file.version = targetVersion;
|
manifest.file.version = targetVersion;
|
||||||
manifest.file.download = getDownloadURL(targetVersion);
|
manifest.file.download = getDownloadURL(targetVersion);
|
||||||
fs.writeJSONSync(`${sourceDirectory}/${manifest.name}`, manifest.file, { spaces: 2 });
|
fs.writeJSONSync(`${sourceDirectory}/${manifest.name}`, manifest.file, { spaces: 2 });
|
||||||
|
@ -213,7 +193,7 @@ function bumpVersion(cb) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const execBuild = gulp.parallel(buildCode, buildStyles, copyFiles);
|
const execBuild = gulp.parallel(buildCode, copyFiles);
|
||||||
|
|
||||||
exports.build = gulp.series(clean, execBuild);
|
exports.build = gulp.series(clean, execBuild);
|
||||||
exports.watch = buildWatch;
|
exports.watch = buildWatch;
|
||||||
|
|
10646
package-lock.json
generated
10646
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -9,6 +9,9 @@ import registerForInitHook from './hooks/init';
|
||||||
import registerForUpdateSceneHook from './hooks/updateScene';
|
import registerForUpdateSceneHook from './hooks/updateScene';
|
||||||
import registerForUpdateTokenHook from './hooks/updateToken';
|
import registerForUpdateTokenHook from './hooks/updateToken';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register for all the hooks that darkness-dependent-vision needs to react to.
|
||||||
|
*/
|
||||||
export default function registerForHooks() {
|
export default function registerForHooks() {
|
||||||
registerForInitHook();
|
registerForInitHook();
|
||||||
registerForUpdateSceneHook();
|
registerForUpdateSceneHook();
|
||||||
|
|
Loading…
Reference in a new issue