Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit e4f302d

Browse files
committed
move demos out of main repo and into shell-composer-plugin repo
Fixes #1014
1 parent 8c22605 commit e4f302d

File tree

15 files changed

+42
-198
lines changed

15 files changed

+42
-198
lines changed

app/content/js/ui.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,6 +1821,8 @@ const ui = (function() {
18211821
* leading @ character?
18221822
*
18231823
*/
1824+
const specialPaths = [] // any special paths added via self.addPath
1825+
const defaultSpecial = { filepath: require('path').join(__dirname, '..') } // default special is the app/ top-level
18241826
self.findFile = (filepath, safe) => {
18251827
if (!filepath) {
18261828
if (!safe) {
@@ -1831,12 +1833,31 @@ const ui = (function() {
18311833
}
18321834
} else if (filepath.charAt(0) === '@') {
18331835
// ui.js is in the /app/build directory
1834-
return require('path').join(__dirname, '..', filepath.substring(1))
1836+
const desiredPrefix = require('path').dirname(filepath)
1837+
const special = specialPaths.find(({prefix}) => desiredPrefix.indexOf(prefix) === 0) || defaultSpecial
1838+
return require('path').join(special.filepath, filepath)
18351839
} else {
18361840
return require('expand-home-dir')(filepath)
18371841
}
18381842
}
18391843

1844+
/**
1845+
* Augment the module load path
1846+
*
1847+
*/
1848+
self.addPath = filepath => {
1849+
const path = require('path')
1850+
1851+
// use app-module-path to augment the node module require path
1852+
require('app-module-path').addPath(path.resolve(filepath))
1853+
1854+
// remember this for self.findFile
1855+
const prefix = path.basename(filepath)
1856+
if (prefix.charAt(0) === '@') {
1857+
specialPaths.push({ prefix , filepath: path.dirname(filepath) })
1858+
}
1859+
}
1860+
18401861
/**
18411862
* Get the userdata directory
18421863
*

app/demos/authenticate.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/demos/hello.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/demos/hello.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/demos/if.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

app/demos/let.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

app/demos/login.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/demos/retain.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

app/demos/try.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

app/demos/validate.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)