@dword-design/base 16.2.2 → 16.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Code style
|
|
4
|
+
- Write everything in TypeScript
|
|
5
|
+
- The project uses strict typing
|
|
6
|
+
- Only add an explicit type if it's needed
|
|
7
|
+
- If it's otherwise resolved to `any`
|
|
8
|
+
- Don't add a return type if it can be resolved form the return statements in the function
|
|
9
|
+
- Use arrow functions instead of `function` if possible
|
|
10
|
+
- End each statement with a semicolon
|
|
11
|
+
- Use declarative programming instead of procedural
|
|
12
|
+
- Instead of pushing into an array, declare the array as a whole. For conditional elements, use `['a', ...cond ? ['b'] : []]`
|
|
13
|
+
- Instead of adding fields into an object, declare the object as a whole. For conditional elements, use `{ a: 'foo', ...cond && { b: 'bar' } }`
|
|
14
|
+
- Add `async` to a function if and only if it has at least one `await` expression
|
|
15
|
+
- Use CONSTANT_CASE for constants
|
|
16
|
+
|
|
17
|
+
## Best practices
|
|
18
|
+
- Generally use libraries instead of reinventing the wheel
|
|
19
|
+
- Use async variants of functions if possible
|
|
20
|
+
- Use [fs-extra](https://www.npmjs.com/package/fs-extra) package instead of `node:fs/promises`
|
|
21
|
+
- Use `fs` default export
|
|
22
|
+
- Use `fs.outputFile` to write a file if it's not clear if the parent folder exists
|
|
23
|
+
- Use [execa](https://www.npmjs.com/search?q=execa) to run processes
|
|
24
|
+
- Use [delay](https://www.npmjs.com/package/delay) for delays
|
|
25
|
+
- Use [lodash-es](https://www.npmjs.com/package/lodash-es) for utilities
|
|
26
|
+
- As a headless browser, use [playwright](https://www.npmjs.com/package/playwright)
|
|
27
|
+
- Install chromium via [@playwright/browser-chromium](https://www.npmjs.com/package/@playwright/browser-chromium) so that it auto-installs when running `pnpm install --frozen-lockfile`
|
|
28
|
+
- Use `.textContent` over `.innerText`
|
|
29
|
+
|
|
30
|
+
## Change management
|
|
31
|
+
- When making changes, only make the changes you're asked for. Do not do any Boyscout changes, change wordings etc.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import fs from "fs-extra";
|
|
1
3
|
import { stringify as stringifyIni } from "ini";
|
|
2
4
|
import sortKeys from "sort-keys";
|
|
3
5
|
import sortPackageJson from "sort-package-json";
|
|
@@ -14,6 +16,7 @@ import githubFunding from "./github-funding.js";
|
|
|
14
16
|
import githubLabelsConfig from "./github-labels.js";
|
|
15
17
|
import githubSyncLabelsConfig from "./github-sync-labels.js";
|
|
16
18
|
import npmrc from "./npmrc.js";
|
|
19
|
+
const resolver = createRequire(import.meta.url);
|
|
17
20
|
export default function () {
|
|
18
21
|
const packageConfig = this.getPackageConfig();
|
|
19
22
|
return {
|
|
@@ -57,6 +60,7 @@ export default function () {
|
|
|
57
60
|
`,
|
|
58
61
|
".vscode/settings.json": `${JSON.stringify(this.getVscodeConfig(), void 0, 2)}
|
|
59
62
|
`,
|
|
63
|
+
"AGENTS.md": fs.readFileSync(resolver.resolve("./agents.md"), "utf8"),
|
|
60
64
|
"LICENSE.md": this.getLicenseString(),
|
|
61
65
|
"README.md": this.getReadmeString(),
|
|
62
66
|
"eslint.config.ts": this.getEslintConfig(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/base",
|
|
3
|
-
"version": "16.2.
|
|
3
|
+
"version": "16.2.4",
|
|
4
4
|
"description": "Base package for projects.",
|
|
5
5
|
"repository": "dword-design/base",
|
|
6
6
|
"funding": "https://github.com/sponsors/dword-design",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@dword-design/base-config-node": "^5.0.1",
|
|
37
37
|
"@dword-design/ci": "^5.0.0",
|
|
38
38
|
"@dword-design/defu": "^1.0.3",
|
|
39
|
-
"@dword-design/dotenv-json-extended": "^
|
|
39
|
+
"@dword-design/dotenv-json-extended": "^5.1.1",
|
|
40
40
|
"@dword-design/eslint-config": "^9.0.0",
|
|
41
41
|
"@dword-design/personal-data": "^3.0.0",
|
|
42
42
|
"@semantic-release/changelog": "^6.0.3",
|