Skip to content

Commit

Permalink
update new release notifier
Browse files Browse the repository at this point in the history
  • Loading branch information
daviestar committed Aug 30, 2021
1 parent 41d69d0 commit 8a86a8b
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 60 deletions.
1 change: 1 addition & 0 deletions compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^7.0.0",
"css-loader": "^5.2.6",
"inline-environment-variables-webpack-plugin": "^1.2.1",
"raw-loader": "^4.0.2",
"style-loader": "^2.0.0",
"webpack": "^5.18.0",
Expand Down
40 changes: 18 additions & 22 deletions compiler/src/utils/check-for-latest-version.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
// import path from 'path';

// import fetch from 'node-fetch';
import fetch from 'node-fetch';

export async function checkForLatestVersion() {
// const response = await fetch(
// 'https://api.github.com/repos/UofGAnalytics/build-coursework/releases/latest'
// );
// const json = await response.json();
// const latestTag = json.tag_name.replace('v', '');
// const workspacePackagePath = path.join(__dirname, 'package.json');
console.log('__dirname:', __dirname);
console.log('process.cwd():', process.cwd());
// const workspacePackageJson = require(workspacePackagePath);
// const currentTag = workspacePackageJson.version;
const response = await fetch(
'https://api.github.com/repos/UofGAnalytics/build-coursework/releases/latest'
);
const json = await response.json();
const latestTag = json.tag_name.replace('v', '');
const currentVersion = process.env.VERSION;

console.log({ latestTag, currentVersion });

// if (latestTag !== currentTag) {
// console.log(
// `You are running version ${currentTag} and the latest version is ${latestTag}.`
// );
// console.log(`Run the following command to update:`);
// console.log(
// `npm install -g UofGAnalytics/build-coursework@v${latestTag}`
// );
// }
if (latestTag !== currentVersion) {
console.log(
`You are running version ${currentVersion} and the latest version is ${latestTag}.`
);
console.log(`Run the following command to update:`);
console.log(
`npm update -g UofGAnalytics/build-coursework#v${latestTag}`
);
}
}
4 changes: 4 additions & 0 deletions compiler/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const CopyPlugin = require('copy-webpack-plugin');
const ShebangPlugin = require('webpack-shebang-plugin');
const InlineEnvironmentVariablesPlugin = require('inline-environment-variables-webpack-plugin');

const pkg = require('../package.json');

const isProd = process.env.NODE_ENV === 'production'

Expand Down Expand Up @@ -47,6 +50,7 @@ module.exports = {
plugins: [
new CleanWebpackPlugin(),
new ShebangPlugin(),
new InlineEnvironmentVariablesPlugin({ VERSION: pkg.version }),
new CopyPlugin({
patterns: [
{ from: './src/knitr/knitr.R', to: './' },
Expand Down
60 changes: 22 additions & 38 deletions release/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ function createH1(titles) {

/***/ }),

/***/ 7205:
/***/ 319:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
Expand Down Expand Up @@ -3074,8 +3074,24 @@ async function createContext(dirPath, options = {}) {
options
};
}
// EXTERNAL MODULE: ./src/utils/check-for-latest-version.ts
var check_for_latest_version = __webpack_require__(2240);
;// CONCATENATED MODULE: ./src/utils/check-for-latest-version.ts

async function checkForLatestVersion() {
const response = await external_node_fetch_default()('https://api.github.com/repos/UofGAnalytics/build-coursework/releases/latest');
const json = await response.json();
const latestTag = json.tag_name.replace('v', '');
const currentVersion = "1.1.2";
console.log({
latestTag,
currentVersion
});

if (latestTag !== currentVersion) {
console.log(`You are running version ${currentVersion} and the latest version is ${latestTag}.`);
console.log(`Run the following command to update:`);
console.log(`npm update -g UofGAnalytics/build-coursework#v${latestTag}`);
}
}
// EXTERNAL MODULE: ./src/utils/timer.ts
var utils_timer = __webpack_require__(2364);
;// CONCATENATED MODULE: ./src/index.ts
Expand All @@ -3087,7 +3103,7 @@ var utils_timer = __webpack_require__(2364);


async function rMarkdown(dirPath, options = {}) {
await (0,check_for_latest_version/* checkForLatestVersion */.m)();
await checkForLatestVersion();
const timer = (0,utils_timer/* createTimer */.e)();
const ctx = await createContext(dirPath, options);
const result = [];
Expand Down Expand Up @@ -3270,38 +3286,6 @@ function transformAttributes(containerName, attributesArr) {

/***/ }),

/***/ 2240:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "m": () => (/* binding */ checkForLatestVersion)
/* harmony export */ });
// import path from 'path';
// import fetch from 'node-fetch';
async function checkForLatestVersion() {
// const response = await fetch(
// 'https://api.github.com/repos/UofGAnalytics/build-coursework/releases/latest'
// );
// const json = await response.json();
// const latestTag = json.tag_name.replace('v', '');
// const workspacePackagePath = path.join(__dirname, 'package.json');
console.log('__dirname:', __dirname);
console.log('process.cwd():', process.cwd()); // const workspacePackageJson = require(workspacePackagePath);
// const currentTag = workspacePackageJson.version;
// if (latestTag !== currentTag) {
// console.log(
// `You are running version ${currentTag} and the latest version is ${latestTag}.`
// );
// console.log(`Run the following command to update:`);
// console.log(
// `npm install -g UofGAnalytics/build-coursework@v${latestTag}`
// );
// }
}

/***/ }),

