Skip to content

Commit

Permalink
feat: add support to packageAll
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioramos committed May 27, 2020
1 parent e7d27c3 commit 1b955dd
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 4,288 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# todo

- [ ] tree-shake handler code;
- [ ] `packageAll`;
- [ ] tests;
16 changes: 13 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,19 @@ module.exports = class {
};
}

resolveFilePathsAll(...args) {
this.serverless.cli.log('resolveFilePathsAll', ...args);
throw new Error('todo');
async resolveFilePathsAll() {
const allFiles = await Map(
this.serverless.service.getAllFunctions(),
(fnName) => {
return this.resolveFilePathsFunction(fnName);
},
);

return Uniq(
SortBy(Flatten(allFiles), (pathname) => {
return pathname.split(sep).includes('package.json');
}),
);
}

async getFileContentAndStat(pathname) {
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"apr-for-each": "^3.0.3",
"apr-map": "^3.0.3",
"apr-parallel": "^3.0.3",
"archiver": "^4.0.1",
"globby": "^11.0.0",
"lodash.sortby": "^4.7.0",
"lodash.topairs": "^4.3.0",
Expand All @@ -50,9 +51,7 @@
"eslint-config-xo-space": "^0.24.0",
"husky": "^4.2.5",
"lint-staged": "^10.2.6",
"prettier": "^2.0.5",
"serverless": "^1.71.3",
"typescript": "^3.9.3"
"prettier": "^2.0.5"
},
"peerDependencies": {
"serverless": "^1.71.3",
Expand Down
16 changes: 16 additions & 0 deletions test/setup-fixtures.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rm __fixtures__/ts-ws-all/plugin/*
ln ../package.json __fixtures__/ts-ws-all/plugin/package.json
ln ../index.js __fixtures__/ts-ws-all/plugin/index.js

rm __fixtures__/ts-ws-individual/plugin/*
ln ../package.json __fixtures__/ts-ws-individual/plugin/package.json
ln ../index.js __fixtures__/ts-ws-individual/plugin/index.js

rm __fixtures__/ws-all/plugin/*
ln ../package.json __fixtures__/ws-all/plugin/package.json
ln ../index.js __fixtures__/ws-all/plugin/index.js

rm __fixtures__/ws-individual/plugin/*
ln ../package.json __fixtures__/ws-individual/plugin/package.json
ln ../index.js __fixtures__/ws-individual/plugin/index.js

0 comments on commit 1b955dd

Please sign in to comment.