Skip to content

Commit

Permalink
build: install react
Browse files Browse the repository at this point in the history
  • Loading branch information
SandroMiguel committed Jan 18, 2023
1 parent 22614ed commit e19041c
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 42 deletions.
18 changes: 18 additions & 0 deletions bin/cecilia.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { spawnSync } from 'node:child_process'

const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)

spawnSync(
`node ${dirname}/setup-dependencies.mjs && node ${dirname}/setup-eslintrc.mjs && node ${dirname}/setup-lint.mjs`,
[],
{
stdio: 'inherit',
shell: true,
},
)
console.log('Setup complete!')
19 changes: 0 additions & 19 deletions bin/postinstall-dependencies.mjs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

import readline from 'node:readline'
import { exec } from 'node:child_process'

Expand All @@ -7,7 +9,7 @@ const readLineInterface = readline.createInterface({
})

readLineInterface.question(
'Install with npm (1) or yarn (2) ? (1/2) ',
'Install dependencies with npm (1) or yarn (2) ? (1/2) ',
(userInput) => {
let install
if (userInput.toLowerCase() === '1') {
Expand Down
20 changes: 13 additions & 7 deletions bin/postinstall-eslintrc.mjs → bin/setup-eslintrc.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

import readline from 'node:readline'
import fs from 'node:fs'

Expand All @@ -11,13 +13,17 @@ readLineInterface.question(
(userInput) => {
readLineInterface.close()
if (userInput.toLowerCase() === 'y') {
fs.writeFile('.eslintrc.js', '{"extends": "cecilia"}', (error) => {
if (error) {
console.log(error)
return
}
console.log('The file was created!')
})
fs.writeFile(
'.eslintrc.js',
'module.exports = { extends: "cecilia" }',
(error) => {
if (error) {
console.log(error)
return
}
console.log('The file .eslintrc.js was created!')
},
)
}
},
)
4 changes: 3 additions & 1 deletion bin/postinstall-lint.mjs → bin/setup-lint.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

import readline from 'node:readline'
import { exec } from 'node:child_process'

Expand All @@ -15,7 +17,7 @@ readLineInterface.question(
console.log('Now you can use "npm run lint" to lint your files.')
} else {
console.log(
'You can manually add this command in your package.json scripts: "lint": "eslint ."',
'You can manually add the following command in your package.json scripts: "lint": "eslint ."',
)
}
},
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"name": "eslint-config-cecilia",
"version": "2.8.3",
"description": "ESLint configuration for awesome projects",
"main": "index.js",
"bin": {
"cecilia": "./bin/cecilia.mjs"
},
"scripts": {
"lint": "eslint .",
"test": "jest",
"postinstall:dependencies": "node bin/postinstall-dependencies.mjs",
"postinstall:eslintrc": "node bin/postinstall-eslintrc.mjs",
"postinstall:lint": "node bin/postinstall-lint.mjs",
"prepare": "husky install && npm run postinstall:dependencies && npm run postinstall:eslintrc && npm run postinstall:lint"
"prepare": "husky install"
},
"files": [
".eslintrc.js",
Expand Down Expand Up @@ -48,7 +47,7 @@
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^39.6.4",
"eslint-plugin-jsdoc": "^39.6.6",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.1",
Expand Down
18 changes: 10 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,7 @@ __metadata:
eslint-config-airbnb: ^19.0.4
eslint-config-prettier: ^8.6.0
eslint-plugin-import: ^2.27.5
eslint-plugin-jsdoc: ^39.6.4
eslint-plugin-jsdoc: ^39.6.6
eslint-plugin-jsx-a11y: ^6.7.1
eslint-plugin-prettier: ^4.2.1
eslint-plugin-react: ^7.32.1
Expand All @@ -2588,6 +2588,8 @@ __metadata:
jest: ^29.3.1
prettier: ^2.8.3
react: ^18.2.0
bin:
cecilia: ./bin/cecilia.mjs
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -2650,9 +2652,9 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-jsdoc@npm:^39.6.4":
version: 39.6.4
resolution: "eslint-plugin-jsdoc@npm:39.6.4"
"eslint-plugin-jsdoc@npm:^39.6.6":
version: 39.6.6
resolution: "eslint-plugin-jsdoc@npm:39.6.6"
dependencies:
"@es-joy/jsdoccomment": ~0.36.1
comment-parser: 1.3.1
Expand All @@ -2663,7 +2665,7 @@ __metadata:
spdx-expression-parse: ^3.0.1
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
checksum: 2976112ae997b9f246eba98d849359a0df46ea07c0a9d6d90c3b76a29c253b9e92d1d46d6cf86f878e442653b97591e5ea01d05a6accdb078339c39e8767723e
checksum: 517ad77506604fdfc0d8c708b7db29e7146027827cb4d67da9d2f216c9b9f812e714da7150289bb0ad0800aa09a8cdf6b4968101a6615f462a19288738d6df67
languageName: node
linkType: hard

Expand Down Expand Up @@ -4984,11 +4986,11 @@ __metadata:
linkType: hard

"minimatch@npm:^5.0.1":
version: 5.1.5
resolution: "minimatch@npm:5.1.5"
version: 5.1.6
resolution: "minimatch@npm:5.1.6"
dependencies:
brace-expansion: ^2.0.1
checksum: 2eca85c49d69b572c1cc7036a870fab781961bee5654dd8ae65f1c51e51458b83f89c53ae5a5c76beca34b8c646e2351ac74957b0f8691df21045d7e1f42947d
checksum: 7564208ef81d7065a370f788d337cd80a689e981042cb9a1d0e6580b6c6a8c9279eba80010516e258835a988363f99f54a6f711a315089b8b42694f5da9d0d77
languageName: node
linkType: hard

Expand Down

0 comments on commit e19041c

Please sign in to comment.