Skip to content

Commit

Permalink
feat: modified publish script to change dependencies before publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
roerohan committed Apr 8, 2021
1 parent 1191534 commit 5474f6c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
npm install
- if: steps.check.outputs.versionChanged == 'true'
run: npm publish --access public
run: npm run publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-vnc",
"version": "0.1.5",
"version": "0.1.6",
"description": "A React Component to connect to a websockified VNC client using noVNC.",
"author": "roerohan",
"license": "MIT",
Expand Down Expand Up @@ -35,7 +35,8 @@
"test": "react-scripts test",
"eject": "react-scripts eject",
"build:lib": "rollup -c",
"prepack": "npm run build:lib"
"prepack": "npm run build:lib",
"publish": "npm run build:lib && cp README.md LICENSE dist/ && cd dist && npm publish"
},
"eslintConfig": {
"extends": [
Expand Down
27 changes: 27 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
import pkg from './package.json';
import typescript from 'rollup-plugin-typescript2';
import fs from 'fs';

const {
react,
'react-scripts': reactScripts,
'react-dom': reactDom,
...dependencies
} = pkg.dependencies;

const peerDependencies = {
react: '>=16.0.0',
'react-scripts': reactScripts,
'react-dom': '>=16.0.0',
};

fs.writeFileSync('./dist/package.json', JSON.stringify({
name: pkg.name,
description: pkg.description,
version: pkg.version,
private: false,
main: pkg.main.replace(/dist\//ig, ''),
typings: pkg.typings.replace(/dist\//ig, ''),
publishConfig: pkg.publishConfig,
keywords: pkg.keywords,
dependencies,
peerDependencies,
}, null, 4));

export default {
input: pkg.source,
Expand Down

0 comments on commit 5474f6c

Please sign in to comment.