Skip to content

Commit 1cffb09

Browse files
committed
Update setup-aether.js to work when symlinked
1 parent ae7c249 commit 1cffb09

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

setup-aether.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ const path = require("path");
1515
// List of esper langauge plugins we want to move into the public directory.
1616
const targets = ["lua", "python", "coffeescript"];
1717

18+
const PWD = process.env.PWD || __dirname; // __dirname might be undesirable if this is symlinked
19+
1820
const aether_webpack_config = {
19-
context: path.resolve(__dirname),
21+
context: path.resolve(PWD),
2022
entry: {
2123
aether: "./app/lib/aether/aether.coffee",
2224
// We need to create the html parser ourselves and move it ourselves into
@@ -25,7 +27,7 @@ const aether_webpack_config = {
2527
},
2628
output: {
2729
filename: "./aether/build/[name].js",
28-
path: path.resolve(__dirname, 'bower_components'),
30+
path: path.resolve(PWD, 'bower_components'),
2931
},
3032
module: {
3133
rules: [
@@ -79,13 +81,13 @@ function copyLanguagesFromEsper(targets) {
7981
.map(lang => [
8082
[
8183
path.join(
82-
__dirname,
84+
PWD,
8385
"bower_components",
8486
"esper.js",
8587
`esper-plugin-lang-${lang}.js`
8688
),
8789
path.join(
88-
__dirname,
90+
PWD,
8991
"public",
9092
"javascripts",
9193
"app",
@@ -95,13 +97,13 @@ function copyLanguagesFromEsper(targets) {
9597
],
9698
[
9799
path.join(
98-
__dirname,
100+
PWD,
99101
"bower_components",
100102
"esper.js",
101103
`esper-plugin-lang-${lang}-modern.js`
102104
),
103105
path.join(
104-
__dirname,
106+
PWD,
105107
"public",
106108
"javascripts",
107109
"app",
@@ -113,22 +115,22 @@ function copyLanguagesFromEsper(targets) {
113115
.reduce((l, paths) => l.concat(paths));
114116

115117
for (let [src, dest] of target_paths) {
116-
// const src = path.join(__dirname, 'bower_components', 'esper.js', `esper-plugin-lang-${target}.js`);
117-
// const dest = path.join(__dirname, 'bower_components', 'aether', 'build', `${target}.js`);
118+
// const src = path.join(PWD, 'bower_components', 'esper.js', `esper-plugin-lang-${target}.js`);
119+
// const dest = path.join(PWD, 'bower_components', 'aether', 'build', `${target}.js`);
118120
console.log(`Copy ${src}, ${dest}`);
119121
fs.copySync(src, dest);
120122
}
121123

122124
// Finally copy html as we globally load these within the html iframe.
123125
const src = path.join(
124-
__dirname,
126+
PWD,
125127
"bower_components",
126128
"aether",
127129
"build",
128130
"html.js"
129131
);
130132
const dest = path.join(
131-
__dirname,
133+
PWD,
132134
"public",
133135
"javascripts",
134136
"app",

0 commit comments

Comments
 (0)