Socket
Socket
Sign inDemoInstall

@neutralinojs/neu

Package Overview
Dependencies
139
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.7.0 to 9.8.0

7

.tmprz/release_notes.md
## What's new
### Core: Downloader/bundler
- Download the TypeScript definition file for standalone client library mode. This won't include the TypeScript definition file to the final application bundle.
### Core: Downloader
- Download the latest Neutralinojs framework resources with the `--latest` option in the `neu update` command.
- If framework versions are not present in the app/template configuration, download the latest framework resources automatically. The CLI will download nightly releases if it can't fetch the latest release tag because of an GitHub API-related issue (i.e., Exceeded rate limits).
Install the latest (`v9.7.0`) [npm package](https://www.npmjs.com/package/@neutralinojs/neu):
Install the latest (`v9.8.0`) [npm package](https://www.npmjs.com/package/@neutralinojs/neu):

@@ -10,0 +11,0 @@ ```

@@ -9,2 +9,8 @@ # Changelog

## v9.8.0
### Core: Downloader
- Download the latest Neutralinojs framework resources with the `--latest` option in the `neu update` command.
- If framework versions are not present in the app/template configuration, download the latest framework resources automatically. The CLI will download nightly releases if it can't fetch the latest release tag because of an GitHub API-related issue (i.e., Exceeded rate limits).
## v9.7.0

@@ -11,0 +17,0 @@

{
"name": "@neutralinojs/neu",
"version": "9.7.0",
"version": "9.8.0",
"description": "neu CLI for Neutralinojs",

@@ -5,0 +5,0 @@ "main": "./bin/neu.js",

@@ -8,6 +8,7 @@ const utils = require('../utils');

.description('updates neutralinojs binaries and client library')
.action(async (name, command) => {
.option('-l, --latest')
.action(async (command) => {
utils.checkCurrentProject();
await downloader.downloadAndUpdateBinaries();
await downloader.downloadAndUpdateClient();
await downloader.downloadAndUpdateBinaries(command.latest);
await downloader.downloadAndUpdateClient(command.latest);

@@ -14,0 +15,0 @@ utils.showArt();

@@ -5,3 +5,4 @@ module.exports = {

clientUrlPrefix: "https://github.com/neutralinojs/neutralino.js/releases/download/{tag}/neutralino.",
templateUrl: "https://github.com/{template}/archive/main.zip"
templateUrl: "https://github.com/{template}/archive/main.zip",
releasesApiUrl: "https://api.github.com/repos/neutralinojs/{repo}/releases/latest"
},

@@ -8,0 +9,0 @@ files: {

@@ -9,7 +9,31 @@ const fs = require('fs');

let getBinaryDownloadUrl = () => {
const configObj = config.get();
let version = configObj.cli.binaryVersion;
return constants.remote.binariesUrl
.replace(/{tag}/g, utils.getVersionTag(version));
let cachedLatestClientVersion = null;
let getLatestVersion = (repo) => {
return new Promise((resolve, reject) => {
function fallback() {
utils.warn('Unable to fetch the latest version tag from GitHub. Using nightly releases...');
resolve('nightly');
}
let opt = {
headers: {'User-Agent': 'Neutralinojs CLI'}
};
https.get(constants.remote.releasesApiUrl.replace('{repo}', repo), opt, function (response) {
let body = '';
response.on('data', (data) => body += data);
response.on('end', () => {
if(response.statusCode != 200) {
return fallback();
}
let apiRes = JSON.parse(body);
let version = apiRes.tag_name.replace('v', '');
utils.log(`Found the latest release tag ${utils.getVersionTag(version)} for ${repo}...`);
resolve(version);
});
response.on('error', () => {
fallback();
});
});
});
}

@@ -23,19 +47,38 @@

let getClientDownloadUrl = () => {
let getBinaryDownloadUrl = async (latest) => {
const configObj = config.get();
let version = configObj.cli.clientVersion;
let clientLibrary = configObj.cli.clientLibrary;
let scriptUrl = constants.remote.clientUrlPrefix + getScriptExtension();
return scriptUrl
.replace(/{tag}/g, utils.getVersionTag(version));
let version = configObj.cli.binaryVersion;
if(!version || latest) {
version = await getLatestVersion('neutralinojs');
config.update('cli.binaryVersion', version);
}
return constants.remote.binariesUrl
.replace(/{tag}/g, utils.getVersionTag(version));
}
let getTypesDownloadUrl = () => {
let getClientDownloadUrl = async (latest, types = false) => {
const configObj = config.get();
let version = configObj.cli.clientVersion;
let scriptUrl = constants.remote.clientUrlPrefix + 'd.ts';
if(!version || latest) {
if(cachedLatestClientVersion) {
version = cachedLatestClientVersion;
}
else {
version = await getLatestVersion('neutralino.js');
}
cachedLatestClientVersion = version;
config.update('cli.clientVersion', version);
}
let scriptUrl = constants.remote.clientUrlPrefix + (types ? 'd.ts' : getScriptExtension());
return scriptUrl
.replace(/{tag}/g, utils.getVersionTag(version));
.replace(/{tag}/g, utils.getVersionTag(version));
}
let getTypesDownloadUrl = (latest) => {
return getClientDownloadUrl(latest, true);
}
let getRepoNameFromTemplate = (template) => {

@@ -45,3 +88,3 @@ return template.split('/')[1];

let downloadBinariesFromRelease = () => {
let downloadBinariesFromRelease = (latest) => {
return new Promise((resolve, reject) => {

@@ -52,10 +95,13 @@ fs.mkdirSync('.tmp', { recursive: true });

utils.log('Downloading Neutralinojs binaries..');
https.get(getBinaryDownloadUrl(), function (response) {
response.pipe(file);
response.on('end', () => {
utils.log('Extracting zip file...');
decompress(zipFilename, '.tmp/')
.then(() => resolve())
.catch((e) => reject(e));
});
getBinaryDownloadUrl(latest)
.then((url) => {
https.get(url, function (response) {
response.pipe(file);
response.on('end', () => {
utils.log('Extracting binaries.zip file...');
decompress(zipFilename, '.tmp/')
.then(() => resolve())
.catch((e) => reject(e));
});
});
});

@@ -65,3 +111,3 @@ });

let downloadClientFromRelease = () => {
let downloadClientFromRelease = (latest) => {
return new Promise((resolve, reject) => {

@@ -71,13 +117,16 @@ fs.mkdirSync('.tmp', { recursive: true });

utils.log('Downloading the Neutralinojs client..');
https.get(getClientDownloadUrl(), function (response) {
response.pipe(file);
file.on('finish', () => {
file.close();
resolve();
getClientDownloadUrl(latest)
.then((url) => {
https.get(url, function (response) {
response.pipe(file);
file.on('finish', () => {
file.close();
resolve();
});
});
});
});
});
}
let downloadTypesFromRelease = () => {
let downloadTypesFromRelease = (latest) => {
return new Promise((resolve, reject) => {

@@ -87,9 +136,13 @@ fs.mkdirSync('.tmp', { recursive: true });

utils.log('Downloading the Neutralinojs types..');
https.get(getTypesDownloadUrl(), function (response) {
response.pipe(file);
file.on('finish', () => {
file.close();
resolve();
getTypesDownloadUrl(latest)
.then((url) => {
https.get(url, function (response) {
response.pipe(file);
file.on('finish', () => {
file.close();
resolve();
});
});
});
});
});

@@ -120,4 +173,4 @@ }

module.exports.downloadAndUpdateBinaries = async () => {
await downloadBinariesFromRelease();
module.exports.downloadAndUpdateBinaries = async (latest = false) => {
await downloadBinariesFromRelease(latest);
utils.log('Finalizing and cleaning temp. files.');

@@ -142,3 +195,3 @@ if(!fse.existsSync('bin'))

module.exports.downloadAndUpdateClient = async () => {
module.exports.downloadAndUpdateClient = async (latest = false) => {
const configObj = config.get();

@@ -151,4 +204,4 @@ if(!configObj.cli.clientLibrary) {

const clientLibrary = utils.trimPath(configObj.cli.clientLibrary);
await downloadClientFromRelease();
await downloadTypesFromRelease();
await downloadClientFromRelease(latest);
await downloadTypesFromRelease(latest);
utils.log('Finalizing and cleaning temp. files...');

@@ -155,0 +208,0 @@ fse.copySync(`.tmp/${constants.files.clientLibraryPrefix + getScriptExtension()}`

@@ -10,3 +10,3 @@ const fs = require('fs');

let error = (message) => {
console.error(`neu: ${chalk.bgRed.black('ERROR')} ${message}`);
console.error(`neu: ${chalk.bgRed.black('ERRR')} ${message}`);
}

@@ -39,3 +39,3 @@

let warn = (message) => {
console.warn(`neu: ${chalk.bgYellow.black('WARNING')} ${message}`);
console.warn(`neu: ${chalk.bgYellow.black('WARN')} ${message}`);
}

@@ -42,0 +42,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc