Browse Source

Use the themeDir and schemaDir options of ensureAssets

Jason Grout 4 năm trước cách đây
mục cha
commit
e6c1f7bcf6

+ 3 - 2
examples/federated/core_package/package.json

@@ -4,7 +4,7 @@
   "private": true,
   "scripts": {
     "build": "npm run clean && webpack",
-    "clean": "rimraf build",
+    "clean": "rimraf static",
     "watch": "npm run clean && webpack --watch"
   },
   "resolutions": {
@@ -176,7 +176,8 @@
   "jupyterlab": {
     "buildDir": "./build",
     "outputDir": "./static",
-    "dataDir": "../data",
+    "themeDir": "../data",
+    "schemaDir": "../data",
     "singletonPackages": [
       "@jupyterlab/application",
       "@jupyterlab/apputils",

+ 10 - 16
examples/federated/core_package/webpack.config.js

@@ -47,31 +47,25 @@ if (fs.existsSync(outputDir)) {
 }
 fs.ensureDirSync(outputDir);
 
-const dataDir = path.resolve(jlab.dataDir);
-
-const schemaDir = path.join(dataDir, 'schemas')
-if (fs.existsSync(schemaDir)) {
-  fs.removeSync(schemaDir);
+const schemaDir = path.resolve(jlab.schemaDir)
+if (fs.existsSync(path.join(schemaDir, 'schemas'))) {
+  fs.removeSync(path.join(schemaDir, 'schemas'));
 }
-fs.ensureDirSync(schemaDir);
+// fs.ensureDirSync(path.join(schemaDir, 'schemas'));
 
-const themeDir = path.join(dataDir, 'themes')
-if (fs.existsSync(themeDir)) {
-  fs.removeSync(themeDir);
+const themeDir = path.resolve(jlab.themeDir)
+if (fs.existsSync(path.join(themeDir, 'themes'))) {
+  fs.removeSync(path.join(themeDir, 'themes'));
 }
 fs.ensureDirSync(themeDir);
 
 // Configuration to handle extension assets
 const extensionAssetConfig = Build.ensureAssets({
   packageNames: extensionPackages,
-  output: path.resolve(jlab.dataDir)
+  output: buildDir,
+  schemaOutput: schemaDir,
+  themeOutput: themeDir
 });
-if (dataDir !== buildDir) {
-  fs.moveSync(
-    path.join(dataDir, 'style.js'),
-    path.join(buildDir, 'style.js')
-  )
-}
 
 // Create the entry point and other assets in build directory.
 const source = fs.readFileSync('index.template.js').toString();