-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
5cf1365
commit 2c02104
Showing
5 changed files
with
36 additions
and
21 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,8 +1,16 @@ | ||
#!/usr/bin/env node | ||
/* eslint-disable no-var, no-eval */ | ||
|
||
if (process.version.match(/v(\d+)\./)[1] < 4) { | ||
console.error('standardx: Node v4 or greater is required. `standardx` did not run.') | ||
var match = process.version.match(/v(\d+)\.(\d+)/) | ||
var major = parseInt(match[1], 10) | ||
var minor = parseInt(match[2], 10) | ||
|
||
if (major >= 12 || (major === 12 && minor >= 20)) { | ||
eval('import("standard-engine")').then(function (standardEngine) { | ||
eval('import("../options.js")').then(function (options) { | ||
standardEngine.cli(options.default) | ||
}) | ||
}) | ||
} else { | ||
const opts = require('../options') | ||
require('standard-engine').cli(opts) | ||
console.error('standardx: Node 12.20.0 or greater is required. `standardx` did not run.') | ||
} |
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,5 +1,7 @@ | ||
/*! standardx. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
const Linter = require('standard-engine').linter | ||
const opts = require('./options') | ||
import standardEngine from 'standard-engine' | ||
import opts from './options.js' | ||
|
||
module.exports = new Linter(opts) | ||
const Linter = standardEngine.linter | ||
|
||
export default new Linter(opts) |
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,17 +1,18 @@ | ||
const pkg = require('./package.json') | ||
const stdVersion = require('standard/package.json').version | ||
const stdOpts = require('standard/options.js') | ||
import { readFileSync } from 'node:fs' | ||
import stdOpts from 'standard/options.js' | ||
|
||
const opts = Object.assign({}, stdOpts, { | ||
const stdVersion = stdOpts.version | ||
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf-8')) | ||
const baseConfig = JSON.parse(readFileSync(stdOpts.eslintConfig.configFile, 'utf-8')) | ||
|
||
export default Object.assign({}, stdOpts, { | ||
bugs: pkg.bugs.url, | ||
cmd: 'standardx', | ||
eslintConfig: { | ||
baseConfig: require('standard/eslintrc.json'), | ||
baseConfig, | ||
useEslintrc: true | ||
}, | ||
homepage: pkg.homepage, | ||
tagline: 'Use JavaScript Standard Style (tweaked by standardx)', | ||
version: `${pkg.version} (standard ${stdVersion})` | ||
}) | ||
|
||
module.exports = opts |
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