diff --git a/commitlint.config.js b/commitlint.config.cjs
similarity index 100%
rename from commitlint.config.js
rename to commitlint.config.cjs
diff --git a/package-lock.json b/package-lock.json
index 02d5cdc..ebe9bb9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,6 +14,7 @@
"lit": "^3.1.1"
},
"devDependencies": {
+ "@aurodesignsystem/auro-library": "^2.2.6",
"@aurodesignsystem/design-tokens": "^4.3.0",
"@aurodesignsystem/eslint-config": "^1.3.0",
"@aurodesignsystem/webcorestylesheets": "^5.0.2",
@@ -97,6 +98,21 @@
"node": ">=0.10.0"
}
},
+ "node_modules/@aurodesignsystem/auro-library": {
+ "version": "2.2.6",
+ "resolved": "https://registry.npmjs.org/@aurodesignsystem/auro-library/-/auro-library-2.2.6.tgz",
+ "integrity": "sha512-9Tr6IdsVJjuiyfH9TnDN5SOOBOn709zPmBRTNnCWWQ/PnqM9LYO7PBMJsuBL3VmR4zdSdBbjfYQc5PeEc7Fs+g==",
+ "dev": true,
+ "dependencies": {
+ "markdown-magic": "^2.6.1"
+ },
+ "bin": {
+ "generateDocs": "bin/generateDocs.mjs"
+ },
+ "engines": {
+ "node": ">=18.15.0"
+ }
+ },
"node_modules/@aurodesignsystem/design-tokens": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@aurodesignsystem/design-tokens/-/design-tokens-4.3.0.tgz",
diff --git a/package.json b/package.json
index b94cdaf..12a6cdb 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"type": "git",
"url": "https://github.com/AlaskaAirlines/auro-table"
},
+ "type": "module",
"main": "index.js",
"license": "Apache-2.0",
"engines": {
@@ -27,6 +28,7 @@
"@aurodesignsystem/webcorestylesheets": "^5.0.2"
},
"devDependencies": {
+ "@aurodesignsystem/auro-library": "^2.2.6",
"@aurodesignsystem/design-tokens": "^4.3.0",
"@aurodesignsystem/eslint-config": "^1.3.0",
"@aurodesignsystem/webcorestylesheets": "^5.0.2",
@@ -132,7 +134,7 @@
"build:ci": "npm-run-all sweep build",
"build:api": "wca analyze 'src/auro-table.js' --outFiles docs/api.md",
"build:dev:assets": "npm-run-all build:sass:component postCss:component sass:render build:docs",
- "build:docs": "node scripts/generateDocs.js",
+ "build:docs": "node scripts/generateDocs.mjs",
"build:sass": "npm-run-all build:sass:component postCss:component sass:render",
"build:sass:component": "sass --no-source-map src:src",
"build:watch": "nodemon -e scss,js,html --watch src --watch apiExamples/**/* --exec npm run build:dev:assets",
@@ -144,7 +146,7 @@
"esLint": "./node_modules/.bin/eslint src/**/*.js",
"linters": "npm-run-all scssLint esLint",
"preCommit": "node scripts/pre-commit.mjs",
- "postCss:component": "node ./scripts/postCss.js",
+ "postCss:component": "node ./scripts/postCss.mjs",
"postinstall": "node packageScripts/postinstall.mjs",
"sass:render": "sass-render src/*.css -t ./scripts/staticStyles-template.js",
"serve": "web-dev-server --open demo/ --node-resolve --watch",
diff --git a/packageScripts/postinstall.mjs b/packageScripts/postinstall.mjs
index 2a8120c..813e93b 100644
--- a/packageScripts/postinstall.mjs
+++ b/packageScripts/postinstall.mjs
@@ -21,7 +21,7 @@ console.log(chalk.hex('#f26135')(`
╭ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ──────────────────────────────╮
Thanks for installing the latest version
- of `) + chalk.hex('#ffd200').bold(`auro-table v${pjson.version}.`) + chalk.hex('#f26135')(`
+ of `) + chalk.hex('#ffd200').bold(`${pjson.name} v${pjson.version}.`) + chalk.hex('#f26135')(`
╰─────────────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
`)
diff --git a/scripts/generateDocs.js b/scripts/generateDocs.mjs
similarity index 82%
rename from scripts/generateDocs.js
rename to scripts/generateDocs.mjs
index b2de1ac..dab70bb 100644
--- a/scripts/generateDocs.js
+++ b/scripts/generateDocs.mjs
@@ -1,7 +1,9 @@
-const path = require('path');
-const markdownMagic = require('markdown-magic');
-const fs = require('fs');
-const https = require('https');
+import path from 'path';
+import markdownMagic from 'markdown-magic';
+import fs from 'fs';
+import https from 'https';
+
+const __dirname = new URL('.', import.meta.url).pathname;
const readmeTemplateUrl = 'https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README.md';
const dirDocTemplates = './docTemplates';
@@ -11,29 +13,29 @@ const readmeFilePath = dirDocTemplates + '/README.md';
* Extract NPM, NAMESPACE and NAME from package.json
*/
- function nameExtraction() {
- const packageJson = fs.readFileSync('package.json', 'utf8', function(err, data) {
- if (err) {
- console.log('ERROR: Unable to read package.json file', err);
- }
- })
+function nameExtraction() {
+ const packageJson = fs.readFileSync('package.json', 'utf8', function(err, data) {
+ if (err) {
+ console.log('ERROR: Unable to read package.json file', err);
+ }
+ })
- pName = JSON.parse(packageJson).name;
+ let pName = JSON.parse(packageJson).name;
- let npmStart = pName.indexOf('@');
- let namespaceStart = pName.indexOf('/');
- let nameStart = pName.indexOf('-');
+ 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)
- };
+ 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;
-};
+ return result;
+}
/**
* Replace all instances of [npm], [name], [Name], [namespace] and [Namespace] accordingly
@@ -65,7 +67,7 @@ function formatTemplateFileContents(content, destination) {
* Write the result to the destination file
*/
fs.writeFileSync(destination, result, { encoding: 'utf8'});
-};
+}
function formatApiTableContents(content, destination) {
const nameExtractionData = nameExtraction();
@@ -74,7 +76,7 @@ function formatApiTableContents(content, destination) {
let result = content;
result = result
- .replace(/\r\n|\r|\n####\s`([a-zA-Z]*)`/g, `\r\n#### \`$1\`back to top`)
+ .replace(/\r\n|\r|\n####\s`([a-zA-Z]*)`/g, `\r\n#### \`$1\`back to top`)
.replace(/\r\n|\r|\n\|\s`([a-zA-Z]*)`/g, '\r\n| [$1](#$1)')
.replace(/\| \[\]\(#\)/g, "");
diff --git a/scripts/postCss.js b/scripts/postCss.mjs
similarity index 72%
rename from scripts/postCss.js
rename to scripts/postCss.mjs
index 8de4c7e..df95225 100644
--- a/scripts/postCss.js
+++ b/scripts/postCss.mjs
@@ -1,7 +1,7 @@
-const autoprefixer = require('autoprefixer');
-const postcss = require('postcss');
-const comments = require('postcss-discard-comments');
-const fs = require('fs');
+import autoprefixer from 'autoprefixer';
+import postcss from 'postcss';
+import comments from 'postcss-discard-comments';
+import fs from 'fs';
fs.readFile('src/style.css', (err, css) => {
postcss([autoprefixer, comments])
diff --git a/scripts/pre-commit.mjs b/scripts/pre-commit.mjs
index b8911de..781e45b 100644
--- a/scripts/pre-commit.mjs
+++ b/scripts/pre-commit.mjs
@@ -1,8 +1,6 @@
'use strict';
import chalk from 'chalk';
-import { createRequire } from 'node:module';
-const require = createRequire(import.meta.url);
console.log(chalk.hex('#ffd200')(`
╭ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ──────────────────────────────╮`) + chalk.hex('#f26135')(`