-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
a65014f
commit c0c6ee8
Showing
17 changed files
with
187 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
|
||
const DEFAULT_CACHE_LOCATION = './.stylelintcache'; | ||
const CACHE_STRATEGY_METADATA = 'metadata'; | ||
const CACHE_STRATEGY_CONTENT = 'content'; | ||
const DEFAULT_CACHE_STRATEGY = CACHE_STRATEGY_METADATA; | ||
|
||
const DEFAULT_IGNORE_FILENAME = '.stylelintignore'; | ||
|
||
const DEFAULT_FORMATTER = 'string'; | ||
|
||
const EXIT_CODE_ERROR = 2; | ||
|
||
exports.CACHE_STRATEGY_CONTENT = CACHE_STRATEGY_CONTENT; | ||
exports.CACHE_STRATEGY_METADATA = CACHE_STRATEGY_METADATA; | ||
exports.DEFAULT_CACHE_LOCATION = DEFAULT_CACHE_LOCATION; | ||
exports.DEFAULT_CACHE_STRATEGY = DEFAULT_CACHE_STRATEGY; | ||
exports.DEFAULT_FORMATTER = DEFAULT_FORMATTER; | ||
exports.DEFAULT_IGNORE_FILENAME = DEFAULT_IGNORE_FILENAME; | ||
exports.EXIT_CODE_ERROR = EXIT_CODE_ERROR; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const DEFAULT_CACHE_LOCATION = './.stylelintcache'; | ||
export const CACHE_STRATEGY_METADATA = 'metadata'; | ||
export const CACHE_STRATEGY_CONTENT = 'content'; | ||
export const DEFAULT_CACHE_STRATEGY = CACHE_STRATEGY_METADATA; | ||
|
||
export const DEFAULT_IGNORE_FILENAME = '.stylelintignore'; | ||
|
||
export const DEFAULT_FORMATTER = 'string'; | ||
|
||
export const EXIT_CODE_ERROR = 2; |
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,24 @@ | ||
'use strict'; | ||
|
||
const node_path = require('node:path'); | ||
const promises = require('node:fs/promises'); | ||
const stripAnsi = require('strip-ansi'); | ||
const writeFileAtomic = require('write-file-atomic'); | ||
|
||
const _interopDefault = e => e && e.__esModule ? e : { default: e }; | ||
|
||
const stripAnsi__default = /*#__PURE__*/_interopDefault(stripAnsi); | ||
const writeFileAtomic__default = /*#__PURE__*/_interopDefault(writeFileAtomic); | ||
|
||
/** | ||
* @param {string} content | ||
* @param {string} filePath | ||
* @returns {Promise<void>} | ||
*/ | ||
async function writeOutputFile(content, filePath) { | ||
await promises.mkdir(node_path.dirname(filePath), { recursive: true }); | ||
|
||
await writeFileAtomic__default.default(node_path.normalize(filePath), stripAnsi__default.default(content)); | ||
} | ||
|
||
module.exports = writeOutputFile; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { dirname, normalize } from 'node:path'; | ||
import { mkdir } from 'node:fs/promises'; | ||
import stripAnsi from 'strip-ansi'; | ||
import writeFileAtomic from 'write-file-atomic'; | ||
|
||
/** | ||
* @param {string} content | ||
* @param {string} filePath | ||
* @returns {Promise<void>} | ||
*/ | ||
export default async function writeOutputFile(content, filePath) { | ||
await mkdir(dirname(filePath), { recursive: true }); | ||
|
||
await writeFileAtomic(normalize(filePath), stripAnsi(content)); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { rmSync } from 'node:fs'; | ||
|
||
import fg from 'fast-glob'; | ||
|
||
const inputFiles = fg.globSync([ | ||
'lib/**/*.mjs', | ||
'!**/__tests__/**', | ||
'!lib/testUtils/**', | ||
|
||
// NOTE: We cannot support CJS for `cli.mjs` since the `meow` dependency is pure ESM. | ||
'!lib/cli.mjs', | ||
]); | ||
|
||
// clean up | ||
for (const input of inputFiles) { | ||
rmSync(input.replace('.mjs', '.cjs'), { force: true }); | ||
} | ||
|
||
export default inputFiles.map((input) => { | ||
return { | ||
input, | ||
output: { | ||
format: 'cjs', | ||
file: input.replace('.mjs', '.cjs'), | ||
generatedCode: 'es2015', | ||
interop: 'auto', | ||
}, | ||
}; | ||
}); |
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,26 @@ | ||
import { exit, stderr, stdout } from 'node:process'; | ||
import { EOL } from 'node:os'; | ||
import { execSync } from 'node:child_process'; | ||
|
||
function main() { | ||
try { | ||
execSync('git diff --exit-code --name-only -- lib', { encoding: 'utf8' }); | ||
} catch (error) { | ||
if (error.stdout) { | ||
stdout.write(`You must commit the following files:${EOL}`); | ||
stdout.write(error.stdout); | ||
} | ||
|
||
if (error.stderr) { | ||
stderr.write(error.stderr); | ||
} | ||
|
||
if (typeof error.status === 'number') { | ||
exit(error.status); | ||
} else { | ||
throw error; | ||
} | ||
} | ||
} | ||
|
||
main(); |
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