Browse Source

Initial commit

pull/1/head
Luke Childs 6 years ago
commit
b2e26479d5
  1. 5
      .gitignore
  2. 7
      .travis.yml
  3. 21
      LICENSE
  4. 16
      README.md
  5. 24
      index.js
  6. 40
      package.json

5
.gitignore

@ -0,0 +1,5 @@
node_modules
.nyc_output
npm-debug.log
package-lock.json
yarn.lock

7
.travis.yml

@ -0,0 +1,7 @@
language: node_js
node_js:
- '10'
script: npm test
notifications:
email:
on_success: never

21
LICENSE

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Luke Childs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

16
README.md

@ -0,0 +1,16 @@
# parcel-plugin-ogimage
> Set absolute URL for og:image meta tags.
[![Build Status](https://travis-ci.com/lukechilds/parcel-plugin-ogimage.svg?branch=master)](https://travis-ci.com/lukechilds/parcel-plugin-ogimage)
[![npm](https://img.shields.io/npm/v/parcel-plugin-ogimage.svg)](https://www.npmjs.com/package/parcel-plugin-ogimage)
## Install
```shell
npm install parcel-plugin-ogimage
```
## License
MIT © Luke Childs

24
index.js

@ -0,0 +1,24 @@
const ora = require('ora');
const chalk = require('chalk');
const fs = require('fs');
const path = require('path');
const prettyMs = require('pretty-ms');
module.exports = bundler => {
bundler.on('buildEnd', async () => {
if (process.env.NODE_ENV !== 'production') return;
console.log('');
const spinner = ora(chalk.grey('Fixing og:image link')).start();
const start = Date.now();
const htmlPath = path.join(bundler.options.outDir, 'index.html');
const html = fs.openSync(htmlPath).toString();
console.log(html);
const end = Date.now();
spinner.stopAndPersist({
symbol: '✨ ',
text: chalk.green(`Fixed og:image link in ${prettyMs(end - start)}.`)
});
};

40
package.json

@ -0,0 +1,40 @@
{
"name": "parcel-plugin-ogimage",
"version": "0.0.0",
"description": "Set absolute URL for og:image meta tags.",
"main": "index.js",
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lukechilds/parcel-plugin-ogimage.git"
},
"keywords": [
"parcel",
"plugin",
"og:image",
"og",
"open graph",
"image"
],
"author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)",
"license": "MIT",
"bugs": {
"url": "https://github.com/lukechilds/parcel-plugin-ogimage/issues"
},
"homepage": "https://github.com/lukechilds/parcel-plugin-ogimage#readme",
"devDependencies": {
"xo": "^0.23.0"
},
"dependencies": {
"chalk": "^2.4.2",
"fs": "^0.0.1-security",
"ora": "^3.4.0",
"path": "^0.12.7",
"pretty": "^2.0.0"
}
}
Loading…
Cancel
Save