Skip to content

Commit

Permalink
1.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
JayCanuck committed Sep 27, 2018
2 parents 1675a1e + 5081d3a commit 1e2bf6e
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 32 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 1.2.0 (September 27, 2018)

* Updated to latest `@enact/dev-utils` and `mocha-react-proptype-checker` dependency releases.

### create

* Added `core-js` as a direct dependency when creating a new project with `--local` to prevent conflicting polyfill versions.

### pack

* Added support for `-m`/`--meta` option to override the `enact` object metadata from the `package.json`.

## 1.1.1 (August 10, 2018)

### create
Expand Down
9 changes: 6 additions & 3 deletions commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const minimist = require('minimist');
const validatePackageName = require('validate-npm-package-name');

const ENACT_DEV_NPM = '@enact/cli';
const CORE_JS_NPM = 'core-js@2';
const INCLUDED = path.dirname(require.resolve('@enact/template-moonstone'));
const TEMPLATE_DIR = path.join(process.env.APPDATA || os.homedir(), '.enact');

Expand Down Expand Up @@ -154,8 +155,8 @@ function displayHelp() {
console.log();
console.log(' Options');
console.log(' -t, --template Specific template to use');
console.log(' -local Include @enact/cli locally');
console.log(' -verbose Verbose output logging');
console.log(' --local Include @enact/cli locally');
console.log(' --verbose Verbose output logging');
console.log(' -v, --version Display version information');
console.log(' -h, --help Display help information');
console.log();
Expand Down Expand Up @@ -258,7 +259,9 @@ function api(opts = {}) {
.then(() => {
if (opts.local) {
console.log('Installing @enact/cli locally. This might take a couple minutes.');
return npmInstall(opts.directory, opts.verbose, '--save-dev', ENACT_DEV_NPM);
return npmInstall(opts.directory, opts.verbose, '--save', CORE_JS_NPM).then(() =>
npmInstall(opts.directory, opts.verbose, '--save-dev', ENACT_DEV_NPM)
);
}
})
.then(() => generator.complete && generator.complete(params));
Expand Down
2 changes: 1 addition & 1 deletion commands/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function displayHelp() {
console.log(' enact link [options]');
console.log();
console.log(' Options');
console.log(' -verbose Verbose output logging');
console.log(' --verbose Verbose output logging');
console.log(' -v, --version Display version information');
console.log(' -h, --help Display help information');
console.log();
Expand Down
33 changes: 28 additions & 5 deletions commands/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const minimist = require('minimist');
const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const stripAnsi = require('strip-ansi');
const webpack = require('webpack');
const {mixins, packageRoot} = require('@enact/dev-utils');
const {optionParser: app, mixins} = require('@enact/dev-utils');

function displayHelp() {
let e = 'node ' + path.relative(process.cwd(), __filename);
Expand All @@ -44,6 +44,7 @@ function displayHelp() {
console.log(' "all" - All locales that iLib supports');
console.log(' -s, --snapshot Generate V8 snapshot blob');
console.log(' (requires V8_MKSNAPSHOT set)');
console.log(' -m, --meta JSON to override package.json enact metadata');
console.log(' --stats Output bundle analysis file');
console.log(' --verbose Verbose log build details');
console.log(' -v, --version Display version information');
Expand Down Expand Up @@ -102,7 +103,7 @@ function printFileSizes(stats, output) {
const assets = stats.assets.filter(asset => /\.(js|css|bin)$/.test(asset.name)).map(asset => {
const size = fs.statSync(path.join(output, asset.name)).size;
return {
folder: path.relative(packageRoot().path, path.join(output, path.dirname(asset.name))),
folder: path.relative(app.context, path.join(output, path.dirname(asset.name))),
name: path.basename(asset.name),
size: size,
sizeLabel: filesize(size)
Expand Down Expand Up @@ -164,6 +165,18 @@ function watch(config) {
function api(opts = {}) {
let config;

// Apply any package.json enact metadata overrides.
// Until webpak 4 is used, must occur before requiring webpack config.
if (opts.meta) {
let meta;
try {
meta = JSON.parse(opts.meta);
} catch (e) {
throw new Error('Invalid metadata; must be a valid JSON string.\n' + e.message);
}
app.applyEnactMeta(meta);
}

// Do this as the first thing so that any code reading it knows the right env.
if (opts.production) {
process.env.NODE_ENV = 'production';
Expand All @@ -173,6 +186,7 @@ function api(opts = {}) {
config = require('../config/webpack.config.dev');
}

// Set any output path override
if (opts.output) config.output.path = path.resolve(opts.output);

mixins.apply(config, opts);
Expand All @@ -193,13 +207,22 @@ function api(opts = {}) {
function cli(args) {
const opts = minimist(args, {
boolean: ['minify', 'framework', 'stats', 'production', 'isomorphic', 'snapshot', 'verbose', 'watch', 'help'],
string: ['externals', 'externals-public', 'locales', 'output'],
string: ['externals', 'externals-public', 'locales', 'output', 'meta'],
default: {minify: true},
alias: {o: 'output', p: 'production', i: 'isomorphic', l: 'locales', s: 'snapshot', w: 'watch', h: 'help'}
alias: {
o: 'output',
p: 'production',
i: 'isomorphic',
l: 'locales',
s: 'snapshot',
m: 'meta',
w: 'watch',
h: 'help'
}
});
if (opts.help) displayHelp();

process.chdir(packageRoot().path);
process.chdir(app.context);
api(opts).catch(err => {
console.log();
console.log(chalk.red('Failed to compile.\n'));
Expand Down
20 changes: 16 additions & 4 deletions commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const {choosePort, createCompiler, prepareProxy, prepareUrls} = require('react-d
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const app = require('@enact/dev-utils').optionParser;
const devConfig = require('../config/webpack.config.dev');

// Any unhandled promise rejections should be treated like errors.
process.on('unhandledRejection', err => {
Expand Down Expand Up @@ -49,6 +48,7 @@ function displayHelp() {
console.log(' -b, --browser Automatically open browser');
console.log(' -i, --host Server host IP address');
console.log(' -p, --port Server port number');
console.log(' -m, --meta JSON to override package.json enact metadata');
console.log(' -v, --version Display version information');
console.log(' -h, --help Display help information');
console.log();
Expand Down Expand Up @@ -193,8 +193,20 @@ function serve(config, host, port, open) {
}

function api(opts) {
// Apply any package.json enact metadata overrides.
// Until webpak 4 is used, must occur before requiring webpack config.
if (opts.meta) {
let meta;
try {
meta = JSON.parse(opts.meta);
} catch (e) {
throw new Error('Invalid metadata; must be a valid JSON string.\n' + e.message);
}
app.applyEnactMeta(meta);
}

// Setup the development config with additional webpack-dev-erver customizations.
const config = hotDevServer(devConfig);
const config = hotDevServer(require('../config/webpack.config.dev'));

// Tools like Cloud9 rely on this.
const host = process.env.HOST || opts.host || config.devServer.host || '0.0.0.0';
Expand All @@ -210,9 +222,9 @@ function api(opts) {

function cli(args) {
const opts = minimist(args, {
string: ['host', 'port'],
string: ['host', 'port', 'meta'],
boolean: ['browser', 'help'],
alias: {b: 'browser', i: 'host', p: 'port', h: 'help'}
alias: {b: 'browser', i: 'host', p: 'port', m: 'meta', h: 'help'}
});
if (opts.help) displayHelp();

Expand Down
13 changes: 11 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ Node 6.4 or later.

## Installation via npm

Standard global installation of `@enact/cli` via npm. For Linux `sudo` may be required.

Standard global installation of `@enact/cli` via npm.
```sh
npm install -g @enact/cli
```

All releases are published, with the default (and `latest` tag) being the current stable release. Unreleased and development builds can be installed by installing from the git repository directly (for example, `enactjs/cli#develop`).

### Linux Notes

When installing under Linux, it may be necessary to prefix the install command with `sudo`.
Additionally, if you receive an error when the install process attempts to install PhantomJS, try
the following:

```sh
sudo npm install -g --unsafe-perm @enact/cli
```
21 changes: 7 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enact/cli",
"version": "1.1.1",
"version": "1.2.0",
"description": "Full-featured build environment tool for Enact applications.",
"main": "index.js",
"author": "Jason Robitaille <[email protected]>",
Expand Down Expand Up @@ -36,7 +36,7 @@
"@babel/preset-env": "7.0.0-beta.41",
"@babel/preset-react": "7.0.0-beta.41",
"@babel/preset-stage-0": "7.0.0-beta.41",
"@enact/dev-utils": "1.1.2",
"@enact/dev-utils": "1.2.0",
"@enact/template-moonstone": "2.0.0",
"autoprefixer": "8.1.0",
"babel-eslint": "8.2.2",
Expand Down Expand Up @@ -80,7 +80,7 @@
"license-checker": "16.0.0",
"minimist": "1.2.0",
"mocha": "5.0.4",
"mocha-react-proptype-checker": "0.1.0",
"mocha-react-proptype-checker": "0.2.0",
"phantomjs-prebuilt": "2.1.16",
"postcss-flexbugs-fixes": "3.3.0",
"postcss-global-import": "1.0.6",
Expand Down

0 comments on commit 1e2bf6e

Please sign in to comment.