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 ADDED
@@ -0,0 +1,7 @@
1
+ extends: relaxed
2
+
3
+ rules:
4
+ line-length:
5
+ max: 200
6
+ allow-non-breakable-inline-mappings: true
7
+
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
- ### webpack
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
- ### babel
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-scripts",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "newspack-scripts": "./bin/newspack-scripts.js"
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 --squash release --strategy-option=theirs
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,8 @@
1
+ version: 2.1
2
+
3
+ description: >
4
+ Newspack shared CI config.
5
+
6
+ display:
7
+ home_url: "https://newspack.pub"
8
+ source_url: "https://www.github.com/Automattic/newspack-scripts"
@@ -0,0 +1,6 @@
1
+ description: >
2
+ Chechout code and attach workspace.
3
+ steps:
4
+ - checkout
5
+ - attach_workspace:
6
+ at: ~/
@@ -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,10 @@
1
+ description: >
2
+ Lint the JS & SCSS files.
3
+
4
+ executor: default
5
+
6
+ steps:
7
+ - checkout_with_workspace
8
+ - run:
9
+ name: Run Linter
10
+ command: npm run lint
@@ -0,0 +1,12 @@
1
+ description: >
2
+ Lint PHP files.
3
+
4
+ executor: default
5
+
6
+ steps:
7
+ - checkout
8
+ - run:
9
+ name: Lint Files
10
+ command: |
11
+ composer install
12
+ ./vendor/bin/phpcs
@@ -0,0 +1,10 @@
1
+ description: >
2
+ Perform post-release tasks.
3
+
4
+ executor: default
5
+
6
+ steps:
7
+ - checkout_with_workspace
8
+ - run:
9
+ name: Perform post-release chores
10
+ command: ./node_modules/newspack-scripts/post-release.sh
@@ -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,10 @@
1
+ description: >
2
+ Run JS tests.
3
+
4
+ executor: default
5
+
6
+ steps:
7
+ - checkout_with_workspace
8
+ - run:
9
+ name: Run JS Tests
10
+ command: npm run test
@@ -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