Skip to content

Commit

Permalink
feat!: cleanup & refactor dependency usage (#1378)
Browse files Browse the repository at this point in the history
* feat!: remove optimist dependency
* feat!: remove fs-extra dependency
* feat!: remove chalk dependency
* refactor: prefix path with node:
* refactor: prefix child_process with node:
* refactor: replace ncp with fs.cp
* dep: bump @cordova/eslint-config@5.1.0 w/ lint fix
* feat!: replace ncp w/ fs.cp
* feat!: increase engine.node requirement v20.18.0
* dep!: remove gulp-less
* dep!: remove baconjs
* dep!: remove @babel/core & @babel/preset-react
* dep!: remove preact & preact-compat
* dep!: remove classnames
* dep: update sass & gulp-sass dependencies
* dep: update semver
* fix: resolve sass warnings for lighten and darken
  • Loading branch information
erisu authored Nov 8, 2024
1 parent 4db7637 commit e9730df
Show file tree
Hide file tree
Showing 13 changed files with 572 additions and 1,276 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ This repository contains the source code for the Cordova website at [cordova.apa

## Technical Overview

The main parts are built as a static site with [Jekyll](http://jekyllrb.com/), containing the homepage and subpages, the [blog](https://cordova.apache.org/blog) and the [docs](https://cordova.apache.org/docs).
The [plugin search](https://cordova.apache.org/plugins) is an embedded PreactJS application.
The main parts are built as a static site with [Jekyll](http://jekyllrb.com/), containing the homepage and subpages, the [blog](https://cordova.apache.org/blog) and the [docs](https://cordova.apache.org/docs).

Here in the repository the code of the actual site is located in [`/www`](www) with its subfolder [`/docs`](www/docs), [`/blog`](www/blog) and [`/plugins`](www/plugins).
Some additional content is [pulled in during the build process](TODO).
Expand Down
31 changes: 7 additions & 24 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
'use strict';

// dependencies
const path = require('path');
const fs = require('fs');
const fse = require('fs-extra');
const child_process = require('child_process');
const path = require('node:path');
const fs = require('node:fs');
const child_process = require('node:child_process');
const { styleText } = require('node:util');

const minimist = require('minimist');
const gulp = require('gulp');
const Less = require('gulp-less');
const Sass = require('gulp-sass')(require('sass'));
const browsersync = require('browser-sync');

Expand All @@ -18,7 +16,6 @@ const buffer = require('vinyl-buffer');

const htmllint = require('gulp-htmllint');
const Crawler = require('simplecrawler');
const ncp = require('ncp');

const nextversion = require('./tools/bin/nextversion');
const { listdirsSync, srcTocfileName, logger } = require('./tools/bin/util');
Expand Down Expand Up @@ -108,7 +105,7 @@ function bin (name) {

function remove (path) {
console.log('removing ' + path);
fse.removeSync(path);
fs.rmSync(path, { recursive: true, force: true });
}

function getBundleExecutable () {
Expand Down Expand Up @@ -174,17 +171,13 @@ function copyDocsVersion (oldVersion, newVersion, cb) {
const newVersionDocs = path.join(DOCS_DIR, languageName, newVersion);
const newVersionToc = path.join(TOC_DIR, srcTocfileName(languageName, newVersion));

const copyOptions = {
stopOnErr: true
};

// copy docs
console.log(oldVersionDocs + ' -> ' + newVersionDocs);
ncp.ncp(oldVersionDocs, newVersionDocs, copyOptions, doneCopying);
fs.cp(oldVersionDocs, newVersionDocs, { recursive: true, force: true }, doneCopying);

// copy ToC
console.log(oldVersionToc + ' -> ' + newVersionToc);
ncp.ncp(oldVersionToc, newVersionToc, copyOptions, doneCopying);
fs.cp(oldVersionToc, newVersionToc, { recursive: true, force: true }, doneCopying);
});
}

Expand Down Expand Up @@ -214,7 +207,6 @@ module.exports.help = module.exports.default = function help () {
logger(' fetch download docs specified in ' + FETCH_CONFIG);
logger('');
logger(' styles run all the below tasks');
logger(' less compile all .less files');
logger(' sass compile all .scss files');
logger(' css copy over all .css files');
logger('');
Expand Down Expand Up @@ -285,15 +277,6 @@ module.exports.regen = gulp.series(jekyll, function regen () {
browsersync.reload();
});

const less = module.exports.less = function less () {
return gulp.src(path.join(CSS_SRC_DIR, '**', '*.less'))
.pipe(Less())
.pipe(new HeaderTransform(YAML_FRONT_MATTER))
.pipe(gulp.dest(CSS_OUT_DIR))
.pipe(gulp.dest(CSS_OUT_DIR.replace(SOURCE_DIR, argv.outDir)))
.pipe(browsersync.reload({ stream: true }));
};

const css = module.exports.css = function css () {
return gulp.src(path.join(CSS_SRC_DIR, '**', '*.css'))
.pipe(new HeaderTransform(YAML_FRONT_MATTER))
Expand All @@ -311,7 +294,7 @@ const sass = module.exports.sass = function sass () {
.pipe(browsersync.reload({ stream: true }));
};

const styles = module.exports.styles = gulp.series(less, css, sass);
const styles = module.exports.styles = gulp.series(css, sass);
const data = module.exports.data = gulp.series(toc, docsVersion, pagesDict);
const configs = module.exports.configs = gulp.series(defaults, version);

Expand Down
Loading

0 comments on commit e9730df

Please sign in to comment.