Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add npm scripts for simple task automation #124

Merged
merged 7 commits into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/composer.lock
/vendor/
/.phpcs.xml
/phpcs.xml
node_modules/
vendor/
25 changes: 25 additions & 0 deletions .scripts/makepot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env node

// This script replaces the default use of `wpi18n makepot`, with custom
// POT file headers. It can be run with `npm run makepot`.

const chalk = require('chalk');
const wpi18n = require('node-wp-i18n');

console.log(chalk`{cyan Making pot file}...`);

wpi18n.makepot(
{
domainPath: 'languages',
potHeaders: {
'poedit': true,
'x-poedit-basepath': '..',
'report-msgid-bugs-to': 'StudioPress <[email protected]>',
'last-translator': 'StudioPress <[email protected]>',
'language-team': 'StudioPress <[email protected]>'
}
}
).then(
(result) => console.log(chalk`{cyan Pot file updated at {bold ${result.domainPath}/${result.potFile}}}`),
(err) => console.log(chalk`{red ${err}}`)
);
3 changes: 3 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "stylelint-config-wordpress"
}
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Github project link: https://github.com/copyblogger/genesis-sample/
3. Activate the Genesis Sample theme.
4. Inside your WordPress dashboard, go to Genesis > Theme Settings and configure them to your liking.

## Theme Support

Please visit https://my.studiopress.com/help/ for theme support.

## For Developers

The version of [Genesis Sample on GitHub](https://github.com/copyblogger/genesis-sample/) includes tooling to check code against WordPress standards. To use it:
Expand All @@ -21,13 +25,26 @@ The version of [Genesis Sample on GitHub](https://github.com/copyblogger/genesis

You'll see output highlighting issues with PHP files that do not conform to Genesis Sample coding standards.

### Packaging for distribution
### npm scripts

Scripts are also provided to help with CSS linting, CSS autoprefixing, and creation of pot language files. To use them:

1. Switch to the branch you plan to distribute.
2. Run `composer export` to zip all non-development files as `genesis-sample.zip`.
1. Install [Node.js](https://nodejs.org/), which also gives you the Node Package Manager (npm).
2. In the command line, change directory to the Genesis Sample folder.
3. Type the command `npm install` to install dependencies.

The `export` command is an alias for `git archive -o genesis-sample.zip HEAD`.
You can then type any of these commands:

## Theme Support
- `npm run autoprefixer` to add and remove vendor prefixes in `style.css`.
- `npm run makepot` to regenerate the `languages/genesis-sample.pot` file.
- `npm run lint:css` to generate a report of style violations for `style.css`.
- `npm run zip` to create a genesis-sample.zip of the current branch that excludes all development files.

Please visit https://my.studiopress.com/help/ for theme support.
### Packaging for distribution

1. Follow the install instructions for npm scripts above.
2. Switch to the git branch you plan to distribute.
3. Bump version numbers manually.
4. Type `npm run zip` to zip all non-development files as `genesis-sample.zip`.

The `zip` command is an alias for `git archive -o genesis-sample.zip HEAD`.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"sort-order": true
},
"scripts": {
"export": "git archive -o genesis-sample.zip HEAD",
"install-codestandards": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
"phpcs": "phpcs"
},
Expand Down
Loading