Skip to content

Commit

Permalink
feat(CV-0-1): restored uuid and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jonathan committed Dec 4, 2023
1 parent 06b83ee commit 589bdb7
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 109 deletions.
66 changes: 33 additions & 33 deletions __tests__/guard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,29 @@ describe('Guard', () => {
version: 1,
}

expect(guardIterator(a, 'name')).toBeTruthy()
expect(guardIterator(a, 'age')).toBeTruthy()
expect(guardIterator(a, 'name', 'age')).toBeTruthy()
expect(guardIterator(a, 'age', 'name')).toBeTruthy()

expect(guardIterator(b, 'name')).toBeTruthy()
expect(guardIterator(b, 'version')).toBeTruthy()
expect(guardIterator(b, 'name', 'version')).toBeTruthy()
expect(guardIterator(b, 'version', 'name')).toBeTruthy()

expect(guardIterator(c, 'name')).toBeTruthy()
expect(guardIterator(c, 'age')).toBeTruthy()
expect(guardIterator(c, 'name', 'age')).toBeTruthy()
expect(guardIterator(c, 'age', 'name')).toBeTruthy()
expect(guardIterator(c, 'name')).toBeTruthy()
expect(guardIterator(c, 'version')).toBeTruthy()
expect(guardIterator(c, 'name', 'version')).toBeTruthy()
expect(guardIterator(c, 'version', 'name')).toBeTruthy()
expect(guardIterator(c, 'age', 'name')).toBeTruthy()
expect(guardIterator(c, 'name')).toBeTruthy()
expect(guardIterator(c, 'version')).toBeTruthy()
expect(guardIterator(c, 'name', 'version')).toBeTruthy()
expect(guardIterator(c, 'version', 'name')).toBeTruthy()
expect(guardIterator([ a ], 'name')).toBeTruthy()
expect(guardIterator([ a ], 'age')).toBeTruthy()
expect(guardIterator([ a ], 'name', 'age')).toBeTruthy()
expect(guardIterator([ a ], 'age', 'name')).toBeTruthy()

expect(guardIterator([ b ], 'name')).toBeTruthy()
expect(guardIterator([ b ], 'version')).toBeTruthy()
expect(guardIterator([ b ], 'name', 'version')).toBeTruthy()
expect(guardIterator([ b ], 'version', 'name')).toBeTruthy()

expect(guardIterator([ c ], 'name')).toBeTruthy()
expect(guardIterator([ c ], 'age')).toBeTruthy()
expect(guardIterator([ c ], 'name', 'age')).toBeTruthy()
expect(guardIterator([ c ], 'age', 'name')).toBeTruthy()
expect(guardIterator([ c ], 'name')).toBeTruthy()
expect(guardIterator([ c ], 'version')).toBeTruthy()
expect(guardIterator([ c ], 'name', 'version')).toBeTruthy()
expect(guardIterator([ c ], 'version', 'name')).toBeTruthy()
expect(guardIterator([ c ], 'age', 'name')).toBeTruthy()
expect(guardIterator([ c ], 'name')).toBeTruthy()
expect(guardIterator([ c ], 'version')).toBeTruthy()
expect(guardIterator([ c ], 'name', 'version')).toBeTruthy()
expect(guardIterator([ c ], 'version', 'name')).toBeTruthy()

const name = 'name'
const age = 38
Expand All @@ -173,16 +173,16 @@ describe('Guard', () => {
const tuple = [ null, 'hello world' ] as const
const tupleEmpty = [] as const

expect(guardIterator(name)).toBeTruthy()
expect(guardIterator(age)).toBeTruthy()
expect(guardIterator(version)).toBeTruthy()
expect(guardIterator(neg)).toBeTruthy()
expect(guardIterator(isTrue)).toBeTruthy()
expect(guardIterator(isFalse)).toBeTruthy()
expect(guardIterator(tricky1)).toBeTruthy()
expect(guardIterator(tricky2)).toBeFalsy()
expect(guardIterator(tricky3)).toBeFalsy()
expect(guardIterator([ name ])).toBeTruthy()
expect(guardIterator(age)).toBeFalsy()
expect(guardIterator([ version ])).toBeTruthy()
expect(guardIterator([ neg ])).toBeTruthy()
expect(guardIterator([ isTrue ])).toBeTruthy()
expect(guardIterator([ isFalse ])).toBeTruthy()
expect(guardIterator([ tricky1 ])).toBeTruthy()
expect(guardIterator([ tricky2 ])).toBeFalsy()
expect(guardIterator([ tricky3 ])).toBeFalsy()
expect(guardIterator(tuple)).toBeFalsy()
expect(guardIterator(tupleEmpty)).toBeTruthy()
expect(guardIterator([ tupleEmpty ])).toBeTruthy()
})
})
88 changes: 49 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cosmicmind/foundationjs",
"version": "0.0.1-rc-092723-1",
"version": "0.0.1-rc-120323-1",
"description": "A library of helpful tools for developing projects in TypeScript.",
"keywords": [],
"author": {
Expand Down Expand Up @@ -58,6 +58,7 @@
"eslint": "^8.49.0",
"eslint-plugin-yml": "^1.9.0",
"npm-run-all": "^4.1.5",
"terser": "^5.24.0",
"ts-node": "^10.9.1",
"tslib": "^2.6.2",
"typescript": "^4.9.5",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ export * from '@/logger'
export * from '@/assert'
export * from '@/guard'
export * from '@/error'
export * from '@/uuid'
export * from '@/type-defs'
export * from '@/tools'
export * from '@/uuid'
73 changes: 38 additions & 35 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/* eslint-disable camelcase */

import {
URL,
fileURLToPath,
Expand All @@ -38,49 +40,50 @@ import {
import {
PluginOption,
LibraryFormats,
ConfigEnv,
defineConfig,
UserConfigExport,
} from 'vite'

import dts from 'vite-plugin-dts'

const name = process.env.npm_package_name
const srcDir = 'src'
const entry = `${srcDir}/index.ts`
const fileName = 'lib-[format]'
const formats: LibraryFormats[] = [ 'es', 'cjs' ]
const emptyOutDir = false
const minify = false

const alias = {
'@': fileURLToPath(new URL(srcDir, import.meta.url)),
}
export default ({ mode }: ConfigEnv): UserConfigExport => {
const name = process.env.npm_package_name
const srcDir = 'src'
const entry = `${srcDir}/index.ts`
const fileName = 'lib-[format]'
const formats: LibraryFormats[] = [ 'es', 'cjs' ]
const emptyOutDir = true
const minify = 'development' !== mode ? 'terser' : false

const external = [
'lib0/random.js'
]
const alias = {
'@': fileURLToPath(new URL(srcDir, import.meta.url)),
}

const plugins = [
dts()
] as PluginOption[]
const plugins = [
dts()
] as PluginOption[]

export default defineConfig({
resolve: {
alias,
},
plugins,
build: {
minify,
emptyOutDir,
lib: {
name,
entry,
formats,
fileName,
return defineConfig({
resolve: {
alias,
},
rollupOptions: {
external,
output: {
plugins,
build: {
minify,
terserOptions: {
mangle: true,
compress: true,
keep_fnames: false,
keep_classnames: true,
},
emptyOutDir,
lib: {
name,
entry,
formats,
fileName,
},
},
},
})
})
}

0 comments on commit 589bdb7

Please sign in to comment.