Skip to content

Commit

Permalink
6.0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
enact-bot committed Jul 26, 2023
2 parents fa15278 + 483f7f8 commit 1ba1fda
Show file tree
Hide file tree
Showing 16 changed files with 9,096 additions and 6,760 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 6.0.2 (July 26, 2023)

* Updated `chalk` version to `^5.3.0`.
* Updated `find-cache-dir` version to `^7.1.0`.

## 6.0.1 (July 4, 2023)

* Updated dependencies.
Expand Down
91 changes: 49 additions & 42 deletions bin/enact.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

'use strict';

const chalk = require('chalk');
const semver = require('semver');
const pkg = require('../package.json');

Expand All @@ -14,11 +13,13 @@ if (
pkg.engines.node
)
) {
console.log(
chalk.red(`You are running Node ${process.version}, but @enact/cli requires Node ${pkg.engines.node}.\n`) +
chalk.bold.red('Please update your version of Node.')
);
process.exit(1);
import('chalk').then(({default: chalk}) => {
console.log(
chalk.red(`You are running Node ${process.version}, but @enact/cli requires Node ${pkg.engines.node}.\n`) +
chalk.bold.red('Please update your version of Node.')
);
process.exit(1);
});
}

// Uncaught error handler
Expand All @@ -29,30 +30,34 @@ if (process.platform === 'win32' && process.title === 'Windows PowerShell ISE')

// Handle tasks/arguments
if (process.argv.indexOf('-v') >= 0 || process.argv.indexOf('--version') >= 0) {
// Enact-CLI ascii art title
const title = `
import('chalk').then(({default: chalk}) => {
// Enact-CLI ascii art title
const title = `
┌─┐┌┐┌┌─┐┌─┐┌┬┐ ┌─┐┬ ┬ ▐██▄▄ ▄▄██▌
│ ││││ ││ │ │ │ │ ▐██▀██████▀▀
├┤ │││├─┤│ │ ──│ │ │ ▐██▄▄ ▀▀ ▄▄
│ ││││ ││ │ │ │ │ ▐██▀██████▀
└─┘┘└┘┴ ┴└─┘ ┴ └─┘┴─┘┴ ▐██▄▄ ▀▀ ▄▄██▌
──────────────────────── ▀▀██████▀▀
▀▀ `;
// Add colour to the logo
const colourTitle = title
.split(/[\n\r]+/g)
.map(l => {
const half = (l.length - 31) / 2;
return (
l.substring(0, 31) +
chalk.bgBlueBright(chalk.whiteBright(l.substring(31, 31 + half)) + chalk.white(l.substring(31 + half)))
);
})
.join('\n');
console.log();
console.log(colourTitle);
console.log(' Version ' + pkg.version);
console.log();
// Add colour to the logo
const colourTitle = title
.split(/[\n\r]+/g)
.map(l => {
const half = (l.length - 31) / 2;
return (
l.substring(0, 31) +
chalk.bgBlueBright(
chalk.whiteBright(l.substring(31, 31 + half)) + chalk.white(l.substring(31 + half))
)
);
})
.join('\n');
console.log();
console.log(colourTitle);
console.log(' Version ' + pkg.version);
console.log();
});
} else {
const command = process.argv[2];

Expand All @@ -75,25 +80,27 @@ if (process.argv.indexOf('-v') >= 0 || process.argv.indexOf('--version') >= 0) {
break;
}
default: {
console.log(' Usage');
console.log(' enact <command> [...]');
console.log();
console.log(' Commands');
console.log(' create Create a new project');
console.log(' link Link @enact dependencies');
console.log(' bootstrap Install and link dependencies');
console.log(' serve Development server');
console.log(' pack Bundle source code');
console.log(' test Test specs runner');
console.log(' transpile Transpile to ES5');
console.log(' template Manage Enact templates');
console.log(' license Detect all used licenses');
console.log(' lint Lint source code');
console.log(' clean Clean build directory');
console.log(' eject Eject to standalone app');
console.log();
console.log(` Refer to each command's ${chalk.cyan('--help')} for more details.`);
console.log();
import('chalk').then(({default: chalk}) => {
console.log(' Usage');
console.log(' enact <command> [...]');
console.log();
console.log(' Commands');
console.log(' create Create a new project');
console.log(' link Link @enact dependencies');
console.log(' bootstrap Install and link dependencies');
console.log(' serve Development server');
console.log(' pack Bundle source code');
console.log(' test Test specs runner');
console.log(' transpile Transpile to ES5');
console.log(' template Manage Enact templates');
console.log(' license Detect all used licenses');
console.log(' lint Lint source code');
console.log(' clean Clean build directory');
console.log(' eject Eject to standalone app');
console.log();
console.log(` Refer to each command's ${chalk.cyan('--help')} for more details.`);
console.log();
});
}
}
}
12 changes: 8 additions & 4 deletions commands/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// @remove-file-on-eject
const path = require('path');
const chalk = require('chalk');
const spawn = require('cross-spawn');
const fs = require('fs-extra');
const minimist = require('minimist');
const packageRoot = require('@enact/dev-utils').packageRoot;
const doLink = require('./link').api;

