-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
1 parent
3562208
commit 9a6cd31
Showing
23 changed files
with
185 additions
and
50 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
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,8 @@ | ||
'use strict'; | ||
|
||
require('../css/main.css'); | ||
require('../css/nojs.css'); | ||
require('../css/columns/name-size-date.css'); | ||
require('../css/columns/name-size.css'); | ||
require('../css/themes/light.css'); | ||
require('../css/themes/dark.css'); |
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 was deleted.
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
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,33 @@ | ||
import path, {dirname} from 'node:path'; | ||
import {fileURLToPath} from 'node:url'; | ||
import process from 'node:process'; | ||
import fs from 'node:fs'; | ||
import fullstore from 'fullstore'; | ||
import nanomemoizeDefault from 'nano-memoize'; | ||
import readFilesSync from '@cloudcmd/read-files-sync'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
const isMap = (a) => /\.map$/.test(a); | ||
const not = (fn) => (a) => !fn(a); | ||
|
||
const _isDev = fullstore(process.env.NODE_ENV === 'development'); | ||
const getDist = (isDev) => isDev ? 'dist-dev' : 'dist'; | ||
|
||
export const isDev = _isDev; | ||
|
||
export const getThemes = ({isDev = _isDev()} = {}) => { | ||
return readFilesSyncMemo(isDev); | ||
}; | ||
|
||
const {nanomemoize} = nanomemoizeDefault; | ||
|
||
const readFilesSyncMemo = nanomemoize((isDev) => { | ||
const dist = getDist(isDev); | ||
const themesDir = path.join(__dirname, '..', dist, 'themes'); | ||
const names = fs | ||
.readdirSync(themesDir) | ||
.filter(not(isMap)); | ||
|
||
return readFilesSync(themesDir, names, 'utf8'); | ||
}); |
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,31 @@ | ||
import {dirname} from 'node:path'; | ||
import {fileURLToPath} from 'node:url'; | ||
import test from 'supertape'; | ||
import fs from 'node:fs'; | ||
import {getThemes, isDev} from './theme.mjs'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
|
||
test('themes: dev', (t) => { | ||
const themes = getThemes({ | ||
isDev: true, | ||
}); | ||
|
||
const css = fs.readFileSync(`${__dirname}/../css/themes/dark.css`, 'utf8'); | ||
|
||
t.equal(themes['dark'], css); | ||
t.end(); | ||
}); | ||
|
||
test('themes: no args', (t) => { | ||
const currentIsDev = isDev(); | ||
isDev(true); | ||
const themes = getThemes(); | ||
|
||
const css = fs.readFileSync(`${__dirname}/../css/themes/light.css`, 'utf8'); | ||
isDev(currentIsDev); | ||
|
||
t.equal(themes.light, css); | ||
t.end(); | ||
}); |
Oops, something went wrong.