Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

feat: Prepare a new snapshot version to integrate in Portal's build #542

Merged
merged 12 commits into from
Mar 10, 2020
Merged
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
root: true,
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/no-explicit-any': [
'error',
{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"build": "node scripts/build.js",
"check-deps": "node scripts/check-deps.js",
"ci": "yarn check-deps && yarn format:check && yarn lint && yarn build && yarn test",
"clean": "yarn workspaces run clean",
"format": "prettier --write \".*.ts\" \"packages/**/*.ts\"",
"format:check": "prettier --list-different \".*.ts\" \"packages/**/*.ts\"",
"level-deps": "node scripts/level-deps.js",
Expand Down
4 changes: 3 additions & 1 deletion packages/generator-liferay-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "generator-liferay-js",
"version": "3.0.0",
"description": "Yeoman generators for Liferay DXP and Portal CE JavaScript projects.",
"license": "LGPL-3.0",
"main": "generators/app/index.js",
"files": [
"generators"
Expand All @@ -12,8 +13,9 @@
"liferay-js"
],
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/liferay-npm-bridge-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
"name": "liferay-npm-bridge-generator",
"version": "3.0.0",
"description": "A CLI utility to generate module bridges (modules that re-export other modules).",
"license": "LGPL-3.0",
"bin": {
"liferay-npm-bridge-generator": "bin/liferay-npm-bridge-generator.js"
},
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/liferay-npm-build-support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "liferay-npm-build-support",
"version": "3.0.0",
"description": "A library of scripts and helpers used by generated projects in their build processes.",
"license": "LGPL-3.0",
"bin": {
"lnbs-build": "bin/lnbs-build.js",
"lnbs-copy-assets": "bin/lnbs-copy-assets.js",
Expand All @@ -11,8 +12,9 @@
"lnbs-translate": "bin/lnbs-translate.js"
},
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/liferay-npm-build-tools-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"name": "liferay-npm-build-tools-common",
"version": "3.0.0",
"description": "Utility library for Liferay NPM Build Tools.",
"license": "LGPL-3.0",
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "node ../../scripts/disable-publish.js",
"release:snapshot": "node ../../scripts/release-snapshot.js"
},
Expand Down
67 changes: 64 additions & 3 deletions packages/liferay-npm-build-tools-common/src/project/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@

import {Project} from '.';
import prop from 'dot-prop';
import {print, warn} from 'liferay-npm-build-tools-common/lib/format';

import FilePath from '../file-path';

/** Valid log levels for console and report */
export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';

