generator-jive-react-addon
v1.2.0
Published
generates a jive add-on (app/tile) bootstrapped for react/webpack toolchain
Downloads
8
Readme
#generator-jive-react-addon
Use this yeoman generator for scaffolding a react-based jive tile
##What it does It runs jive-sdk native scaffolder, then applies a series of modifications:
- Applies gulp/webpack/babel/react toolchain, including:
- Compilation of JS and CSS/SCSS sources
- Processing fonts and images
- Optimizing code for production or development (minification, source maps, etc)
- Optional hot module replacement (HMR), if you intend to use local jive instance (not in IE!)
- Analysis of the modules sizes in the resulting bundle
- Generation of verbosely named add-on packages in deployment-ready .zip archives
- Creates
./src/{tileName}
folder with:- Entry point files with react renderer
- Basic react components for view and configuration
- HTML templates
- Helper functions for data management and iframe resizing
- Schema revision tools
- Deletes unused files
- Adds a proper
.gitignore
- Adds
.npmrc
file, which configures npm to save dependencies in a most error-resistant way and warn you if your npm/node version is low - Replaces jive-sdk configuration files with single simplified YAML file (1)
- Prevents scripts and CSS caching between builds
- Applies npm package.json "version" value to the project in various ways
- Calculates a build stamp - a checksum that only changes when actual code is modified (2)
- Automatically applies production/development middleware URL in case the tile requires it
- Installs latest versions of npm dependencies and fixates them
Footnotes:
- More complex options are backed up in
./src/meta.yaml
and./src/{tileName}/meta.yaml
- All build stamps with detailed file lists are saved under
./logs/buildstamps
directory in case thorough comparison is needed. Logs are not versioned
Prerequisites
Stuff you'll need to use it:
- node.js v8.12.0 or later
- npm v6.4.1 or later
- Globally installed npm packages:
- yo
- jive-sdk
- gulp v4
You can install them all using [sudo] npm install -g yo jive-sdk gulp@4
Installation
Install it as a regular npm global package: [sudo] npm install -g generator-jive-react-addon
. To
update, just run installation command again.
Using generator
Creating jive tile
- Go to the folder of your choice (this may be your recently cloned empty git repository)
- Run
yo jive-react-addon:tile --force
. The flag--force
is required because the generator will overwrite a lot of files created by initial jive-sdk scaffold. - Answer prompting questions: tile system name, display name, description, etc
- Answer do you want to use HMR and/or middlewares and the following questions
- Wait for the successful completion of the script (it should say "TILE CREATED!")
Adding a middleware option to an existing tile
- Go to the tile folder
- Run
yo jive-react-addon:add-mw --force
- Fill in the asked details
- Wait for a script to say "MIDDLEWARE SETTINGS APPLIED!"
Attention!
- This will overwrite your
./src/gulpfile.js
file.
Building a tile
This generator creates several standard npm commands to use with npm run
:
- build-prod - builds a .zip package optimized for production. This script requires you to commit and
push all changes. Also, the project should not have untracked files, they have to be either added to
versioning or to .gitignore. In other words, it only allows you to build production version if
the
git status
output is "nothing to commit, working tree clean". - build-dev - builds a .zip package optimized for development.
- local-dev-watch run in development mode with changes watcher turned on to develop tile using local jive intsance.
- local-dev-hot (optional) run webpack-dev-server to develop tile using local jive intsance.
Additional configuration
This generator creates 3 config files: config.yaml
, config-local.yaml
and
config-local.template.yaml
. The config-local.yaml
file is added to .gitignore
, which means each
developer has to have their own version of this file - copied from the
config-local.template.yaml
and properly edited.config-local.yaml
file contains data specific to environment and/or developer, such as local jive
instance path, testing middleware etc.
Changelog
1.0.0
Major:
- Generator now tells it's own version on startup
- Applied SCSS and preprocessors
Minor:
- Added setStateAsync function
- Added forced CSS-renderer accelerator for iOS
Bugfixes:
- Fixed bug: hot loader was not honoring configuration value
- Added missing immutability-helper import
0.15.0
Major:
- Added ignoreExtensionRegistrationSource and suppressAddonRegistration manipulations
- Added vendor-based code-splitting
- Added .nvmrc (node 8.12.0) and changed requirements to npm (6.4.1)
- Added iframe-hack ("DomActions")
- Changed the way fonts are loaded (no more need for "FontsLoader", so it's deleted)
- No more need to put tile name in build scripts. Preparations for multi-tile addons support
- Now polyfilling browser versions that have 0.5 share or more
Minor:
- Added Mediator.js
- Added frame reload on ctrl+alt+click or cmd+opt+click (only works in dev mode)
- Added temporary solution for "includes" and IE (for anrom-jive-app-tools)
- Switched to anrom-jive-app-tools 0.8 beta. Switched dataUtils helper to usage of the library.
- createCommand now supports command w/o params
- Warns user to not use _ in tile name (causes jive-sdk error)
0.14.0
Major:
- Moved to babel v7
- Polyfills are now automatically added on their usage
- Polyfills are now based on browserslist (.browserlistrc file)
- Applied optional chaining proposal:
foo?.bar?.baz
. No more "unable to call property X of undefined" - Babel discontinued "stage-x" presets, so moved to proper proposal plugins
Minor:
- Regenerator injection is now applied on babel build
- Built distributives are now stored in
./dist
directory
0.13.3
Fixed critical breaking change in regenerator-runtime
0.13.1, 0.13.2
Updated README according to 0.13.0 changes, dealt with bitbucket/npm markdown differences
0.13.0
Major:
- Added this readme
jiveclientconfiguration.json
anddefinition.json
files are added to.gitignore
and are dynamically generated on build based on data from./config.yaml
,./src/meta.yaml
and./src/{tileName}/meta.yaml
. In this way configuration is made simpler, also build stamp is no longer changed on change of prod/dev middleware- .zip files are now ignored by git by default Minor:
- Production middleware URL is now taken from
./config.yaml
, not./config-local.yaml
- Now using version (including buildstamp) for anti-caching instead of date+time Bugfixes:
- Stripping
console.log
was incorrect, it was stripping all console output. Now works as planned
0.12.0
Major:
- Now generator features the refactored config schema revisioning tool. This also includes revisioning-friendly function "loadConfigFromString" in configuration for usage in MigrationConfig component of se-components-config
Minor:
- When using local HMR version in the console is being appended with "-hot". This should explain why there's no buildstamp on HMR.
0.11.0
- Now using YAML config file for local/personal data (jive instance local path, middleware URLs etc). In this way we also avoid very long gulp and webpack CLI strings.
- Now you can run
yo jive-react-addon:add-hot
andyo jive-react-addon:add-mw
separately to turn on HMR or middlewares accordingly. - Now you can run gulp with
--force
flag that allows to skip git commit verification before production build. Not recommended, use with caution!
0.10.0
Major:
- Jive-SDK command is now included in the generator (no need to run
jive-sdk create tile-app-internal --name="{tile-name}
before it). Now generator prompts for the tile sysnem name. - Now prompts for usage of middleware and if the answer is yes - for MW URLs and registration endpoints
- Now prompts for usage of HMR and if "yes" - for local jive instance path and optional HMR server URL
- Default build scripts are renamed according to our new task-naming policy (build-prod, build-dev, local-dev-hot)
- Now defines the minimal versions of node (8.11.4) and npm (5.6) needed for a successful build
- Now properly places default packages in "dependencies" and "devDependencies" depending on whether or not the package is about to be included in a resulting bundle
- Applied build-stamping. Build-stamp is only depends on the essential project files and should be
the same for the similar project on any location. Also creates logs in
./logs/buildstamps
- Now
console.log
usage is stripped from production builds.console.info
,console.warn
andconsole.error
are still available - Now places tile's information in console. This includes the name of the tile, it's version (including build-stamp), git commit and branch and git user who build it. Also shows if all changes were submitted to git at the moment of build
- Now builds development package with version and "-dev" in name
Minor:
- Abandoned webpack v1 usage. Now it's always webpack v3 by default. Previously used flags for webpack 1/2 ('-w1', '-w') will not work anymore!
- Moved build complex scripts to
./build-scripts
folder. Made build scripts modular - Switched to gulp v4. Now all scripts are running in strict order by using async and callbacks
- Applied usage of arguments in webpack and gulp. Now such variables as tile name, local jive path, middleware URL etc are only defined once in package.json as a command line arguments for gulp and then used throughout the entire project
- Now checks if node and npm is installed and crashes to a proper error if not
Bugfixes:
- Upgraded uglifier version (moment.js locale bug)
- Fixed the work of git prompting and information collection