Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/fe-pr-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
run: npm ci

- name: Build and Push to Jfrog NPM Registry
uses: collaborationFactory/github-actions/.github/actions/artifacts@master
uses: collaborationFactory/github-actions/.github/actions/artifacts@feature/PFM-ISSUE-31903-Make-apps-publishable-with-its-own-package
env:
JFROG_BASE64_TOKEN: ${{ secrets.JFROG_BASE64_TOKEN }}
JFROG_URL: ${{ secrets.JFROG_URL }}
Expand Down
14 changes: 13 additions & 1 deletion tools/scripts/artifacts/nx-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { JfrogCredentials } from './jfrog-credentials';
import { Version } from './version';
import { getJfrogUrl } from './configuration';
import { NpmPackage } from './types';
import { existsSync } from 'node:fs';

interface PackageJson {
author: string;
Expand Down Expand Up @@ -56,6 +57,9 @@ export class NxProject {
this.isPublishable = true;
}
} else {
console.log(`Path to app package.json ${this.getPackageJsonPathInSource()}`);
this.hasPackageJson = existsSync(this.getPackageJsonPathInSource());
console.log(`App package.json exists ${this.hasPackageJson}`);
this.isPublishable = true;
}
}
Expand Down Expand Up @@ -262,14 +266,22 @@ export class NxProject {
console.log('wrote .npmrc to: ' + npmrcPathInDist);
}

private getPackageJsonPath(): string{
let packageJsonPath = this.getPackageJsonPathInDist();
if(!existsSync(packageJsonPath)) {
packageJsonPath = this.getPackageJsonPathInSource();
}
return packageJsonPath;
}

public setVersionOrGeneratePackageJsonInDist(
version: Version,
registry: string
) {
if (this.hasPackageJson) {
try {
this.packageJsonContent = JSON.parse(
fs.readFileSync(this.getPackageJsonPathInDist()).toString()
fs.readFileSync(this.getPackageJsonPath()).toString()
);
this.packageJsonContent.author = 'squad-fe';
this.packageJsonContent.version = version.toString();
Expand Down