gdu 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,9 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const http_1 = __importDefault(require("http"));
7
+ const path_1 = require("path");
6
8
  const execa_1 = __importDefault(require("execa"));
7
9
  const graphql_config_1 = require("graphql-config");
8
10
  const kleur_1 = require("kleur");
11
+ const node_static_1 = require("node-static");
12
+ const open_1 = __importDefault(require("open"));
9
13
  const roots_1 = require("../lib/roots");
10
14
  const graphqlSchema_1 = __importDefault(require("./graphqlSchema"));
11
15
  exports.default = async (options) => {
@@ -26,7 +30,8 @@ exports.default = async (options) => {
26
30
  schemaPath,
27
31
  });
28
32
  const folderPath = path.slice(0, folderIndex + 1);
29
- const compareSchemaPath = options.compareSchemaPath || `${folderPath}compare-${path.slice(folderIndex + 1, path.length)}`;
33
+ const compareSchemaPath = options.compareSchemaPath ||
34
+ `${folderPath}compare-${path.slice(folderIndex + 1, path.length)}`;
30
35
  await (0, graphqlSchema_1.default)({
31
36
  ...options,
32
37
  e: options.c,
@@ -43,7 +48,20 @@ exports.default = async (options) => {
43
48
  })
44
49
  .then((result) => {
45
50
  console.log(`${(0, kleur_1.green)('SUCCESS!')}`, result);
46
- console.log(`${(0, kleur_1.green)('Diff document generated under')} ${(0, kleur_1.blue)('./schemaDiff/index.html')}`);
51
+ console.log(`${(0, kleur_1.green)('Schemas Diff document generated under')} ${(0, kleur_1.blue)('./schemaDiff/index.html')}`);
52
+ const staticSitePath = (0, path_1.join)(roots_1.PROJECT_ROOT, 'schemaDiff');
53
+ const file = new node_static_1.Server(staticSitePath);
54
+ const port = options.port || 8080;
55
+ const url = `http://localhost:${port}`;
56
+ http_1.default.createServer(function (request, response) {
57
+ request
58
+ .addListener('end', function () {
59
+ file.serve(request, response);
60
+ })
61
+ .resume();
62
+ }).listen(port);
63
+ console.log(`View diff under ${url}`);
64
+ (0, open_1.default)(url);
47
65
  }, (error) => {
48
66
  throw error;
49
67
  });
@@ -0,0 +1,2 @@
1
+ declare const _default: (options: any) => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const http_1 = __importDefault(require("http"));
7
+ const path_1 = require("path");
8
+ const execa_1 = __importDefault(require("execa"));
9
+ const graphql_config_1 = require("graphql-config");
10
+ const kleur_1 = require("kleur");
11
+ const node_static_1 = require("node-static");
12
+ const open_1 = __importDefault(require("open"));
13
+ const roots_1 = require("../lib/roots");
14
+ const graphqlSchema_1 = __importDefault(require("./graphqlSchema"));
15
+ exports.default = async (options) => {
16
+ const graphQLConfig = await (0, graphql_config_1.loadConfig)({
17
+ rootDir: roots_1.PROJECT_ROOT,
18
+ });
19
+ const config = graphQLConfig.getDefault();
20
+ const compareEndpointConfig = config.extension('endpoints')[options.endpoint];
21
+ if (typeof compareEndpointConfig === 'undefined') {
22
+ throw new TypeError(`Compare Endpoint ${options.endpoint} doesnt exist use -c flag to pass you compare endpoint name`);
23
+ }
24
+ const path = config.schema;
25
+ const schemaPath = options.schemaPath || path;
26
+ await (0, graphqlSchema_1.default)({
27
+ ...options,
28
+ s: schemaPath,
29
+ schemaPath,
30
+ });
31
+ execa_1.default
32
+ .command(`graphdoc -s ${schemaPath} -o ./doc/schema --force`, {
33
+ stdio: 'inherit',
34
+ cwd: roots_1.PROJECT_ROOT,
35
+ localDir: roots_1.PROJECT_ROOT,
36
+ extendEnv: true,
37
+ })
38
+ .then((result) => {
39
+ console.log(`${(0, kleur_1.green)('SUCCESS!')}`, result);
40
+ console.log(`${(0, kleur_1.green)('Schema docs generated under')} ${(0, kleur_1.blue)('./doc/schema')}`);
41
+ const staticSitePath = (0, path_1.join)(roots_1.PROJECT_ROOT, 'doc', 'schema');
42
+ const file = new node_static_1.Server(staticSitePath);
43
+ const port = options.port || 8080;
44
+ const url = `http://localhost:${port}`;
45
+ http_1.default.createServer(function (request, response) {
46
+ request
47
+ .addListener('end', function () {
48
+ file.serve(request, response);
49
+ })
50
+ .resume();
51
+ }).listen(port);
52
+ console.log(`View docs under ${url}`);
53
+ (0, open_1.default)(url);
54
+ }, (error) => {
55
+ throw error;
56
+ });
57
+ };
@@ -10,7 +10,7 @@ const roots_1 = require("../lib/roots");
10
10
  const normalise = (patterns, rawSchema) => {
11
11
  if (typeof rawSchema !== 'string')
12
12
  return rawSchema;
13
- const schema = rawSchema.replaceAll('`', '\'');
13
+ const schema = rawSchema.replaceAll('`', "'");
14
14
  return Array.isArray(patterns)
15
15
  ? patterns.reduce((schemaStr, normaliser) => schemaStr.replace(new RegExp(normaliser.pattern, normaliser.flags), normaliser.replacer), schema)
16
16
  : schema;
@@ -68,11 +68,18 @@ exports.default = (app) => {
68
68
  .option('-s, --schemaPath', 'The path to write schema file to.')
69
69
  .example('graphql-schema')
70
70
  .action(deferredAction(async () => Promise.resolve().then(() => __importStar(require('./graphqlSchema')))));
71
+ app.command('graphql-doc')
72
+ .option('-e, --endpoint', 'The endpoint name to retrieve the schema from.')
73
+ .option('-s, --schemaPath', 'The path to write schema file to.')
74
+ .option('-p, --port', 'Port number to serve the docs over.')
75
+ .example('graphql-schema')
76
+ .action(deferredAction(async () => Promise.resolve().then(() => __importStar(require('./graphqlDoc')))));
71
77
  app.command('graphql-diff')
72
78
  .option('-e, --endpoint', 'The endpoint name to retrieve the schema from.')
73
79
  .option('-s, --schemaPath', 'The path to write schema file to.')
74
80
  .option('-c, --compareEndpoint', 'The endpoint name to retrieve compare schema from.')
75
81
  .option('-cs, --compareSchemaPath', 'The path to write schema file to.')
82
+ .option('-p, --port', 'Port number to serve the diff over.')
76
83
  .example('graphql-diff')
77
84
  .action(deferredAction(async () => Promise.resolve().then(() => __importStar(require('./graphqlDiff')))));
78
85
  app.command('test').action(NOT_READY);
@@ -188,11 +188,7 @@ exports.defaultSecurityHeaders = [
188
188
  value: 'SAMEORIGIN https://*.autoguru.com.au',
189
189
  },
190
190
  ];
191
- const productionEnvs = new Set([
192
- 'prod',
193
- 'dockerprod',
194
- 'preprod',
195
- ]);
191
+ const productionEnvs = new Set(['prod', 'dockerprod', 'preprod']);
196
192
  const createNextJSConfig = (buildEnv) => {
197
193
  var _a, _b;
198
194
  const isDev = !(0, misc_1.isProductionBuild)();
package/package.json CHANGED
@@ -1,115 +1,118 @@
1
1
  {
2
- "name": "gdu",
3
- "version": "5.1.0",
4
- "private": false,
5
- "description": "AutoGuru's development toolkit",
6
- "homepage": "https://github.com/autoguru-au/octane/tree/master/packages/gdu#readme",
7
- "repository": "https://github.com/autoguru-au/octane/tree/master/packages/gdu",
8
- "license": "MIT",
9
- "files": [
10
- "babel/",
11
- "react-native/",
12
- "bin/",
13
- "dist/",
14
- "entry/",
15
- "gdu.d.ts"
16
- ],
17
- "bin": {
18
- "gdu": "./bin/gdu.js"
19
- },
20
- "types": "./dist/main.d.ts",
21
- "main": "./dist/main.js",
22
- "scripts": {
23
- "build": "tsc",
24
- "prepublishOnly": "yarn run build",
25
- "watch": "tsc --watch"
26
- },
27
- "dependencies": {
28
- "@autoguru/babel-preset": "^1.2.0",
29
- "@autoguru/tsconfig": "1.0.79",
30
- "@autoguru/utilities": "^1.1.1",
31
- "@babel/helper-plugin-utils": "^7.14.5",
32
- "@babel/preset-typescript": "^7.15.0",
33
- "@babel/runtime-corejs3": "^7.14.9",
34
- "@babel/template": "^7.14.5",
35
- "@graphql-cli/generate": "^4.1.0",
36
- "@graphql-inspector/diff-command": "^3.3.0",
37
- "@graphql-tools/json-file-loader": "^6.2.6",
38
- "@vanilla-extract/babel-plugin": "^1.1.6",
39
- "@vanilla-extract/css": "^1.7.1",
40
- "@vanilla-extract/next-plugin": "^2.0.2",
41
- "@vanilla-extract/webpack-plugin": "^2.1.10",
42
- "babel-loader": "^8.2.2",
43
- "babel-plugin-relay": "^13.2.0",
44
- "babel-plugin-treat": "^1.6.2",
45
- "browserslist-useragent-regexp": "^3.0.2",
46
- "clean-webpack-plugin": "^4.0.0-alpha.0",
47
- "core-js": "^3.9.1",
48
- "css-loader": "^6.4.0",
49
- "cssnano": "^4.1.10",
50
- "date-fns": "^2.17.0",
51
- "deepmerge": "^4.2.2",
52
- "diary": "^0.0.12",
53
- "dotenv-webpack": "^7.1.0",
54
- "ensure-gitignore": "^1.1.2",
55
- "env-ci": "^5.0.2",
56
- "execa": "^5.0.0",
57
- "find-up": "^5.0.0",
58
- "find-yarn-workspace-root": "^2.0.0",
59
- "glob": "^7.1.6",
60
- "graphql": "^15.5.0",
61
- "graphql-config": "^3.2.0",
62
- "graphql-schema-diff": "^2.5.0",
63
- "html-webpack-plugin": "^5.3.2",
64
- "intersection-observer": "^0.12.0",
65
- "ip": "^1.1.5",
66
- "js-yaml": "^3.14.0",
67
- "js-yaml-loader": "^1.2.2",
68
- "kleur": "^4.1.4",
69
- "mini-css-extract-plugin": "^2.4.2",
70
- "mkdirp": "^1.0.4",
71
- "next": "^12.1.6",
72
- "next-transpile-modules": "^9.0.0",
73
- "node-fetch": "^2.6.1",
74
- "null-loader": "^4.0.1",
75
- "postcss-flexbugs-fixes": "^4.2.1",
76
- "postcss-loader": "^3.0.0",
77
- "postcss-preset-env": "^6.7.0",
78
- "prettier": "^2.3.1",
79
- "recursive-readdir": "^2.2.2",
80
- "resolve-url-loader": "^3.1.2",
81
- "sade": "^1.7.4",
82
- "tapable": "^2.2.0",
83
- "terser-webpack-plugin": "^5.1.4",
84
- "treat": "2.0.4",
85
- "ts-dedent": "^2.2.0",
86
- "tsconfig-paths-webpack-plugin": "^3.5.2",
87
- "url-loader": "^4.1.1",
88
- "webpack": "^5.74.0",
89
- "webpack-dev-server": "^4.9.3",
90
- "whatwg-fetch": "^3.6.2"
91
- },
92
- "devDependencies": {
93
- "@babel/core": "^7.15.0",
94
- "@next/eslint-plugin-next": "^12.2.3",
95
- "@types/babel-types": "^7.0.10",
96
- "@types/glob": "^7.1.4",
97
- "@types/node": "^16.4.13",
98
- "@types/node-fetch": "^2.5.12",
99
- "@types/sade": "^1.7.3",
100
- "@types/webpack": "^5.28.0",
101
- "babel-plugin-macros": "^3.1.0",
102
- "browserslist-config-autoguru": "*",
103
- "typescript": "^4.4.3"
104
- },
105
- "peerDependencies": {
106
- "@types/node": ">=10",
107
- "browserslist-config-autoguru": ">=2.2.0"
108
- },
109
- "engines": {
110
- "node": ">=12.14.0"
111
- },
112
- "publishConfig": {
113
- "access": "public"
114
- }
2
+ "name": "gdu",
3
+ "version": "5.2.0",
4
+ "private": false,
5
+ "description": "AutoGuru's development toolkit",
6
+ "homepage": "https://github.com/autoguru-au/octane/tree/master/packages/gdu#readme",
7
+ "repository": "https://github.com/autoguru-au/octane/tree/master/packages/gdu",
8
+ "license": "MIT",
9
+ "files": [
10
+ "babel/",
11
+ "react-native/",
12
+ "bin/",
13
+ "dist/",
14
+ "entry/",
15
+ "gdu.d.ts"
16
+ ],
17
+ "bin": {
18
+ "gdu": "./bin/gdu.js"
19
+ },
20
+ "types": "./dist/main.d.ts",
21
+ "main": "./dist/main.js",
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "prepublishOnly": "yarn run build",
25
+ "watch": "tsc --watch"
26
+ },
27
+ "dependencies": {
28
+ "@2fd/graphdoc": "^2.4.0",
29
+ "@autoguru/babel-preset": "^1.2.0",
30
+ "@autoguru/tsconfig": "1.0.79",
31
+ "@autoguru/utilities": "^1.1.1",
32
+ "@babel/helper-plugin-utils": "^7.14.5",
33
+ "@babel/preset-typescript": "^7.15.0",
34
+ "@babel/runtime-corejs3": "^7.14.9",
35
+ "@babel/template": "^7.14.5",
36
+ "@graphql-cli/generate": "^4.1.0",
37
+ "@graphql-inspector/diff-command": "^3.3.0",
38
+ "@graphql-tools/json-file-loader": "^6.2.6",
39
+ "@vanilla-extract/babel-plugin": "^1.1.6",
40
+ "@vanilla-extract/css": "^1.7.1",
41
+ "@vanilla-extract/next-plugin": "^2.0.2",
42
+ "@vanilla-extract/webpack-plugin": "^2.1.10",
43
+ "babel-loader": "^8.2.2",
44
+ "babel-plugin-relay": "^13.2.0",
45
+ "babel-plugin-treat": "^1.6.2",
46
+ "browserslist-useragent-regexp": "^3.0.2",
47
+ "clean-webpack-plugin": "^4.0.0-alpha.0",
48
+ "core-js": "^3.9.1",
49
+ "css-loader": "^6.4.0",
50
+ "cssnano": "^4.1.10",
51
+ "date-fns": "^2.17.0",
52
+ "deepmerge": "^4.2.2",
53
+ "diary": "^0.0.12",
54
+ "dotenv-webpack": "^7.1.0",
55
+ "ensure-gitignore": "^1.1.2",
56
+ "env-ci": "^5.0.2",
57
+ "execa": "^5.0.0",
58
+ "find-up": "^5.0.0",
59
+ "find-yarn-workspace-root": "^2.0.0",
60
+ "glob": "^7.1.6",
61
+ "graphql": "^15.5.0",
62
+ "graphql-config": "^3.2.0",
63
+ "graphql-schema-diff": "^2.5.0",
64
+ "html-webpack-plugin": "^5.3.2",
65
+ "intersection-observer": "^0.12.0",
66
+ "ip": "^1.1.5",
67
+ "js-yaml": "^3.14.0",
68
+ "js-yaml-loader": "^1.2.2",
69
+ "kleur": "^4.1.4",
70
+ "mini-css-extract-plugin": "^2.4.2",
71
+ "mkdirp": "^1.0.4",
72
+ "next": "^12.1.6",
73
+ "next-transpile-modules": "^9.0.0",
74
+ "node-fetch": "^2.6.1",
75
+ "node-static": "^0.7.11",
76
+ "null-loader": "^4.0.1",
77
+ "open": "^8.4.0",
78
+ "postcss-flexbugs-fixes": "^4.2.1",
79
+ "postcss-loader": "^3.0.0",
80
+ "postcss-preset-env": "^6.7.0",
81
+ "prettier": "^2.3.1",
82
+ "recursive-readdir": "^2.2.2",
83
+ "resolve-url-loader": "^3.1.2",
84
+ "sade": "^1.7.4",
85
+ "tapable": "^2.2.0",
86
+ "terser-webpack-plugin": "^5.1.4",
87
+ "treat": "2.0.4",
88
+ "ts-dedent": "^2.2.0",
89
+ "tsconfig-paths-webpack-plugin": "^3.5.2",
90
+ "url-loader": "^4.1.1",
91
+ "webpack": "^5.74.0",
92
+ "webpack-dev-server": "^4.9.3",
93
+ "whatwg-fetch": "^3.6.2"
94
+ },
95
+ "devDependencies": {
96
+ "@babel/core": "^7.15.0",
97
+ "@next/eslint-plugin-next": "^12.2.3",
98
+ "@types/babel-types": "^7.0.10",
99
+ "@types/glob": "^7.1.4",
100
+ "@types/node": "^16.4.13",
101
+ "@types/node-fetch": "^2.5.12",
102
+ "@types/sade": "^1.7.3",
103
+ "@types/webpack": "^5.28.0",
104
+ "babel-plugin-macros": "^3.1.0",
105
+ "browserslist-config-autoguru": "*",
106
+ "typescript": "^4.4.3"
107
+ },
108
+ "peerDependencies": {
109
+ "@types/node": ">=10",
110
+ "browserslist-config-autoguru": ">=2.2.0"
111
+ },
112
+ "engines": {
113
+ "node": ">=12.14.0"
114
+ },
115
+ "publishConfig": {
116
+ "access": "public"
117
+ }
115
118
  }