Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable no-console */
/**
* @fileoverview Defines and exports the {@link Config} class.
*/
const assert = require('assert');
const path = require('path');
const fs = require('fs');
const yaml = require('yaml').default;
const Map = require('yaml/map').default;
const Pair = require('yaml/pair').default;
const Scalar = require('yaml/scalar').default;
const Seq = require('yaml/seq').default;
const { AntError, logger } = require('@back4app/ant-util');
const BinFunction = require('../functions/BinFunction');
const Runtime = require('../functions/runtimes/Runtime');
const LibFunction = require('../functions/LibFunction');
const Template = require('../templates/Template');
const Host = require('../hosts/Host');
const BasepathResolver = require('./handler/BasepathResolver');
const VariablesResolver = require('./handler/VariablesResolver');
const FunctionsPathResolver = require('./handler/FunctionsPathResolver');
const RuntimesPathResolver = require('./handler/RuntimesPathResolver');
const TemplatesPathResolver = require('./handler/TemplatesPathResolver');
const PluginsPathResolver = require('./handler/PluginsPathResolver');
/* eslint-disable no-console */
/**
* @fileoverview Tests for lib/config/Config.js file.
*/
const { AssertionError } = require('assert');
const process = require('process');
const fs = require('fs');
const path = require('path');
const fsExtra = require('fs-extra');
const yaml = require('yaml').default;
const Map = require('yaml/map').default;
const Pair = require('yaml/pair').default;
const Scalar = require('yaml/scalar').default;
const Seq = require('yaml/seq').default;
const { AntError } = require('@back4app/ant-util');
const {
Config,
Ant,
BinFunction,
Runtime,
LibFunction
} = require('../../../');
const utilPath = path.resolve(
__dirname,
'../../../node_modules/@back4app/ant-util-tests'
/* eslint-disable no-console */
/**
* @fileoverview Tests for lib/Core.js file.
*/
const path = require('path');
const fs = require('fs-extra');
const yaml = require('yaml').default;
const { makeExecutableSchema } = require('graphql-tools');
const { yargsHelper } = require('@back4app/ant-util-yargs');
const {
Config,
Ant,
AntFunction,
BinFunction,
Runtime,
LibFunction,
Provider,
Host,
Template,
Plugin
} = require('@back4app/ant');
const { AntCli } = require('@back4app/ant-cli');
const Core = require('../../lib/Core');
#!/usr/bin/env node
const { createReadStream, createWriteStream, promises } = require('fs')
const { readdir, readFile, writeFile } = promises
const { join, basename, dirname } = require('path')
const frontmatter = require('front-matter')
const mkdirp = require('mkdirp-promise')
const YAML = require('yaml').default
// get all md files in src
const getPosts = async (src) => {
const all = await readdir(src)
const md = all
.filter((name) => name.match(/\.md$/))
.map((name) => join(src, name) )
return md
}
const expandWithContent = async (posts) => {
const expandedPosts = await Promise.all(
posts.map(
(path) => new Promise((resolve, reject) => {
readFile(path, 'utf8')
.then((content) => resolve({ path, ...frontmatter(content) }))
/**
* @fileoverview Tests for lib/Ant.js file.
*/
const fs = require('fs');
const yaml = require('yaml').default;
const Core = require('@back4app/ant-core');
const GraphQL = require('@back4app/ant-graphql');
const Serverless = require('@back4app/ant-serverless');
const Ant = require('../../lib/Ant');
const Runtime = require('../../lib/functions/runtimes/Runtime');
const RuntimeController = require(
'../../lib/functions/runtimes/RuntimeController'
);
const FunctionController = require('../../lib/functions/FunctionController');
const TemplateController = require('../../lib/templates/TemplateController');
const Plugin = require('../../lib/plugins/Plugin');
const PluginController = require('../../lib/plugins/PluginController');
describe('lib/Ant.js', () => {
test('should export "Ant" class', () => {
const ant = new Ant();
const { parse } = require('yaml').default
const { readFileSync } = require('fs')
const { resolve } = require('path')
module.exports = parse(
readFileSync(resolve(__dirname, '../integrations.yml'), 'utf-8')
)
.map(({ name, ios = {}, android = {} }) => {
if (ios.disabled && android.disabled) {
return null
}
const slug = (sep = '') => name.replace(/-|_| /g, sep)
const suffix = ios.disabled ? '-android' : android.disabled ? '-ios' : ''
return {
name,
#! /usr/bin/env node
'use strict'
const pkg = require('./package.json')
const path = require('path')
const fs = require('fs-extra')
const themekit = require('@slater/themekit')
const queue = require('function-rate-limit')
const c = require('ansi-colors')
const bili = require('bili')
const postcss = require('rollup-plugin-postcss')
const chokidar = require('chokidar')
const mm = require('micromatch')
const yaml = require('yaml').default
const onExit = require('exit-hook')
const exit = require('exit')
const spaghetti = require('@friendsof/spaghetti')
const { socket, closeServer } = require('./lib/socket.js')
const bundler = require('./lib/bundler.js')
const { log, join, resolve } = require('./lib/util.js')
log(c.gray(`v${pkg.version}`))
const {
_: args,
config: configFile = 'slater.config.js',
env = 'development',
debug,
...props
} = require('minimist')(process.argv.slice(2))