@w5s/managed-script-config 1.0.0-alpha.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.
- package/README.md +50 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/script/rescue.d.ts +1 -0
- package/dist/script/rescue.js +9 -0
- package/dist/script/rescue.js.map +1 -0
- package/package.json +48 -0
- package/src/config.ts +10 -0
- package/src/index.ts +2 -0
- package/src/meta.ts +8 -0
- package/src/script/rescue.ts +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=# W5S Managed Script Config _(${name})_) -->
|
|
2
|
+
# W5S Managed Script Config _(@w5s/managed-script-config)_
|
|
3
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
4
|
+
|
|
5
|
+
[![NPM Version][package-version-svg]][package-url]
|
|
6
|
+
[![License][license-image]][license-url]
|
|
7
|
+
|
|
8
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=> ${description}&unknownTxt= ) -->
|
|
9
|
+
> Managed script shared configuration
|
|
10
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=```console\nnpm install --save-dev ${name}\n```) -->
|
|
15
|
+
```console
|
|
16
|
+
npm install --save-dev @w5s/managed-script-config
|
|
17
|
+
```
|
|
18
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
In your `managed-script.config.json` (or the `"managed-script"` field of `package.json`):
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"extends": ["@w5s/managed-script-config"]
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This provides the following scripts:
|
|
31
|
+
|
|
32
|
+
- `rescue`: `git clean -fdx` then `pnpm install`. The implementation lives in [`rescue.ts`](./src/rescue.ts), invoked through the `MANAGED_SCRIPT_CONFIG_DIR` environment variable so it resolves regardless of the consuming project's working directory.
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[${license}][license-url] © ${author}) -->
|
|
36
|
+
[MIT][license-url] © Julien Polo <julien.polo@gmail.com>
|
|
37
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
38
|
+
|
|
39
|
+
<!-- VARIABLES -->
|
|
40
|
+
|
|
41
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square) -->
|
|
42
|
+
[package-version-svg]: https://img.shields.io/npm/v/@w5s/managed-script-config.svg?style=flat-square
|
|
43
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
44
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}) -->
|
|
45
|
+
[package-url]: https://www.npmjs.com/package/@w5s/managed-script-config
|
|
46
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
47
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square) -->
|
|
48
|
+
[license-image]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square
|
|
49
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
50
|
+
[license-url]: ../../LICENSE
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.d.mts
|
|
2
|
+
declare global {
|
|
3
|
+
var __c12_dotenv_vars__: Map<Record<string, any>, Set<string>>;
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/types.d.ts
|
|
7
|
+
interface ConfigLayerMeta {
|
|
8
|
+
name?: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
type UserInputConfig = Record<string, any>;
|
|
12
|
+
interface C12InputConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
|
|
13
|
+
$test?: T;
|
|
14
|
+
$development?: T;
|
|
15
|
+
$production?: T;
|
|
16
|
+
$env?: Record<string, T>;
|
|
17
|
+
$meta?: MT;
|
|
18
|
+
}
|
|
19
|
+
type InputConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> = C12InputConfig<T, MT> & T;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/config.d.ts
|
|
22
|
+
declare const config: InputConfig<import("@w5s/managed-script").UserConfig, ConfigLayerMeta>;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/meta.d.ts
|
|
25
|
+
export declare const meta: Readonly<{
|
|
26
|
+
buildNumber: number;
|
|
27
|
+
name: string;
|
|
28
|
+
version: string;
|
|
29
|
+
}>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { config as default };
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from "@w5s/managed-script";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region src/config.ts
|
|
4
|
+
const configDir = new URL(".", import.meta.url).pathname;
|
|
5
|
+
const config = defineConfig({ scripts: { rescue: `node "${path.join(configDir, "script", "rescue.js")}"` } });
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/meta.ts
|
|
8
|
+
const meta = Object.freeze({
|
|
9
|
+
buildNumber: 0,
|
|
10
|
+
name: "@w5s/managed-script-config",
|
|
11
|
+
version: "1.0.0-alpha.2"
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { config as default, meta };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/config.ts","../src/meta.ts"],"sourcesContent":["import { defineConfig } from '@w5s/managed-script';\nimport path from 'node:path';\n\nconst configDir = new URL('.', import.meta.url).pathname;\n\nexport const config = defineConfig({\n scripts: {\n rescue: `node \"${path.join(configDir, 'script', 'rescue.js')}\"`,\n },\n});\n","export const meta = Object.freeze({\n // @ts-ignore - these variables are injected at build time\n buildNumber: (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,\n // @ts-ignore - these variables are injected at build time\n name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,\n // @ts-ignore - these variables are injected at build time\n version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,\n});\n"],"mappings":";;;AAGA,MAAM,YAAY,IAAI,IAAI,KAAK,YAAY,GAAG,CAAC,CAAC;AAEhD,MAAa,SAAS,aAAa,EACjC,SAAS,EACP,QAAQ,SAAS,KAAK,KAAK,WAAW,UAAU,WAAW,EAAE,GAC/D,EACF,CAAC;;;ACTD,MAAa,OAAO,OAAO,OAAO;CAEhC,aAAA;CAEA,MAAA;CAEA,SAAA;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rescue.js","names":[],"sources":["../../src/script/rescue.ts"],"sourcesContent":["import { $ } from '@w5s/managed-script/zx';\n\n/* cspell:ignore nothrow */\nconst $noThrow = $({ nothrow: true });\n\nawait $noThrow`git clean -fdx`;\nawait $noThrow`pnpm install`;\n"],"mappings":";;AAGA,MAAM,WAAW,EAAE,EAAE,SAAS,KAAK,CAAC;AAEpC,MAAM,QAAQ;AACd,MAAM,QAAQ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@w5s/managed-script-config",
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
|
+
"description": "Managed script shared configuration",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"config",
|
|
7
|
+
"scripts",
|
|
8
|
+
"cli"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/w5s/project-config/blob/main/packages/managed-script-config#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/w5s/project-config/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/w5s/project-config.git",
|
|
17
|
+
"directory": "packages/managed-script-config"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Julien Polo <julien.polo@gmail.com>",
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
"./package.json": "./package.json",
|
|
25
|
+
".": "./dist/index.js",
|
|
26
|
+
"./internal/*": null
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/",
|
|
30
|
+
"src/",
|
|
31
|
+
"index.js",
|
|
32
|
+
"index.d.ts",
|
|
33
|
+
"!**/*.spec.*",
|
|
34
|
+
"!**/__tests__/**"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"postpack": "clean-package restore"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@w5s/managed-script": "workspace:^"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=22.0.0"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfig } from '@w5s/managed-script';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
const configDir = new URL('.', import.meta.url).pathname;
|
|
5
|
+
|
|
6
|
+
export const config = defineConfig({
|
|
7
|
+
scripts: {
|
|
8
|
+
rescue: `node "${path.join(configDir, 'script', 'rescue.js')}"`,
|
|
9
|
+
},
|
|
10
|
+
});
|
package/src/index.ts
ADDED
package/src/meta.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const meta = Object.freeze({
|
|
2
|
+
// @ts-ignore - these variables are injected at build time
|
|
3
|
+
buildNumber: (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,
|
|
4
|
+
// @ts-ignore - these variables are injected at build time
|
|
5
|
+
name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,
|
|
6
|
+
// @ts-ignore - these variables are injected at build time
|
|
7
|
+
version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,
|
|
8
|
+
});
|