Skip to content
Permalink
Browse files

[ember-cli-eyeglass] Handle older versions of broccoli.

  • Loading branch information...
chriseppstein committed Apr 18, 2019
1 parent f283151 commit dbcde80e0d9cf195c0813b3d9331a8ec7ad7d667
Showing with 16 additions and 4 deletions.
  1. +2 −1 packages/ember-cli-eyeglass/package.json
  2. +7 −3 packages/ember-cli-eyeglass/src/broccoli-ln-s.ts
  3. +7 −0 yarn.lock
@@ -82,7 +82,8 @@
"debug": "^4.1.1",
"fs-extra": "^7.0.0",
"lodash.clonedeep": "^4.5.0",
"lodash.defaultsdeep": "^4.6.0"
"lodash.defaultsdeep": "^4.6.0",
"tmp": "^0.1.0"
},
"peerDependencies": {
"ember-cli": "^3.5.0"
@@ -1,6 +1,7 @@
import BroccoliPlugin = require("broccoli-plugin");
import path = require("path");
import * as fs from "fs-extra";
import tmp = require("tmp");

type EnsureSymlinkSync = (srcFile: string, destLink: string) => void;
/* eslint-disable-next-line @typescript-eslint/no-var-requires */
@@ -26,6 +27,7 @@ type BroccoliSymbolicLinkerOptions =
*/
export class BroccoliSymbolicLinker extends BroccoliPlugin {
files: FileMap;
fakeOutputPath: string | undefined;
constructor(fileMap?: FileMap | undefined, options: BroccoliSymbolicLinkerOptions = {}) {
let pluginOpts: BroccoliPlugin.BroccoliPluginOptions = {needsCache: false};
Object.assign(pluginOpts, options);
@@ -50,10 +52,12 @@ export class BroccoliSymbolicLinker extends BroccoliPlugin {
// eslint-disable-next-line @typescript-eslint/camelcase
ln_s(src: string, dest: string): string {
this.files[dest] = src;
if (!this.outputPath) {
throw new Error("outputPath is not eagerly defined. Please upgrade ember-cli to at least version 3.5.")
let tartgetDir = this.outputPath;
if (!tartgetDir) {
this.fakeOutputPath = this.fakeOutputPath || tmp.dirSync().name;
tartgetDir = this.fakeOutputPath;
}
return path.join(this.outputPath, dest);
return path.join(tartgetDir, dest);
}
/**
* Returns the number of symlinks that will be created.
@@ -11546,6 +11546,13 @@ tmp@0.0.33, tmp@^0.0.33:
dependencies:
os-tmpdir "~1.0.2"

tmp@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.1.0.tgz#ee434a4e22543082e294ba6201dcc6eafefa2877"
integrity sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==
dependencies:
rimraf "^2.6.3"

tmpl@1.0.x:
version "1.0.4"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"

0 comments on commit dbcde80

Please sign in to comment.
You can’t perform that action at this time.