Skip to content

Commit

Permalink
Release 13.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benm071 committed Jul 15, 2022
1 parent 55c6fa5 commit 25036d3
Show file tree
Hide file tree
Showing 42 changed files with 1,795 additions and 588 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @oracle/ojet-cli 12.1.0
# @oracle/ojet-cli 13.0.0

## About the module
This module contains a command line interface for Oracle JET web and hybrid mobile application development.
Expand Down Expand Up @@ -64,7 +64,7 @@ Or view help on adding a plugin:
ojet help add plugin
```

For more information on the Oracle JET CLI, refer to the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1210&id=homepage).
For more information on the Oracle JET CLI, refer to the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1300&id=homepage).

## [Contributing](https://github.com/oracle/ojet-cli/blob/master/CONTRIBUTING.md)
Oracle JET is an open source project. Pull Requests are currently not being accepted. See [CONTRIBUTING](https://github.com/oracle/ojet-cli/blob/master/CONTRIBUTING.md) for details.
Expand Down
8 changes: 8 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## Release Notes for ojet-cli ##

### 13.0.0

* Metadata to support API documentation is now emitted for vcomponents during build
* New webpack applicatons support non-vdom JavaScript and Typescript source code
* Updated default typescript version to 4.6.4
* Add synonym for --vcomponent to allow 'functional' in addition to 'function'
* Enhancements to ease monorepo development

### 12.1.0

* Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion THIRDPARTYLICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ THIRD-PARTY COMPONENT LICENSE
node_modules/minimist/ MIT
node_modules/adm-zip/ MIT
node_modules/fs-extra/ MIT
node_modules/xmldom/ MIT
node_modules/@xmldom/xmldom/ MIT
node_modules/inquirer MIT

Copyright (c) 2015, Google
Expand Down
5 changes: 3 additions & 2 deletions common/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ module.exports = {
* @param {object} generator object with build options
*/
getComponentDestPath: (generator) => {
_getComponentDestPath(generator);
const destPath = _getComponentDestPath(generator);
return destPath;
}
};

Expand Down Expand Up @@ -511,7 +512,7 @@ function _filterTsxTemplates(generator, destPath) {
const componentName = _getComponentName(generator);
const pathToClassBasedTemplate = path.join(destPath, `${componentName}.tsx`);
const pathToFunctionalBasedTemplate = path.join(destPath, `${componentName}-functional-template.tsx`);
if (generator.options.vcomponent === 'function') {
if (generator.options.vcomponent === 'function' || generator.options.vcomponent === 'functional') {
// <componentName>.tsx now has functional based template after overwriting it
// with <componentName-functional>.tsx contents. We need to do this because,
// once the chosen template is vcomponent, then we need to use the functional
Expand Down
8 changes: 6 additions & 2 deletions common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,20 @@ function _customizeVDOMTemplateTsconfigForWebpack() {
const oraclejetConfigJson = fs.readJSONSync(pathToOraclejetConfigJson);
const pathToTsconfigJson = path.join(pathToApp, 'tsconfig.json');
const tsconfigJson = fs.readJSONSync(pathToTsconfigJson);
const toolingUtil = utils.loadToolingUtil();
const preactPath = toolingUtil.getModulePath('./node_modules/preact', 'preact');
const preactCompat = path.join(preactPath, 'compat', 'src', 'index.d.ts');

tsconfigJson.compilerOptions.rootDir = `./${oraclejetConfigJson.paths.source.common}`;
tsconfigJson.compilerOptions.outDir = `./${oraclejetConfigJson.paths.staging.web}`;
tsconfigJson.compilerOptions.typeRoots.unshift('./types');
tsconfigJson.compilerOptions.resolveJsonModule = true;
tsconfigJson.compilerOptions.esModuleInterop = true;
tsconfigJson.compilerOptions.paths.react = [
'./node_modules/preact/compat/src/index.d.ts'
preactCompat
];
tsconfigJson.compilerOptions.paths['react-dom'] = [
'./node_modules/preact/compat/src/index.d.ts'
preactCompat
];
fs.writeJSONSync(pathToTsconfigJson, tsconfigJson, { spaces: 2 });
}
Expand Down
4 changes: 1 addition & 3 deletions common/template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const constants = require('../../lib/util/constants');
const _HYBRID = 'hybrid';
const _WEB = 'web';

const _TEMPLATES_NPM_URL = '@oracle/oraclejet-templates@~12.1.0';

module.exports =
{
handleTemplate: function _handleTemplate(generator, templateDestDirectory) {
Expand All @@ -42,7 +40,7 @@ function _getHandler(generator, template, templateDestDirectory) {
return localTemplate.handle(generator, templateLocalPath, templateDestDirectory);
}
const templateSpec = _resolveTemplateSpec(generator, template);
return npmTemplate.handle(generator, _TEMPLATES_NPM_URL, templateDestDirectory, templateSpec);
return npmTemplate.handle(generator, templateDestDirectory, templateSpec);
}

function _isUrl(url) {
Expand Down
42 changes: 13 additions & 29 deletions common/template/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

const fs = require('fs-extra');
const path = require('path');
const execSync = require('child_process').execSync;
const utils = require('../../lib/util/utils');
const injectorUtils = require('../../lib/util/injectors');

module.exports = {
const templateRoot = path.dirname(require.resolve('@oracle/oraclejet-templates'));

handle: function _handle(generator, npmUrl, destination, templateSpec) {
module.exports = {
handle: function _handle(generator, destination, templateSpec) {
return new Promise((resolve, reject) => {
_installNpmTemplate(generator, npmUrl)
.then(() => {
_copyNpmTemplate(generator, templateSpec, destination);
return resolve(generator);
})
.catch(err => reject(err));
try {
_copyNpmTemplate(generator, templateSpec, destination);
resolve(generator);
} catch (err) {
reject(err);
}
});
}
};
Expand All @@ -42,10 +42,8 @@ module.exports = {
* @param {string} destination - destination path
*/
function _copyNpmTemplate(generator, templateSpec, destination) {
const templateRoot = path.join(path.resolve(generator.appDir),
'node_modules', '@oracle/oraclejet-templates');
const src = _getTemplateFromTypeSpecificDirectory(templateRoot, templateSpec) ||
_getTemplateFromGenericDirectory(templateRoot, templateSpec);
const src = _getTemplateFromTypeSpecificDirectory(templateSpec) ||
_getTemplateFromGenericDirectory(templateSpec);

if (!src) {
const msg = `${templateSpec.name}:${templateSpec.type}`;
Expand Down Expand Up @@ -124,15 +122,15 @@ function _copyNpmTemplate(generator, templateSpec, destination) {
});
}

function _getTemplateFromTypeSpecificDirectory(templateRoot, templateSpec) {
function _getTemplateFromTypeSpecificDirectory(templateSpec) {
const src = path.join(templateRoot, templateSpec.name, templateSpec.type);
if (!_checkDirExists(src)) {
return null;
}
return src;
}

function _getTemplateFromGenericDirectory(templateRoot, templateSpec) {
function _getTemplateFromGenericDirectory(templateSpec) {
const src = path.join(templateRoot, templateSpec.name);
if (!_checkDirExists(src)) {
return null;
Expand All @@ -152,17 +150,3 @@ function _checkDirExists(filePath) {
}
return false;
}

function _installNpmTemplate(generator, npmUrl) {
return new Promise((resolve) => {
const cmd = `npm install ${npmUrl}`;
try {
const appDir = path.resolve(generator.appDir);
fs.ensureDirSync(path.join(appDir, 'node_modules'));
execSync(cmd, { cwd: appDir, stdio: 'ignore' });
} catch (err) {
utils.log.error(err);
}
resolve();
});
}
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ const config = {
aliases: ['packs'],
description: 'Creates a pack with the specified name in an existing app',
parameters: '<pack-name>',
examples: ['ojet create pack component demo-pack']
examples: ['ojet create pack demo-pack']
},
theme: {
aliases: ['themes'],
Expand Down
19 changes: 10 additions & 9 deletions generators/add-pcss-theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const utils = require('../../lib/util/utils');
const commonMessages = require('../../common/messages');

const DEFAULT_THEME = 'mytheme';
const JET_PCSS_SRC_PATH = 'node_modules/@oracle/oraclejet/dist/pcss/oj/';
const JET_VERSION_TOKEN = '<%= jetversion %>';
const THEMENAME_TOKEN = '<%= themename %>';
const COMPONENT_TOKEN = '<%= importcomponents %>';
Expand All @@ -41,9 +40,8 @@ function _setSettingsFileByTech(tech) {
}

function _getJETVersion() {
let getPackageJson = path.resolve('./node_modules/@oracle/oraclejet/package.json');
getPackageJson = fs.readJsonSync(getPackageJson);
return getPackageJson.version;
const toolingUtil = utils.loadToolingUtil();
return toolingUtil.getJETVersionV(toolingUtil.getJETVersion());
}

function _getComponentsList(baseName) {
Expand All @@ -52,12 +50,14 @@ function _getComponentsList(baseName) {
const componentAll = ALL_COMP_RW_PATH + baseName + COMPONENT_LIST.all;
const componentCommon = ALL_COMP_RW_PATH + baseName + COMPONENT_LIST.common;

const JET_PCSS_SRC_PATH = path.join(utils.loadToolingUtil().getOraclejetPath(), 'dist', 'pcss', 'oj');

const srcAllCompPath =
path.join(JET_PCSS_SRC_PATH, `v${_getJETVersion()}`, componentAll);
path.join(JET_PCSS_SRC_PATH, _getJETVersion(), componentAll);
const srcCommonCompPath =
path.join(JET_PCSS_SRC_PATH, `v${_getJETVersion()}`, componentCommon);
path.join(JET_PCSS_SRC_PATH, _getJETVersion(), componentCommon);
const srcNotagAllCompPath =
path.join(JET_PCSS_SRC_PATH, `v${_getJETVersion()}`, componentNotag);
path.join(JET_PCSS_SRC_PATH, _getJETVersion(), componentNotag);

let notagCompContent = fs.readFileSync(srcNotagAllCompPath, 'utf-8');
notagCompContent = notagCompContent.replace(replaceCopyright, '')
Expand All @@ -80,7 +80,7 @@ function _getReplaceValuePairsArray(basetheme, tech) {
return [
{
findstr: new RegExp('@import\ \"\.\.\/utilities', 'g'), //eslint-disable-line
replacewith: `@import "../../../../node_modules/@oracle/oraclejet/dist/pcss/oj/v${_getJETVersion()}/utilities`
replacewith: `@import "../../../../node_modules/@oracle/oraclejet/dist/pcss/oj/${_getJETVersion()}/utilities`
},
{
findstr: new RegExp('.*\\$themeName.*'),
Expand Down Expand Up @@ -112,8 +112,9 @@ function _injectDefaultValues(basetheme, destPath, tech) {
function _copyCssSettingsFile(addTheme, destPath, setTechnology) {
const whichTheme = addTheme.themeOptionValue;
const srcSettings = _getSettingsFileByTech(whichTheme, setTechnology);
const JET_PCSS_SRC_PATH = path.join(utils.loadToolingUtil().getOraclejetPath(), 'dist', 'pcss', 'oj');
const srcPath =
path.join(JET_PCSS_SRC_PATH, `v${_getJETVersion()}`, ALL_COMP_RW_PATH, whichTheme, srcSettings);
path.join(JET_PCSS_SRC_PATH, _getJETVersion(), ALL_COMP_RW_PATH, whichTheme, srcSettings);
const destSettingsFileName = _setSettingsFileByTech(setTechnology);
const destSettingsPath = path.join(destPath, constants.DEFAULT_PCSS_THEME, destSettingsFileName);
fs.copySync(srcPath, destSettingsPath);
Expand Down
10 changes: 6 additions & 4 deletions generators/add-theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const utils = require('../../lib/util/utils');
const commonMessages = require('../../common/messages');

const DEFAULT_THEME = 'mytheme';
const JET_SCSS_SRC_PATH = 'node_modules/@oracle/oraclejet/dist/scss';

const PLATFORM_TOKEN = '<%= platform %>';
const JET_VERSION_TOKEN = '<%= jetversion %>';
const THEMENAME_TOKEN = '<%= themename %>';
Expand Down Expand Up @@ -72,6 +72,7 @@ function _addSassTheme(addTheme) {
_renameFilesAllPlatforms(themeName, themeDestPath);
resolve(addTheme);
} catch (err) {
utils.log.error(err);
reject();
}
});
Expand Down Expand Up @@ -118,9 +119,8 @@ function _isValidThemeName(string) {
}

function _getJetVersion() {
let packageJSON = path.resolve('./node_modules/@oracle/oraclejet/package.json');
packageJSON = fs.readJsonSync(packageJSON);
return packageJSON.version;
const toolingUtil = utils.loadToolingUtil();
return toolingUtil.getJETVersionV(toolingUtil.getJETVersion());
}

// default marker <%= jetversion %> <%= themename %> <%= platform %>
Expand All @@ -140,6 +140,8 @@ function _copySettingsFilesFromJETSrc(themeName, dest) {
constants.SUPPORTED_PLATFORMS.forEach((platform) => {
const platformPath = _getPlatformPath(platform);
const srcSettingFileName = _getSrcSettingFileName(platform);
const JET_SCSS_SRC_PATH = path.join(utils.loadToolingUtil().getOraclejetPath(), 'dist', 'scss');

const srcPath = path.join(JET_SCSS_SRC_PATH, platformPath, srcSettingFileName);

const destSettingFileName = _getDestSettingFileName(DEFAULT_THEME, platform);
Expand Down
6 changes: 3 additions & 3 deletions generators/app/templates/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "1.0.0",
"description": "An Oracle JavaScript Extension Toolkit(JET) web app",
"dependencies": {
"@oracle/oraclejet": "~12.1.0"
"@oracle/oraclejet": "~13.0.0"
},
"devDependencies": {
"fs-extra": "^8.1.0",
"glob": "^7.1.1",
"glob": "7.2.0",
"underscore": "^1.10.2",
"@oracle/oraclejet-tooling": "~12.1.0"
"@oracle/oraclejet-tooling": "~13.0.0"
},
"engines": {
"node": ">=12.21.0"
Expand Down
6 changes: 3 additions & 3 deletions generators/hybrid/templates/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "1.0.0",
"description": "An Oracle JavaScript Extension Toolkit (JET) mobile app",
"dependencies": {
"@oracle/oraclejet": "~12.1.0"
"@oracle/oraclejet": "~13.0.0"
},
"devDependencies": {
"fs-extra": "^8.1.0",
"glob": "^7.1.1",
"glob": "7.2.0",
"underscore": "^1.10.2",
"@oracle/oraclejet-tooling": "~12.1.0"
"@oracle/oraclejet-tooling": "~13.0.0"
},
"engines": {
"node": ">=12.21.0"
Expand Down
2 changes: 1 addition & 1 deletion hybrid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fs = require('fs-extra');
const path = require('path');
const constants = require('../lib/util/constants');
const commonMessages = require('../common/messages');
const DOMParser = require('xmldom').DOMParser;
const DOMParser = require('@xmldom/xmldom').DOMParser;
const endOfLine = require('os').EOL;
const graphics = require('./graphics');
const paths = require('../lib/util/paths');
Expand Down
2 changes: 2 additions & 0 deletions lib/scopes/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ app.createComponent = function (parameter, options) {
};

app.createTheme = function (parameter, options) {
utils.validateSassInstall();
if (!utils.validCustomProperties()) {
utils.log.warning('The created theme defaults to alta as base-theme, which is deprecated.');
return addTheme(parameter, options);
}
return addPcssTheme(parameter, options);
Expand Down
7 changes: 3 additions & 4 deletions lib/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,9 @@ utils.validateServeOptions = (serveOptions, targetKey, platform) => {
return customOptions;
};

utils.validCustomProperties = () => {
const customProp = fs.existsSync(`${path.resolve(process.cwd())}/node_modules/postcss-calc`);
return customProp;
};
utils.validCustomProperties = () => utils.loadToolingUtil().getInstalledCssPackage();

utils.validateSassInstall = () => utils.loadToolingUtil().validateSassInstall();

utils.loadTooling = () => {
const toolingPath = path.join(process.cwd(), constants.TOOLING_PATH);
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oracle/ojet-cli",
"version": "12.1.0",
"version": "13.0.0",
"description": "Oracle JET Command Line Interface",
"license": "UPL-1.0",
"homepage": "http://www.oracle.com/jet",
Expand All @@ -11,10 +11,12 @@
"dependencies": {
"adm-zip": "~0.4.7",
"fs-extra": "~8.1.0",
"inquirer": "~6.2.2",
"glob": "7.2.0",
"inquirer": "~8.2.2",
"minimist": "~1.2.0",
"xmldom": "0.5.0",
"@oracle/oraclejet-tooling": "~12.1.0"
"@xmldom/xmldom": "0.8.1",
"@oracle/oraclejet-tooling": "~13.0.0",
"@oracle/oraclejet-templates": "~13.0.0"
},
"engines": {
"node": ">=12.21.0"
Expand Down
2 changes: 1 addition & 1 deletion template/component/js/component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@component-name@",
"version": "1.0.0",
"jetVersion": "^12.1.0",
"jetVersion": "^13.0.0",
"displayName": "A user friendly, translatable name of the component.",
"description": "A translatable high-level description for the component.",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion template/component/ts/component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@component-name@",
"version": "1.0.0",
"jetVersion": "^12.1.0",
"jetVersion": "^13.0.0",
"displayName": "A user friendly, translatable name of the component.",
"description": "A translatable high-level description for the component.",
"properties": {
Expand Down
Loading

0 comments on commit 25036d3

Please sign in to comment.