Skip to content

Commit

Permalink
[REFACTO] Use @vercel/ncc package to inject dependencies into a singl…
Browse files Browse the repository at this point in the history
…e file, which avoids pushing the "node_modules" (#28)
  • Loading branch information
Demmonius committed Sep 5, 2021
1 parent 41d6340 commit 4e2d754
Show file tree
Hide file tree
Showing 12,812 changed files with 534 additions and 2,799,404 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .github/workflows/run-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- run: yarn # Install all dependencies
- uses: ./
id: store-variables
with:
Expand All @@ -32,6 +33,7 @@ jobs:
needs: run-integration-test
steps:
- uses: actions/checkout@v2
- run: yarn # Install all dependencies
- uses: ./
with:
variables: |
Expand All @@ -48,6 +50,7 @@ jobs:
needs: second-test
steps:
- uses: actions/checkout@v2
- run: yarn # Install all dependencies
- uses: ./
with:
variables: |
Expand All @@ -64,6 +67,7 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- run: yarn # Install all dependencies
- uses: ./
with:
variables: |
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ yarn-error.log*

# Tmp files (cache, etc.)
*.cache
.vercel
github-action-runtime/stats.json

# NPM modules
node_modules/
387 changes: 387 additions & 0 deletions github-action-runtime/LICENSE

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions github-action-runtime/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions github-action-runtime/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions github-action-runtime/sourcemap-register.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions github-action-runtime/stats.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
try {
const variables = core.getInput('variables');
const delimiter = core.getInput('delimiter');
const failIfNotFound = (core.getInput('failIfNotFound') == "true");
const failIfNotFound = core.getInput('failIfNotFound') == 'true';
core.debug(`Received variables: ${variables}`); // debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true https://github.com/actions/toolkit/blob/master/docs/action-debugging.md#how-to-access-step-debug-logs
core.debug(`Using delimiter: "${delimiter}"`);
yield manageArtifacts_1.default(variables, delimiter, failIfNotFound);
Expand All @@ -66,7 +66,8 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
}
});
//runConfigChecks();
run().then(actionReturn => {
}).catch(error => {
run()
.then((actionReturn) => { })
.catch((error) => {
core.setFailed(error);
});
16 changes: 7 additions & 9 deletions lib/manageArtifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ const io = require('@actions/io');
const defineVariableOperation = (variable) => {
try {
const variableContent = {
key: variable.split("=")[0],
value: variable.split("=")[1]
key: variable.split('=')[0],
value: variable.split('=')[1],
};
if (typeof variableContent.key !== 'undefined' && typeof variableContent.value !== 'undefined') {
return {
operationToProceed: 0,
detail: variableContent
detail: variableContent,
};
}
else if (typeof variableContent.key !== undefined) {
return {
operationToProceed: 1,
detail: variableContent
detail: variableContent,
};
}
else {
Expand All @@ -74,7 +74,7 @@ const defineVariableOperation = (variable) => {
const storeArtifact = (variables, failIfNotFound) => __awaiter(void 0, void 0, void 0, function* () {
const client = artifact.create();
const artifactOptions = {
retentionDays: 1 // Only keep artifacts 1 day to avoid reach limit: https://github.com/actions/toolkit/blob/c861dd8859fe5294289fcada363ce9bc71e9d260/packages/artifact/src/internal/upload-options.ts#L1
retentionDays: 1,
};
const artifactsUploadPromises = [];
rimraf_1.default.sync(config_1.WORKDIR);
Expand Down Expand Up @@ -134,10 +134,8 @@ const manageArtifacts = (variables, delimiter, failIfNotFound) => __awaiter(void
console.log(error);
}
}
yield storeArtifact(variablesDetail.filter((variable) => variable.operationToProceed === 0)
.map((variable) => variable.detail), failIfNotFound);
yield retrieveArtifact(variablesDetail.filter((variable) => variable.operationToProceed === 1)
.map((variable) => variable.detail), failIfNotFound);
yield storeArtifact(variablesDetail.filter((variable) => variable.operationToProceed === 0).map((variable) => variable.detail), failIfNotFound);
yield retrieveArtifact(variablesDetail.filter((variable) => variable.operationToProceed === 1).map((variable) => variable.detail), failIfNotFound);
const variablesResult = variablesDetail.reduce((variablesObject, variableToExport) => (Object.assign(Object.assign({}, variablesObject), { [variableToExport.detail.key]: variableToExport.detail.value })), {});
});
exports.default = manageArtifacts;
1 change: 0 additions & 1 deletion node_modules/.bin/acorn

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/atob

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/escodegen

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/esgenerate

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/eslint

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/eslint-config-prettier

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/eslint-ignore-errors

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/esparse

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/esvalidate

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/import-local-fixture

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/is-ci

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/jest

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/jest-runtime

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/js-yaml

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/jsesc

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/json5

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/loose-envify

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/mkdirp

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/node-which

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/parser

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/prettier

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/rimraf

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/sane

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/semver

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/sshpk-conv

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/sshpk-sign

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/sshpk-verify

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/ts-jest

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/tsc

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/tsserver

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/uuid

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/watch

This file was deleted.

Loading

0 comments on commit 4e2d754

Please sign in to comment.