Browse Source

fixed path issue in ensureUiComponents, more cleanup

telamonian 5 years ago
parent
commit
fbecad196e

+ 9 - 12
buildutils/src/ensure-package.ts

@@ -310,28 +310,25 @@ export async function ensureUiComponents(pkgPath: string): Promise<string[]> {
   const tab = '  ';
 
   const iconSrcDir = path.join(pkgPath, 'src/icon');
-  const svgs = glob.sync(path.join(pkgPath, 'style', '**/*.svg'));
+  const svgs = glob.sync(path.join(pkgPath, 'style/icons', '**/*.svg'));
 
   // build the per-icon import code
   let iconImportStatements: string[] = [];
   let iconModelDeclarations: string[] = [];
   svgs.forEach(svg => {
     const name = utils.stem(svg);
-    // skip the debug icons
-    if (name !== 'bad' && name !== 'blank') {
-      const nameCamel = utils.camelCase(name) + 'Svg';
-      iconImportStatements.push(
-        `import ${nameCamel} from '${path.relative(iconSrcDir, svg)}';`
-      );
-      iconModelDeclarations.push(
-        tab + tab + `{ name: '${name}', svg: ${nameCamel} }`
-      );
-    }
+    const nameCamel = utils.camelCase(name) + 'Svg';
+    iconImportStatements.push(
+      `import ${nameCamel} from '${path.relative(iconSrcDir, svg)}';`
+    );
+    iconModelDeclarations.push(
+      tab + tab + `{ name: '${name}', svg: ${nameCamel} }`
+    );
   });
 
   // generate the actual iconImports file
   let iconImports = generatedHeader('ensureUiComponents') + '\n\n';
-  iconImports += "import { Icon } from './icon';\n\n";
+  iconImports += "import { Icon } from './interfaces';\n\n";
 
   iconImports += '// icon svg import statements\n';
   iconImports += iconImportStatements.join('\n') + '\n\n';

+ 3 - 3
packages/ui-components/src/icon/iconimports.ts

@@ -5,7 +5,7 @@
 
 /* This file was auto-generated by ensureUiComponents() in @jupyterlab/buildutils */
 
-import { Icon } from './icon';
+import { Icon } from './interfaces';
 
 // icon svg import statements
 import fileSvg from '../../style/icons/filetype/file.svg';
@@ -20,12 +20,12 @@ import rKernelSvg from '../../style/icons/filetype/r-kernel.svg';
 import reactSvg from '../../style/icons/filetype/react.svg';
 import spreadsheetSvg from '../../style/icons/filetype/spreadsheet.svg';
 import yamlSvg from '../../style/icons/filetype/yaml.svg';
-import jupyterFaviconSvg from '../../style/icons/jupyter-favicon.svg';
 import buildSvg from '../../style/icons/sidebar/build.svg';
 import extensionSvg from '../../style/icons/sidebar/extension.svg';
 import paletteSvg from '../../style/icons/sidebar/palette.svg';
 import runningSvg from '../../style/icons/sidebar/running.svg';
 import tabSvg from '../../style/icons/sidebar/tab.svg';
+import jupyterFaviconSvg from '../../style/icons/splash/jupyter-favicon.svg';
 import kernelSvg from '../../style/icons/statusbar/kernel.svg';
 import lineFormSvg from '../../style/icons/statusbar/line-form.svg';
 import notTrustedSvg from '../../style/icons/statusbar/not-trusted.svg';
@@ -47,12 +47,12 @@ export namespace IconImports {
     { name: 'react', svg: reactSvg },
     { name: 'spreadsheet', svg: spreadsheetSvg },
     { name: 'yaml', svg: yamlSvg },
-    { name: 'jupyter-favicon', svg: jupyterFaviconSvg },
     { name: 'build', svg: buildSvg },
     { name: 'extension', svg: extensionSvg },
     { name: 'palette', svg: paletteSvg },
     { name: 'running', svg: runningSvg },
     { name: 'tab', svg: tabSvg },
+    { name: 'jupyter-favicon', svg: jupyterFaviconSvg },
     { name: 'kernel', svg: kernelSvg },
     { name: 'line-form', svg: lineFormSvg },
     { name: 'not-trusted', svg: notTrustedSvg },

+ 2 - 2
packages/ui-components/src/icon/iconregistry.tsx

@@ -10,8 +10,8 @@ import { IIconRegistry, Icon } from './interfaces';
 import { IconImports } from './iconimports';
 import { iconStyle, iconStyleFlat } from '../style/icon';
 
-import badSvg from '../../style/icons/bad.svg';
-import blankSvg from '../../style/icons/blank.svg';
+import badSvg from '../../style/debug/bad.svg';
+import blankSvg from '../../style/debug/blank.svg';
 
 /**
  * The icon registry class.

+ 0 - 0
packages/ui-components/style/icons/debug/bad.svg → packages/ui-components/style/debug/bad.svg


+ 0 - 0
packages/ui-components/style/icons/debug/blank.svg → packages/ui-components/style/debug/blank.svg


+ 0 - 0
packages/ui-components/style/icons/brand/jupyter-favicon.svg → packages/ui-components/style/icons/splash/jupyter-favicon.svg