Skip to content

Commit

Permalink
Implement gpr hack
Browse files Browse the repository at this point in the history
Even though we don't publish to gpr but npm, the problem looks similar.

actions/setup-node#269
  • Loading branch information
tehw0lf committed Dec 15, 2021
1 parent f7f98c5 commit 8f282e3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
run: npm install -g pnpm
- name: Enable pre and post scripts
run: pnpm config set enable-pre-post-scripts true
- name: Run GPR hack to set package name to / instead of %2f
run: node gpr-hack.js
- name: Install packages
run: pnpm install --frozen-lockfile
- name: Lint
Expand Down
43 changes: 43 additions & 0 deletions gpr-hack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// gpr-hack.js
import { readFileSync, writeFileSync } from 'fs';

contactFormFilePath = 'libs/contact-form/package.json';
gitPortfolioFilePath = 'libs/git-portfolio/package.json';
wordlistGeneratorFilePath = 'libs/wordlist-generator/package.json';

contactFormName = '@tehw0lf/contact-form';
gitPortfolioName = '@tehw0lf/git-portfolio';
wordlistGeneratorName = '@tehw0lf/wordlist-generator';

const contactFormFile = readFileSync(contactFormFilePath, {
encoding: 'utf-8'
});
const contactFormJson = JSON.parse(contactFormFile);
contactFormJson.name = contactFormName;

const gitPortfolioFile = readFileSync(gitPortfolioFilePath, {
encoding: 'utf-8'
});
const gitPortfolioJson = JSON.parse(gitPortfolioFile);
gitPortfolioJson.name = gitPortfolioName;

const wordlistGeneratorFile = readFileSync(wordlistGeneratorFilePath, {
encoding: 'utf-8'
});
const wordlistGeneratorJson = JSON.parse(wordlistGeneratorFile);
wordlistGeneratorJson.name = wordlistGeneratorName;

writeFileSync(
contactFormFilePath,
JSON.stringify(contactFormJson, undefined, 2)
);

writeFileSync(
gitPortfolioFilePath,
JSON.stringify(gitPortfolioJson, undefined, 2)
);

writeFileSync(
wordlistGeneratorFilePath,
JSON.stringify(wordlistGeneratorJson, undefined, 2)
);

0 comments on commit 8f282e3

Please sign in to comment.