Skip to content

Releases: swissquote/crafty

React Hot Loader 4, TypeScript 2.9.0

10 Jul 07:56
Compare
Choose a tag to compare

Highlights

  • Updated to React Hot Loader 4, easier to install and use
  • Updated to Typescript 2.9
  • Lazy load dependencies for faster command startup and not loading unused libraries
  • Change UglifyJS configuration to compress faster
  • Added crafty help to list available tasks and commands

Changes

crafty-preset-react

React Hot Loader 4

Moving from React Hot Loader 3 to 4 meant a lot of changes inside Crafty, especially for TypeScript, but will only require a small change on your side.

React Hot Loader 3 required this :

import React from "react";
import ReactDOM from "react-dom";
import {AppContainer} from "react-hot-loader";

import App from "./containers/App";
 
const render = Component => {
  ReactDOM.render(
    <AppContainer>
      <Component />
    </AppContainer>,
    document.getElementById("root"),
  );
};

render(App);

// Webpack Hot Module Replacement API
if (module.hot) {
  module.hot.accept("./containers/App", () => {
    render(App);
  });
}

Which can now be returned to

import React from "react";
import ReactDOM from "react-dom";

import App from "./containers/App";

ReactDOM.render(
  <App />,
  document.getElementById("root"),
);

But in exchange the App Component (The root of your react app) must be wrapped in hot(module)(YourComponent);

import React from 'react'
import { hot } from 'react-hot-loader'

const App = () => <div>Hello World!</div>

export default hot(module)(App);

crafty-preset-typescript

TypeScript 2.9

No change is required on your side to benefit from this update.

Running Babel after TypeScript in Webpack

After running the TypeScript loader, we now run babel in order to apply the optimizations that babel can do, like inlining React components and applying plugins like React Hot Loader

crafty-preset-jest

  • Fix code coverage collection in Jest #21

UglifyJS Configuration

We made some changes to the UglifyJS Configuration to disable advanced compression techniques as they are slow and don't bring a lot of improvement overall.
You can re-enable these options if you wish in your own crafty.config.js

Internal Changes

  • Use yarn for development instead of npm
  • Lazy load dependencies to make crafty faster

Version updates

