-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix(Configs,myplop): config issues and lint/format errors in myplop
add to eslint ignore file (prerttier file config at myplop), repair errors of lint and format at myplop, webpack config error in dev and build (prod)
- Loading branch information
1 parent
eeb1015
commit e6d3d8b
Showing
19 changed files
with
167 additions
and
255 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,53 +1,53 @@ | ||
import { readFileSync, readdirSync, statSync } from "fs"; | ||
import yaml from "js-yaml"; | ||
import path, { join, resolve } from "path"; | ||
// import { readFileSync, readdirSync, statSync } from "fs"; | ||
// import yaml from "js-yaml"; | ||
// import path, { join, resolve } from "path"; | ||
|
||
const AllWorkspaceNames = async () => { | ||
const parsedWorkspaces = await yaml.load( | ||
readFileSync("./pnpm-workspace.yaml", "utf8") | ||
); | ||
const result = await Promise.all( | ||
parsedWorkspaces.packages.map(async (workspace) => { | ||
const path = join(process.cwd(), workspace).replace("*", ""); | ||
// const AllWorkspaceNames = async () => { | ||
// const parsedWorkspaces = await yaml.load( | ||
// readFileSync("./pnpm-workspace.yaml", "utf8") | ||
// ); | ||
// const result = await Promise.all( | ||
// parsedWorkspaces.packages.map(async (workspace) => { | ||
// const path = join(process.cwd(), workspace).replace("*", ""); | ||
|
||
const dirPackageJson = readdirSync(path) | ||
.filter((file) => { | ||
const filePath = join(path, file); | ||
return ( | ||
statSync(filePath).isDirectory() && | ||
readdirSync(filePath).includes("package.json") | ||
); | ||
}) | ||
.map((directory) => join(path, directory, "package.json")); | ||
// const dirPackageJson = readdirSync(path) | ||
// .filter((file) => { | ||
// const filePath = join(path, file); | ||
// return ( | ||
// statSync(filePath).isDirectory() && | ||
// readdirSync(filePath).includes("package.json") | ||
// ); | ||
// }) | ||
// .map((directory) => join(path, directory, "package.json")); | ||
|
||
const WorkspacesName = await Promise.all( | ||
dirPackageJson.map(async (packageJson) => { | ||
const res = await import(`file://${packageJson}`, { | ||
assert: { type: "json" }, | ||
}); | ||
return res.default.name; | ||
}) | ||
); | ||
// const WorkspacesName = await Promise.all( | ||
// dirPackageJson.map(async (packageJson) => { | ||
// const res = await import(`file://${packageJson}`, { | ||
// assert: { type: "json" }, | ||
// }); | ||
// return res.default.name; | ||
// }) | ||
// ); | ||
|
||
return WorkspacesName; | ||
}) | ||
); | ||
return result.flat(Infinity); | ||
}; | ||
|
||
const prompts = async () => { | ||
const result = (await AllWorkspaceNames()).map( | ||
(workspace) => `pnpm pre --filter ${workspace} --` | ||
); | ||
return result; | ||
}; | ||
|
||
// export default { | ||
// "*": ["pnpm turbo test"], | ||
// return WorkspacesName; | ||
// }) | ||
// ); | ||
// return result.flat(Infinity); | ||
// }; | ||
export default { | ||
"*": [...(await prompts())], | ||
}; | ||
// export default { | ||
// "./config/eslintrc": "pnpm pre --filter eslintrc", | ||
|
||
// const prompts = async () => { | ||
// const result = (await AllWorkspaceNames()).map( | ||
// (workspace) => `pnpm pre --filter ${workspace} --` | ||
// ); | ||
// return result; | ||
// }; | ||
|
||
// // export default { | ||
// // "*": ["pnpm turbo test"], | ||
// // }; | ||
// // export default { | ||
// // "*": [...(await prompts())], | ||
// // }; | ||
// // export default { | ||
// // "./config/eslintrc": "pnpm pre --filter eslintrc", | ||
// // }; |
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,29 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"compilerOptions": { | ||
"lib": ["esnext", "dom"], | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"target": "ES6", | ||
"allowUnreachableCode": false, | ||
"allowUnusedLabels": false, | ||
"alwaysStrict": false, | ||
"exactOptionalPropertyTypes": false, | ||
"noFallthroughCasesInSwitch": false, | ||
"noImplicitAny": true, | ||
"noImplicitOverride": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noPropertyAccessFromIndexSignature": false, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"strict": true, | ||
"strictBindCallApply": true, | ||
"strictFunctionTypes": true, | ||
"strictNullChecks": true, | ||
"strictPropertyInitialization": true, | ||
"resolveJsonModule": true | ||
}, | ||
"display": "default", | ||
"exclude": ["node_modules", "dist", "lib"] | ||
} |
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,3 +1,3 @@ | ||
*.hbs | ||
dist/* | ||
lib/* | ||
lib/* |
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 +1 @@ | ||
# `myplop` | ||
# `myplop` |
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,3 +1,4 @@ | ||
import WebpackConfig from 'webpackrc/webpack.base.js'; | ||
import {merge} from "webpack-merge"; | ||
import { merge } from "webpack-merge"; | ||
import WebpackConfig from "webpackrc/webpack.base.js"; | ||
|
||
export default merge(WebpackConfig, {}); |
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,3 +1,4 @@ | ||
import WebpackConfigDev from 'webpackrc/webpack.dev.js'; | ||
import {merge} from "webpack-merge"; | ||
import { merge } from "webpack-merge"; | ||
import WebpackConfigDev from "webpackrc/webpack.dev.js"; | ||
|
||
export default merge(WebpackConfigDev, {}); |
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,3 +1,4 @@ | ||
import WebpackConfigProd from 'webpackrc/webpack.dev.js'; | ||
import {merge} from "webpack-merge"; | ||
import { merge } from "webpack-merge"; | ||
import WebpackConfigProd from "webpackrc/webpack.prod.js"; | ||
|
||
export default merge(WebpackConfigProd, {}); |
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 @@ | ||
console.log("Hello World!"),module.exports={}.default; |
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,4 +1,4 @@ | ||
import EslintBase from "eslintrc/base.js"; | ||
import EslintTypescript from "eslintrc/typescript.js"; | ||
|
||
export default [...EslintBase, ...EslintTypescript]; | ||
export default [{ ignores: ["prettier.config.js"] }, ...EslintBase, ...EslintTypescript]; |
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,36 +1,45 @@ | ||
{ | ||
"name": "myplop", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"private": false, | ||
"scripts": { | ||
"pre": "echo 'Add test script here'", | ||
"test": "echo 'Add test script here'", | ||
"build": "webpack --config ./config/webpack/webpack.prod.js", | ||
"build:npm": "pnpm npm:prepack && webpack --config ./config/webpack/webpack.prod.js && pnpm npm:postpack ", | ||
"dev": "webpack --config ./config/webpack/webpack.dev.js", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"format": "pnpm prettier . --write && pnpm prettier . --check", | ||
"npm:prepack": "clean-package", | ||
"npm:postpack": "clean-package restore", | ||
"npm:publish": "npm publish", | ||
"link-cli": "pnpm unlink --global && pnpm link --global", | ||
"name": "myplop", | ||
"version": "0.0.0", | ||
"private": false, | ||
"type": "module", | ||
"scripts": { | ||
"build": "webpack --config ./config/webpack/webpack.prod.js", | ||
"build:npm": "pnpm npm:prepack && webpack --config ./config/webpack/webpack.prod.js && pnpm npm:postpack ", | ||
"dev": "webpack --config ./config/webpack/webpack.dev.js", | ||
"format": "pnpm prettier . --write && pnpm prettier . --check", | ||
"link-cli": "pnpm unlink --global && pnpm link --global", | ||
"link-cli:dev": "cd lib && pnpm unlink --global && pnpm link --global", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"npm:postpack": "clean-package restore", | ||
"npm:prepack": "clean-package", | ||
"npm:publish": "npm publish", | ||
"pre": "echo 'Add test script here'", | ||
"test": "echo 'Add test script here'", | ||
"unlink-cli": "cd lib && pnpm unlink --global", | ||
"unlink-cli:dev": "cd lib && pnpm unlink --global " | ||
}, | ||
"devDependencies": { | ||
"bundle-declarations-webpack-plugin": "^5.0.0", | ||
"clean-package": "^2.2.0", | ||
"copy-webpack-plugin": "^12.0.1", | ||
"eslintrc": "workspace:*", | ||
"prettierrc": "workspace:*", | ||
"swc-loader": "^0.2.3", | ||
"typescript": "^5.3.3", | ||
"webpack": "^5.89.0", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-merge": "^5.10.0", | ||
"webpackrc": "workspace:*" | ||
} | ||
} | ||
}, | ||
"lint-staged": { | ||
"*": [ | ||
"pnpm format --", | ||
"pnpm lint:fix --", | ||
"pnpm lint --" | ||
] | ||
}, | ||
"devDependencies": { | ||
"bundle-declarations-webpack-plugin": "^5.0.0", | ||
"clean-package": "^2.2.0", | ||
"copy-webpack-plugin": "^12.0.1", | ||
"eslintrc": "workspace:*", | ||
"prettier": "^3.1.1", | ||
"prettierrc": "workspace:*", | ||
"swc-loader": "^0.2.3", | ||
"tsconfig": "workspace:*", | ||
"typescript": "^5.3.3", | ||
"webpack": "^5.89.0", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-merge": "^5.10.0", | ||
"webpackrc": "workspace:*" | ||
} | ||
} |
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,4 +1,6 @@ | ||
import prettierConfig from "prettierrc/.prettierrc.json" | ||
// Eslint doesn't support `assert` because it's experimental | ||
import prettierConfig from "prettierrc/.prettierrc.json" assert { type: "json" }; | ||
|
||
export default { | ||
...prettierConfig, | ||
} | ||
...prettierConfig | ||
}; |
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 +1 @@ | ||
console.log("Hello World!") | ||
console.log("Hello World!"); |
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,14 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/tsconfig", | ||
"compilerOptions": { | ||
"declaration": true, | ||
|
||
"outDir": "./dist", | ||
"baseUrl": "./src", | ||
"paths": { | ||
"@/*": ["*"] | ||
} | ||
}, | ||
// "include": ["src"], | ||
"extends": "tsconfig/base.json" | ||
} |
Oops, something went wrong.