From 3604b784ccb4f16d1a78649717d0412553d2af54 Mon Sep 17 00:00:00 2001 From: Dale Sande Date: Wed, 7 Feb 2024 13:03:22 -0800 Subject: [PATCH] docs: update readme --- README.md | 11 ++++---- package-lock.json | 12 ++++----- package.json | 2 +- scripts/generateDocs.mjs | 55 +++++++++++++++++++++++----------------- 4 files changed, 44 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 38e9052..6382213 100644 --- a/README.md +++ b/README.md @@ -105,19 +105,18 @@ import "@aurodesignsystem/auro-sidenav"; In cases where the project is not able to process JS assets, there are pre-processed assets available for use. See -- `auro-sidenav__bundled.js` for modern browsers. Legacy browsers such as IE11 are no longer supported. -We recommend you load these bundles using [differential serving](https://philipwalton.com/articles/deploying-es2015-code-in-production-today/) so that the browser only loads the bundle correctly. To accomplish this, the script tag for the modern bundle should have `type="module"` and the script tag. +**WARNING!** When installing into your application environment, DO NOT use `@latest` for the requested version. Risks include unknown MAJOR version releases and instant adoption of any new features and possible bugs without developer knowledge. The `@latest` wildcard should NEVER be used for production customer-facing applications. You have been warned. ### Bundle example code - + ```html - - - - + + + ``` diff --git a/package-lock.json b/package-lock.json index 3378e6f..483990a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aurodesignsystem/auro-sidenav", - "version": "1.0.2", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@aurodesignsystem/auro-sidenav", - "version": "1.0.2", + "version": "1.1.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { @@ -16,7 +16,7 @@ "lit": "^3.1.2" }, "devDependencies": { - "@aurodesignsystem/auro-library": "^2.2.6", + "@aurodesignsystem/auro-library": "^2.4.7", "@aurodesignsystem/design-tokens": "^4.3.0", "@aurodesignsystem/eslint-config": "^1.3.0", "@aurodesignsystem/webcorestylesheets": "^5.0.5", @@ -226,9 +226,9 @@ } }, "node_modules/@aurodesignsystem/auro-library": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@aurodesignsystem/auro-library/-/auro-library-2.4.1.tgz", - "integrity": "sha512-tS1kFgEOEckNzMhzbpKl8rXuvr/SrDl37vRQRQNnW+87awxK7E+cI/KHs9arkqGPobFB8gocH/4ryFgOEu/PNQ==", + "version": "2.4.7", + "resolved": "https://registry.npmjs.org/@aurodesignsystem/auro-library/-/auro-library-2.4.7.tgz", + "integrity": "sha512-R6qJqQqO9Jpu475D9rpIei6wEIYL1v57YFyFViYa13/DrLRlzSKMUubJCdIIwNtm/8qvvKf0VWVBpZfevRmp+Q==", "dev": true, "dependencies": { "markdown-magic": "^2.6.1" diff --git a/package.json b/package.json index bc113a0..3857869 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@aurodesignsystem/webcorestylesheets": "^5.0.5" }, "devDependencies": { - "@aurodesignsystem/auro-library": "^2.2.6", + "@aurodesignsystem/auro-library": "^2.4.7", "@aurodesignsystem/design-tokens": "^4.3.0", "@aurodesignsystem/eslint-config": "^1.3.0", "@aurodesignsystem/webcorestylesheets": "^5.0.5", diff --git a/scripts/generateDocs.mjs b/scripts/generateDocs.mjs index dab70bb..e261b15 100644 --- a/scripts/generateDocs.mjs +++ b/scripts/generateDocs.mjs @@ -14,28 +14,34 @@ const readmeFilePath = dirDocTemplates + '/README.md'; */ function nameExtraction() { - const packageJson = fs.readFileSync('package.json', 'utf8', function(err, data) { - if (err) { - console.log('ERROR: Unable to read package.json file', err); - } - }) - - let pName = JSON.parse(packageJson).name; - - let npmStart = pName.indexOf('@'); - let namespaceStart = pName.indexOf('/'); - let nameStart = pName.indexOf('-'); - - let result = { - 'npm': pName.substring(npmStart, namespaceStart), - 'namespace': pName.substring(namespaceStart + 1, nameStart), - 'namespaceCap': pName.substring(namespaceStart + 1)[0].toUpperCase() + pName.substring(namespaceStart + 2, nameStart), - 'name': pName.substring(nameStart + 1), - 'nameCap': pName.substring(nameStart + 1)[0].toUpperCase() + pName.substring(nameStart + 2) - }; - - return result; -} + const packageJson = fs.readFileSync('package.json', 'utf8', function(err, data) { + if (err) { + console.log('ERROR: Unable to read package.json file', err); + } + }) + + let pName = JSON.parse(packageJson).name; + let pVersion = JSON.parse(packageJson).version; + let pdtVersion = JSON.parse(packageJson).peerDependencies['\@aurodesignsystem/design-tokens'].substring(1) + let wcssVersion = JSON.parse(packageJson).peerDependencies['\@aurodesignsystem/webcorestylesheets'].substring(1) + + let npmStart = pName.indexOf('@'); + let namespaceStart = pName.indexOf('/'); + let nameStart = pName.indexOf('-'); + + let result = { + 'npm': pName.substring(npmStart, namespaceStart), + 'namespace': pName.substring(namespaceStart + 1, nameStart), + 'namespaceCap': pName.substring(namespaceStart + 1)[0].toUpperCase() + pName.substring(namespaceStart + 2, nameStart), + 'name': pName.substring(nameStart + 1), + 'nameCap': pName.substring(nameStart + 1)[0].toUpperCase() + pName.substring(nameStart + 2), + 'version': pVersion, + 'tokensVersion': pdtVersion, + 'wcssVersion': wcssVersion + }; + + return result; + } /** * Replace all instances of [npm], [name], [Name], [namespace] and [Namespace] accordingly @@ -53,6 +59,9 @@ function formatTemplateFileContents(content, destination) { result = result.replace(/\[Name](?!\()/g, nameExtractionData.nameCap); result = result.replace(/\[namespace]/g, nameExtractionData.namespace); result = result.replace(/\[Namespace]/g, nameExtractionData.namespaceCap); + result = result.replace(/\[Version]/g, nameExtractionData.version); + result = result.replace(/\[dtVersion]/g, nameExtractionData.tokensVersion); + result = result.replace(/\[wcssVersion]/g, nameExtractionData.wcssVersion); /** * Cleanup line breaks @@ -61,7 +70,7 @@ function formatTemplateFileContents(content, destination) { result = result.replace(/>(\r\n|\r|\n){2,}/g, '>\r\n'); // Remove empty lines directly after a closing html tag. result = result.replace(/>(\r\n|\r|\n)```/g, '>\r\n\r\n```'); // Ensure an empty line before code samples. result = result.replace(/>(\r\n|\r|\n){2,}```(\r\n|\r|\n)/g, '>\r\n```\r\n'); // Ensure no empty lines before close of code sample. - result = result.replace(/([^(\r\n|\r|\n)])(\r\n|\r|\n)+#/g, "$1\r\n\r\n#"); // Ensure empty line before header sections. + result = result.replace(/([^(\r\n|\r|\n)])(\r?\n|\r(?!\n))+#/g, "$1\r\n\r\n#"); // Ensure empty line before header sections. /** * Write the result to the destination file