Skip to content

Commit

Permalink
4.6.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sjro committed May 23, 2023
2 parents 674b004 + be296da commit e9c0e4e
Show file tree
Hide file tree
Showing 16 changed files with 236 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dist: focal
language: node_js
node_js:
- lts/*
- node
#- node
sudo: false
install:
- npm config set prefer-offline false
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

The following is a curated list of changes in the Enact docs-utils module, newest changes on the top.

## [4.6.0] - 2023-05-23

- Updated `jsonata` version to ^2.0.2.

## [4.5.0] - 2023-04-06

- Changed to require node 14 or later
- Changed to require node 14 or later.

12 changes: 10 additions & 2 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ import 'prismjs/plugins/command-line/prism-command-line.css';
export const onRouteUpdate = ({location}) => {
if (location.hash) {
setTimeout(() => {
const node = document.querySelector(`${location.hash}`);
let node;
if (location.hash.includes('.')) {
// To select the element using `querySelector()` we escape the period in the ID with two backslashes
const parsedHashLocation = location.hash.replace(/\./g, '\\.');
node = document.querySelector(parsedHashLocation);
} else {
node = document.querySelector(`${location.hash}`);
}

if (node) {
node.scrollIntoView();
} else {
console.log(`Invalid location: ${location.hash}`); // eslint-disable-line no-console
}
}, 0);
}, 5);
}
};
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"node": ">=14"
},
"dependencies": {
"@enact/core": "^4.6.0",
"@enact/docs-utils": "^0.4.0",
"@enact/ui": "^4.6.0",
"@primer/octicons": "^17.10.2",
"@enact/core": "^4.6.2",
"@enact/docs-utils": "^0.4.2",
"@enact/ui": "^4.6.2",
"@primer/octicons": "^18.3.0",
"babel-plugin-dev-expression": "^0.2.3",
"broken-link-checker": "^0.7.8",
"chokidar": "^3.5.3",
Expand All @@ -20,7 +20,7 @@
"css-loader": "^6.7.3",
"elasticlunr": "^0.9.5",
"find-cache-dir": "^3.3.2",
"gatsby": "^4.25.4",
"gatsby": "^4.25.6",
"gatsby-plugin-catch-links": "^4.25.0",
"gatsby-plugin-google-gtag": "^4.25.0",
"gatsby-plugin-image": "^2.25.0",
Expand All @@ -29,7 +29,7 @@
"gatsby-plugin-offline": "^5.25.0",
"gatsby-plugin-postcss": "^5.25.0",
"gatsby-plugin-react-helmet": "^5.25.0",
"gatsby-plugin-sharp": "^4.25.0",
"gatsby-plugin-sharp": "^4.25.1",
"gatsby-plugin-typography": "^4.25.0",
"gatsby-remark-autolink-headers": "^5.25.0",
"gatsby-remark-copy-linked-files": "^5.25.0",
Expand All @@ -45,22 +45,21 @@
"global-modules": "^2.0.0",
"gray-matter": "^4.0.3",
"json-loader": "^0.5.7",
"jsonata": "^1.8.6",
"jsonata": "^2.0.2",
"jsonfile": "^6.1.0",
"less": "~4.1.3",
"less-loader": "^11.1.0",
"lodash": "^4.17.21",
"markdown-it": "^13.0.1",
"markdown-it-jsx": "^1.1.0",
"markdown-toc": "^1.2.0",
"minimist": "^1.2.7",
"mkdirp": "^1.0.4",
"minimist": "^1.2.8",
"postcss": "^8.4.21",
"postcss-loader": "^7.0.2",
"postcss-loader": "^7.2.4",
"prismjs": "^1.29.0",
"progress": "~2.0.3",
"prop-types": "^15.8.1",
"ramda": "^0.28.0",
"ramda": "^0.29.0",
"react": "^18.2.0",
"react-document-title": "^2.0.3",
"react-dom": "^18.2.0",
Expand Down
10 changes: 5 additions & 5 deletions sample-runner/agate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"dist/*"
],
"dependencies": {
"@enact/core": "^4.6.0",
"@enact/i18n": "^4.6.0",
"@enact/core": "^4.6.2",
"@enact/i18n": "^4.6.2",
"@enact/agate": "enactjs/agate#develop",
"@enact/spotlight": "^4.6.0",
"@enact/ui": "^4.6.0",
"ilib": "^14.15.1",
"@enact/spotlight": "^4.6.2",
"@enact/ui": "^4.6.2",
"ilib": "^14.17.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
10 changes: 5 additions & 5 deletions sample-runner/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"dist/*"
],
"dependencies": {
"@enact/core": "^4.6.0",
"@enact/i18n": "^4.6.0",
"@enact/spotlight": "^4.6.0",
"@enact/ui": "^4.6.0",
"ilib": "^14.16.0",
"@enact/core": "^4.6.2",
"@enact/i18n": "^4.6.2",
"@enact/spotlight": "^4.6.2",
"@enact/ui": "^4.6.2",
"ilib": "^14.17.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
10 changes: 5 additions & 5 deletions sample-runner/moonstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"dist/*"
],
"dependencies": {
"@enact/core": "^4.6.0",
"@enact/i18n": "^4.6.0",
"@enact/core": "^4.6.2",
"@enact/i18n": "^4.6.2",
"@enact/moonstone": "^4.5.2",
"@enact/spotlight": "^4.6.0",
"@enact/ui": "^4.6.0",
"ilib": "^14.16.0",
"@enact/spotlight": "^4.6.2",
"@enact/ui": "^4.6.2",
"ilib": "^14.17.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
10 changes: 5 additions & 5 deletions sample-runner/sandstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"dist/*"
],
"dependencies": {
"@enact/core": "^4.6.0",
"@enact/i18n": "^4.6.0",
"@enact/core": "^4.6.2",
"@enact/i18n": "^4.6.2",
"@enact/sandstone": "enactjs/sandstone#develop",
"@enact/spotlight": "^4.6.0",
"@enact/ui": "^4.6.0",
"ilib": "^14.16.0",
"@enact/spotlight": "^4.6.2",
"@enact/ui": "^4.6.2",
"ilib": "^14.17.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 2 additions & 0 deletions sample-runner/sandstone/src/EnactImporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import FlexiblePopupPanels from '@enact/sandstone/FlexiblePopupPanels';
import FormCheckboxItem from '@enact/sandstone/FormCheckboxItem';
import Heading from '@enact/sandstone/Heading';
import Icon from '@enact/sandstone/Icon';
import IconItem from '@enact/sandstone/IconItem';
import Image from '@enact/sandstone/Image';
import ImageItem from '@enact/sandstone/ImageItem';
import Input, {InputField} from '@enact/sandstone/Input';
Expand Down Expand Up @@ -77,6 +78,7 @@ const sandstoneExports = {
Header,
Heading,
Icon,
IconItem,
Image,
ImageItem,
Input,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const sum = (a, b) => (a + b);

> When using Advanced arrow functions with JSX, we recommend wrapping the JSX with parenthesis. They aren't required but the result is more readable and consistent with traditional functions or basic arrow functions that must use parenthesis for multi-line JSX.
> More on [how `return` behaves with new lines](http://lucumr.pocoo.org/2011/2/6/automatic-semicolon-insertion/) and [examples with JSX](https://goo.gl/7kI5oT) and the transpiled result.
> More on [how `return` behaves with new lines](http://lucumr.pocoo.org/2011/2/6/automatic-semicolon-insertion/) and [examples with JSX](https://babeljs.io/repl#?browsers=defaults&build=&builtIns=false&corejs=false&spec=false&loose=false&code_lz=MYewdgzgLgBATgUzAEwXAQgQwgS2ASTADdMAbHZGAXhgAoBKagPhgG8AoGeBKAVzjCcuMADzIcRJkOGiIAB0xgm0XgDNVIgPTzFUmVvGSA3OwC-J9qEixEKNFlzAAamQrU6jKiw5dEfAXTSooZ6MrIKSirqWjpKQQYSofQm5uyW4NDcdnAAgsgkYMAIyC7klDQMzDBCYonxscp80doRoQnGaVaZtqi5-YpFJa7IAAqIqmiI5R5VtDUh9a1RGi26NZoLyUA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=module&lineWrap=false&presets=react&prettier=false&targets=&version=7.21.8&externalPlugins=&assumptions=%7B%7D) and the transpiled result.
You may notice that we used both methods of returning data from an arrow function in our `Kitten` component (in the `computed` property and the `render` method).

Expand Down
26 changes: 22 additions & 4 deletions src/templates/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,26 @@ export default class JSONWrapper extends Component {
location: PropTypes.object
};

render () {
constructor (props) {
super(props);
this.state = {
renderDoc: null,
responseRenderModuleDescription: null,
responseRenderModuleMembers: null
};
}

async componentDidMount () {
const doc = JSON.parse(this.props.data.jsonDoc.internal.content);
this.setState({
renderDoc: doc[0],
responseRenderModuleDescription: await renderModuleDescription(doc),
responseRenderModuleMembers: await renderModuleMembers(doc[0].members)
});
}

render () {
const {renderDoc, responseRenderModuleDescription, responseRenderModuleMembers} = this.state;
const path = this.props.location.pathname.replace(/.*\/docs\/modules\//, '').replace(/\/$/, '');
const pathParts = path.replace(/([A-Z])/g, ' $1').split(' '); // Find all uppercase letters and allow a linebreak to happen before each one.
// The <wbr /> is an optional line-break. It only line-breaks if it needs to, and only on the specified points. Long lines won't get cut off in the middle of words.
Expand All @@ -34,11 +52,11 @@ export default class JSONWrapper extends Component {
<SiteTitle {...this.props} title={path}>
<div>
<EditContent>
{doc[0]}
{renderDoc}
</EditContent>
<h1>{pathParts.map((part, idx) => [<wbr key={idx} />, part])}</h1>
{renderModuleDescription(doc)}
{renderModuleMembers(doc[0].members)}
{responseRenderModuleDescription}
{responseRenderModuleMembers}
<div className="moduleTypesKey">
<TypesKey />
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import jsonata from 'jsonata'; // http://docs.jsonata.org/

import css from '../css/main.module.less';

export const processDefaultTag = (tags) => {
export const processDefaultTag = async (tags) => {
// Find any tag field whose `title` is 'default' (won't be there if no default)
const expression = "$[title='default'].description";
const result = jsonata(expression).evaluate(tags);
const result = await jsonata(expression).evaluate(tags);
return result || 'undefined';
};

Expand All @@ -33,16 +33,16 @@ export const renderDefaultTag = (defaultStr) => {
return <var className={css.default}><span className={css.title}>Default: </span>{defaultStr}</var>;
};

export const hasRequiredTag = (member) => {
export const hasRequiredTag = async (member) => {
// Find any tag field whose `title` is 'required' (won't be there if not required)
const expression = "$[title='required']";
const result = jsonata(expression).evaluate(member.tags);
const result = await jsonata(expression).evaluate(member.tags);
return !!result;
};

export const hasDeprecatedTag = (member) => {
export const hasDeprecatedTag = async (member) => {
// Find any tag field whose `title` is 'deprecated'
const expression = "$[title='deprecated']";
const result = jsonata(expression).evaluate(member.tags);
const result = await jsonata(expression).evaluate(member.tags);
return !!result;
};
Loading

0 comments on commit e9c0e4e

Please sign in to comment.