Skip to content

Commit

Permalink
Fix copy files task path (#39)
Browse files Browse the repository at this point in the history
* Fix copy files task path

* Update changelogs

* Fix prep-release command

* Update pr-checks.yml
  • Loading branch information
irshadahmad21 authored Jan 23, 2024
1 parent 4cbc859 commit be77063
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-pets-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wptelegram-login": patch
---

Fixed the error when there is no user data to update.
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
SVN_USERNAME: ${{ secrets.SVN_USERNAME || 'test' }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD || 'test' }}

- name: Copy README.md to dist
run: |
cp ${{ fromJson(needs.details.outputs.result).relativeDir }}/README.md dist/${{ fromJson(needs.details.outputs.result).relativeDir }}/README.md
- name: Deploy to repo
uses: manzoorwanijk/action-deploy-to-repo@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
jobs:
php-lint-test:
name: "PHP: Lint, Test"
if: github.repository == 'wpsocio/wp-plugins-dev'
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:

js-lint-build:
name: "JS: Lint, Build and Test"
if: github.repository == 'wpsocio/wp-plugins-dev'
timeout-minutes: 15
runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: changesets
with:
publish: pnpm release
version: pnpm prep-version
version: pnpm prep-release
title: Prepare for next release
commit: Prepare for next release
env:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lint:js": "wireit",
"lint:js:fix": "biome format ./ --write",
"lint:php": "wireit",
"prep-version": "changeset status --output=changeset-status.json && changeset version && wpdev bundle --from-release=changeset-status.json",
"prep-release": "changeset status --output=changeset-status.json && changeset version && wpdev bundle --from-changeset --changeset-json=changeset-status.json",
"release": "changeset publish",
"setup:php": "wireit",
"test:php": "wireit",
Expand Down
6 changes: 1 addition & 5 deletions plugins/wptelegram-comments/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Changelog

All notable changes to this project are documented in this file.

## Unreleased

## [1.1.9 - 2023-12-7](https://github.com/wpsocio/wptelegram-comments/releases/tag/v1.1.9)
## 1.1.9

- Maintenance release

Expand Down
10 changes: 1 addition & 9 deletions plugins/wptelegram-login/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Changelog

All notable changes to this project are documented in this file.

## Unreleased

### Bug fixes

- Fixed the error when there is no user data to update.

## [1.10.7 - 2023-10-9](https://github.com/wpsocio/wptelegram-login/releases/tag/v1.10.7)
## 1.10.7

### Bug fixes

Expand Down
6 changes: 1 addition & 5 deletions plugins/wptelegram-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Changelog

All notable changes to this project are documented in this file.

## Unreleased

## [2.1.11 - 2023-12-7](https://github.com/wpsocio/wptelegram-widget/releases/tag/v2.1.11)
## 2.1.11

- Maintenance release

Expand Down
10 changes: 6 additions & 4 deletions tools/wpdev/src/commands/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,16 @@ export default class Bundle extends WithProjects<typeof Bundle> {
}

const {
relativeSource,
stripFromPath,
files,
ignore = getDistIgnorePattern(project.dir),
} = bundle.tasks.copyFilesBefore;

return await copyFiles(
path.join(project.dir, relativeSource),
project.dir,
{ files, ignore },
outDir,
stripFromPath,
);
},
},
Expand Down Expand Up @@ -369,15 +370,16 @@ export default class Bundle extends WithProjects<typeof Bundle> {
}

const {
relativeSource,
stripFromPath,
files,
ignore = getDistIgnorePattern(project.dir),
} = bundle.tasks.copyFilesAfter;

return await copyFiles(
path.join(project.dir, relativeSource),
project.dir,
{ files, ignore },
outDir,
stripFromPath,
);
},
},
Expand Down
3 changes: 2 additions & 1 deletion tools/wpdev/src/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ export async function copyFiles(
cwd: string,
targetFiles: TaskTarget,
destDir: string,
stripFromPath: string,
) {
const entries = globFiles(targetFiles, { cwd });

for (const file of entries) {
const filePath = path.join(cwd, file);
const destPath = path.join(destDir, file);
const destPath = path.join(destDir, file.replace(stripFromPath, ''));

if (!fs.existsSync(path.dirname(destPath))) {
fs.mkdirSync(path.dirname(destPath), { recursive: true });
Expand Down
8 changes: 5 additions & 3 deletions tools/wpdev/src/utils/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ const targetFilesSchema = z.object({
});

const copyFilesData = z.object({
relativeSource: z
stripFromPath: z
.string()
.optional()
.default('src')
.describe('The directory relative to which the source files are.'),
.describe(
'The string/path to strip from the source file paths before copying them.',
),
files: targetFilesSchema.shape.files
.optional()
.default(['**/*', '../CHANGELOG.md', '../README.md']),
.default(['src/**/*', 'CHANGELOG.md']),
ignore: targetFilesSchema.shape.ignore,
});

Expand Down

0 comments on commit be77063

Please sign in to comment.