Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinGot committed Aug 6, 2019
2 parents 4f22e46 + 96435d5 commit 9d4c955
Show file tree
Hide file tree
Showing 26 changed files with 8,790 additions and 7,235 deletions.
45 changes: 44 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,54 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

## [0.0.3](https://github.com/groupe-sii/clea-cli/compare/0.0.2...0.0.3) - 2019-08-05
## [1.0.0](https://github.com/groupe-sii/clea-cli/compare/0.0.3...1.0.0) - 2019-08-06

### BREAKING CHANGES

- **raw-loader**: as of [raw-loader 2.0.0](https://github.com/webpack-contrib/raw-loader/pull/69), you should add the `.default` when requiring a template [@ValentinGot]

```typescript
export const AppComponent = {
controller: AppController,
template: require('./app.component.html').default
};
```

- **@clea/cli**: bump to Webpack 4 [@ValentinGot]
- **@clea/cli**: minimum required nodejs version is now `8.9.0` [@ValentinGot]

### Feat

- **performance**: add a new performance entry configuration in the `.clea-cli.json` file [@ValentinGot]

```json
{
"performance": {
"hints": "warning",
"maxEntrypointSize": 2000000,
"maxAssetSize": 2000000
}
}
```

### Fixed

- **package.json**: as of now, postcss requires `autoprefixer` to be set as a dependency [@ValentinGot]

### Updated

- **generate**: generated components are now in the `__name__.compnent.ts` file. The controller file has been removed for more clarity. [@ValentinGot]
- **@clea/cli**: bump TypeScript version to `3.5` [@ValentinGot]
- **@clea/cli**: bump Angular version to `1.7` [@ValentinGot]

## [0.0.3](https://github.com/groupe-sii/clea-cli/compare/0.0.2...0.0.3) - 2019-08-05

### updated

- **@clea/cli**: upgrade dependencies [@ValentinGot]

### Fixed

- **@clea/cli**: security issues [@ValentinGot]

## [0.0.2](https://github.com/groupe-sii/clea-cli/compare/0.0.1...0.0.2) - 2017-10-05
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<a href="https://groupe-sii.github.io/cheat-sheets/clea/index.html"><strong>Cheat Sheet</strong></a>
</p>

The CLI requires NodeJS >= 6.9.0 and NPM 3 or higher.
The CLI requires NodeJS >= 8.9.0 and NPM 5 or higher.

# Usage

Expand Down
4 changes: 2 additions & 2 deletions bin/clea.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const program = require('commander'),
{ commands } = require('../lib/commands-options/clea'),
Command = require('../lib/utilities/command');

if (nodeVersion.compare(new SemVer('6.9.0')) < 0) {
logger.error(`ERROR: Your running version of Node v${nodeVersion.version}, is not a supported version to use the CLI. The official Node supported version is 6.9 and greater.`);
if (nodeVersion.compare(new SemVer('8.9.0')) < 0) {
logger.error(`ERROR: Your running version of Node v${nodeVersion.version}, is not a supported version to use the CLI. The official Node supported version is 8.9 and greater.`);

process.exit(1);
}
Expand Down
1 change: 1 addition & 0 deletions docs/more/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
* [Proxy to Backend](/docs/more/proxy.md)
* [SonarQube Reporters](/docs/more/sonarqube-reporters.md)
* [Autocompletion](/docs/more/autocompletion.md)
* [Performance](/docs/more/performance.md)
19 changes: 19 additions & 0 deletions docs/more/performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Performance

> Clea can notify you of assets and entry points that exceed a specific file limit.
## Configuration

The configuration can be found in the `.clea-cli.json` file:
```json
{
"performance": {
"hints": "warning",
"maxEntrypointSize": 2000000,
"maxAssetSize": 2000000
}
}
```

Please refer to the [Webpack performance](https://webpack.js.org/configuration/performance/) section for mor information about configuration.

11 changes: 9 additions & 2 deletions lib/blueprints/component/files/__name__.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { <%= classifiedName %>Controller } from './<%= fileName %>.controller';
import './<%= fileName %>.component.scss';

export class <%= classifiedName %>Controller {

constructor () { 'ngInject'; }

$onInit () {}

}

export const <%= classifiedName %>Component: ng.IComponentOptions = {
template : require('./<%= fileName %>.component.html'),
template : require('./<%= fileName %>.component.html').default,
controller: <%= classifiedName %>Controller
};
7 changes: 0 additions & 7 deletions lib/blueprints/component/files/__name__.controller.ts

This file was deleted.

3 changes: 1 addition & 2 deletions lib/blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class ComponentBlueprint extends Blueprints {
this.files = [
'__name__.component.html',
'__name__.component.scss',
'__name__.component.ts',
'__name__.controller.ts'
'__name__.component.ts'
];

if (this.project.clea.spec && this.project.clea.spec.component) {
Expand Down
11 changes: 9 additions & 2 deletions lib/blueprints/module/files/__name__.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { <%= classifiedName %>Controller } from './<%= fileName %>.controller';
import './<%= fileName %>.component.scss';

export class <%= classifiedName %>Controller {

constructor () { 'ngInject'; }

$onInit () {}

}

export const <%= classifiedName %>Component: ng.IComponentOptions = {
template : require('./<%= fileName %>.component.html'),
template : require('./<%= fileName %>.component.html').default,
controller: <%= classifiedName %>Controller
};
7 changes: 0 additions & 7 deletions lib/blueprints/module/files/__name__.controller.ts

This file was deleted.

3 changes: 1 addition & 2 deletions lib/blueprints/module/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class ModuleBlueprint extends Blueprints {
this.files = this.files.concat([
'__name__.component.html',
'__name__.component.scss',
'__name__.component.ts',
'__name__.controller.ts'
'__name__.component.ts'
]);

if (this.project.clea.spec && this.project.clea.spec.module) {
Expand Down
56 changes: 35 additions & 21 deletions lib/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,41 @@ class Bundler {
}

stats () {
let options = {
colors : true,
hash : true,
timings : true,
chunks : true,
chunkModules: false,
children : false,
modules : false,
reasons : false,
warnings : true,
assets : false,
version : false
},
verboseOptions = {
children: true,
assets : true,
version : true,
reasons : true
};

return (this.options.verbose) ? Object.assign(options, verboseOptions) : options;
const webpackOutputOptions = {
colors: true,
hash: true,
timings: true,
chunks: true,
chunkModules: false,
children: false,
modules: false,
reasons: false,
warnings: true,
errors: true,
assets: false,
version: false,
errorDetails: false,
moduleTrace: false,
entrypoints: false
};

const verboseWebpackOutputOptions = {
colors: false,
usedExports: true,
maxModules: Infinity,
optimizationBailout: true,
reasons: true,
children: true,
assets: true,
version: true,
chunkModules: true,
errorDetails: true,
moduleTrace: true
};

return this.options.verbose
? Object.assign(webpackOutputOptions, verboseWebpackOutputOptions)
: webpackOutputOptions;
}

}
Expand Down
39 changes: 8 additions & 31 deletions lib/models/webpack-configs-app/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const path = require('path'),
webpack = require('webpack'),
CleanWebpackPlugin = require('clean-webpack-plugin'),
{ CleanWebpackPlugin } = require('clean-webpack-plugin'),
CopyWebpackPlugin = require('copy-webpack-plugin'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'),
TypedocWebpackPlugin = require('typedoc-webpack-plugin'),
CompressionPlugin = require('compression-webpack-plugin');
Expand All @@ -11,52 +9,31 @@ function build (project, options, swConfig = null) {
let rootPath = path.join(project.root, project.clea.root);

let config = {
mode: 'production',

output: {
// Output directory
path: path.resolve(project.root, options.outputPath),

// Filename of each output file on disk
filename: '[name].[chunkhash].bundle.js',
filename: '[name].[chunkhash].js',

// Filename of each SourceMap file
sourceMapFilename: '[name].[chunkhash].bundle.map',

// Filename of each non-entry chunk
chunkFilename: '[id].[chunkhash].chunk.js'
sourceMapFilename: '[name].[chunkhash].map'
},

// Sourcemap generation mode
devtool: options.sourcemap ? 'source-map' : undefined,

performance: project.clea.performance ? project.clea.performance : { hints: false },

plugins: [
new CleanWebpackPlugin([ options.outputPath ], {
root: path.resolve('.'),
new CleanWebpackPlugin({
verbose: options.verbose
}),
new CopyWebpackPlugin([{
from: path.join(rootPath, 'public')
}]),
new webpack.optimize.UglifyJsPlugin({
// Mangler options
mangle : {
except: ['$super', '$', 'exports', 'require', 'angular', '$log']
},
compress: {
// No compilance with IE6-8 quirks
screw_ie8 : true,
drop_debugger: true,
drop_console : true,
warnings : options.verbose
},
// Remove comments
comments: false
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new ExtractTextPlugin({
filename: '[name].[hash].bundle.css',
disable : true
})
}])
]
};

Expand Down
Loading

0 comments on commit 9d4c955

Please sign in to comment.