removed runtime dependencies
This commit is contained in:
parent
24fac66594
commit
39e6945130
|
@ -3,39 +3,12 @@ name: 'Bump Version'
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'remove-dependencies'
|
||||
|
||||
jobs:
|
||||
generate-bundle:
|
||||
name: 'Generate bundle'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 'Checkout source code'
|
||||
uses: 'actions/checkout@v2'
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
- name: 'Setup Node.js'
|
||||
uses: 'actions/setup-node@v1'
|
||||
with:
|
||||
node-version: 12
|
||||
- name: 'generate bundle'
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
git config user.name "Automated Version Bump"
|
||||
git config user.email "gh-action-bump-version@users.noreply.github.com"
|
||||
git add dist -f
|
||||
if [ $(git status --porcelain=v1 2>/dev/null | wc -l) -gt 0 ]
|
||||
then
|
||||
git commit -m "ci: generate bundle"
|
||||
git push
|
||||
fi
|
||||
|
||||
bump-version:
|
||||
name: 'Bump Version on master'
|
||||
runs-on: ubuntu-latest
|
||||
needs: generate-bundle
|
||||
|
||||
steps:
|
||||
- name: 'Checkout source code'
|
||||
|
@ -46,7 +19,7 @@ jobs:
|
|||
run: cat ./package.json
|
||||
- name: 'Automated Version Bump'
|
||||
id: version-bump
|
||||
uses: 'phips28/gh-action-bump-version@master'
|
||||
uses: 'melody-universe/gh-action-bump-version@remove-dependencies'
|
||||
with:
|
||||
tag-prefix: 'v'
|
||||
env:
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
node_modules
|
||||
.nyc_output
|
||||
/dist
|
|
@ -2,7 +2,7 @@ name: Automated Version Bump
|
|||
description: Automated version bump for npm packages.
|
||||
runs:
|
||||
using: node12
|
||||
main: dist/main.js
|
||||
main: index.js
|
||||
branding:
|
||||
icon: chevron-up
|
||||
color: blue
|
||||
|
|
File diff suppressed because one or more lines are too long
45
index.js
45
index.js
|
@ -1,7 +1,6 @@
|
|||
const { execSync } = require('child_process');
|
||||
const execa = require('execa');
|
||||
const { execSync, spawn } = require('child_process');
|
||||
const { existsSync } = require('fs');
|
||||
const { Signale } = require('signale');
|
||||
const { EOL } = require('os');
|
||||
const path = require('path');
|
||||
|
||||
// Change working directory if user defined PACKAGEJSON_DIR
|
||||
|
@ -11,11 +10,10 @@ if (process.env.PACKAGEJSON_DIR) {
|
|||
}
|
||||
|
||||
const workspace = process.env.GITHUB_WORKSPACE;
|
||||
const logger = new Signale({ config: { underlineLabel: false } });
|
||||
|
||||
(async () => {
|
||||
const pkg = getPackageJson();
|
||||
const event = process.env.GITHUB_EVENT_PATH ? __non_webpack_require__(process.env.GITHUB_EVENT_PATH) : {};
|
||||
const event = process.env.GITHUB_EVENT_PATH ? require(process.env.GITHUB_EVENT_PATH) : {};
|
||||
|
||||
if (!event.commits) {
|
||||
console.log("Couldn't find any commits in this event, incrementing patch version...");
|
||||
|
@ -178,7 +176,7 @@ const logger = new Signale({ config: { underlineLabel: false } });
|
|||
await runInWorkspace('git', ['push', remoteRepo]);
|
||||
}
|
||||
} catch (e) {
|
||||
logger.fatal(e);
|
||||
logError(e);
|
||||
exitFailure('Failed to bump version');
|
||||
return;
|
||||
}
|
||||
|
@ -188,19 +186,44 @@ const logger = new Signale({ config: { underlineLabel: false } });
|
|||
function getPackageJson() {
|
||||
const pathToPackage = path.join(workspace, 'package.json');
|
||||
if (!existsSync(pathToPackage)) throw new Error("package.json could not be found in your project's root.");
|
||||
return __non_webpack_require__(pathToPackage);
|
||||
return require(pathToPackage);
|
||||
}
|
||||
|
||||
function exitSuccess(message) {
|
||||
logger.success(message);
|
||||
console.info(`✔ success ${message}`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
function exitFailure(message) {
|
||||
logger.fatal(message);
|
||||
logError(message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function runInWorkspace(command, args) {
|
||||
return execa(command, args, { cwd: workspace });
|
||||
function logError(error) {
|
||||
console.error(`✖ fatal ${error.stack || error}`);
|
||||
}
|
||||
|
||||
function runInWorkspace(command, args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(command, args, { cwd: workspace });
|
||||
let isDone = false;
|
||||
const errorMessages = [];
|
||||
child.on('error', (error) => {
|
||||
if (!isDone) {
|
||||
isDone = true;
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
child.stderr.on('data', (chunk) => errorMessages.push(chunk));
|
||||
child.on('exit', (code) => {
|
||||
if (!isDone) {
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
} else {
|
||||
reject(`${errorMessages.join('')}${EOL}${command} exited with code ${code}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
//return execa(command, args, { cwd: workspace });
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
|
@ -16,19 +16,12 @@
|
|||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node ./index.js",
|
||||
"test": "jest",
|
||||
"build": "webpack"
|
||||
},
|
||||
"dependencies": {
|
||||
"execa": "^5.1.1",
|
||||
"signale": "^1.4.0"
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"jest": "^25.2.7",
|
||||
"standard": "^14.3.3",
|
||||
"prettier": "^2.3.0",
|
||||
"terser-webpack-plugin": "^5.1.4",
|
||||
"webpack": "^5.49.0",
|
||||
"webpack-cli": "^4.7.2"
|
||||
"prettier": "^2.3.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './index.js',
|
||||
target: 'node',
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
format: {
|
||||
comments: false,
|
||||
},
|
||||
},
|
||||
extractComments: false,
|
||||
}),
|
||||
],
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue