Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
Save token in home instead of node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
fabien0102 committed Feb 4, 2020
1 parent ab65d3e commit 87fb25b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"qs": "^6.9.1",
"react-fast-compare": "^2.0.4",
"request": "^2.88.0",
"slash": "^3.0.0",
"swagger2openapi": "^5.3.2",
"tslib": "^1.10.0",
"url": "^0.11.0",
Expand Down
6 changes: 4 additions & 2 deletions src/bin/restful-react-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import inquirer from "inquirer";
import difference from "lodash/difference";
import { join, parse } from "path";
import request from "request";
import { homedir } from "os";
import slash from "slash";

import importOpenApi from "../scripts/import-open-api";
import { OperationObject } from "openapi3-ts";
Expand Down Expand Up @@ -122,7 +124,7 @@ const importSpecs = async (options: AdvancedOptions) => {
const { github } = options;

let accessToken: string;
const githubTokenPath = join(__dirname, ".githubToken");
const githubTokenPath = join(homedir(), ".restful-react");
if (existsSync(githubTokenPath)) {
accessToken = readFileSync(githubTokenPath, "utf-8");
} else {
Expand All @@ -136,7 +138,7 @@ const importSpecs = async (options: AdvancedOptions) => {
{
type: "confirm",
name: "saveToken",
message: "Would you like to store your token for the next time? (stored in your node_modules)",
message: `Would you like to store your token for the next time? (stored in your ${slash(githubTokenPath)})`,
},
]);
if (answers.saveToken) {
Expand Down

0 comments on commit 87fb25b

Please sign in to comment.