Skip to content

Commit

Permalink
chore: move top level modules into folders (#526)
Browse files Browse the repository at this point in the history
* chore: move top level modules into folders

* Update build/build-schema-validator.js

Co-authored-by: KaKa <climba03003@gmail.com>

* chore: update path to example.js module

Co-authored-by: KaKa <climba03003@gmail.com>
  • Loading branch information
ivan-tymoshenko and climba03003 committed Sep 7, 2022
1 parent 8f4fdfc commit 34844c6
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ const validationCode = standaloneCode(ajv, validate)

const moduleCode = `/* CODE GENERATED BY '${path.basename(__filename)}' DO NOT EDIT! */\n${validationCode}`

fs.writeFileSync(path.join(__dirname, 'schema-validator.js'), moduleCode)
fs.writeFileSync(path.join(__dirname, '../lib/schema-validator.js'), moduleCode)
2 changes: 1 addition & 1 deletion example.js → examples/example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fastJson = require('.')
const fastJson = require('..')
const stringify = fastJson({
title: 'Example Schema',
type: 'object',
Expand Down
2 changes: 1 addition & 1 deletion server.js → examples/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const http = require('http')

const stringify = require('.')({
const stringify = require('fast-json-stringify')({
type: 'object',
properties: {
hello: {
Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const merge = require('@fastify/deepmerge')()
const clone = require('rfdc')({ proto: true })
const { randomUUID } = require('crypto')

const validate = require('./schema-validator')
const Serializer = require('./serializer')
const Validator = require('./validator')
const RefResolver = require('./ref-resolver')
const validate = require('./lib/schema-validator')
const Serializer = require('./lib/serializer')
const Validator = require('./lib/validator')
const RefResolver = require('./lib/ref-resolver')

let largeArraySize = 2e4
let largeArrayMechanism = 'default'
Expand Down Expand Up @@ -151,7 +151,7 @@ function build (schema, options) {

if (options.mode === 'standalone') {
// lazy load
const buildStandaloneCode = require('./standalone')
const buildStandaloneCode = require('./lib/standalone')
return buildStandaloneCode(options, validator, contextFunctionCode)
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"schema-validator.js"
]
},
"runkitExampleFilename": "example.js"
"runkitExampleFilename": "./examples/example.js"
}
2 changes: 1 addition & 1 deletion test/debug-mode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const test = require('tap').test
const fjs = require('..')

const Ajv = require('ajv').default
const Validator = require('../validator')
const Validator = require('../lib/validator')

function build (opts) {
return fjs({
Expand Down

0 comments on commit 34844c6

Please sign in to comment.