Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ npm-debug.log
/node_modules
/example/installed
/example/data
.idea/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this part of the PR?

28 changes: 14 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class ArchaeServer extends EventEmitter {
const _getOldCerts = () => {
const _getCertFile = fileName => {
try {
return fs.readFileSync(path.join(dirname, cryptoDirectory, 'cert', fileName), 'utf8');
return fs.readFileSync(path.join(cryptoDirectory, 'cert', fileName), 'utf8');
} catch(err) {
if (err.code !== 'ENOENT') {
console.warn(err);
Expand Down Expand Up @@ -174,7 +174,7 @@ class ArchaeServer extends EventEmitter {
commonName: hostname,
});

const certDirectory = path.join(dirname, cryptoDirectory, 'cert');
const certDirectory = path.join(cryptoDirectory, 'cert');
const _makeCertDirectory = () => {
mkdirp.sync(certDirectory);
};
Expand Down Expand Up @@ -463,7 +463,7 @@ class ArchaeServer extends EventEmitter {
if (!err) {
if (fileName) {
const {dirname, installDirectory} = this;
const modulePath = path.join(dirname, installDirectory, 'plugins', pluginName, 'node_modules', pluginName, fileName);
const modulePath = path.join( installDirectory, 'plugins', pluginName, 'node_modules', pluginName, fileName);
const moduleInstance = require(modulePath);

this.plugins[pluginName] = moduleInstance;
Expand Down Expand Up @@ -672,7 +672,7 @@ class ArchaeServer extends EventEmitter {

// user public
if (publicDirectory) {
app.use('/', express.static(path.join(dirname, publicDirectory)));
app.use('/', express.static(publicDirectory));
}

class UpgradeEvent {
Expand Down Expand Up @@ -735,7 +735,7 @@ class ArchaeServer extends EventEmitter {

// archae bundles
const _serveJsFile = (req, res, {module, build = null}) => {
const srcPath = path.join(dirname, installDirectory, 'plugins', module, 'node_modules', module, '.archae', (build ? ('build/' + build) : 'client') + '.js');
const srcPath = path.join(installDirectory, 'plugins', module, 'node_modules', module, '.archae', (build ? ('build/' + build) : 'client') + '.js');

fs.readFile(srcPath, (err, d) => {
if (!err) {
Expand Down Expand Up @@ -1068,7 +1068,7 @@ class ArchaePather {

getInstalledModulePath(moduleName) {
const {dirname, installDirectory} = this;
return path.join(dirname, installDirectory, 'plugins', moduleName, 'node_modules', moduleName);
return path.join( installDirectory, 'plugins', moduleName, 'node_modules', moduleName);
}

getLocalModulePath(module) {
Expand Down Expand Up @@ -1120,7 +1120,7 @@ class ArchaeInstaller {
addModules(modules, moduleNames, force, cb) {
const {dirname, installDirectory, pather} = this;

const _getInstalledFlagFilePath = moduleName => path.join(dirname, installDirectory, 'plugins', moduleName, 'node_modules', moduleName, '.archae', 'installed.txt');
const _getInstalledFlagFilePath = moduleName => path.join(installDirectory, 'plugins', moduleName, 'node_modules', moduleName, '.archae', 'installed.txt');
const _writeFile = (p, d) => new Promise((accept, reject) => {
mkdirp(path.dirname(p), err => {
if (!err) {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ class ArchaeInstaller {
const moduleName = moduleNames[index];

const _ensureNodeModules = (module, moduleName) => new Promise((accept, reject) => {
mkdirp(path.join(dirname, installDirectory, 'plugins', moduleName, 'node_modules'), err => {
mkdirp(path.join( installDirectory, 'plugins', moduleName, 'node_modules'), err => {
if (!err) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird spacing regression here.

accept();
} else {
Expand All @@ -1186,11 +1186,11 @@ class ArchaeInstaller {
const npmInstall = child_process.spawn(
npmCommands.install[0],
npmCommands.install.slice(1).concat([
'--cache-folder', path.join(dirname, installDirectory, 'caches', moduleName),
'--cache-folder', path.join(installDirectory, 'caches', moduleName),
modulePath,
]),
{
cwd: path.join(dirname, installDirectory, 'plugins', moduleName),
cwd: path.join( installDirectory, 'plugins', moduleName),
}
);
npmInstall.stdout.pipe(process.stdout);
Expand All @@ -1211,8 +1211,8 @@ class ArchaeInstaller {
pather.getPluginClient(moduleName, (err, clientFileName) => {
if (!err) {
if (typeof clientFileName === 'string') {
const srcPath = path.join(dirname, installDirectory, 'plugins', moduleName, 'node_modules', moduleName, clientFileName);
const dstPath = path.join(dirname, installDirectory, 'plugins', moduleName, 'node_modules', moduleName, '.archae', 'client.js');
const srcPath = path.join(installDirectory, 'plugins', moduleName, 'node_modules', moduleName, clientFileName);
const dstPath = path.join(installDirectory, 'plugins', moduleName, 'node_modules', moduleName, '.archae', 'client.js');

return _requestRollup(srcPath)
.then(code => _writeFile(dstPath, code))
Expand All @@ -1231,8 +1231,8 @@ class ArchaeInstaller {
if (!err) {
if (Array.isArray(buildFileNames)) {
Promise.all(buildFileNames.map(buildFileName => {
const srcPath = path.join(dirname, installDirectory, 'plugins', moduleName, 'node_modules', moduleName, buildFileName);
const dstPath = path.join(dirname, installDirectory, 'plugins', moduleName, 'node_modules', moduleName, '.archae', 'build', buildFileName);
const srcPath = path.join(installDirectory, 'plugins', moduleName, 'node_modules', moduleName, buildFileName);
const dstPath = path.join( installDirectory, 'plugins', moduleName, 'node_modules', moduleName, '.archae', 'build', buildFileName);

return _requestRollup(srcPath)
.then(code => _writeFile(dstPath, code))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version probably needs an update.

"repository": {
"type": "git",
"url": "https://github.com/modulesio/archae.git"
"url": "https://github.com/toomu/archae.git"
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it the intention to take over this repo in npm?

"dependencies": {
"autows": "0.0.5",
Expand Down