Skip to content

Commit

Permalink
chore: move file
Browse files Browse the repository at this point in the history
1. move script to public and convert to mjs
2. move eslintrc to public/eslintrc folder
  • Loading branch information
DavidKk committed Feb 8, 2024
1 parent f1578f4 commit 63e7b81
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
8 changes: 6 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ module.exports = {
overrides: [
{
files: ['**/*.ts'],
extends: ['.eslintrc.typescript.js'],
extends: ['./public/eslintrc/ts.js'],
},
{
files: ['**/*.js'],
extends: ['.eslintrc.javascript.js'],
extends: ['./public/eslintrc/cjs.js'],
},
{
files: ['**/*.mjs'],
extends: ['./public/eslintrc/esm.js'],
},
],
}
2 changes: 2 additions & 0 deletions @lib/util-lib/__tests__/polify/esm.mjs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/* eslint-disable */

export const abc = 123
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"ci:pages": "shx rm -rf ./gh-pages && mkdir -p ./gh-pages && shx cp -rf ./coverage ./gh-pages/coverage && dumi build",
"ci:coverage": "npm run compile && npm run test",
"ci:build": "npm run compile",
"postinstall": "node ./scripts/postinstall",
"preinstall": "node ./scripts/preinstall",
"postinstall": "node ./public/scripts/postinstall.mjs",
"preinstall": "node ./public/scripts/preinstall.mjs",
"clear": "rimraf --glob ./@*/*/{libs,build,*.tsbuildinfo,tsconfig.build.json} tsconfig.build.json",
"format": "prettier --config .prettierrc.js --write \"**/*.{js,jsx,ts,tsx,d.ts,vue,md,json,yml,yaml}\"",
"lint": "eslint --fix .",
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions public/eslintrc/esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
extends: ['eslint:recommended', 'prettier'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
env: {
es6: true,
node: true,
},
}
File renamed without changes.
11 changes: 5 additions & 6 deletions scripts/postinstall → public/scripts/postinstall.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
#!/usr/bin/env node
import fs from 'fs'
import { exec } from 'child_process'
import Spinnies from 'spinnies'

;(async function main () {
const fs = require('fs')
const { exec } = require('child_process')
const tasks = ['tsc --build ./tsconfig.build.json']

if (!fs.existsSync('tsconfig.build.json')) {
tasks.unshift(...[
'ts-patch install -s',
'lerna run compile --concurrency 2 --parallel --include-dependencies --scope=@dumlj/tidy-cli',
'dumlj concurrently \"tscfg --exclude \"**/__template__\" --exclude \"**/__example__\"\" \"deps --exclude \"**/__template__\" --exclude \"**/__example__\"\"',
'dumlj concurrently "tscfg --exclude "**/__template__" --exclude "**/__example__"" "deps --exclude "**/__template__" --exclude "**/__example__""',
'npm run compile',
// must compile create-cli
'dumlj install husky',
])
}

const Spinnies = require('spinnies')
const spinnies = new Spinnies()
tasks.forEach((command) => spinnies.add(command, { text: command }))

Expand Down
2 changes: 0 additions & 2 deletions scripts/preinstall → public/scripts/preinstall.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

if (!process.env.npm_execpath.match(/pnpm/)) {
throw new Error('\x1b[31mPlease use [email protected] to install. @see https://pnpm.io/pnpm-cli\x1b[0m')
}

0 comments on commit 63e7b81

Please sign in to comment.