From 88e71a670a9fbe7348b1ae50f3664e8766e3d4ec Mon Sep 17 00:00:00 2001 From: Zak Burke Date: Fri, 21 Mar 2025 18:15:55 -0400 Subject: [PATCH] STRWEB-134 prune `stripes.js` and its deps `./stripes.js` appears to be a legacy import from stripes-core and hasn't been touched since. I think stripes-core's tools were completely overhauled in their conversion to becoming stripes-cli, and this script just got lost along the way. `commander` is worth considering as a well-maintained alternative to `yargs` in stripes-cli, but that's a whole different project. Refs STRWEB-134 --- CHANGELOG.md | 1 + package.json | 1 - stripes.js | 67 ---------------------------------------------------- 3 files changed, 1 insertion(+), 68 deletions(-) delete mode 100755 stripes.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b2fbcb..8408849 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 6.1.0 IN PROGRESS * Unlock `esbuild-loader` from `~3.0.0`, bumping to `^4.2.2`. Refs STRWEB-95. +* Prune dead code, `stripes.js` and its dep `commander`. Refs STRWEB-134. ## [6.0.0](https://github.com/folio-org/stripes-webpack/tree/v6.0.0) (2025-02-24) [Full Changelog](https://github.com/folio-org/stripes-webpack/compare/v5.2.0...v6.0.0) diff --git a/package.json b/package.json index 9da33c7..cb3235c 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "autoprefixer": "^10.4.13", "babel-loader": "^9.1.3", "buffer": "^6.0.3", - "commander": "^2.9.0", "connect-history-api-fallback": "^1.3.0", "core-js": "^3.6.1", "css-loader": "^6.4.0", diff --git a/stripes.js b/stripes.js deleted file mode 100755 index a6884bf..0000000 --- a/stripes.js +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env node - -/* eslint-disable no-console */ - -const commander = require('commander'); -const path = require('path'); -const stripes = require('./webpack/stripes-node-api'); -const packageJSON = require('./package.json'); - -commander.version(packageJSON.version); - -// Display error to the console and exit -function processError(err) { - if (err) { - console.error(err); - } - process.exit(1); -} - -// Display webpack output to the console -function processStats(stats) { - console.log(stats.toString({ - chunks: false, - colors: true, - })); - // Check for webpack compile errors and exit - if (stats.hasErrors()) { - processError(); - } -} - -commander - .command('dev') - .option('--port [port]', 'Port') - .option('--host [host]', 'Host') - .option('--cache', 'Use HardSourceWebpackPlugin cache') - .option('--devtool [devtool]', 'Use another value for devtool instead of "inline-source-map"') - .arguments('') - .description('Launch a webpack-dev-server') - .action((stripesConfigFile, options) => { - // eslint-disable-next-line global-require,import/no-dynamic-require - const stripesConfig = require(path.resolve(stripesConfigFile)); - stripes.serve(stripesConfig, options); - }); - -commander - .command('build') - .option('--publicPath [publicPath]', 'publicPath') - .option('--sourcemap', 'include sourcemaps in build') - .option('--no-minify', 'do not minify JavaScript') - .arguments(' ') - .description('Build a tenant bundle') - .action((stripesConfigFile, outputPath, options) => { - // eslint-disable-next-line global-require,import/no-dynamic-require - const stripesConfig = require(path.resolve(stripesConfigFile)); - options.outputPath = outputPath; - stripes.build(stripesConfig, options) - .then(stats => processStats(stats)) - .catch(err => processError(err)); - }); - -commander.parse(process.argv); - -// output help if no command specified -if (!process.argv.slice(2).length) { - commander.outputHelp(); -}