@ankhorage/devtools 1.3.0 → 1.3.2
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.
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @readme
|
|
21
21
|
*/
|
|
22
|
+
import { fixupPluginRules } from '@eslint/compat';
|
|
22
23
|
import js from '@eslint/js';
|
|
23
24
|
import prettierConfig from 'eslint-config-prettier';
|
|
24
25
|
import importPlugin from 'eslint-plugin-import';
|
|
@@ -177,7 +178,7 @@ function createReactConfig(files) {
|
|
|
177
178
|
function createReactNativeConfig(files) {
|
|
178
179
|
return {
|
|
179
180
|
files,
|
|
180
|
-
plugins: { 'react-native': reactNativePlugin },
|
|
181
|
+
plugins: { 'react-native': fixupPluginRules(reactNativePlugin) },
|
|
181
182
|
rules: {
|
|
182
183
|
'react-native/no-inline-styles': 'warn',
|
|
183
184
|
'react-native/no-unused-styles': 'error',
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Synchronize the consumer `package.json` contract owned by `@ankhorage/devtools`.
|
|
3
3
|
*
|
|
4
4
|
* Package synchronization is merge-aware. It installs the current `@ankhorage/devtools` version
|
|
5
|
-
* as a development dependency
|
|
6
|
-
*
|
|
5
|
+
* as a development dependency for normal consumers, while `@ankhorage/ankh` keeps devtools as a
|
|
6
|
+
* runtime dependency because the CLI loads it as a bundled core provider. Individually installed
|
|
7
|
+
* toolchain packages that devtools now owns are removed, and the canonical `lint`, `lint:fix`,
|
|
8
|
+
* `format`, `format:check`, and `knip` scripts are written.
|
|
7
9
|
* Unrelated manifest fields, scripts, dependencies, and metadata are preserved.
|
|
8
10
|
*
|
|
9
11
|
* Status compares only the fields owned by this contract, so unrelated repository customization
|
|
@@ -20,6 +22,7 @@ import { readFile, writeFile } from 'node:fs/promises';
|
|
|
20
22
|
import { resolve } from 'node:path';
|
|
21
23
|
const PACKAGE_PATH = 'package.json';
|
|
22
24
|
const DEVTOOLS_PACKAGE_NAME = '@ankhorage/devtools';
|
|
25
|
+
const ANKH_PACKAGE_NAME = '@ankhorage/ankh';
|
|
23
26
|
const STANDARD_SCRIPTS = {
|
|
24
27
|
lint: 'ankhorage-eslint . --max-warnings=0',
|
|
25
28
|
'lint:fix': 'ankhorage-eslint . --fix --max-warnings=0',
|
|
@@ -79,9 +82,8 @@ export function applyManagedPackageContract(manifest, devtoolsVersion) {
|
|
|
79
82
|
}
|
|
80
83
|
const scripts = { ...toRecord(manifest.scripts), ...STANDARD_SCRIPTS };
|
|
81
84
|
const devDependencies = removeOwnedDependencies(toRecord(manifest.devDependencies));
|
|
82
|
-
devDependencies[DEVTOOLS_PACKAGE_NAME] = `^${devtoolsVersion}`;
|
|
83
85
|
const dependencies = toRecord(manifest.dependencies);
|
|
84
|
-
|
|
86
|
+
applyDevtoolsDependencyPlacement(manifest, dependencies, devDependencies, devtoolsVersion);
|
|
85
87
|
return {
|
|
86
88
|
...manifest,
|
|
87
89
|
...normalizedDependencies(manifest, dependencies),
|
|
@@ -98,8 +100,7 @@ export function isManagedPackageContractCurrent(manifest, devtoolsVersion) {
|
|
|
98
100
|
const dependencies = toRecord(manifest.dependencies);
|
|
99
101
|
return (hasStandardScripts(scripts) &&
|
|
100
102
|
DEVTOOLS_OWNED_DEV_DEPENDENCIES.every((name) => devDependencies[name] === undefined) &&
|
|
101
|
-
devDependencies
|
|
102
|
-
dependencies[DEVTOOLS_PACKAGE_NAME] === undefined);
|
|
103
|
+
hasCurrentDevtoolsDependencyPlacement(manifest, dependencies, devDependencies, devtoolsVersion));
|
|
103
104
|
}
|
|
104
105
|
export function readCurrentDevtoolsVersion() {
|
|
105
106
|
const parsed = JSON.parse(readFileSync(new URL('../../../package.json', import.meta.url), 'utf8'));
|
|
@@ -124,6 +125,25 @@ async function readPackageManifest(targetDirectory) {
|
|
|
124
125
|
throw error;
|
|
125
126
|
}
|
|
126
127
|
}
|
|
128
|
+
function applyDevtoolsDependencyPlacement(manifest, dependencies, devDependencies, devtoolsVersion) {
|
|
129
|
+
const versionRange = `^${devtoolsVersion}`;
|
|
130
|
+
if (manifest.name === ANKH_PACKAGE_NAME) {
|
|
131
|
+
dependencies[DEVTOOLS_PACKAGE_NAME] = versionRange;
|
|
132
|
+
delete devDependencies[DEVTOOLS_PACKAGE_NAME];
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
devDependencies[DEVTOOLS_PACKAGE_NAME] = versionRange;
|
|
136
|
+
delete dependencies[DEVTOOLS_PACKAGE_NAME];
|
|
137
|
+
}
|
|
138
|
+
function hasCurrentDevtoolsDependencyPlacement(manifest, dependencies, devDependencies, devtoolsVersion) {
|
|
139
|
+
const versionRange = `^${devtoolsVersion}`;
|
|
140
|
+
if (manifest.name === ANKH_PACKAGE_NAME) {
|
|
141
|
+
return (dependencies[DEVTOOLS_PACKAGE_NAME] === versionRange &&
|
|
142
|
+
devDependencies[DEVTOOLS_PACKAGE_NAME] === undefined);
|
|
143
|
+
}
|
|
144
|
+
return (devDependencies[DEVTOOLS_PACKAGE_NAME] === versionRange &&
|
|
145
|
+
dependencies[DEVTOOLS_PACKAGE_NAME] === undefined);
|
|
146
|
+
}
|
|
127
147
|
function removeOwnedDependencies(devDependencies) {
|
|
128
148
|
for (const dependencyName of DEVTOOLS_OWNED_DEV_DEPENDENCIES) {
|
|
129
149
|
delete devDependencies[dependencyName];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/devtools",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Shared development tools and repository standards for Ankhorage",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/devtools#readme",
|
|
@@ -96,8 +96,9 @@
|
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@ankhorage/utility": "^0.1.1",
|
|
99
|
+
"@eslint/compat": "^2.1.0",
|
|
99
100
|
"@eslint/js": "^10.0.1",
|
|
100
|
-
"eslint": "^10.
|
|
101
|
+
"eslint": "^10.7.0",
|
|
101
102
|
"eslint-config-prettier": "^10.1.8",
|
|
102
103
|
"eslint-plugin-import": "^2.32.0",
|
|
103
104
|
"eslint-plugin-prettier": "^5.5.5",
|