@qld-gov-au/qgds-bootstrap5 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.esbuild/plugins/qgds-plugin-version.js +99 -0
- package/dist/assets/css/qld.bootstrap.css +1 -1
- package/dist/assets/css/qld.bootstrap.css.map +2 -2
- package/dist/assets/js/qld.bootstrap.min.js +9 -9
- package/dist/assets/js/qld.bootstrap.min.js.map +3 -3
- package/dist/components/bs5/head/head.hbs +11 -0
- package/dist/components/bs5/navbar/navbar.hbs +3 -2
- package/dist/sample-data/footer/footer.data.json +2 -2
- package/dist/sample-data/head/head.data.json +3 -0
- package/esbuild.js +4 -3
- package/package.json +15 -15
- package/src/components/bs5/breadcrumbs/breadcrumbs.stories.js +1 -1
- package/src/components/bs5/button/button.stories.js +1 -1
- package/src/components/bs5/card/card.scss +9 -0
- package/src/components/bs5/correctincorrect/correctincorrect.scss +3 -3
- package/src/components/bs5/dateinput/Dateinput.stories.js +1 -1
- package/src/components/bs5/footer/_colours.scss +33 -39
- package/src/components/bs5/footer/footer.data.json +2 -2
- package/src/components/bs5/footer/footer.functions.js +5 -8
- package/src/components/bs5/footer/footer.scss +23 -10
- package/src/components/bs5/footer/footer.stories.js +3 -3
- package/src/components/bs5/formcheck/_formcheck.stories.bak.js +2 -2
- package/src/components/bs5/formcheck/stories/checkbox/checkbox.stories.js +1 -1
- package/src/components/bs5/formcheck/stories/radio/radio.stories.js +1 -1
- package/src/components/bs5/head/Head.js +10 -0
- package/src/components/bs5/head/head.data.json +3 -0
- package/src/components/bs5/head/head.hbs +11 -0
- package/src/components/bs5/head/head.stories.js +76 -0
- package/src/components/bs5/head/manifest.json +0 -0
- package/src/components/bs5/header/header.stories.js +7 -225
- package/src/components/bs5/navbar/navbar.hbs +3 -2
- package/src/components/bs5/navbar/navbar.scss +6 -1
- package/src/components/bs5/searchInput/search.functions.js +38 -27
- package/src/components/bs5/searchInput/searchInput.stories.js +1 -1
- package/src/components/bs5/select/Select.stories.js +1 -1
- package/src/components/bs5/sidenav/sidenav.scss +1 -1
- package/src/components/bs5/sidenav/sidenav.stories.js +1 -1
- package/src/components/bs5/tag/tag.scss +5 -2
- package/src/components/bs5/textarea/Textarea.stories.js +1 -1
- package/src/components/bs5/textbox/Textbox.stories.js +1 -1
- package/src/components/bs5/textbox/textInput.scss +17 -3
- package/src/components/bs5/typography/typography.stories.js +4 -2
- package/src/main.js +45 -41
- package/src/scss/qld-type.scss +26 -10
- package/src/scss/qld-variables.scss +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import listFiles from "../helpers/listfiles.js";
|
|
6
|
+
import log from "../helpers/logger.js";
|
|
7
|
+
|
|
8
|
+
// Helper function to get git information
|
|
9
|
+
const getGitInfo = () => {
|
|
10
|
+
const getGitBranch = () => execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
|
11
|
+
const getGitTag = () => {
|
|
12
|
+
try {
|
|
13
|
+
return execSync('git describe --tags --exact-match 2>/dev/null').toString().trim();
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const getGitCommit = () => execSync('git rev-parse HEAD').toString().trim();
|
|
19
|
+
const getGitCommitDate = () => execSync('git log -1 --format=%cI').toString().trim();
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
branch: getGitBranch(),
|
|
23
|
+
tag: getGitTag(),
|
|
24
|
+
commit: getGitCommit(),
|
|
25
|
+
datetime: getGitCommitDate(),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Function to extract major version prefix from a tag
|
|
30
|
+
const extractMajorVersion = (tag) => {
|
|
31
|
+
if (tag.startsWith('v')) {
|
|
32
|
+
// Format 'vX.Y.Z' -> 'vX'
|
|
33
|
+
return tag.split('.')[0];
|
|
34
|
+
} else {
|
|
35
|
+
// Split by non-alphanumeric characters and take the first part
|
|
36
|
+
return tag.split(/[^a-zA-Z0-9]/)[0];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Helper function to get package.json info
|
|
41
|
+
const getPackageJson = async () => {
|
|
42
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
43
|
+
const packageJsonPath = path.resolve(__dirname, '../../package.json');
|
|
44
|
+
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
|
|
45
|
+
return {
|
|
46
|
+
project_id: packageJson.name,
|
|
47
|
+
version: packageJson.version,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Create the plugin
|
|
52
|
+
const versionPlugin = () => ({
|
|
53
|
+
name: 'version-plugin',
|
|
54
|
+
setup(build) {
|
|
55
|
+
// Get version details
|
|
56
|
+
let versionDetails;
|
|
57
|
+
build.onStart(async () => {
|
|
58
|
+
const packageInfo = await getPackageJson();
|
|
59
|
+
const gitInfo = getGitInfo();
|
|
60
|
+
versionDetails = {
|
|
61
|
+
...packageInfo,
|
|
62
|
+
...gitInfo,
|
|
63
|
+
majorVersion: extractMajorVersion(gitInfo.tag || 'v' + packageInfo.version),
|
|
64
|
+
};
|
|
65
|
+
console.log(`version details collected: ${JSON.stringify(versionDetails)}`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Replace placeholders in HTML, Mustache, and Handlebars files
|
|
69
|
+
build.onEnd(async (result) => {
|
|
70
|
+
console.log('version update starting');
|
|
71
|
+
|
|
72
|
+
//List new components
|
|
73
|
+
const root = process.cwd();
|
|
74
|
+
const relativePath = "/dist/components/";
|
|
75
|
+
|
|
76
|
+
const newTemplateFiles = listFiles(root + relativePath);
|
|
77
|
+
for (const file of newTemplateFiles) {
|
|
78
|
+
if (/\.(html|mustache|hbs)$/.test(file)) {
|
|
79
|
+
// const outputPath = path.resolve(process.cwd(), file);
|
|
80
|
+
let source = await fs.readFile(file, 'utf8');
|
|
81
|
+
let newSource = source.replace(/###VERSION###/g, JSON.stringify(versionDetails));
|
|
82
|
+
|
|
83
|
+
// Replace major version placeholder if present
|
|
84
|
+
newSource = newSource.replace(/###MAJOR_VERSION###/g, versionDetails.majorVersion);
|
|
85
|
+
|
|
86
|
+
// Check if the content has changed
|
|
87
|
+
if (source !== newSource) {
|
|
88
|
+
console.log(`Placeholder replaced in: ${file}, ${newSource}`);
|
|
89
|
+
await fs.writeFile(file, newSource);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export { versionPlugin };
|