From 016599fbe0b2c81e261e6cc323409c8d5f30d7bc Mon Sep 17 00:00:00 2001 From: Jason Baker Date: Mon, 17 Jul 2023 23:44:51 -0600 Subject: [PATCH] refactor(naming): use version naming scripts from auro-library --- README.md | 1 - package-lock.json | 9 +++++++ package.json | 1 + scripts/dependencyTagVersioning.mjs | 42 ----------------------------- scripts/version.js | 2 +- scripts/versionWriter.js | 21 --------------- src/auro-combobox.js | 2 +- src/inputVersion.js | 2 +- 8 files changed, 13 insertions(+), 67 deletions(-) delete mode 100644 scripts/dependencyTagVersioning.mjs delete mode 100644 scripts/versionWriter.js diff --git a/README.md b/README.md index 3abf053..9ad8182 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,6 @@ For the most up to date information on [UI development browser support](https:// [![Build Status](https://img.shields.io/github/actions/workflow/status/AlaskaAirlines/auro-combobox/testPublish.yml?style=for-the-badge)](https://github.com/AlaskaAirlines/auro-combobox/actions/workflows/testPublish.yml) [![See it on NPM!](https://img.shields.io/npm/v/@aurodesignsystem/auro-combobox?style=for-the-badge&color=orange)](https://www.npmjs.com/package/@aurodesignsystem/auro-combobox) [![License](https://img.shields.io/npm/l/@aurodesignsystem/auro-combobox?color=blue&style=for-the-badge)](https://www.apache.org/licenses/LICENSE-2.0) -[![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/@aurodesignsystem/auro-combobox?style=for-the-badge)](https://snyk.io/test/npm/@aurodesignsystem/auro-combobox?tab=issues) ```shell $ npm i @aurodesignsystem/auro-combobox diff --git a/package-lock.json b/package-lock.json index e2d2100..8fc5279 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@alaskaairux/icons": "^4.28.0", "@aurodesignsystem/auro-dropdown": "^2.9.9", "@aurodesignsystem/auro-input": "^2.14.1", + "@aurodesignsystem/auro-library": "^1.0.1", "@aurodesignsystem/auro-menu": "^3.10.0", "chalk": "^5.3.0", "lit": "^2.7.6" @@ -430,6 +431,14 @@ "@aurodesignsystem/webcorestylesheets": "^4.3.0" } }, + "node_modules/@aurodesignsystem/auro-library": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@aurodesignsystem/auro-library/-/auro-library-1.0.1.tgz", + "integrity": "sha512-Rkg+wK7587o2U4Eh0G3PIm6IpN7s3CahRTh9deZL5RXa1AqIDhZf1HZY31i7fJMTr1jaNfRDd0qrjLEoaqnQMw==", + "engines": { + "node": ">=18.15.0" + } + }, "node_modules/@aurodesignsystem/auro-menu": { "version": "3.10.0", "resolved": "https://registry.npmjs.org/@aurodesignsystem/auro-menu/-/auro-menu-3.10.0.tgz", diff --git a/package.json b/package.json index 82212b1..0b1721b 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@alaskaairux/icons": "^4.28.0", "@aurodesignsystem/auro-dropdown": "^2.9.9", "@aurodesignsystem/auro-input": "^2.14.1", + "@aurodesignsystem/auro-library": "^1.0.1", "@aurodesignsystem/auro-menu": "^3.10.0", "chalk": "^5.3.0", "lit": "^2.7.6" diff --git a/scripts/dependencyTagVersioning.mjs b/scripts/dependencyTagVersioning.mjs deleted file mode 100644 index 5781eaa..0000000 --- a/scripts/dependencyTagVersioning.mjs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license -// See LICENSE in the project root for license information. - -// --------------------------------------------------------------------- - -import { literal, unsafeStatic } from 'lit/static-html.js'; - -export class AuroDependencyVersioning { - - /** - * Generates a unique string to be used for child auro element naming. - * @private - * @param {string} baseName - Defines the first part of the unique element name. - * @param {string} version - Version of the component that will be appended to the baseName. - * @returns {string} - Unique string to be used for naming. - */ - generateElementName(baseName, version) { - let result = baseName; - - result += '-'; - result += version.replace(/[.]/g, '_'); - - return result; - } - - /** - * Generates a unique string to be used for child auro element naming. - * @param {string} baseName - Defines the first part of the unique element name. - * @param {string} version - Version of the component that will be appended to the baseName. - * @returns {string} - Unique string to be used for naming. - */ - generateTag(baseName, version, tagClass) { - const elementName = this.generateElementName(baseName, version); - const tag = literal`${unsafeStatic(elementName)}`; - - if (!customElements.get(elementName)) { - customElements.define(elementName, class extends tagClass {}); - } - - return tag; - } -} diff --git a/scripts/version.js b/scripts/version.js index d7c8029..e7f76d0 100644 --- a/scripts/version.js +++ b/scripts/version.js @@ -3,7 +3,7 @@ // --------------------------------------------------------------------- -const versionWriter = require("./versionWriter"); +const versionWriter = require("@aurodesignsystem/auro-library/scripts/build/versionWriter"); versionWriter.writeDepVersionFile('@aurodesignsystem/auro-dropdown'); versionWriter.writeDepVersionFile('@aurodesignsystem/auro-input'); diff --git a/scripts/versionWriter.js b/scripts/versionWriter.js deleted file mode 100644 index 8bb15b0..0000000 --- a/scripts/versionWriter.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license -// See LICENSE in the project root for license information. - -// --------------------------------------------------------------------- - -function writeDepVersionFile(pkg) { - console.warn('writeDepVersionFile', pkg); - - const fs = require('fs'); - - const path = '../node_modules/' + pkg + '/package.json'; - const json = require(path); - const version = json.version; - const elemSubName = pkg.substring(pkg.indexOf('auro-') + 5); - const versionFilePath = './src/' + elemSubName + 'Version.js'; - - fs.writeFileSync(versionFilePath, `export default '${version}'`); -}; - -// add the code below -module.exports = { writeDepVersionFile }; diff --git a/src/auro-combobox.js b/src/auro-combobox.js index de66bcd..d56e245 100644 --- a/src/auro-combobox.js +++ b/src/auro-combobox.js @@ -6,7 +6,7 @@ // If using litElement base class import { LitElement } from "lit"; import { html } from 'lit/static-html.js'; -import { AuroDependencyVersioning } from "../scripts/dependencyTagVersioning.mjs"; +import { AuroDependencyVersioning } from '@aurodesignsystem/auro-library/scripts/runtime/dependencyTagVersioning.mjs'; // If using auroElement base class // See instructions for importing auroElement base class https://git.io/JULq4 diff --git a/src/inputVersion.js b/src/inputVersion.js index 3765d5c..bda565a 100644 --- a/src/inputVersion.js +++ b/src/inputVersion.js @@ -1 +1 @@ -export default '2.14.0' \ No newline at end of file +export default '2.14.1' \ No newline at end of file