Skip to content

Commit

Permalink
fix: add build and node node modules in husky hook
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Sep 29, 2019
1 parent 04cd479 commit b2929e3
Show file tree
Hide file tree
Showing 93 changed files with 1,081 additions and 769 deletions.
44 changes: 22 additions & 22 deletions build/expo.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
"use strict";
const __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
const result = {};
if (mod != null) for (const k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
Expand All @@ -24,13 +24,13 @@ const cli = __importStar(require("@actions/exec"));
* It uses the `EXPO_CLI_PASSWORD` environment variable for improved security.
*/
function authenticate(username, password) {
return __awaiter(this, void 0, void 0, function* () {
if (!username || !password) {
return core.debug('Skipping authentication, `expo-username` and/or `expo-password` not set...');
}
yield cli.exec('expo', ['login', `--username=${username}`], {
env: Object.assign(Object.assign({}, process.env), { EXPO_CLI_PASSWORD: password }),
});
});
return __awaiter(this, void 0, void 0, function* () {
if (!username || !password) {
return core.debug('Skipping authentication, `expo-username` and/or `expo-password` not set...');
}
yield cli.exec('expo', ['login', `--username=${username}`], {
env: Object.assign(Object.assign({}, process.env), { EXPO_CLI_PASSWORD: password }),
});
});
}
exports.authenticate = authenticate;
26 changes: 13 additions & 13 deletions build/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"use strict";
const __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@actions/core");
const expo_1 = require("./expo");
const install_1 = require("./install");
function run() {
return __awaiter(this, void 0, void 0, function* () {
const path = yield install_1.install(core_1.getInput('expo-version') || 'latest', core_1.getInput('expo-packager') || 'npm');
core_1.addPath(path);
yield expo_1.authenticate(core_1.getInput('expo-username'), core_1.getInput('expo-password'));
});
return __awaiter(this, void 0, void 0, function* () {
const path = yield install_1.install(core_1.getInput('expo-version') || 'latest', core_1.getInput('expo-packager') || 'npm');
core_1.addPath(path);
yield expo_1.authenticate(core_1.getInput('expo-username'), core_1.getInput('expo-password'));
});
}
exports.run = run;
run();
79 changes: 40 additions & 39 deletions build/install.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
"use strict";
const __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
const result = {};
if (mod != null) for (const k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const cache = __importStar(require("@actions/tool-cache"));
const cli = __importStar(require("@actions/exec"));
const io = __importStar(require("@actions/io"));
const path = __importStar(require("path"));
// eslint-disable-next-line @typescript-eslint/no-var-requires
const registry = require('libnpm');
/**
* Resolve the provided semver to exact version of `expo-cli`.
* This uses the npm registry and accepts latest, dist-tags or version ranges.
* It's used to determine the cached version of `expo-cli`.
*/
function resolve(version) {
return __awaiter(this, void 0, void 0, function* () {
return (yield registry.manifest(`expo-cli@${version}`)).version;
});
return __awaiter(this, void 0, void 0, function* () {
return (yield registry.manifest(`expo-cli@${version}`)).version;
});
}
exports.resolve = resolve;
/**
Expand All @@ -38,29 +39,29 @@ exports.resolve = resolve;
* It returns the path where Expo is installed.
*/
function install(version, packager) {
return __awaiter(this, void 0, void 0, function* () {
const exact = yield resolve(version);
let root = yield fromCache(exact);
if (!root) {
root = yield fromPackager(exact, packager);
root = yield toCache(exact, root);
}
return path.join(root, 'node_modules', '.bin');
});
return __awaiter(this, void 0, void 0, function* () {
const exact = yield resolve(version);
let root = yield fromCache(exact);
if (!root) {
root = yield fromPackager(exact, packager);
root = yield toCache(exact, root);
}
return path.join(root, 'node_modules', '.bin');
});
}
exports.install = install;
/**
* Install `expo-cli`, by version, using npm or yarn.
* It creates a temporary directory to store all required files.
*/
function fromPackager(version, packager) {
return __awaiter(this, void 0, void 0, function* () {
const root = process.env['RUNNER_TEMP'] || '';
const tool = yield io.which(packager);
yield io.mkdirP(root);
yield cli.exec(tool, ['add', `expo-cli@${version}`], { cwd: root });
return root;
});
return __awaiter(this, void 0, void 0, function* () {
const root = process.env['RUNNER_TEMP'] || '';
const tool = yield io.which(packager);
yield io.mkdirP(root);
yield cli.exec(tool, ['add', `expo-cli@${version}`], { cwd: root });
return root;
});
}
exports.fromPackager = fromPackager;
/**
Expand All @@ -70,9 +71,9 @@ exports.fromPackager = fromPackager;
* @see https://github.com/actions/toolkit/issues/47
*/
function fromCache(version) {
return __awaiter(this, void 0, void 0, function* () {
return cache.find('expo-cli', version);
});
return __awaiter(this, void 0, void 0, function* () {
return cache.find('expo-cli', version);
});
}
exports.fromCache = fromCache;
/**
Expand All @@ -82,8 +83,8 @@ exports.fromCache = fromCache;
* @see https://github.com/actions/toolkit/issues/47
*/
function toCache(version, root) {
return __awaiter(this, void 0, void 0, function* () {
return cache.cacheDir(root, 'expo-cli', version);
});
return __awaiter(this, void 0, void 0, function* () {
return cache.cacheDir(root, 'expo-cli', version);
});
}
exports.toCache = toCache;
1 change: 1 addition & 0 deletions node_modules/@babel/code-frame/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 14 additions & 10 deletions node_modules/@types/eslint-visitor-keys/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 16 additions & 11 deletions node_modules/@types/json-schema/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 14 additions & 11 deletions node_modules/@typescript-eslint/eslint-plugin/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b2929e3

Please sign in to comment.