Skip to content

Commit

Permalink
use ncc build
Browse files Browse the repository at this point in the history
  • Loading branch information
shunjid committed Sep 9, 2020
1 parent 3aec3cf commit 82833fe
Show file tree
Hide file tree
Showing 717 changed files with 54,011 additions and 225,499 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ outputs:
description: 'Test'
runs:
using: 'node12'
main: 'index.js'
main: 'dist/index.js'
53,702 changes: 53,702 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

47 changes: 26 additions & 21 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ const path = require("path");
const fs = require("fs");
const glob = require("glob");
const csso = require("csso");
const { minify } = require("terser");

const { Octokit } = require("@octokit/core");
const { createPullRequest } = require("octokit-plugin-create-pull-request");
const {
minify
} = require("terser");

const {
Octokit
} = require("@octokit/core");
const {
createPullRequest
} = require("octokit-plugin-create-pull-request");
const MyOctokit = Octokit.plugin(createPullRequest);

/**
Expand Down Expand Up @@ -37,7 +43,7 @@ const MyOctokit = Octokit.plugin(createPullRequest);
}

const currentBranch = github.context.ref.slice(11);
if(currentBranch.startsWith('_minisauras_')){
if (currentBranch.startsWith('_minisauras_')) {
console.log(`Code has been minifed. Branch ${currentBranch} can be merged now.`);
return;
}
Expand Down Expand Up @@ -88,11 +94,11 @@ const MyOctokit = Octokit.plugin(createPullRequest);
const FUNNY_CAT = 'https://media1.tenor.com/images/841aeb9f113999616d097b414c539dfd/tenor.gif';
let prDescription = 'Changes in these files:\n';
files.forEach(function (f) {
prDescription += `- **${f}** \n`;
prDescription += `- **${f}** \n`;
});
prDescription += `![cat](${FUNNY_CAT})`;

if(prDescription.includes(FUNNY_CAT)) {
if (prDescription.includes(FUNNY_CAT)) {
await pluginOctokit.createPullRequest({
owner: repoInfo.owner,
repo: repoInfo.repo,
Expand All @@ -104,18 +110,18 @@ const MyOctokit = Octokit.plugin(createPullRequest);
commit: `Minified ${files.length} files`,
}, ],
}).then(function (result) {
const tableData = {
'Pull request url': result.data.url,
'Pull request title': result.data.title,
'Sent by': result.data.user.login,
'Total number of commits': result.data.commits,
'Additions': result.data.additions,
'Deletions': result.data.deletions,
'Number of files changed': result.data.changed_files
}
console.table(tableData);
}).catch(function (error) {
throw new Error(error);
const tableData = {
'Pull request url': result.data.url,
'Pull request title': result.data.title,
'Sent by': result.data.user.login,
'Total number of commits': result.data.commits,
'Additions': result.data.additions,
'Deletions': result.data.deletions,
'Number of files changed': result.data.changed_files
}
console.table(tableData);
}).catch(function () {
process.on('unhandledRejection', () => {});
});
}
}
Expand Down Expand Up @@ -152,5 +158,4 @@ const readAndMinify = async function (file) {
} else {
console.log("Other files");
}
};

};
1 change: 0 additions & 1 deletion node_modules/.bin/terser

This file was deleted.

9 changes: 0 additions & 9 deletions node_modules/@actions/core/LICENSE.md

This file was deleted.

147 changes: 0 additions & 147 deletions node_modules/@actions/core/README.md

This file was deleted.

21 changes: 0 additions & 21 deletions node_modules/@actions/core/lib/command.d.ts

This file was deleted.

92 changes: 0 additions & 92 deletions node_modules/@actions/core/lib/command.js

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/@actions/core/lib/command.js.map

This file was deleted.

Loading

0 comments on commit 82833fe

Please sign in to comment.