Skip to content

Commit

Permalink
GitHub workflow to publish the package
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Sep 27, 2021
1 parent f38fc61 commit 832c7d2
Show file tree
Hide file tree
Showing 47 changed files with 13,132 additions and 23 deletions.
9 changes: 0 additions & 9 deletions .eslintrc

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Node.js package
on:
push:
branches:
- master
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
test-and-publish:
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm install
- run: npm test
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ env.NPM_TOKEN }}
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test/
.vscode
.github
.prettierrc
readme.md
2 changes: 1 addition & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exports.pluginOptionsSchema = ({ Joi }) => {
const processHtmlFile = async (filePath, { propertyId, scriptVersion }) => {
let apiResult;
let processedBody = '';

const fileContents = await fs.readFile(filePath);
if (!/<head>/i.test(fileContents)) {
console.log(
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "DataUnlocker's integration to Gatsby",
"main": "gatsby-node.js",
"scripts": {
"pretest": "cd test/test-gatsby-website && rm -rf public && npm install && npm run build",
"pretest": "cd test/gatsby-website && rm -rf public && npm install && npm run build",
"test": "ava test/**/*.test.js",
"prettier": "prettier",
"autoformat": "prettier --write ./*.js ./test/*.js"
Expand All @@ -27,7 +27,8 @@
"dependencies": {
"fs-extra": "^10.0.0",
"node-fetch": "^2.6.5",
"tiny-glob": "^0.2.9"
"tiny-glob": "^0.2.9",
"typescript": "^4.4.3"
},
"devDependencies": {
"ava": "^3.15.0",
Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ In your `gatsby-config.js`, use the following:
```javascript
module.exports = {
plugins: [
'other-plugin1',
'other-plugin2',
{
// Keep gatsby-plugin-dataunlocker below all other plugins, as it is a post-processing plugin.
resolve: 'gatsby-plugin-dataunlocker',
options: {
propertyId: '6751714b4c5980736a4b6aaa',
propertyId: '6751714b4c5980736a4b6aaa', // Required. Your DataUnlocker property ID.
scriptVersion: 'latest', // Optional. Use 'latest' or a specific script version like '3.0.3'.
},
},
Expand Down
3 changes: 3 additions & 0 deletions test/gatsby-website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
.cache/
public
54 changes: 54 additions & 0 deletions test/gatsby-website/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<p align="center">
<a href="https://www.gatsbyjs.com/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter">
<img alt="Gatsby" src="https://www.gatsbyjs.com/Gatsby-Monogram.svg" width="60" />
</a>
</p>
<h1 align="center">
Gatsby minimal starter
</h1>

## 🚀 Quick start

1. **Create a Gatsby site.**

Use the Gatsby CLI to create a new site, specifying the minimal starter.

```shell
# create a new Gatsby site using the minimal starter
npm init gatsby
```

2. **Start developing.**

Navigate into your new site’s directory and start it up.

```shell
cd my-gatsby-site/
npm run develop
```

3. **Open the code and start customizing!**

Your site is now running at http://localhost:8000!

Edit `src/pages/index.js` to see your site update in real-time!

4. **Learn more**

- [Documentation](https://www.gatsbyjs.com/docs/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)

- [Tutorials](https://www.gatsbyjs.com/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)

- [Guides](https://www.gatsbyjs.com/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)

- [API Reference](https://www.gatsbyjs.com/docs/api-reference/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)

- [Plugin Library](https://www.gatsbyjs.com/plugins?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)

- [Cheat Sheet](https://www.gatsbyjs.com/docs/cheat-sheet/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)

## 🚀 Quick start (Gatsby Cloud)

Deploy this starter with one click on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/):

[<img src="https://www.gatsbyjs.com/deploynow.svg" alt="Deploy to Gatsby Cloud">](https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-minimal)
16 changes: 16 additions & 0 deletions test/gatsby-website/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
siteMetadata: {
siteUrl: "https://public-test.dataunlocker.com",
title: "Test Gatsby Website",
},
plugins: [
'gatsby-plugin-meta-redirect',
{
resolve: require.resolve(`../..`),
options: {
propertyId: "534c5239534d2d687a744b38",
scriptVersion: "latest",
},
},
],
};
9 changes: 9 additions & 0 deletions test/gatsby-website/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
exports.createPages = ({ actions }) => {
const { createRedirect } = actions;

createRedirect({
fromPath: '/test-redirect/',
toPath: '/test-page-redirect-to/',
isPermanent: true,
});
};
Loading

0 comments on commit 832c7d2

Please sign in to comment.