Skip to content

Commit

Permalink
Tools: Update packages, switch from yarn to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle committed Dec 17, 2024
1 parent 76fd1bd commit 2cda74f
Show file tree
Hide file tree
Showing 18 changed files with 30,486 additions and 14,073 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm

- name: Set PHP version
uses: shivammathur/setup-php@e04e1d97f0c0481c6e1ba40f8a538454fe5d7709 # v2.21.2
Expand All @@ -31,10 +31,10 @@ jobs:
- name: Install JS dependencies
run: |
yarn
npm install
- name: Build
run: yarn workspaces run build
run: npm run build --workspaces

- name: Ignore .gitignore
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm

- name: Install JS dependencies
run: |
yarn
npm install
- name: Set PHP version
uses: shivammathur/setup-php@e04e1d97f0c0481c6e1ba40f8a538454fe5d7709 # v2.21.2
Expand All @@ -39,8 +39,8 @@ jobs:
- name: Lint JavaScript and Styles
run: |
yarn workspaces run lint:js --quiet
yarn workspaces run lint:css
npm run lint:js --workspaces -- --quiet
npm run lint:css --workspaces
- name: Lint PHP
run: |
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ jobs:
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm

- name: Install JS dependencies
run: |
yarn
npm install
- name: Build
run: yarn workspaces run build
run: npm run build --workspaces

- name: Install WordPress
run: |
chmod -R 767 ./ # TODO: Possibly integrate in wp-env
yarn wp-env start --update
yarn wp-env run tests-cli wp core version
yarn wp-env run tests-cli wp plugin list
npm run wp-env start --update
npm run wp-env run tests-cli wp core version
npm run wp-env run tests-cli wp plugin list
- name: Running multisite unit tests
run: yarn test:php
run: npm run test:php
if: ${{ success() || failure() }}

unit-js:
Expand All @@ -70,7 +70,7 @@ jobs:
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm

- name: Set PHP version
uses: shivammathur/setup-php@e04e1d97f0c0481c6e1ba40f8a538454fe5d7709 # v2.21.2
Expand All @@ -85,13 +85,13 @@ jobs:
- name: Install JS dependencies
run: |
yarn
npm
- name: Build
run: yarn workspaces run build
run: npm run build --workspaces

- name: Run unit tests on theme data store
run: yarn workspace wporg-pattern-directory-theme test:unit
run: npm run test:unit --workspace=wporg-pattern-directory-theme

- name: Run unit tests on the pattern creator
run: yarn workspace wporg-pattern-creator test:unit
run: npm run test:unit --workspace=wporg-pattern-creator
4 changes: 2 additions & 2 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends" : "@wordpress/stylelint-config/scss",
"extends" : "@wordpress/stylelint-config/scss-stylistic",
"rules" : {
"max-line-length": 115,
"@stylistic/max-line-length": 115,
"no-descending-specificity": null,
"rule-empty-line-before" : [ "always-multi-line", {
"except" : [ "first-nested", "after-single-line-comment" ]
Expand Down
44 changes: 22 additions & 22 deletions bin/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,46 @@ set -e

# Install dependencies
composer update
yarn
npm install

# Build the project
yarn workspaces run build
npm run build --workspaces

# Setup the environment
yarn wp-env start --update
npm run wp-env start --update

# Update wp configs
yarn wp-env run cli wp config set JETPACK_DEV_DEBUG true
yarn wp-env run cli wp config set WPORG_SANDBOXED true
npm run wp-env run cli wp config set JETPACK_DEV_DEBUG true
npm run wp-env run cli wp config set WPORG_SANDBOXED true

# Create the table for locales
yarn wp-env run cli wp db import wp-content/uploads/data/wporg_locales.sql
npm run wp-env run cli wp db import wp-content/uploads/data/wporg_locales.sql

# Activate plugins
yarn wp-env run cli wp plugin activate wordpress-importer
yarn wp-env run cli wp plugin activate gutenberg
yarn wp-env run cli wp plugin activate pattern-directory/bootstrap.php
yarn wp-env run cli wp plugin activate pattern-creator
npm run wp-env run cli wp plugin activate wordpress-importer
npm run wp-env run cli wp plugin activate gutenberg
npm run wp-env run cli wp plugin activate pattern-directory/bootstrap.php
npm run wp-env run cli wp plugin activate pattern-creator

# Activate theme
yarn wp-env run cli wp theme activate pattern-directory
npm run wp-env run cli wp theme activate pattern-directory

# Change permalinks
yarn wp-env run cli wp rewrite structure '/%postname%/'
npm run wp-env run cli wp rewrite structure '/%postname%/'

# Set up site title
yarn wp-env run cli wp option update blogname "Pattern Directory"
yarn wp-env run cli wp option update blogdescription "Add a beautifully designed, ready to go layout to any WordPress site with a simple copy/paste."
npm run wp-env run cli wp option update blogname "Pattern Directory"
npm run wp-env run cli wp option update blogdescription "Add a beautifully designed, ready to go layout to any WordPress site with a simple copy/paste."

# Create the default pages
yarn wp-env run cli wp post create --post_type=page --post_status='publish' --post_name='front-page' --post_title='Pattern Directory'
yarn wp-env run cli wp post create --post_type=page --post_status='publish' --post_name='archives' --post_title='Archives'
npm run wp-env run cli wp post create --post_type=page --post_status='publish' --post_name='front-page' --post_title='Pattern Directory'
npm run wp-env run cli wp post create --post_type=page --post_status='publish' --post_name='archives' --post_title='Archives'

yarn wp-env run cli wp option update show_on_front 'page'
yarn wp-env run cli wp option update page_on_front 4
yarn wp-env run cli wp option update page_for_posts 5
yarn wp-env run cli wp option update posts_per_page 18
npm run wp-env run cli wp option update show_on_front 'page'
npm run wp-env run cli wp option update page_on_front 4
npm run wp-env run cli wp option update page_for_posts 5
npm run wp-env run cli wp option update posts_per_page 18

# Import content
yarn wp-env run cli wp import --authors=create --skip=image_resize wp-content/uploads/data/exports/pattern-dir.000.xml
yarn wp-env run cli wp import --authors=create --skip=image_resize wp-content/uploads/data/exports/pattern-dir.001.xml
npm run wp-env run cli wp import --authors=create --skip=image_resize wp-content/uploads/data/exports/pattern-dir.000.xml
npm run wp-env run cli wp import --authors=create --skip=image_resize wp-content/uploads/data/exports/pattern-dir.001.xml
Loading

0 comments on commit 2cda74f

Please sign in to comment.