[babel-preset-swissquote, crafty-preset-babel, crafty-preset-typescript] Update @babel/* to 7.0.0-beta.52
[babel-preset-swissquote] Updated babel-plugin-transform-react-remove-prop-types from 0.4.12 to 0.4.13
[crafty-preset-babel] Updated babel-loader to 8.0.0-beta.3
[crafty-preset-babel] Updated babel-preset-jest to 23.2.0
[crafty-preset-babel] Updated eslint to 5.1.0
[crafty-preset-babel] Updated gulp-eslint to 5.0.0
[crafty-preset-babel] Updated rollup-plugin-babel to 4.0.0-beta.5
[crafty-preset-jest] Updated jest-cli to 23.3.0
[crafty-preset-postcss] Updated css-loader to 1.0.0
[crafty-preset-postcss] Updated gulp-rename to 1.3.0
[crafty-preset-postcss] Updated mini-css-extract-plugin to 0.4.1
[crafty-preset-postcss] Updated postcss to 6.0.23
[crafty-preset-postcss] Updated postcss-loader to 2.1.5
[crafty-preset-postcss] Updated postcss-scss to 1.0.6
[crafty-preset-postcss] Updated stylelint to 9.3.0
[crafty-preset-postcss] Updated webpack to 4.15.1
[crafty-preset-react] Updated react-hot-loader to 4.3.3
[crafty-preset-react] Updated react-test-renderer to 16.4.1
[crafty-preset-typescript] Updated rollup-plugin-typescript2 to 0.15.1
[crafty-preset-typescript] Updated ts-jest to 23.0.0
[crafty-preset-typescript] Updated tslint to 5.10.0
[crafty-preset-typescript] Updated tslint-eslint-rules to 5.3.1
[crafty-preset-typescript] Updated typescript to 2.9.2
[crafty-runner-rollup] Updated rollup to 0.62.0
[crafty-runner-rollup] Updated rollup-plugin-json to 3.0.0
[crafty-runner-rollup] Updated rollup-plugin-uglify to 4.0.0
[crafty-runner-webpack] Removed service-port, replaced by hash-index
[crafty-runner-webpack] Updated uglifyjs-webpack-plugin to 1.2.7
[crafty-runner-webpack] Updated webpack to 4.15.1
[crafty-runner-webpack] Updated webpack-chain to 4.8.0
[crafty-runner-webpack] Updated webpack-merge to 4.1.3
[crafty] Update browserslist to 4.0.0
[crafty] Update enhanced-resolve to 4.1.0
[eslint-plugin-swissquote] Updated babel-eslint to 9.0.0-beta.1
[eslint-plugin-swissquote] Updated eslint-plugin-import to 2.13.0
[eslint-plugin-swissquote] Updated eslint-plugin-react to 7.10.0
[postcss-swissquote-preset] Updated autoprefixer to 8.6.5
[postcss-swissquote-preset] Updated browserslist to 4.0.0
[postcss-swissquote-preset] Updated postcss to 6.0.23
[postcss-swissquote-preset] Updated postcss-dir-pseudo-class to 4.0.0
[stylelint-config-swissquote] Updated stylelint-scss to 3.1.3

crafty-preset-jest minor fixes

19 Jun 09:31
Compare
Choose a tag to compare

Exclude json files from valid test files in @swissquote/crafty-preset-jest #19

Thanks @Elendev for the contribution

crafty-preset-react minor fixes

19 Jun 09:28
Compare
Choose a tag to compare
  • Use ES5 in @swissquote/crafty-preset-react so that it works even if @swissquote/crafty-preset-babel isn't used
  • Minor changes in the documentation to advertise about Jest typings for TypeScript. #18

Thanks @Elendev for the bug reports and contibutions

Webpack 4, Babel 7

03 May 15:04
Compare
Choose a tag to compare

Highlights

  • Webpack 4 migration from Webpack 3 #9
  • Use Babel 7 instead of Babel 6
  • Changed the list of supported browsers

Changes

babel-preset-swissquote

  • Use babel 7
  • Added a deduplicateHelpers option to allow helpers function to be declared only once. crafty-preset-webpack uses that option now.
  • Added a useESModules option to use ES imports for helper functions.
  • Remove prop types in production automatically

crafty-preset-postcss

  • Fix a bug when compiling styles with gulp, timestamp wasn't updated on created files, which broke reloading in browsers. Thanks @mariepw for the fix #13 #14
  • Replace extract-text-webpack-plugin was replaced with mini-css-extract-plugin for Webpack 4, features and options stay the same.

crafty

  • Changed default browsers to "> 0.25%, Firefox ESR, Edge >= 13, Safari >= 7.1, iOS >= 7.1, Chrome >= 32, Firefox >= 24, Opera >= 24, IE >= 9" This now excludes older browsers like IE8 and largely unused browsers.
  • Use browserslist's standard way to read browser list, fallback to crafty's default if nothing else is found.

eslint-plugin-swissquote

  • Added eslint-plugin-sonarjs to check on some more advanced rules for your JavaScript code. #12
  • Enabled sonarjs's recommended rules in our recommended preset.

stylelint-config-swissquote

  • Added stylelint-scss to plugins. #10
  • Replaced at-rule-no-unknown with scss/at-rule-no-unknown

Documentation

  • Fix typos in documentation, thanks @Elendev for contributions.

Internal

  • added npm clean to run lerna clean
  • added a postinstall script to run lerna bootstrap right after npm install

Version updates

  • [babel-preset-swissquote, crafty-preset-babel] Update @babel/core to 7.0.0-beta.46
  • [babel-preset-swissquote] Replace babel-plugin-syntax-dynamic-import@6.18.0 with @babel/plugin-syntax-dynamic-import@7.0.0-beta.46
  • [babel-preset-swissquote] Replace babel-plugin-transform-class-properties@6.24.1 with @babel/plugin-proposal-class-properties@7.0.0-beta.46
  • [babel-preset-swissquote] Replace babel-plugin-transform-object-rest-spread@6.26.0 with @babel/plugin-proposal-object-rest-spread@7.0.0-beta.46
  • [babel-preset-swissquote] Replace babel-plugin-transform-react-constant-elements@6.23.0 with @babel/plugin-transform-react-constant-elements@7.0.0-beta.46
  • [babel-preset-swissquote] Replace babel-plugin-transform-regenerator@6.26.0 with @babel/plugin-transform-regenerator@7.0.0-beta.46
  • [babel-preset-swissquote] Replace babel-plugin-transform-runtime@6.23.0 with @babel/plugin-transform-runtime@7.0.0-beta.46
  • [babel-preset-swissquote] Replace babel-preset-env@1.6.1 with @babel/preset-env@7.0.0-beta.46
  • [babel-preset-swissquote, crafty-preset-babel] Replace babel-runtime@^6.23.0 with @babel/preset-env@7.0.0-beta.46
  • [babel-preset-swissquote] Replace babel-plugin-dynamic-import-node@1.2.0 with babel-plugin-transform-dynamic-import@2.0.0
  • [babel-preset-swissquote] Replace babel-plugin-transform-react-jsx@6.24.1, babel-plugin-transform-react-jsx-self@6.22.0, babel-plugin-transform-react-jsx-source@6.22.0, babel-preset-react@6.24.1 with @babel/preset-react@7.0.0-beta.46
  • [crafty-preset-babel] Update babel-loader from 7.1.4 to 8.0.0-beta.2
  • [crafty-preset-babel] Update babel-plugin-istanbul from 4.1.5 to 4.1.6
  • [crafty-preset-babel] Update babel-preset-jest from 22.4.1 to 22.4.3
  • [crafty-preset-babel] Update gulp-babel from 7.0.1 to 8.0.0-beta.2
  • [crafty-preset-babel] Update rollup-plugin-babel from 3.0.3 to 4.0.0-beta.2
  • [crafty-preset-polyfills] Update core-js from 2.5.4 to 2.5.5
  • [crafty-preset-postcss, postcss-swissquote-preset] Update postcss from 6.0.21 to 6.0.22
  • [crafty-preset-postcss] Update postcss-loader from 2.1.3 to 2.1.4
  • [crafty-preset-postcss] Update postcss-scss from 1.0.4 to 1.0.5
  • [crafty-preset-postcss] Update style-loader from 0.20.3 to 0.21.0
  • [crafty-preset-postcss] Update stylelint from 9.1.3 to 9.2.0
  • [crafty-preset-postcss] Replace extract-text-webpack-plugin@3.0.2 with mini-css-extract-plugin@^0.4.0
  • [crafty-preset-react] Update react-test-renderer from 16.2.0 to 16.3.2
  • [crafty-preset-typescript] Update rollup-plugin-typescript2 from 0.12.0 to 0.13.0
  • [crafty-preset-typescript] Update ts-loader from 3.5.0 to 4.2.0
  • [crafty-preset-typescript] Update tslint-loader from 3.5.3 to 3.6.0
  • [crafty-preset-typescript] Update typescript from 2.8.1 to 2.8.3
  • [crafty-runner-rollup] Update rollup from 0.57.1 to 0.58.2
  • [crafty-runner-rollup] Update rollup-plugin-commonjs from 9.1.0 to 9.1.3
  • [crafty-runner-webpack, crafty-preset-postcss] Update webpack from 3.10.0 to 4.6.0
  • [crafty-runner-webpack] Added uglifyjs-webpack-plugin from ^1.2.5
  • [crafty-runner-webpack] Update webpack-chain from 4.5.0 to 4.6.0
  • [crafty-runner-webpack] Update webpack-dev-server from 2.11.1 to 3.1.4
  • [crafty-runner-webpack] Update webpack-stylish from 0.1.7 to 0.1.8
  • [crafty] Update enhanced-resolve from 3.4.1 to 4.0.0
  • [crafty] Update meow from 4.0.0 to 5.0.0
  • [crafty, postcss-swissquote-preset] Update browserslist from 3.2.3 to 3.2.6
  • [eslint-plugin-swissquote] Update babel-eslint from 7.2.3 to 8.2.3
  • [eslint-plugin-swissquote] Update eslint-plugin-import from 2.9.0 to 2.11.0
  • [eslint-plugin-swissquote] Added eslint-plugin-sonarjs version ^0.1.0
  • [postcss-swissquote-preset] Update autoprefixer from 8.2.0 to 8.4.1
  • [postcss-swissquote-preset] Update postcss-dir-pseudo-class from ^2.1.0 to 3.0.0
  • [postcss-swissquote-preset] Update postcss-url from 7.3.1 to 7.3.2

Dependencies updates and tweaks

28 Mar 20:07
Compare
Choose a tag to compare

Highlights

  • [crafty-runner-webpack] Webpack's output is now cleaner with the help of webpack-stylish
  • [crafty-preset-babel] Use uglify-es in when using the Gulp runner
  • [crafty-runner-webpack] Create an UMD package by default with webpack instead of an AMD package
  • [stylelint-config-swissquote] added selector-max-compound-selectors rule with a default of 6.
  • [stylelint-config-swissquote] created swissquote/no-block-inside-block rule, it's not enabled by default.
  • [crafty-preset-typescript] Updated to TypeScript 2.8.1

TypeScript 2.8.1

The TypeScript preset now comes with TypeScript 2.8.1. ( instead of 2.6.2 )

We'll not go into details on the new features, but I invite you to check the team's announcements

Documentation

  • Fix spelling and typos in the documentation
  • Use a separate theme
  • Added search

Version updates

  • [crafty-preset-babel] babel-loader from 7.1.2 to 7.1.4
  • [crafty-preset-babel] babel-preset-jest from 21.2.0 to 22.4.1
  • [crafty-preset-babel] eslint from 4.15.0 to 4.19.1
  • [crafty-preset-babel] eslint-loader from 1.9.0 to 2.0.0
  • [crafty-preset-babel] gulp-babel from 7.0.0 to 7.0.1
  • [crafty-preset-babel] gulp-eslint from 4.0.1 to 4.0.2
  • [crafty-preset-babel] gulp-sourcemaps from 2.6.3 to 2.6.4
  • [crafty-preset-babel] tmp from 0.0.33 to 0.0.33
  • [crafty-preset-polyfills] core-js from 2.5.3 to 2.5.4
  • [crafty-preset-postcss] css-loader from 0.28.8 to 0.28.11
  • [crafty-preset-postcss] gulp-sourcemaps from 2.6.3 to 2.6.4
  • [crafty-preset-postcss] lodash from 4.17.4 to 4.17.5
  • [crafty-preset-postcss] [postcss-swissquote-preset] postcss from 6.0.16 to 6.0.21
  • [crafty-preset-postcss] postcss-loader from 2.0.10 to 2.1.3
  • [crafty-preset-postcss] postcss-scss from 1.0.3 to 1.0.4
  • [crafty-preset-postcss] style-loader from 0.19.1 to 0.20.3
  • [crafty-preset-postcss] stylelint from 8.4.0 to 9.1.3
  • [crafty-preset-typescript] gulp-sourcemaps from 2.6.3 to 2.6.4
  • [crafty-preset-typescript] gulp-tslint from 8.1.2 to 8.1.3
  • [crafty-preset-typescript] gulp-typescript from 3.2.3 to 4.0.2
  • [crafty-preset-typescript] gulp-plugin-typescript2 from 0.10.0 to 0.12.0
  • [crafty-preset-typescript] ts-loader from 3.2.0 to 3.5.0
  • [crafty-preset-typescript] tslint-eslint-rules from 4.1.1 to 5.1.0
  • [crafty-preset-rollup] [crafty-runner-webpack] chalk from 2.3.0 to 2.3.2
  • [crafty-preset-rollup] rollup from 0.54.0 to 0.57.1
  • [crafty-preset-rollup] rollup-plugin-commonjs from 8.2.6 to 9.1.0
  • [crafty-preset-rollup] rollup-plugin-node-resolve from 3.0.2 to 3.3.0
  • [crafty-preset-rollup] rollup-plugin-uglify from 2.0.1 to 3.0.0
  • [crafty-preset-rollup] uglify-es from 3.3.7 to 3.3.9
  • [crafty-runner-gulp] [crafty] glob-watcher from 5.0.0 to 5.0.1
  • [crafty-runner-webpack] case-sensitive-paths-webpack-plugin from 2.1.1 to 2.1.2
  • [crafty-runner-webpack] glob-to-regexp from 0.3.0 to 0.4.0
  • [crafty-runner-webpack] webpack-dev-server from 2.11.0 to 2.11.1
  • [crafty-runner-webpack] webpack-merge from 4.1.1 to 4.1.2
  • [eslint-plugin-swissquote] eslint-plugin-import from 2.8.0 to 2.9.0
  • [eslint-plugin-swissquote] eslint-plugin-react from 7.5.1 to 7.7.0
  • [eslint-plugin-swissquote] eslint from 4.12.1 to 4.19.1
  • [postcss-swissquote-preset] autoprefixer from 7.2.5 to 8.2.0
  • [postcss-swissquote-preset] browserslist from 2.11.3 to 3.2.3
  • [postcss-swissquote-preset] postcss-advanced-variables from 2.3.0 to 2.3.3
  • [postcss-swissquote-preset] postcss-cssnext from 3.0.2 to 3.1.0
  • [postcss-swissquote-preset] postcss-import from 11.0.0 to 11.1.0
  • [postcss-swissquote-preset] postcss-url from 7.3.0 to 7.3.1
  • [stylelint-config-swissquote] stylelint from 8.3.1 to 9.1.3

Dependencies updates and bugfixes

16 Jan 15:44
Compare
Choose a tag to compare

Bugfixes

  • [eslint-plugin-swissquote] React rules default options were done incorrectly.

Documentation

  • Added more badges to the README
  • Updated list of supported browsers to be in sync with the code.
  • Updated crafty-preset-babel's homepage to preset Babel and not CSS (unlucky copy/paste)

Updates

  • [internal] lerna from 2.5.1 to 2.7.1
  • [internal] markdownlint-cli from 0.5.0 to 0.6.0
  • [crafty-preset-babel] eslint from 4.13.1 to 4.15.0
  • [crafty-preset-babel] gulp-eslint from 4.0.0 to 4.0.1
  • [crafty-preset-babel] [crafty-preset-images] [crafty-preset-typescript] gulp-newer from 1.3.0 to 1.4.0
  • [crafty-preset-babel] [crafty-preset-postcss] [crafty-preset-typescript] gulp-sourcemaps from 2.6.1 to 2.6.3
  • [crafty-preset-babel] rollup-plugin-babel from 3.0.2 to 3.0.3
  • [crafty-preset-images] gulp-imagemin from 4.0.0 to 4.1.0
  • [crafty-preset-postcss] css-loader from 0.28.7 to 0.28.8
  • [crafty-preset-postcss] end-of-stream from 1.4.0 to 1.4.1
  • [crafty-preset-postcss] gulp-postcss from 7.0.0 to 7.0.1
  • [crafty-preset-postcss] postcss from 6.0.14 to 6.0.16
  • [crafty-preset-postcss] postcss-loader from 2.0.9 to 2.0.10
  • [crafty-preset-postcss] postcss-scss from 1.0.2 to 1.0.3
  • [crafty-preset-react] enzyme from 3.2.0 to 3.3.0
  • [crafty-preset-react] enzyme-adapter-react-16 from 1.1.0 to 1.1.1
  • [crafty-preset-typescript] rollup-plugin-typescript2 from 0.8.4 to 0.10.0
  • [crafty-preset-typescript] tslint from 5.8.0 to 5.9.1
  • [crafty] [crafty-runner-gulp] glob-watcher from 4.0.0 to 5.0.0
  • [crafty-runner-gulp] gulp-plumber from 1.1.0 to 1.2.0
  • [crafty-runner-rollup] rollup from 0.52.1 to 0.54.0
  • [crafty-runner-rollup] rollup-plugin-node-resolve from 3.0.0 to 3.0.2
  • [crafty-runner-rollup] uglify-es from 3.2.2 to 3.3.7
  • [crafty-runner-webpack] webpack-dev-server from 2.9.7 to 2.11.0
  • [postcss-swissquote-preset] autoprefixer from 7.2.3 to 7.2.5
  • [postcss-swissquote-preset] browserslist from 2.10.0 to 2.11.3
  • [postcss-swissquote-preset] postcss from 6.0.14 to 6.0.16
  • [postcss-swissquote-preset] postcss-advanced-variables from 1.2.2 to 2.3.0
  • [postcss-swissquote-preset] postcss-sassy-mixins removed because its feature is now covered by postcss-advanced-variables

Initial Release

22 Dec 10:38
Compare
Choose a tag to compare

This is the first release of Crafty and all of its presets.

Instead of changes, this will be a quick overview of each package's feature.

@swissquote/crafty

  • The core package of Crafty, it gives the foundations to load presets and execute the tasks and commands created by them.
  • Contains the run, test and watch commands

Runners

@swissquote/crafty-runner-webpack

  • Bundle your JavaScript using EcmaScript 2015 imports or commonjs imports
  • Your code is Uglified after compilation.
  • Configurable output formats
  • Automatically integrates with watch mode, re-compiles your files on changes

@swissquote/crafty-runner-gulp

  • Create any gulp task
  • Combine tasks in parallel or in series
  • Create file watchers that run tasks or anything else on change.

@swissquote/crafty-runner-rollup

  • Bundle your JavaScript using EcmaScript 2015 imports or commonjs imports
  • Your code is Uglified after compilation.
  • Configurable output formats
  • Automatically integrates with watch mode, re-compiles your files on changes

Presets

@swissquote/crafty-preset-babel

  • Integrated with Webpack or Rollup or simply outputs your code file by file using Gulp
  • Uses a carefully crafted preset of babel plugins
  • Lints your code with ESLint

@swissquote/crafty-preset-images

  • Compress jpg/png/gif or svg images

@swissquote/crafty-preset-images-simple

  • Works the same as crafty-preset-images but doesn't compress images. Is meant if you build your projects behind a corporate proxy and can't download the compression binaries.

@swissquote/crafty-preset-jest

  • Configures Jest to work out of the box with crafty-preset-babel and crafty-preset-typescript
  • All jest features work the same, without special configuration

@swissquote/crafty-preset-maven

  • Automatically set the destination of your files according to maven's target works for webapps and webjars.

@swissquote/crafty-preset-polyfills

Doesn't work yet.

@swissquote/crafty-preset-postcss

  • Compiles your CSS using PostCSS with our postcss preset
  • Lints your CSS using Stylelint

@swissquote/crafty-preset-react

  • Configures Webpack for Hot Module Replacement
  • Configures Jest to easily test React components

@swissquote/crafty-preset-typescript

  • Integrates TypeScript with Webpack or Rollup or simply outputs your code file by file using Gulp
  • Lints your code using TSLint

Presets for other tools

@swissquote/babel-preset-swissquote

  • Transform EcmaScript 2015+ using babel-preset-env
  • Convert JSX to JavaScript for React
  • polyfills for async/await and generators when needed
  • Is used inside @swissquote/crafty-preset-babel

@swissquote/eslint-plugin-swissquote

  • Contains Swissquote's JavaScript Styleguide
  • Is used inside @swissquote/crafty-preset-babel

@swissquote/postcss-swissquote-preset

  • Contains Swissqute's CSS Presets
  • Transpiles CSS level 4 to valid CSS level 3
  • Understands the scss syntax and many of its features (loops, conditions, variables)
  • Embed images or get their size
  • Is used inside @swissquote/crafty-preset-postcss

@swissquote/stylelint-config-swissquote

  • Contains Swissquote's CSS styleguide and Stylelint plugins
  • Is used inside @swissquote/crafty-preset-postcss