-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: Solid JS Scaffolding Support (#249)
- Loading branch information
Showing
16 changed files
with
112 additions
and
29 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Framework } from '../types'; | ||
import { resolveCssLocation } from './steps/solid'; | ||
|
||
const Solid: Framework = { | ||
requiredDependencies: ['tailwindcss', 'postcss', 'autoprefixer'], | ||
initCommands: ['npx tailwindcss init -p'], | ||
cssLocation: resolveCssLocation, | ||
content: ['./src/**/*.{js,jsx,ts,tsx}'], | ||
steps: [], | ||
}; | ||
|
||
export default Solid; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import glob from 'glob'; | ||
import util from 'util'; | ||
|
||
export async function resolveCssLocation() { | ||
const [match] = await util.promisify(glob)('./src/**/root.css', { | ||
ignore: ['node_modules'], | ||
}); | ||
|
||
if (!match) { | ||
return './src/index.css'; | ||
} | ||
|
||
return match; | ||
} |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import glob from 'glob'; | ||
import { resolveCssLocation } from '../../src/frameworks/steps/solid'; | ||
|
||
vi.mock('glob'); | ||
|
||
describe('Solid JS CSS', () => { | ||
afterEach(() => { | ||
vi.clearAllMocks(); | ||
}); | ||
|
||
afterAll(() => { | ||
vi.resetAllMocks(); | ||
}); | ||
|
||
it('can resolve css location', async () => { | ||
vi.mocked(glob) | ||
.mockImplementationOnce((_, __, cb) => { | ||
console.log(typeof cb, cb); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return cb(null, ['foo']) as any; | ||
}) | ||
.mockImplementationOnce((_, __, cb) => { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return cb(null, []) as any; | ||
}); | ||
const first = await resolveCssLocation(); | ||
const second = await resolveCssLocation(); | ||
|
||
expect(first).toStrictEqual('foo'); | ||
expect(second).toStrictEqual('./src/index.css'); | ||
}); | ||
}); |