newspack-scripts 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yamllint +7 -0
- package/README.md +34 -2
- package/package.json +1 -1
- package/post-release.sh +1 -2
- package/src/@orb.yml +8 -0
- package/src/commands/checkout_with_workspace.yml +6 -0
- package/src/executors/default.yml +11 -0
- package/src/jobs/build-distributable.yml +24 -0
- package/src/jobs/build.yml +21 -0
- package/src/jobs/lint-js-scss.yml +10 -0
- package/src/jobs/lint-php.yml +12 -0
- package/src/jobs/post-release.yml +10 -0
- package/src/jobs/release.yml +20 -0
- package/src/jobs/test-js.yml +10 -0
- package/src/jobs/test-php.yml +29 -0
package/.yamllint
ADDED
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ The following assumes that CI will run:
|
|
|
86
86
|
|
|
87
87
|
This package exposes a couple of configuration files.
|
|
88
88
|
|
|
89
|
-
###
|
|
89
|
+
### Webpack
|
|
90
90
|
|
|
91
91
|
The `webpack.config.js` file should use this package's config-extending function:
|
|
92
92
|
|
|
@@ -105,7 +105,7 @@ const webpackConfig = getBaseWebpackConfig(
|
|
|
105
105
|
module.exports = webpackConfig;
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
###
|
|
108
|
+
### Babel
|
|
109
109
|
|
|
110
110
|
A basic `babel.config.js`:
|
|
111
111
|
|
|
@@ -141,6 +141,38 @@ stylelint '**/*.scss' --syntax scss --config=./node_modules/newspack-scripts/con
|
|
|
141
141
|
|
|
142
142
|
_Note: Due to issue with dependency resolving, you might end up a different version of `prettier` in project's `node_modules` and `node_modules/newspack-scripts/node_modules`. See https://github.com/Automattic/newspack-scripts/issues/1 for more information._
|
|
143
143
|
|
|
144
|
+
### TypeScript
|
|
145
|
+
|
|
146
|
+
See note about `typescript-check` script above.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## CircleCI Orb
|
|
151
|
+
|
|
152
|
+
This repository hosts a [CircleCI Orb](https://circleci.com/docs/2.0/orb-intro), in `/src` directory. An Orb is a re-usable configuration – here's an example of how to use it:
|
|
153
|
+
|
|
154
|
+
```yml
|
|
155
|
+
version: 2.1
|
|
156
|
+
|
|
157
|
+
orbs:
|
|
158
|
+
newspack: adekbadek/newspack@1.0.0
|
|
159
|
+
|
|
160
|
+
workflows:
|
|
161
|
+
version: 2
|
|
162
|
+
all:
|
|
163
|
+
jobs:
|
|
164
|
+
- newspack/build
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Updating the Orb
|
|
168
|
+
|
|
169
|
+
To update the Orb, use [CircleCI's CLI's](https://circleci.com/docs/2.0/local-cli/) [`pack`](https://circleci-public.github.io/circleci-cli/circleci_orb_pack.html) and [`publish`](https://circleci-public.github.io/circleci-cli/circleci_orb_publish.html) commands:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Replace the `version` at the end (e.g. 1.0.1)
|
|
173
|
+
circleci orb pack src/ > orb.yml && circleci orb publish orb.yml adekbadek/newspack@version
|
|
174
|
+
```
|
|
175
|
+
|
|
144
176
|
---
|
|
145
177
|
|
|
146
178
|
## Misc
|
package/package.json
CHANGED
package/post-release.sh
CHANGED
|
@@ -35,7 +35,6 @@ fi
|
|
|
35
35
|
echo '[newspack-scripts] Merging the release branch into master'
|
|
36
36
|
git checkout master
|
|
37
37
|
# Merge release branch into master branch, prefering the changes from release branch if conflicts arise.
|
|
38
|
-
git merge --
|
|
39
|
-
git commit --message "chore(release): merge in release $LATEST_VERSION_TAG"
|
|
38
|
+
git merge --no-ff release --strategy-option=theirs -m "chore(release): merge in release $LATEST_VERSION_TAG"
|
|
40
39
|
# Push updated master upstream.
|
|
41
40
|
git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git"
|
package/src/@orb.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
description: >
|
|
2
|
+
This is a sample executor using Docker and Node.
|
|
3
|
+
docker:
|
|
4
|
+
- image: 'cimg/php:<<parameters.tag>>'
|
|
5
|
+
parameters:
|
|
6
|
+
tag:
|
|
7
|
+
default: 7.4-browsers
|
|
8
|
+
description: >
|
|
9
|
+
Pick a specific circleci/php image variant:
|
|
10
|
+
https://hub.docker.com/r/cimg/php/tags
|
|
11
|
+
type: string
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
description: >
|
|
2
|
+
Build the distributable files, so they are available as CI artifacts.
|
|
3
|
+
|
|
4
|
+
executor: default
|
|
5
|
+
|
|
6
|
+
parameters:
|
|
7
|
+
archive-name:
|
|
8
|
+
type: string
|
|
9
|
+
default: ""
|
|
10
|
+
description: "Name of the ZIP archive distributable."
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- checkout_with_workspace
|
|
14
|
+
- run:
|
|
15
|
+
name: Install rsync
|
|
16
|
+
command: sudo apt-get update && sudo apt-get install rsync
|
|
17
|
+
- run:
|
|
18
|
+
name: Install PHP packages
|
|
19
|
+
command: composer install --no-dev --no-scripts
|
|
20
|
+
- run:
|
|
21
|
+
name: Build plugin files
|
|
22
|
+
command: npm run build && npm run release:archive
|
|
23
|
+
- store_artifacts:
|
|
24
|
+
path: release/<<parameters.archive-name>>.zip
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
description: >
|
|
2
|
+
Install node dependencies.
|
|
3
|
+
|
|
4
|
+
executor: default
|
|
5
|
+
|
|
6
|
+
steps:
|
|
7
|
+
- checkout_with_workspace
|
|
8
|
+
- restore_cache:
|
|
9
|
+
key: v1-npm-{{ checksum "package.json" }}-{{checksum "package-lock.json" }}
|
|
10
|
+
# https://medium.com/@mdsky1986/caching-node-dependencies-when-using-npm-ci-89fe3f46404a
|
|
11
|
+
- run:
|
|
12
|
+
name: Install node dependencies
|
|
13
|
+
command: "[ ! -d node_modules ] && npm ci --loglevel warn --yes || echo package.json and package-lock.json unchanged. Using cache."
|
|
14
|
+
- save_cache:
|
|
15
|
+
key: v1-npm-{{ checksum "package.json" }}-{{checksum "package-lock.json" }}
|
|
16
|
+
paths:
|
|
17
|
+
- node_modules
|
|
18
|
+
- persist_to_workspace:
|
|
19
|
+
root: ~/
|
|
20
|
+
paths:
|
|
21
|
+
- project
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
description: >
|
|
2
|
+
Release new version.
|
|
3
|
+
|
|
4
|
+
executor: default
|
|
5
|
+
|
|
6
|
+
steps:
|
|
7
|
+
- checkout_with_workspace
|
|
8
|
+
- run:
|
|
9
|
+
name: Install rsync
|
|
10
|
+
command: sudo apt-get update && sudo apt-get install rsync
|
|
11
|
+
- run:
|
|
12
|
+
name: Install PHP packages
|
|
13
|
+
command: composer install --no-dev --no-scripts
|
|
14
|
+
- run:
|
|
15
|
+
name: Release new version
|
|
16
|
+
command: npm run release
|
|
17
|
+
- persist_to_workspace:
|
|
18
|
+
root: ~/
|
|
19
|
+
paths:
|
|
20
|
+
- project
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
description: >
|
|
2
|
+
Run PHP tests.
|
|
3
|
+
|
|
4
|
+
docker:
|
|
5
|
+
- image: cimg/php:7.4
|
|
6
|
+
- image: circleci/mysql:5.6.50
|
|
7
|
+
|
|
8
|
+
environment:
|
|
9
|
+
- WP_TESTS_DIR: '/tmp/wordpress-tests-lib'
|
|
10
|
+
- WP_CORE_DIR: '/tmp/wordpress/'
|
|
11
|
+
steps:
|
|
12
|
+
- checkout
|
|
13
|
+
- run:
|
|
14
|
+
name: Setup Environment Variables
|
|
15
|
+
command: |
|
|
16
|
+
echo "export PATH=$HOME/.composer/vendor/bin:$PATH" >> $BASH_ENV
|
|
17
|
+
source /home/circleci/.bashrc
|
|
18
|
+
- run:
|
|
19
|
+
name: Install Dependencies
|
|
20
|
+
command: |
|
|
21
|
+
sudo apt-get update && sudo apt-get install -y subversion default-mysql-client
|
|
22
|
+
- run:
|
|
23
|
+
name: Run Tests
|
|
24
|
+
command: |
|
|
25
|
+
composer install
|
|
26
|
+
composer global require "phpunit/phpunit=7.5.*"
|
|
27
|
+
rm -rf $WP_TESTS_DIR $WP_CORE_DIR
|
|
28
|
+
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 5.8.1
|
|
29
|
+
phpunit
|