/**
* Reflects miscellaneous project configuration values.
*/
Expand All @@ -23,10 +27,28 @@ export default class Misc {
/**
* Whether or not to dump detailed information about what the tool is doing
*/
get logLevel(): 'off' | 'error' | 'warn' | 'info' | 'debug' {
get logLevel(): LogLevel {
const {npmbundlerrc} = this._project;

return prop.get(npmbundlerrc, 'log-level', 'warn');
let logLevel = prop.get<string>(npmbundlerrc, 'log-level', 'warn');

switch (logLevel) {
case 'off':
case 'error':
case 'warn':
case 'info':
case 'debug':
break;

default:
logLevel = 'off';
print(
warn`Configuration value {log-level} has invalid value: it will be ignored`
);
break;
}

return logLevel as LogLevel;
}

/**
Expand Down Expand Up @@ -54,7 +76,6 @@ export default class Misc {
/**
* Get the path to the report file or undefined if no report is configured.
*/

get reportFile(): FilePath | undefined {
const {_project} = this;
const {npmbundlerrc} = _project;
Expand All @@ -66,5 +87,45 @@ export default class Misc {
: undefined;
}

/**
* Get report log level
*/
get reportLevel(): LogLevel {
const {_project} = this;
const {npmbundlerrc} = _project;

let dumpReport = prop.get<string | boolean>(
npmbundlerrc,
'dump-report',
false
);

switch (dumpReport) {
case 'off':
case 'error':
case 'warn':
case 'info':
case 'debug':
break;

case true:
dumpReport = 'info';
break;

case false:
dumpReport = 'off';
break;

default:
dumpReport = 'off';
print(
warn`Configuration value {dump-report} has invalid value: it will be ignored`
);
break;
}

return dumpReport as LogLevel;
}

private readonly _project: Project;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"name": "liferay-npm-bundler-loader-babel-loader",
"version": "3.0.0",
"description": "A liferay-npm-bundler loader that runs Babel on source files.",
"license": "LGPL-3.0",
"main": "lib/index.js",
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"name": "liferay-npm-bundler-loader-copy-loader",
"version": "3.0.0",
"description": "A liferay-npm-bundler loader that copies files.",
"license": "LGPL-3.0",
"main": "lib/index.js",
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"name": "liferay-npm-bundler-loader-css-loader",
"version": "3.0.0",
"description": "A liferay-npm-bundler loader that turns CSS files into JavaScript modules that inject a <link> into the HTML when they are required.",
"license": "LGPL-3.0",
"main": "lib/index.js",
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"name": "liferay-npm-bundler-loader-json-loader",
"version": "3.0.0",
"description": "A liferay-npm-bundler loader that turns JSON files into JavaScript modules that export the parsed JSON object.",
"license": "LGPL-3.0",
"main": "lib/index.js",
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"name": "liferay-npm-bundler-loader-sass-loader",
"version": "3.0.0",
"description": "A liferay-npm-bundler loader that runs `sass` or `node-sass` on source files.",
"license": "LGPL-3.0",
"main": "lib/index.js",
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"name": "liferay-npm-bundler-loader-style-loader",
"version": "3.0.0",
"description": "A liferay-npm-bundler loader that turns CSS files into JavaScript modules that inject the CSS into the HTML when they are required.",
"license": "LGPL-3.0",
"main": "lib/index.js",
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "yarn build"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"name": "liferay-npm-bundler-preset-angular-cli",
"version": "3.0.0",
"description": "Configuration for liferay-npm-bundler to integrate with Angular CLI projects",
"license": "LGPL-3.0",
"main": "config.json",
"scripts": {
"clean": "node ../../scripts/clean.js"
},
"dependencies": {
"liferay-npm-build-support": "3.0.0",
"liferay-npm-bundler-loader-babel-loader": "3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"name": "liferay-npm-bundler-preset-create-react-app",
"version": "3.0.0",
"description": "Configuration for liferay-npm-bundler to integrate with create-react-app projects",
"license": "LGPL-3.0",
"main": "config.json",
"scripts": {
"clean": "node ../../scripts/clean.js"
},
"dependencies": {
"liferay-npm-bundler-loader-babel-loader": "3.0.0",
"liferay-npm-bundler-loader-copy-loader": "3.0.0"
Expand Down
6 changes: 5 additions & 1 deletion packages/liferay-npm-bundler-preset-standard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"name": "liferay-npm-bundler-preset-standard",
"version": "3.0.0",
"description": "Standard configuration for liferay-npm-bundler.",
"main": "config.json"
"license": "LGPL-3.0",
"main": "config.json",
"scripts": {
"clean": "node ../../scripts/clean.js"
}
}
4 changes: 4 additions & 0 deletions packages/liferay-npm-bundler-preset-vue-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"name": "liferay-npm-bundler-preset-vue-cli",
"version": "3.0.0",
"description": "Configuration for liferay-npm-bundler to integrate with Vue CLI projects",
"license": "LGPL-3.0",
"main": "config.json",
"scripts": {
"clean": "node ../../scripts/clean.js"
},
"dependencies": {
"liferay-npm-build-support": "3.0.0",
"liferay-npm-bundler-loader-babel-loader": "3.0.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/liferay-npm-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
"name": "liferay-npm-bundler",
"version": "3.0.0",
"description": "A CLI utility to bundle NPM dependencies of a Liferay OSGi bundle.",
"license": "LGPL-3.0",
"main": "lib/index.js",
"bin": {
"liferay-npm-bundler": "bin/liferay-npm-bundler.js"
},
"scripts": {
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"clean": "node ../../scripts/clean.js",
"copyfiles": "node ../../scripts/copyfiles.js",
"prepublish": "node ../../scripts/disable-publish.js",
"release:snapshot": "node ../../scripts/release-snapshot.js"
},
Expand Down
Loading