let chalk;

function displayHelp() {
let e = 'node ' + path.relative(process.cwd(), __filename);
if (require.main !== module) e = 'enact bootstrap';
Expand Down Expand Up @@ -175,9 +176,12 @@ function cli(args) {

if (opts._[0] && fs.statSync(opts._[0]).isDirectory()) opts.cwd = opts._[0];

api(opts).catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
import('chalk').then(({default: _chalk}) => {
chalk = _chalk;
api(opts).catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
});
});
}

Expand Down
12 changes: 8 additions & 4 deletions commands/clean.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint-env node, es6 */
const path = require('path');
const chalk = require('chalk');
const fs = require('fs-extra');
const minimist = require('minimist');
const packageRoot = require('@enact/dev-utils').packageRoot;

let chalk;

const build = 'build';
const dist = 'dist';
const node_modules = 'node_modules';
Expand Down Expand Up @@ -57,9 +58,12 @@ function cli(args) {
if (opts.help) displayHelp();

process.chdir(packageRoot().path);
api({paths: opts._, all: opts.all}).catch(err => {
console.error(chalk.red('ERROR: ') + 'Failed to clean project.\n' + err.message);
process.exit(1);
import('chalk').then(({default: _chalk}) => {
chalk = _chalk;
api({paths: opts._, all: opts.all}).catch(err => {
console.error(chalk.red('ERROR: ') + 'Failed to clean project.\n' + err.message);
process.exit(1);
});
});
}

Expand Down
12 changes: 8 additions & 4 deletions commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
*/
const os = require('os');
const path = require('path');
const chalk = require('chalk');
const spawn = require('cross-spawn');
const fs = require('fs-extra');
const minimist = require('minimist');
const validatePackageName = require('validate-npm-package-name');

let chalk;

const ENACT_DEV_NPM = '@enact/cli';
const INCLUDED = path.dirname(require.resolve('@enact/template-sandstone'));
const TEMPLATE_DIR = path.join(process.env.APPDATA || os.homedir(), '.enact');
Expand Down Expand Up @@ -283,9 +284,12 @@ function cli(args) {
opts.directory = path.resolve(typeof opts._[0] !== 'undefined' ? opts._[0] + '' : process.cwd());
opts.name = path.basename(opts.directory).replace(/ /g, '-').toLowerCase();

api(opts).catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
import('chalk').then(({default: _chalk}) => {
chalk = _chalk;
api(opts).catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
});
});
}

Expand Down
12 changes: 8 additions & 4 deletions commands/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
const cp = require('child_process');
const os = require('os');
const path = require('path');
const chalk = require('chalk');
const fs = require('fs-extra');
const prompts = require('prompts');
const minimist = require('minimist');
const {packageRoot} = require('@enact/dev-utils');
const spawn = require('cross-spawn');

let chalk;

const assets = [
{src: path.join(__dirname, '..', 'config'), dest: 'config'},
{src: path.join(__dirname, '..', 'config', 'jest'), dest: 'config/jest'},
Expand Down Expand Up @@ -303,9 +304,12 @@ function cli(args) {

process.chdir(packageRoot().path);

api({bare: opts.bare}).catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
import('chalk').then(({default: _chalk}) => {
chalk = _chalk;
api({bare: opts.bare}).catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
});
});
}

