Skip to content

Updates definition build script for babel 7.0 #5024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@
"lint-staged": {
"{src,spec}/**/*.js": [
"prettier --write",
"flow",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're removing this, should @flow's come out too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, flow doesn’t take an argument, i’ll Find a way to add it back

"eslint --cache ./",
"eslint --cache",
"git add"
]
}
Expand Down
33 changes: 22 additions & 11 deletions resources/buildConfigDefinitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,35 @@ function getENVPrefix(iface) {

function processProperty(property, iface) {
const firstComment = getCommentValue(last(property.leadingComments || []));
const lastComment = getCommentValue((property.trailingComments || [])[0]);
const name = property.key.name;
const prefix = getENVPrefix(iface);

if (!firstComment) {
return;
}
const components = firstComment.split(':ENV:').map((elt) => {
return elt.trim();
const lines = firstComment.split('\n').map((line) => line.trim());
let help = '';
let envLine;
let defaultLine;
lines.forEach((line) => {
if (line.indexOf(':ENV:') === 0) {
envLine = line;
} else if (line.indexOf(':DEFAULT:') === 0) {
defaultLine = line;
} else {
help += line;
}
});
let env;
if (envLine) {
env = envLine.split(' ')[1];
} else {
env = (prefix + toENV(name));
}
let defaultValue;
if (lastComment && lastComment.indexOf('=') >= 0) {
const slice = lastComment.slice(lastComment.indexOf('=') + 1, lastComment.length).trim();
defaultValue = slice;
if (defaultLine) {
defaultValue = defaultLine.split(' ')[1];
}
const help = components[0];
const env = components[1] || (prefix + toENV(name));
let type = property.value.type;
let isRequired = true;
if (type == 'NullableTypeAnnotation') {
Expand Down Expand Up @@ -249,8 +261,7 @@ This code has been generated by resources/buildConfigDefinitions.js
Do not edit manually, but update Options/index.js
`

const babel = require("babel-core");
const res = babel.transformFileSync('./src/Options/index.js', { plugins: [ plugin ], auxiliaryCommentBefore, sourceMaps: false });
const babel = require("@babel/core");
const res = babel.transformFileSync('./src/Options/index.js', { plugins: [ plugin, '@babel/transform-flow-strip-types' ], babelrc: false, auxiliaryCommentBefore, sourceMaps: false });
require('fs').writeFileSync('./src/Options/Definitions.js', res.code + '\n');
require('fs').writeFileSync('./src/Options/docs.js', docs);

3 changes: 1 addition & 2 deletions src/Options/Definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
**** GENERATED CODE ****
This code has been generated by resources/buildConfigDefinitions.js
Do not edit manually, but update Options/index.js
*/ 'use strict';

*/
var parsers = require('./parsers');

module.exports.ParseServerOptions = {
Expand Down
130 changes: 78 additions & 52 deletions src/Options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export interface ParseServerOptions {
/* URL to your parse server with http:// or https://.
:ENV: PARSE_SERVER_URL */
serverURL: string;
/* Restrict masterKey to be used by only these ips, defaults to [] (allow all ips) */
masterKeyIps: ?(string[]); // = []
/* Restrict masterKey to be used by only these ips, defaults to [] (allow all ips)
:DEFAULT: [] */
masterKeyIps: ?(string[]);
/* Sets the app name */
appName: ?string;
/* Adapter module for the analytics */
Expand All @@ -29,16 +30,18 @@ export interface ParseServerOptions {
filesAdapter: ?Adapter<FilesAdapter>;
/* Configuration for push, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#push-notifications */
push: ?any;
/* Configuration for push scheduling, defaults to false. */
scheduledPush: ?boolean; // = false
/* Configuration for push scheduling, defaults to false.
:DEFAULT: false */
scheduledPush: ?boolean;
/* Adapter module for the logging sub-system */
loggerAdapter: ?Adapter<LoggerAdapter>;
/* Log as structured JSON objects
:ENV: JSON_LOGS */
jsonLogs: ?boolean;
/* Folder for the logs (defaults to './logs'); set to null to disable file based logging
:ENV: PARSE_SERVER_LOGS_FOLDER */
logsFolder: ?string; // = ./logs
:ENV: PARSE_SERVER_LOGS_FOLDER
:DEFAULT: ./logs */
logsFolder: ?string;
/* Set the logging to verbose
:ENV: VERBOSE */
verbose: ?boolean;
Expand All @@ -47,16 +50,18 @@ export interface ParseServerOptions {
/* Disables console output
:ENV: SILENT */
silent: ?boolean;
/* The full URI to your database. Supported databases are mongodb or postgres. */
databaseURI: string; // = mongodb://localhost:27017/parse
/* The full URI to your database. Supported databases are mongodb or postgres.
:DEFAULT: mongodb://localhost:27017/parse */
databaseURI: string;
/* Options to pass to the mongodb client */
databaseOptions: ?any;
/* Adapter module for the database */
databaseAdapter: ?Adapter<StorageAdapter>;
/* Full path to your cloud code main.js */
cloud: ?string;
/* A collection prefix for the classes */
collectionPrefix: ?string; // = ''
/* A collection prefix for the classes
:DEFAULT: '' */
collectionPrefix: ?string;
/* Key for iOS, MacOS, tvOS clients */
clientKey: ?string;
/* Key for the Javascript SDK */
Expand All @@ -73,25 +78,32 @@ export interface ParseServerOptions {
/* Key for your files */
fileKey: ?string;
/* Enable (or disable) the addition of a unique hash to the file names
:ENV: PARSE_SERVER_PRESERVE_FILE_NAME */
preserveFileName: ?boolean; // = false
/* Personally identifiable information fields in the user table the should be removed for non-authorized users. */
userSensitiveFields: ?(string[]); // = ["email"]
:ENV: PARSE_SERVER_PRESERVE_FILE_NAME
:DEFAULT: false */
preserveFileName: ?boolean;
/* Personally identifiable information fields in the user table the should be removed for non-authorized users.
:DEFAULT: ["email"] */
userSensitiveFields: ?(string[]);
/* Enable (or disable) anon users, defaults to true
:ENV: PARSE_SERVER_ENABLE_ANON_USERS */
enableAnonymousUsers: ?boolean; // = true
:ENV: PARSE_SERVER_ENABLE_ANON_USERS
:DEFAULT: true */
enableAnonymousUsers: ?boolean;
/* Enable (or disable) client class creation, defaults to true
:ENV: PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION */
allowClientClassCreation: ?boolean; // = true
:ENV: PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION
:DEFAULT: true */
allowClientClassCreation: ?boolean;
/* Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication
:ENV: PARSE_SERVER_AUTH_PROVIDERS */
auth: ?any;
/* Max file size for uploads, defaults to 20mb */
maxUploadSize: ?string; // = 20mb
/* Enable (or disable) user email validation, defaults to false */
verifyUserEmails: ?boolean; // = false
/* Prevent user from login if email is not verified and PARSE_SERVER_VERIFY_USER_EMAILS is true, defaults to false */
preventLoginWithUnverifiedEmail: ?boolean; // = false
/* Max file size for uploads, defaults to 20mb
:DEFAULT: 20mb */
maxUploadSize: ?string;
/* Enable (or disable) user email validation, defaults to false
:DEFAULT: false */
verifyUserEmails: ?boolean;
/* Prevent user from login if email is not verified and PARSE_SERVER_VERIFY_USER_EMAILS is true, defaults to false
:DEFAULT: false */
preventLoginWithUnverifiedEmail: ?boolean;
/* Email verification token validity duration, in seconds */
emailVerifyTokenValidityDuration: ?number;
/* account lockout policy for failed login attempts */
Expand All @@ -105,37 +117,50 @@ export interface ParseServerOptions {
/* Public URL to your parse server with http:// or https://.
:ENV: PARSE_PUBLIC_SERVER_URL */
publicServerURL: ?string;
/* custom pages for password validation and reset */
customPages: ?CustomPagesOptions; // = {}
/* custom pages for password validation and reset
:DEFAULT: {} */
customPages: ?CustomPagesOptions;
/* parse-server's LiveQuery configuration object */
liveQuery: ?LiveQueryOptions;
/* Session duration, in seconds, defaults to 1 year */
sessionLength: ?number; // = 31536000
/* Session duration, in seconds, defaults to 1 year
:DEFAULT: 31536000 */
sessionLength: ?number;
/* Max value for limit option on queries, defaults to unlimited */
maxLimit: ?number;
/* Sets wether we should expire the inactive sessions, defaults to true */
expireInactiveSessions: ?boolean; // = true
/* When a user changes their password, either through the reset password email or while logged in, all sessions are revoked if this is true. Set to false if you don't want to revoke sessions. */
revokeSessionOnPasswordReset: ?boolean; // = true
/* The TTL for caching the schema for optimizing read/write operations. You should put a long TTL when your DB is in production. default to 5000; set 0 to disable. */
schemaCacheTTL: ?number; // = 5000
/* Sets the TTL for the in memory cache (in ms), defaults to 5000 (5 seconds) */
cacheTTL: ?number; // = 5000
/* Sets the maximum size for the in memory cache, defaults to 10000 */
cacheMaxSize: ?number; // = 10000
/* Use a single schema cache shared across requests. Reduces number of queries made to _SCHEMA, defaults to false, i.e. unique schema cache per request. */
enableSingleSchemaCache: ?boolean; // = false
/* Enables the default express error handler for all errors */
enableExpressErrorHandler: ?boolean; // = false
/* Sets the number of characters in generated object id's, default 10 */
objectIdSize: ?number; // = 10
/* Sets wether we should expire the inactive sessions, defaults to true
:DEFAULT: true */
expireInactiveSessions: ?boolean;
/* When a user changes their password, either through the reset password email or while logged in, all sessions are revoked if this is true. Set to false if you don't want to revoke sessions.
:DEFAULT: true */
revokeSessionOnPasswordReset: ?boolean;
/* The TTL for caching the schema for optimizing read/write operations. You should put a long TTL when your DB is in production. default to 5000; set 0 to disable.
:DEFAULT: 5000 */
schemaCacheTTL: ?number;
/* Sets the TTL for the in memory cache (in ms), defaults to 5000 (5 seconds)
:DEFAULT: 5000 */
cacheTTL: ?number;
/* Sets the maximum size for the in memory cache, defaults to 10000
:DEFAULT: 10000 */
cacheMaxSize: ?number;
/* Use a single schema cache shared across requests. Reduces number of queries made to _SCHEMA, defaults to false, i.e. unique schema cache per request.
:DEFAULT: false */
enableSingleSchemaCache: ?boolean;
/* Enables the default express error handler for all errors
:DEFAULT: false */
enableExpressErrorHandler: ?boolean;
/* Sets the number of characters in generated object id's, default 10
:DEFAULT: 10 */
objectIdSize: ?number;
/* The port to run the ParseServer, defaults to 1337.
:ENV: PORT */
port: ?number; // = 1337
/* The host to serve ParseServer on, defaults to 0.0.0.0 */
host: ?string; // = 0.0.0.0
/* Mount path for the server, defaults to /parse */
mountPath: ?string; // = /parse
:ENV: PORT
:DEFAULT: 1337 */
port: ?number;
/* The host to serve ParseServer on, defaults to 0.0.0.0
:DEFAULT: 0.0.0.0 */
host: ?string;
/* Mount path for the server, defaults to /parse
:DEFAULT: /parse */
mountPath: ?string;
/* Run with cluster, optionally set the number of processes default to os.cpus().length */
cluster: ?NumberOrBoolean;
/* middleware for express server, can be string or function */
Expand Down Expand Up @@ -184,8 +209,9 @@ export interface LiveQueryServerOptions {
cacheTimeout: ?number;
/* This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE, defaults to INFO.*/
logLevel: ?string;
/* The port to run the LiveQuery server, defaults to 1337.*/
port: ?number; // = 1337
/* The port to run the LiveQuery server, defaults to 1337.
:DEFAULT: 1337 */
port: ?number;
/* parse-server's LiveQuery redisURL */
redisURL: ?string;
/* LiveQuery pubsub adapter */
Expand Down