Comparing version 1.1.1 to 1.2.0
111
bin/index.js
#!/usr/bin/env node | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
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; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generate = void 0; | ||
var chokidar_1 = __importDefault(require("chokidar")); | ||
@@ -23,9 +36,9 @@ var commander_1 = __importDefault(require("commander")); | ||
var existingFileContent = fs.existsSync(outPath) | ||
? fs.readFileSync(outPath).toString('utf-8') | ||
: ''; | ||
? fs.readFileSync(outPath).toString("utf-8") | ||
: ""; | ||
if (fileContent !== existingFileContent) { | ||
fs_extra_1.mkdirsSync(path_1.dirname(outPath)); | ||
fs.writeFileSync(outPath, Buffer.from(fileContent, 'utf-8')); | ||
(0, fs_extra_1.mkdirsSync)((0, path_1.dirname)(outPath)); | ||
fs.writeFileSync(outPath, Buffer.from(fileContent, "utf-8")); | ||
if (printFilenames) { | ||
console.log({ outPath: outPath }, 'Updated file'); | ||
console.log({ outPath: outPath }, "Updated file"); | ||
} | ||
@@ -36,4 +49,4 @@ return true; | ||
}; | ||
exports.generate = function (source) { | ||
var loader = require('graphql-tag/loader'); | ||
var generate = function (source) { | ||
var loader = require("graphql-tag/loader"); | ||
return loader.call({ | ||
@@ -43,2 +56,3 @@ cacheable: function () { }, | ||
}; | ||
exports.generate = generate; | ||
var updatePath = function (path, outPath) { | ||
@@ -53,4 +67,13 @@ if (!fs.existsSync(path)) { | ||
else { | ||
var source = fs.readFileSync(path).toString('utf-8'); | ||
var newContent = exports.generate(source); | ||
var source = fs.readFileSync(path).toString("utf-8"); | ||
var existingFileContent = fs.existsSync(outPath) | ||
? fs.readFileSync(outPath).toString("utf-8") | ||
: ""; | ||
// Skip generation if the source file body hasn't changed | ||
// We can detect this because the original source is embedded | ||
// into the js file as a JSON value | ||
if (existingFileContent.includes(JSON.stringify(source))) { | ||
return false; | ||
} | ||
var newContent = (0, exports.generate)(source); | ||
return writeIfChanged(outPath, newContent); | ||
@@ -61,8 +84,8 @@ } | ||
try { | ||
commander_1.default.description('Generate javascript files from GraphQL files, so you can import them. Uses babel-tag/loader under the hood.'); | ||
commander_1.default.option('-w, --watch', 'Watch for file changes and automatically update ts files', false); | ||
commander_1.default.option('-o, --output <outPath>', 'Directory to write output files into', './bin'); | ||
commander_1.default.option('-d, --root <rootPath>', 'Dir to consider source files relative to when calculating the output path'); | ||
commander_1.default.option('-v, --verbose', 'More output', false); | ||
commander_1.default.arguments('<patterns...>'); | ||
commander_1.default.description("Generate javascript files from GraphQL files, so you can import them. Uses babel-tag/loader under the hood."); | ||
commander_1.default.option("-w, --watch", "Watch for file changes and automatically update ts files", false); | ||
commander_1.default.option("-o, --output <outPath>", "Directory to write output files into", "./bin"); | ||
commander_1.default.option("-d, --root <rootPath>", "Dir to consider source files relative to when calculating the output path"); | ||
commander_1.default.option("-v, --verbose", "More output", false); | ||
commander_1.default.arguments("<patterns...>"); | ||
commander_1.default.parse(process.argv); | ||
@@ -74,12 +97,12 @@ var _a = commander_1.default.opts(), verbose = _a.verbose, outPath_1 = _a.output, root = _a.root, watch = _a.watch; | ||
if (!outPath_1) { | ||
console.error('Must provide output folder!'); | ||
console.error("Must provide output folder!"); | ||
process.exit(1); | ||
} | ||
var rootPath_1 = root || require('glob-parent')(commander_1.default.args[0]); | ||
var rootPath_1 = root || require("glob-parent")(commander_1.default.args[0]); | ||
if (!outPath_1) { | ||
console.error('Root path not provided and could not be derived from input glob!'); | ||
console.error("Root path not provided and could not be derived from input glob!"); | ||
process.exit(1); | ||
} | ||
var listener = function (path) { | ||
return updatePath(path, path_1.resolve(outPath_1, path_1.relative(rootPath_1 || '', path + '.js'))); | ||
return updatePath(path, (0, path_1.resolve)(outPath_1, (0, path_1.relative)(rootPath_1 || "", path + ".js"))); | ||
}; | ||
@@ -92,25 +115,27 @@ if (watch) { | ||
watcher | ||
.on('add', listener) | ||
.on('change', listener) | ||
.on('unlink', listener) | ||
.on('error', function (error) { return console.error(error); }) | ||
.on('ready', function () { | ||
console.log('Watching for changes'); | ||
.on("add", listener) | ||
.on("change", listener) | ||
.on("unlink", listener) | ||
.on("error", function (error) { return console.error(error); }) | ||
.on("ready", function () { | ||
console.log("graphql2js watching for changes"); | ||
printFilenames = true; | ||
}); | ||
} | ||
else { | ||
var fileCount = 0; | ||
var changedCount = 0; | ||
for (var _i = 0, _b = commander_1.default.args; _i < _b.length; _i++) { | ||
var pattern = _b[_i]; | ||
for (var _c = 0, _d = glob_1.default.sync(pattern); _c < _d.length; _c++) { | ||
var path = _d[_c]; | ||
fileCount += 1; | ||
if (listener(path)) { | ||
changedCount += 1; | ||
} | ||
var fileCount = 0; | ||
var changedCount = 0; | ||
for (var _i = 0, _b = commander_1.default.args; _i < _b.length; _i++) { | ||
var pattern = _b[_i]; | ||
for (var _c = 0, _d = glob_1.default.sync(pattern); _c < _d.length; _c++) { | ||
var path = _d[_c]; | ||
fileCount += 1; | ||
if (listener(path)) { | ||
changedCount += 1; | ||
} | ||
} | ||
console.log({ changedCount: changedCount, fileCount: fileCount }, 'Code generation finished.'); | ||
} | ||
if (fileCount) { | ||
console.log({ changedCount: changedCount, fileCount: fileCount }, "graphql2js finished."); | ||
} | ||
if (!watch) { | ||
process.exit(0); | ||
@@ -127,2 +152,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQUNBLHNEQUFnQztBQUNoQyx3REFBa0M7QUFDbEMscUNBQXlCO0FBQ3pCLDhDQUF3QjtBQUN4Qiw2QkFJYztBQUNkLHFDQUFzQztBQUV0QyxJQUFJLGNBQWMsR0FBRyxLQUFLLENBQUM7QUFFM0IsSUFBTSxjQUFjLEdBQUcsVUFBQyxPQUFlLEVBQUUsV0FBbUI7SUFDMUQsSUFBTSxtQkFBbUIsR0FBRyxFQUFFLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQztRQUNoRCxDQUFDLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDO1FBQzVDLENBQUMsQ0FBQyxFQUFFLENBQUM7SUFDUCxJQUFJLFdBQVcsS0FBSyxtQkFBbUIsRUFBRTtRQUN2QyxxQkFBVSxDQUFDLGNBQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1FBQzdCLEVBQUUsQ0FBQyxhQUFhLENBQUMsT0FBTyxFQUFFLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxFQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUM7UUFDN0QsSUFBSSxjQUFjLEVBQUU7WUFDbEIsT0F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DQUFDLElBQUksRUFBZCxjQUFjLEVBQWQsSUFBYyxFQUFFO1lBQWpDLElBQU0sT0FBTyxTQUFBO1lBQ2hCLEtBQW1CLFVBQWtCLEVBQWxCLEtBQUEsY0FBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsRUFBbEIsY0FBa0IsRUFBbEIsSUFBa0IsRUFBRTtnQkFBbEMsSUFBTSxJQUFJLFNBQUE7Z0JBQ2IsU0FBUyxJQUFJLENBQUMsQ0FBQztnQkFDZixJQUFJLFFBQVEsQ0FBQyxJQUFJLENBQUMsRUFBRTtvQkFDbEIsWUFBWSxJQUFJLENBQUMsQ0FBQztpQkFDbkI7YUFDRjtTQUNGO1FBQ0QsSUFBSSxTQUFTLEVBQUU7WUFDYixPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsWUFBWSxjQUFBLEVBQUUsU0FBUyxXQUFBLEVBQUUsRUFBRSxzQkFBc0IsQ0FBQyxDQUFDO1NBQ2xFO1FBRUQsSUFBRyxDQUFDLEtBQUssRUFBRTtZQUNULE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7U0FDakI7S0FDRjtJQUFDLE9BQU8sQ0FBQyxFQUFFO1FBQ1YsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUNqQixPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0tBQ2pCO0FBQ0gsQ0FBQyxDQUFDO0FBRUYsSUFBSSxPQUFPLENBQUMsSUFBSSxLQUFLLE1BQU0sRUFBRTtJQUMzQixJQUFJLEVBQUUsQ0FBQztDQUNSIn0= |
{ | ||
"name": "graphql2js", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Generate js files from .graphql files, so you can import them", | ||
@@ -24,10 +24,11 @@ "main": "bin/index.js", | ||
"devDependencies": { | ||
"@types/chokidar": "^2.1.3", | ||
"@types/fs-extra": "^5.0.5", | ||
"@types/glob": "^7.1.1", | ||
"@types/glob-parent": "^3.1.1", | ||
"@types/node": "^11.13.8", | ||
"graphql": ">=14", | ||
"typescript": "^3.4.5" | ||
"@types/chokidar": "2.1.3", | ||
"@types/fs-extra": "9.0.12", | ||
"@types/glob": "7.1.4", | ||
"@types/glob-parent": "5.1.0", | ||
"@types/node": "14.17.4", | ||
"graphql": "15.6.1", | ||
"prettier": "2.5.1", | ||
"typescript": "4.5.4" | ||
} | ||
} |
@@ -11,2 +11,4 @@ # graphql2js | ||
If a target file already exists and matches the source file, this leaves the output unchanged. | ||
## Installation | ||
@@ -28,2 +30,6 @@ | ||
To stay running and watch for file changes after the initial build: | ||
`yarn graphql2js -d src -o dist --watch src/**/*.graphql` | ||
### npx | ||
@@ -33,1 +39,10 @@ | ||
To stay running and watch for file changes after the initial build: | ||
`npx graphql2js -d src -o dist --watch src/**/*.graphql` | ||
## History | ||
### 1.2.0 | ||
Changed it so that `--watch` still processes all the files |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
633988
6
12566
46
8
9