Skip to content
This repository has been archived by the owner on Aug 26, 2020. It is now read-only.

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioramos committed Oct 9, 2018
1 parent a2cdbcc commit 931d134
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
20 changes: 10 additions & 10 deletions code_of_conduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down
30 changes: 13 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Reduce = require('apr-reduce');
const Execa = require('execa');
const { symlink, unlink, ensureDir, readdir, stat, copy } = require('fs-extra');
const Resolve = require('resolve-pkg');
const { join, dirname, basename } = require('path');
const { join, dirname } = require('path');

const Link = async (target, path) => {
await ensureDir(dirname(path));
Expand Down Expand Up @@ -43,8 +43,9 @@ module.exports = class ServerlessLernaPlugin {
});

const { data } = JSON.parse(stdout);
const workspaces = (this.workspaces = JSON.parse(data));
return workspaces;
this.workspaces = JSON.parse(data);

return this.workspaces;
}

async initialize() {
Expand All @@ -60,28 +61,28 @@ module.exports = class ServerlessLernaPlugin {
await ForEach(workspaces, async ({ location }, name) => {
this.log(`cleanup: iterating over workspace ${name}`);

const node_modules = join(this.cwd, location, 'node_modules');
const [, st] = await Intercept(stat(node_modules));
const nodeModules = join(this.cwd, location, 'node_modules');
const [, st] = await Intercept(stat(nodeModules));

if (!st || !st.isDirectory()) {
return;
}

const files = await readdir(node_modules, { withFileTypes: true });
const files = await readdir(nodeModules, { withFileTypes: true });
const symlinks = files.filter(file => file.isSymbolicLink());
const scoped = files.filter(({ name }) => /^\@/.test(name));
const scoped = files.filter(({ name }) => /^@/.test(name));

const removable = await Reduce(
scoped,
async (removable, { name }) => {
const n_node_modules = join(node_modules, name);
const [, st] = await Intercept(stat(n_node_modules));
const nNodeModules = join(nodeModules, name);
const [, st] = await Intercept(stat(nNodeModules));

if (!st || !st.isDirectory()) {
return;
}

const files = await readdir(n_node_modules, { withFileTypes: true });
const files = await readdir(nNodeModules, { withFileTypes: true });
return removable.concat(files.filter(file => file.isSymbolicLink()));
},
symlinks,
Expand Down Expand Up @@ -117,12 +118,7 @@ module.exports = class ServerlessLernaPlugin {
await Link(location, join(workspace, 'node_modules', name));
}

const pkg = join(location, 'package.json');
const { dependencies = {} } = require(pkg);

await ForEach(dependencies, async (_, name) => {
await this.linkPackage(workspace, dirname(pkg), resolved);
});
await this.linkPackage(workspace, location, resolved);
});
}

Expand Down Expand Up @@ -165,7 +161,7 @@ module.exports = class ServerlessLernaPlugin {
const modules = await readdir(root, { withFileTypes: true });
await ForEach(
modules.filter(file => file.isSymbolicLink()),
async ({ name }) => await Unlink(join(root, name)),
async ({ name }) => Unlink(join(root, name)),
);
});
});
Expand Down

0 comments on commit 931d134

Please sign in to comment.