Expand Down
12 changes: 8 additions & 4 deletions commands/info.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* eslint-env node, es6 */
const path = require('path');
const fs = require('fs');
const chalk = require('chalk');
const spawn = require('cross-spawn');
const minimist = require('minimist');
const resolveSync = require('resolve').sync;

let chalk;

function displayHelp() {
let e = 'node ' + path.relative(process.cwd(), __filename);
if (require.main !== module) e = 'enact info';
Expand Down Expand Up @@ -167,9 +168,12 @@ function cli(args) {
});
if (opts.help) displayHelp();

api({cliInfo: opts.cli, dev: opts.dev}).catch(err => {
console.error(chalk.red('ERROR: ') + 'Failed to display info.\n' + err.message);
process.exit(1);
import('chalk').then(({default: _chalk}) => {
chalk = _chalk;
api({cliInfo: opts.cli, dev: opts.dev}).catch(err => {
console.error(chalk.red('ERROR: ') + 'Failed to display info.\n' + err.message);
process.exit(1);
});
});
}

Expand Down
18 changes: 11 additions & 7 deletions commands/license.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-env node, es6 */
const path = require('path');
const chalk = require('chalk');
const checker = require('license-checker');
const minimist = require('minimist');

let chalk;

// The following modules reside in `@enact/cli` but end up in production builds of apps
const pkgPathResolve = m => path.dirname(require.resolve(m + '/package.json'));
const enactCLIProdModules = ['@babel/core', 'core-js'].map(pkgPathResolve);
Expand Down Expand Up @@ -53,12 +54,15 @@ function cli(args) {
});
if (opts.help) displayHelp();

api({modules: opts._})
.then(licenses => console.log(JSON.stringify(licenses, null, 2)))
.catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
});
import('chalk').then(({default: _chalk}) => {
chalk = _chalk;
api({modules: opts._})
.then(licenses => console.log(JSON.stringify(licenses, null, 2)))
.catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
});
});
}

module.exports = {api, cli};
Expand Down
12 changes: 8 additions & 4 deletions commands/link.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// @remove-file-on-eject
const path = require('path');
const chalk = require('chalk');
const spawn = require('cross-spawn');
const fs = require('fs-extra');
const minimist = require('minimist');
const packageRoot = require('@enact/dev-utils').packageRoot;

let chalk;

function displayHelp() {
let e = 'node ' + path.relative(process.cwd(), __filename);
if (require.main !== module) e = 'enact link';
Expand Down Expand Up @@ -94,9 +95,12 @@ function cli(args) {

if (opts._[0]) opts.cwd = opts._[0];

api(opts).catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
import('chalk').then(({default: _chalk}) => {
chalk = _chalk;
api(opts).catch(err => {
console.error(chalk.red('ERROR: ') + err.message);
process.exit(1);
});
});
}

Expand Down
17 changes: 12 additions & 5 deletions commands/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
*/
// @remove-on-eject-end
const path = require('path');
const chalk = require('chalk');
const {filesize} = require('filesize');
const fs = require('fs-extra');
const minimist = require('minimist');
const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const printBuildError = require('react-dev-utils/printBuildError');
const stripAnsi = require('strip-ansi');
const webpack = require('webpack');
const {optionParser: app, mixins, configHelper: helper} = require('@enact/dev-utils');

let chalk;
let stripAnsi;

function displayHelp() {
let e = 'node ' + path.relative(process.cwd(), __filename);
if (require.main !== module) e = 'enact pack';
Expand Down Expand Up @@ -315,9 +316,15 @@ function cli(args) {
if (opts.help) displayHelp();

process.chdir(app.context);
api(opts).catch(err => {
printErrorDetails(err, () => {
process.exit(1);
import('chalk').then(({default: _chalk}) => {
chalk = _chalk;
import('strip-ansi').then(({default: _stripAnsi}) => {
stripAnsi = _stripAnsi;
api(opts).catch(err => {
printErrorDetails(err, () => {
process.exit(1);
});
});
});
});
}
Expand Down
Loading

0 comments on commit 1ba1fda

Please sign in to comment.