@pnpm/plugin-commands-init 1.0.43 → 2.0.0
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/lib/init.js +5 -5
- package/lib/init.js.map +1 -1
- package/package.json +8 -8
package/lib/init.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.handler = exports.help = exports.commandNames = exports.cliOptionsTypes
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const cli_utils_1 = require("@pnpm/cli-utils");
|
|
10
|
-
const error_1 =
|
|
11
|
-
const write_project_manifest_1 =
|
|
10
|
+
const error_1 = require("@pnpm/error");
|
|
11
|
+
const write_project_manifest_1 = require("@pnpm/write-project-manifest");
|
|
12
12
|
const render_help_1 = __importDefault(require("render-help"));
|
|
13
13
|
const utils_1 = require("./utils");
|
|
14
14
|
exports.rcOptionsTypes = cliOptionsTypes;
|
|
@@ -28,7 +28,7 @@ function help() {
|
|
|
28
28
|
exports.help = help;
|
|
29
29
|
async function handler(opts, params) {
|
|
30
30
|
if (params?.length) {
|
|
31
|
-
throw new error_1.
|
|
31
|
+
throw new error_1.PnpmError('INIT_ARG', 'init command does not accept any arguments', {
|
|
32
32
|
hint: `Maybe you wanted to run "pnpm create ${params.join(' ')}"`,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -36,7 +36,7 @@ async function handler(opts, params) {
|
|
|
36
36
|
// is set to the first parent directory that has a package.json file.
|
|
37
37
|
const manifestPath = path_1.default.join(process.cwd(), 'package.json');
|
|
38
38
|
if (fs_1.default.existsSync(manifestPath)) {
|
|
39
|
-
throw new error_1.
|
|
39
|
+
throw new error_1.PnpmError('PACKAGE_JSON_EXISTS', 'package.json already exists');
|
|
40
40
|
}
|
|
41
41
|
const manifest = {
|
|
42
42
|
name: path_1.default.basename(process.cwd()),
|
|
@@ -52,7 +52,7 @@ async function handler(opts, params) {
|
|
|
52
52
|
};
|
|
53
53
|
const config = await (0, utils_1.parseRawConfig)(opts.rawConfig);
|
|
54
54
|
const packageJson = { ...manifest, ...config };
|
|
55
|
-
await (0, write_project_manifest_1.
|
|
55
|
+
await (0, write_project_manifest_1.writeProjectManifest)(manifestPath, packageJson, {
|
|
56
56
|
indent: 2,
|
|
57
57
|
});
|
|
58
58
|
return `Wrote to ${manifestPath}
|
package/lib/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,gDAAuB;AACvB,+CAAyC;AAEzC,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,gDAAuB;AACvB,+CAAyC;AAEzC,uCAAuC;AACvC,yEAAmE;AACnE,8DAAoC;AACpC,mCAAwC;AAE3B,QAAA,cAAc,GAAG,eAAe,CAAA;AAE7C,SAAgB,eAAe;IAC7B,OAAO,EAAE,CAAA;AACX,CAAC;AAFD,0CAEC;AAEY,QAAA,YAAY,GAAG,CAAC,MAAM,CAAC,CAAA;AAEpC,SAAgB,IAAI;IAClB,OAAO,IAAA,qBAAU,EAAC;QAChB,WAAW,EAAE,4BAA4B;QACzC,gBAAgB,EAAE,EAAE;QACpB,GAAG,EAAE,IAAA,mBAAO,EAAC,MAAM,CAAC;QACpB,MAAM,EAAE,CAAC,WAAW,CAAC;KACtB,CAAC,CAAA;AACJ,CAAC;AAPD,oBAOC;AAEM,KAAK,UAAU,OAAO,CAC3B,IAAyC,EACzC,MAAiB;IAEjB,IAAI,MAAM,EAAE,MAAM,EAAE;QAClB,MAAM,IAAI,iBAAS,CAAC,UAAU,EAAE,4CAA4C,EAAE;YAC5E,IAAI,EAAE,wCAAwC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;SAClE,CAAC,CAAA;KACH;IACD,6DAA6D;IAC7D,qEAAqE;IACrE,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAA;IAC7D,IAAI,YAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QAC/B,MAAM,IAAI,iBAAS,CAAC,qBAAqB,EAAE,6BAA6B,CAAC,CAAA;KAC1E;IACD,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP,IAAI,EAAE,2CAA2C;SAClD;QACD,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,KAAK;KACf,CAAA;IACD,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,EAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACnD,MAAM,WAAW,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAA;IAC9C,MAAM,IAAA,6CAAoB,EAAC,YAAY,EAAE,WAAW,EAAE;QACpD,MAAM,EAAE,CAAC;KACV,CAAC,CAAA;IACF,OAAO,YAAY,YAAY;;EAE/B,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAA;AACxC,CAAC;AAnCD,0BAmCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/plugin-commands-init",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Create a package.json file",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/plugin-commands-init#readme",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@pnpm/plugin-commands-init": "
|
|
27
|
-
"@pnpm/prepare": "0.0.
|
|
28
|
-
"@pnpm/test-fixtures": "0.0.
|
|
26
|
+
"@pnpm/plugin-commands-init": "2.0.0",
|
|
27
|
+
"@pnpm/prepare": "0.0.55",
|
|
28
|
+
"@pnpm/test-fixtures": "0.0.24",
|
|
29
29
|
"load-json-file": "^6.2.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@pnpm/cli-utils": "0.
|
|
33
|
-
"@pnpm/config": "
|
|
34
|
-
"@pnpm/error": "
|
|
35
|
-
"@pnpm/write-project-manifest": "
|
|
32
|
+
"@pnpm/cli-utils": "1.0.0",
|
|
33
|
+
"@pnpm/config": "16.0.0",
|
|
34
|
+
"@pnpm/error": "4.0.0",
|
|
35
|
+
"@pnpm/write-project-manifest": "4.0.0",
|
|
36
36
|
"camelcase-keys": "^6.2.2",
|
|
37
37
|
"render-help": "^1.0.2"
|
|
38
38
|
},
|