-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
6,737 additions
and
8,850 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
{ | ||
"semi": false, | ||
"trailingComma": "all", | ||
"arrowParens": "always", | ||
"singleQuote": true, | ||
"printWidth": 70, | ||
"endOfLine": "auto", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": true, | ||
"tabWidth": 4, | ||
"importOrder": [ | ||
"^@core/(.*)$", | ||
"^@server/(.*)$", | ||
"^@ui/(.*)$", | ||
"^[./]" | ||
], | ||
"importOrder": ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"], | ||
"importOrderSeparation": true, | ||
"importOrderSortSpecifiers": true, | ||
"importOrderSideEffects": true, | ||
"importOrderCaseInsensitive": true, | ||
"plugins": ["@trivago/prettier-plugin-sort-imports"] | ||
"plugins": ["@trivago/prettier-plugin-sort-imports"], | ||
"printWidth": 80, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"bracketSpacing": false, | ||
"arrowParens": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ | |
"files.associations": { | ||
"*.css": "tailwindcss", | ||
"*.scss": "tailwindcss" | ||
} | ||
}, | ||
"prettier.bracketSpacing": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,96 @@ | ||
import { exec } from 'child_process' | ||
import fs from 'fs' | ||
import readline from 'readline' | ||
import { describe, expect, it, vi } from 'vitest' | ||
import {exec} from 'child_process'; | ||
import fs from 'fs'; | ||
import readline from 'readline'; | ||
import {describe, expect, it, vi} from 'vitest'; | ||
|
||
import { | ||
createPostCSSConfig, | ||
createTailwindConfig, | ||
initialize, | ||
installPackage, | ||
} from './init-tailwind.js' | ||
} from './init-tailwind.js'; | ||
|
||
vi.mock('fs') | ||
vi.mock('child_process') | ||
vi.mock('readline') | ||
vi.mock('fs'); | ||
vi.mock('child_process'); | ||
vi.mock('readline'); | ||
|
||
describe('init-tailwind.js', () => { | ||
describe('installPackage', () => { | ||
it('should install package successfully', async () => { | ||
exec.mockImplementation((cmd, callback) => callback(null)) | ||
await expect( | ||
installPackage('nt-stylesheet'), | ||
).toStrictEqual(Promise.resolve()) | ||
exec.mockImplementation((cmd, callback) => callback(null)); | ||
await expect(installPackage('nt-stylesheet')).toStrictEqual( | ||
Promise.resolve() | ||
); | ||
expect(exec).toHaveBeenCalledWith( | ||
'npm install nt-stylesheet', | ||
expect.any(Function), | ||
) | ||
}) | ||
expect.any(Function) | ||
); | ||
}); | ||
|
||
it('should fail to install package', async () => { | ||
const error = new Error('Installation failed') | ||
exec.mockImplementation((cmd, callback) => | ||
callback(error), | ||
) | ||
await expect( | ||
installPackage('nt-stylesheet'), | ||
).rejects.toThrow('Installation failed') | ||
}) | ||
}) | ||
const error = new Error('Installation failed'); | ||
exec.mockImplementation((cmd, callback) => callback(error)); | ||
await expect(installPackage('nt-stylesheet')).rejects.toThrow( | ||
'Installation failed' | ||
); | ||
}); | ||
}); | ||
|
||
describe('createTailwindConfig', () => { | ||
it('should create tailwind.config.js file', () => { | ||
fs.writeFile.mockImplementation( | ||
(path, content, callback) => callback(null), | ||
) | ||
createTailwindConfig() | ||
fs.writeFile.mockImplementation((path, content, callback) => | ||
callback(null) | ||
); | ||
createTailwindConfig(); | ||
expect(fs.writeFile).toHaveBeenCalledWith( | ||
'tailwind.config.js', | ||
expect.stringContaining('module.exports = {'), | ||
expect.any(Function), | ||
) | ||
}) | ||
}) | ||
expect.any(Function) | ||
); | ||
}); | ||
}); | ||
|
||
describe('createPostCSSConfig', () => { | ||
it('should create postcss.config.js file', () => { | ||
fs.writeFile.mockImplementation( | ||
(path, content, callback) => callback(null), | ||
) | ||
createPostCSSConfig() | ||
fs.writeFile.mockImplementation((path, content, callback) => | ||
callback(null) | ||
); | ||
createPostCSSConfig(); | ||
expect(fs.writeFile).toHaveBeenCalledWith( | ||
'postcss.config.js', | ||
expect.stringContaining('module.exports = {'), | ||
expect.any(Function), | ||
) | ||
}) | ||
}) | ||
expect.any(Function) | ||
); | ||
}); | ||
}); | ||
|
||
describe('initialize', () => { | ||
it('should initialize successfully', async () => { | ||
exec.mockImplementation((cmd, callback) => callback(null)) | ||
exec.mockImplementation((cmd, callback) => callback(null)); | ||
readline.createInterface.mockReturnValue({ | ||
question: (query, callback) => callback('y'), | ||
close: vi.fn(), | ||
}) | ||
fs.writeFile.mockImplementation( | ||
(path, content, callback) => callback(null), | ||
) | ||
}); | ||
fs.writeFile.mockImplementation((path, content, callback) => | ||
callback(null) | ||
); | ||
|
||
await initialize() | ||
await initialize(); | ||
|
||
expect(exec).toHaveBeenCalledWith( | ||
'npm install nt-stylesheet', | ||
expect.any(Function), | ||
) | ||
expect.any(Function) | ||
); | ||
expect(fs.writeFile).toHaveBeenCalledWith( | ||
'tailwind.config.js', | ||
expect.stringContaining('module.exports = {'), | ||
expect.any(Function), | ||
) | ||
expect.any(Function) | ||
); | ||
expect(fs.writeFile).toHaveBeenCalledWith( | ||
'postcss.config.js', | ||
expect.stringContaining('module.exports = {'), | ||
expect.any(Function), | ||
) | ||
}) | ||
}) | ||
}) | ||
expect.any(Function) | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import './styles/styles.scss' | ||
import ntTheme from './themes' | ||
import './styles/styles.scss'; | ||
import ntTheme from './themes'; | ||
|
||
export default ntTheme | ||
export default ntTheme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ module.exports = { | |
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
const ntTheme = require('./themes').default | ||
const ntTheme = require('./themes').default; | ||
|
||
module.exports = { | ||
content: [ | ||
'./styles/**/*.scss', | ||
'./themes/**/*.ts', | ||
'./index.html', | ||
], | ||
content: ['./styles/**/*.scss', './themes/**/*.ts', './index.html'], | ||
theme: { | ||
extend: ntTheme.extend, | ||
}, | ||
plugins: [], | ||
} | ||
}; |
Oops, something went wrong.