/***/ 2364:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

Expand Down Expand Up @@ -12764,8 +12748,8 @@ var __webpack_exports__ = {};
;// CONCATENATED MODULE: external "yargs"
const external_yargs_namespaceObject = require("yargs");
var external_yargs_default = /*#__PURE__*/__webpack_require__.n(external_yargs_namespaceObject);
// EXTERNAL MODULE: ./src/index.ts + 97 modules
var src = __webpack_require__(7205);
// EXTERNAL MODULE: ./src/index.ts + 98 modules
var src = __webpack_require__(319);
;// CONCATENATED MODULE: ./src/cli/cli.ts


Expand Down
18 changes: 18 additions & 0 deletions release/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12415,6 +12415,24 @@ async function context_createContext(dirPath, options = {}) {
options
};
}
;// CONCATENATED MODULE: ./src/utils/check-for-latest-version.ts

async function check_for_latest_version_checkForLatestVersion() {
const response = await fetch('https://api.github.com/repos/UofGAnalytics/build-coursework/releases/latest');
const json = await response.json();
const latestTag = json.tag_name.replace('v', '');
const currentVersion = "1.1.2";
console.log({
latestTag,
currentVersion
});

if (latestTag !== currentVersion) {
console.log(`You are running version ${currentVersion} and the latest version is ${latestTag}.`);
console.log(`Run the following command to update:`);
console.log(`npm update -g UofGAnalytics/build-coursework#v${latestTag}`);
}
}
;// CONCATENATED MODULE: ./src/index.ts


Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4415,6 +4415,13 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561"
integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==

fn-compose@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/fn-compose/-/fn-compose-1.1.0.tgz#6a18465403a6898c7a324566aa0409820ba44a07"
integrity sha1-ahhGVAOmiYx6MkVmqgQJggukSgc=
dependencies:
maybe-args "0.0.3"

follow-redirects@^1.0.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43"
Expand Down Expand Up @@ -5382,6 +5389,13 @@ ini@^1.3.5, ini@~1.3.0:
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==

inline-environment-variables-webpack-plugin@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/inline-environment-variables-webpack-plugin/-/inline-environment-variables-webpack-plugin-1.2.1.tgz#da0e379a154c3f80455c3350a12063b34d5b272b"
integrity sha512-mSK7m+aqRPs4Uc8aB64i4w0pMN81J1ATuG52A/wy4R/+vsbGWaMjhCaZXMbzt3nVqHZbrZyQSa+OZWx4yFDj2Q==
dependencies:
fn-compose "^1.1.0"

inline-style-parser@0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1"
Expand Down Expand Up @@ -6748,6 +6762,11 @@ mathml-tag-names@^2.1.3:
resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3"
integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==

maybe-args@0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/maybe-args/-/maybe-args-0.0.3.tgz#333396b7660fa59fb9a49b73035843a836d4f026"
integrity sha1-MzOWt2YPpZ+5pJtzA1hDqDbU8CY=

mdast-comment-marker@^1.0.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/mdast-comment-marker/-/mdast-comment-marker-1.1.2.tgz#5ad2e42cfcc41b92a10c1421a98c288d7b447a6d"
Expand Down

0 comments on commit 8a86a8b

Please sign in to comment.