Skip to content

Commit

Permalink
[New Theme] Rename aliased CSS assets
Browse files Browse the repository at this point in the history
Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki committed Jun 29, 2023
1 parent a938432 commit e97a3ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
### 🛡 Security

### 📈 Features/Enhancements
- Rename the aliased theme files ([#863](https://github.com/opensearch-project/oui/pull/863))


### 🐛 Bug Fixes

Expand Down
6 changes: 3 additions & 3 deletions scripts/compile-scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ async function compileScssFiles(
const { name } = path.parse(inputFilename);
const outputFilenames = await compileScssFile(
inputFilename,
path.join(destinationDirectory, `eui_${name.replace('next', 'amsterdam')}.css`),
path.join(destinationDirectory, `eui_${name.replace('next', 'amsterdam')}.json`),
path.join(destinationDirectory, `eui_${name.replace('next', 'amsterdam')}.json.d.ts`),
path.join(destinationDirectory, `eui_${name}.css`),
path.join(destinationDirectory, `eui_${name}.json`),
path.join(destinationDirectory, `eui_${name}.json.d.ts`),
packageName,
true
);
Expand Down
7 changes: 3 additions & 4 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const { INIT_CWD, PWD = process.cwd() } = process.env;
if (!INIT_CWD?.startsWith?.(PWD)) {
// Clean up and recreate the folders
fs.rmSync('src/themes/eui', { recursive: true, force: true });
fs.rmSync('src/themes/eui-amsterdam', { recursive: true, force: true });
fs.rmSync('src/themes/eui-next', { recursive: true, force: true });

const copyDirectory = (src, dest) => {
fs.mkdirSync(dest, { recursive: true });
Expand All @@ -35,15 +35,14 @@ if (!INIT_CWD?.startsWith?.(PWD)) {
const srcItem = path.join(src, entry.name);
const destItem = path
.join(dest, entry.name)
.replace('oui', 'eui')
.replace('next', 'amsterdam');
.replace('oui', 'eui');

if (entry.isDirectory()) copyDirectory(srcItem, destItem);
else fs.copyFileSync(srcItem, destItem);
}
};

copyDirectory('src/themes/oui', 'src/themes/eui');
copyDirectory('src/themes/oui-next', 'src/themes/eui-amsterdam');
copyDirectory('src/themes/oui-next', 'src/themes/eui-next');
}
/* End of Aliases */

0 comments on commit e97a3ce

Please sign in to comment.