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
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/*
packages/*/generators
packages/*/lib
packages/*/node_modules
packages/*/node_modules
tsconfig.tsbuildinfo
5 changes: 2 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
],
testPathIgnorePatterns: ['/node_modules/', '/__fixtures__/'],
transform: {
"\\.js$": "ts-jest",
"\\.ts$": "ts-jest"
}
'\\.ts$': 'ts-jest',
},
};
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
"packages/*"
],
"scripts": {
"build": "node scripts/build.js",
"build": "tsc --build packages/*/tsconfig.json && yarn workspaces run copyfiles",
"check-deps": "node scripts/check-deps.js",
"ci": "yarn check-deps && yarn format:check && yarn lint && yarn build && yarn test",
"ci": "yarn clean && 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",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"qa": "node scripts/qa/index.js",
"test": "jest --runInBand",
"watch": "node scripts/watch"
"watch": "node scripts/watch.js"
},
"devDependencies": {
"@types/jest": "^24.0.18",
Expand Down
5 changes: 4 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,11 +13,13 @@
"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": {
"@types/yeoman-generator": "^3.1.4",
"mem-fs": "^1.1.3",
"mem-fs-editor": "^6.0.0",
"rimraf": "^3.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

import {
info,
error,
info,
print,
success,
title,
Expand Down Expand Up @@ -109,6 +109,9 @@ if (argv.which) {
* Generator to add deploy support to projects.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;

/**
* Standard Yeoman constructor
*/
Expand Down Expand Up @@ -182,7 +185,8 @@ export default class extends Generator {
]);

// Set project's package manager internally using a hack
project._pkgManager = answers.pkgManager;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(project as any)._pkgManager = answers.pkgManager;
}

Object.assign(
Expand Down Expand Up @@ -352,6 +356,10 @@ export default class extends Generator {

pkgJson.addPortletProperty('com.liferay.portlet.instanceable', true);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
private _options: any;
private _pkgManager: string;
}

module.exports = exports['default'];
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

Expand Down Expand Up @@ -44,7 +43,10 @@ export default class extends Generator {
]);

this.destinationRoot(path.resolve(answers.folder));
this.composeWith(require.resolve(`../target-${answers.target}`));
this.composeWith(
require.resolve(`../target-${answers.target}`),
undefined
);
}

/**
Expand Down Expand Up @@ -91,6 +93,7 @@ export default class extends Generator {
_getTargetCategories(tds) {
const map = tds.reduce((map, td) => {
map[td.category] = true;

return map;
}, {});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import os from 'os';
import path from 'path';
import readJsonSync from 'read-json-sync';

let cfg = {};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let cfg: any = {};

Object.assign(
cfg,
Expand Down Expand Up @@ -101,6 +102,7 @@ function safeReadJsonSync(path) {
if (err.code !== 'ENOENT') {
throw err;
}

return {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import {DEFAULT_CONFIGURATION} from './constants';
* Generator to add configuration support to projects.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,7 @@ export default class {
}
}
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
private _generator: any;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import PkgJsonModifier from '../utils/modifier/package.json';
* Generator to add deploy support to projects.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import {DEFAULT_LOCALIZATION} from './constants';
* Generator to add localization support to projects.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export default class {
_toProperties(labels) {
return Object.keys(labels).reduce((obj, key) => {
obj[hyphenate(key)] = labels[key];

return obj;
}, {});
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
private _generator: any;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import PkgJsonModifier from '../utils/modifier/package.json';
* Generator to add portlet support to projects.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import {
* Generator to add base scaffolding to projects.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import PkgJsonModifier from '../utils/modifier/package.json';
* Generator to add start support to projects.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ import Generator from 'yeoman-generator';
import {Copier} from '../utils';
import ProjectAnalyzer from '../utils/ProjectAnalyzer';
import NpmbuildrcModifier from '../utils/modifier/npmbuildrc';
import PkgJsonModifier from '../utils/modifier/package.json.js';
import PkgJsonModifier from '../utils/modifier/package.json';
import * as standardTarget from '../utils/target/standard';
import dependenciesJson from './dependencies.json';

/**
* Implementation of generation of Angular portlets.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;
namespace: string;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class extends Generator {
initializing() {
standardTarget.initializing(this);

this.composeWith(require.resolve('./angular-portlet'));
this.composeWith(require.resolve('./angular-portlet'), undefined);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class extends Generator {
initializing() {
standardTarget.initializing(this);

this.composeWith(require.resolve('./metaljs-portlet'));
this.composeWith(require.resolve('./metaljs-portlet'), undefined);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import importsJson from './imports.json';
* Implementation of generation of Metal.js portlets.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;
namespace: string;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class extends Generator {
initializing() {
standardTarget.initializing(this);

this.composeWith(require.resolve('./react-portlet'));
this.composeWith(require.resolve('./react-portlet'), undefined);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import dependenciesJson from './dependencies.json';
* Implementation of generation of React portlets.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;
namespace: string;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

import Generator from 'yeoman-generator';
import Generator, {InstallOptions} from 'yeoman-generator';

/**
* Generator for shared bundles.
Expand All @@ -13,10 +13,10 @@ export default class extends Generator {
* Standard Yeoman initialization function
*/
initializing() {
this.composeWith(require.resolve('../facet-project'));
this.composeWith(require.resolve('../facet-localization'));
this.composeWith(require.resolve('../facet-deploy'));
this.composeWith(require.resolve('./shared-bundle'));
this.composeWith(require.resolve('../facet-project'), undefined);
this.composeWith(require.resolve('../facet-localization'), undefined);
this.composeWith(require.resolve('../facet-deploy'), undefined);
this.composeWith(require.resolve('./shared-bundle'), undefined);
}

/**
Expand All @@ -27,7 +27,8 @@ export default class extends Generator {
bower: false,
skipMessage: this.options['skip-install-message'],
skipInstall: this.options['skip-install'],
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import PkgJsonModifier from '../utils/modifier/package.json';
* Implementation of generation of shared bundles.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class extends Generator {
initializing() {
standardTarget.initializing(this);

this.composeWith(require.resolve('./vanilla-portlet'));
this.composeWith(require.resolve('./vanilla-portlet'), undefined);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ import Generator from 'yeoman-generator';
import {Copier, promptWithConfig} from '../utils';
import ProjectAnalyzer from '../utils/ProjectAnalyzer';
import NpmbuildrcModifier from '../utils/modifier/npmbuildrc';
import PkgJsonModifier from '../utils/modifier/package.json.js';
import PkgJsonModifier from '../utils/modifier/package.json';
import * as standardTarget from '../utils/target/standard';

/**
* Implementation of generation of plain JavaScript portlets.
*/
export default class extends Generator {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
answers: any;
namespace: string;

/**
* Standard Yeoman initialization function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class extends Generator {
initializing() {
standardTarget.initializing(this);

this.composeWith(require.resolve('./vuejs-portlet'));
this.composeWith(require.resolve('./vuejs-portlet'), undefined);
}

/**
Expand Down
Loading