-
-
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.
feat: updated postinstall script in textlint
- Loading branch information
Showing
36 changed files
with
2,845 additions
and
1,883 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
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,52 @@ | ||
#!/usr/bin/env node | ||
|
||
if (process.env.CI) { | ||
process.exit(); | ||
} | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
const { promisify } = require("util"); | ||
|
||
const writeFileAsync = promisify(fs.writeFile); | ||
|
||
// get the path to the host project. | ||
const projectPath = path.resolve(process.cwd(), "..", "..", ".."); | ||
|
||
console.log("Configuring @anolilab/babel-preset", projectPath, "\n"); | ||
|
||
/** | ||
* Writes .babelrc.js if it doesn't exist. Warns if it exists. | ||
*/ | ||
const writeBabelRc = () => { | ||
const eslintPath = path.join(projectPath, ".babelrc.js"); | ||
const content = `module.exports = { | ||
presets: ["@anolilab/babel-preset"] | ||
}; | ||
`; | ||
|
||
if (fs.existsSync(eslintPath)) { | ||
console.warn(`⚠️ .babelrc.js already exists; | ||
Make sure that it includes the following for @anolilab/babel-preset' | ||
to work as it should: { presets: ["@anolilab/babel-preset"] }.`); | ||
|
||
return Promise.resolve(); | ||
} | ||
|
||
return writeFileAsync(eslintPath, content, "utf-8"); | ||
}; | ||
|
||
(async () => { | ||
try { | ||
await writeBabelRc(); | ||
|
||
console.log("😎 Everything went well, have fun!"); | ||
|
||
process.exit(); | ||
} catch (err) { | ||
console.log("😬 something went wrong:"); | ||
console.error(err.message); | ||
|
||
process.exit(1); | ||
} | ||
})(); |
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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
module.exports = [ | ||
'> 1%', | ||
'ie >= 11', | ||
'last 1 Android versions', | ||
'last 1 ChromeAndroid versions', | ||
'last 2 Chrome versions', | ||
'last 2 Firefox versions', | ||
'last 2 Safari versions', | ||
'last 2 iOS versions', | ||
'last 2 Edge versions', | ||
'last 2 Opera versions', | ||
"> 1%", | ||
"last 1 Android versions", | ||
"last 1 ChromeAndroid versions", | ||
"last 2 Chrome versions", | ||
"last 2 Firefox versions", | ||
"last 2 Safari versions", | ||
"last 2 iOS versions", | ||
"last 2 Edge versions", | ||
"last 2 Opera versions", | ||
]; |
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
Oops, something went wrong.