Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
build: switch automatic-releases over to using webpack as the bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinpinto committed Dec 27, 2019
1 parent e8914d0 commit 0498785
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 11 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@types/node": "^13.1.0",
"@typescript-eslint/eslint-plugin": "^2.13.0",
"@typescript-eslint/parser": "^2.13.0",
"@zeit/ncc": "^0.20.5",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.8.0",
"eslint-plugin-jest": "^23.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ describe('tagged releases smoke tests', () => {
},
});

// Should set the AUTOMATIC_RELEASES_TAG env variable to "testingtaglatest"
expect(stdout).toEqual(expect.stringMatching(/::set-env name=AUTOMATIC_RELEASES_TAG,::testingtaglatest/));
// Should set the AUTOMATIC_RELEASES_TAG env variable to "v0.0.1"
expect(stdout).toEqual(expect.stringMatching(/::set-env name=AUTOMATIC_RELEASES_TAG,::v0.0.1/));

// There should not be any stderr output
expect(stderr).toEqual('');
Expand Down
6 changes: 5 additions & 1 deletion packages/automatic-releases/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prettierPaths": "**/*.{json,md,yaml,yml} !package.json"
},
"scripts": {
"build": "ncc build src/index.ts",
"build": "webpack --config webpack.config.js --colors",
"test": "jest --color --forceExit",
"clean": "rm -rf node_modules yarn-error.log dist",
"lint": "yarn run lint:eslint && yarn run lint:prettier",
Expand All @@ -34,6 +34,10 @@
"express": "^4.17.1",
"nock": "^11.7.0",
"portfinder": "^1.0.25",
"terser-webpack-plugin": "^2.3.1",
"ts-loader": "^6.2.1",
"webpack": "^4.41.4",
"webpack-cli": "^3.3.10",
"which": "^2.0.2"
},
"eslintIgnore": [
Expand Down
4 changes: 2 additions & 2 deletions packages/automatic-releases/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as core from '@actions/core';
import * as Octokit from '@octokit/rest';
import defaultChangelogOpts from 'conventional-changelog-angular';
import defaultChangelogOpts from 'conventional-changelog-angular/conventional-recommended-bump';

export const getShortSHA = (sha: string): string => {
const coreAbbrev = 7;
Expand Down Expand Up @@ -157,7 +157,7 @@ export const parseGitTag = (inputRef): string => {
};

export const getChangelogOptions = async () => {
const defaultOpts = await defaultChangelogOpts;
const defaultOpts = defaultChangelogOpts;
defaultOpts['mergePattern'] = '^Merge pull request #(.*) from (.*)$';
defaultOpts['mergeCorrespondence'] = ['issueId', 'source'];
core.debug(`Changelog options: ${JSON.stringify(defaultOpts)}`);
Expand Down
52 changes: 52 additions & 0 deletions packages/automatic-releases/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
target: 'node',
mode: 'production',

entry: {
index: './src/index.ts',
},

module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},

resolve: {
extensions: ['.tsx', '.ts', '.js'],
mainFields: ['main'],
},

output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
library: 'main',
libraryTarget: 'commonjs2',
},

optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false,
},
},
sourceMap: true,
extractComments: false,
}),
],
},

plugins: [new webpack.IgnorePlugin(/\/iconv-loader$/)],
};
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1648,11 +1648,6 @@
resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==

"@zeit/ncc@^0.20.5":
version "0.20.5"
resolved "https://registry.yarnpkg.com/@zeit/ncc/-/ncc-0.20.5.tgz#a41af6e6bcab4a58f4612bae6137f70bce0192e3"
integrity sha512-XU6uzwvv95DqxciQx+aOLhbyBx/13ky+RK1y88Age9Du3BlA4mMPCy13BGjayOrrumOzlq1XV3SD/BWiZENXlw==

"@zkochan/cmd-shim@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e"
Expand Down

0 comments on commit 0498785

Please sign in to comment.