A distributable package of modules used in CORE projects originally derived from the Electric Book Template.
Commit all changes and push to origin.
To automatically publish the package changes as an incremental patch, run:
npm run release
This will bump the current patch version (the third value) by one.
To update to a new minor or major verion, first change the version in the package.json file, and then run:
npm run first-release
Add it as a dependency using the direct GitHub repo and tag version approach, replacing {tag} with the version:
"dependencies": {
"@electricbookworks/core-book-modules": "github:electricbookworks/core-book-modules#{tag}"
}Then install it: npm install.
When you install this package via npm, the postinstall script automatically runs and:
- Copies root folders defined in
FOLDERS_TO_SYNCinsideinstall.jsfrom this package to the parent package. - Creates
.gitignorefiles in copied folders to prevent tracking their contents - Syncs custom files. The parent package can customise the contents of these folders by using the
{folder-name}-custompattern. For example,_tools-custom/some/file.jsin the parent package will be copied into the resulting_tools/some/file.jsthat gets installed in the parent package. It will overwrite any same named file. - Creates a
gulpfile.jsin the root of the parent package that imports the full source of_tools/gulpfile.js - Creates a log file (
core-book-modules-install.log) for debugging purposes if there are any errors.
This dependency approach can result in npm install not correctly updating the package when changing the version. To fix this, use the following inside your Electric Book Template after changing the version:
rm -rf node_modules package-lock.json && npm installYour template should also have a shortcut command for this: npm run update-modules.
Using yalc for local development
To view changes to this package locally from the template importing it without having to create a new release each time, use yalc.
Install yalc:
npm i yalc -g
Publish this package to your local machine store, by running this in the root of this repo:
yalc publish
Inside the template that is consuming this package, run:
yalc link @electricbookworks/core-book-modules
Add this postyalc property to scripts inside the consuming template's package.json:
"scripts": {
"postyalc": "node node_modules/@electricbookworks/core-book-modules/install.js"
}
To push changes to the book template consuming it, run this inside this repo:
yalc push
To watch for changes and have them automatically pushed with yalc:
npm run watch
This will have no effect on deployments external to your local machine. To publish all your changes as a new release, follow the instructions under 'Publishing changes' above.