create-pkgbld 1.1.8 → 1.1.10
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 +2 -2
- package/dist/index.cjs +158 -160
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +158 -160
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Minimalistic scaffolding utility for [pkgbld](https://github.com/kshutkin/package-build/tree/main/pkgbld).
|
|
4
4
|
|
|
5
|
-
*Disclaimer:*
|
|
5
|
+
*Disclaimer:* Despite the version being 1.0.0+ it is still very raw, use only if it fits your needs.
|
|
6
6
|
|
|
7
|
-
[
|
|
7
|
+
[Changelog](./CHANGELOG.md)
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
package/dist/index.cjs
CHANGED
|
@@ -9,164 +9,162 @@ var gitConfig = require('parse-git-config');
|
|
|
9
9
|
var minimist = require('minimist');
|
|
10
10
|
var degit = require('degit');
|
|
11
11
|
|
|
12
|
-
async function execute() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
pkg.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
process.exit(-1);
|
|
171
|
-
}
|
|
12
|
+
async function execute() {
|
|
13
|
+
const myPkg = await readPackage(path.resolve(__dirname, '..'));
|
|
14
|
+
console.log('create-pkgbld ' + myPkg.pkg.version);
|
|
15
|
+
const parsedArgs = minimist(process.argv.slice(2));
|
|
16
|
+
const packageName = parsedArgs._[0];
|
|
17
|
+
const dir = packageName ?? '.';
|
|
18
|
+
let cancelled = false;
|
|
19
|
+
const chooseAction = await prompts({
|
|
20
|
+
type: 'select',
|
|
21
|
+
name: 'action',
|
|
22
|
+
message: 'What do you need to do?',
|
|
23
|
+
choices: [
|
|
24
|
+
{ title: 'Create Monorepo Root', value: 'root' },
|
|
25
|
+
{ title: 'Create a Subpackage', value: 'subpackage' }
|
|
26
|
+
],
|
|
27
|
+
initial: 1
|
|
28
|
+
}, { onCancel });
|
|
29
|
+
if (cancelled) {
|
|
30
|
+
process.exit(-1);
|
|
31
|
+
}
|
|
32
|
+
let rootPkg = {
|
|
33
|
+
pkg: {},
|
|
34
|
+
readme: ''
|
|
35
|
+
};
|
|
36
|
+
if (chooseAction.action === 'subpackage') {
|
|
37
|
+
rootPkg = await readPackage(path.resolve(dir, packageName ? '..' : '.'));
|
|
38
|
+
}
|
|
39
|
+
const template = chooseAction.action === 'root' ? 'kshutkin/monorepo-root' : 'kshutkin/monorepo-package';
|
|
40
|
+
const emitter = degit(template, {
|
|
41
|
+
cache: false,
|
|
42
|
+
force: true,
|
|
43
|
+
verbose: true,
|
|
44
|
+
});
|
|
45
|
+
emitter.on('info', (info) => {
|
|
46
|
+
console.log(info.message);
|
|
47
|
+
});
|
|
48
|
+
await emitter.clone(dir);
|
|
49
|
+
const basePackageName = (packageName && path.basename(packageName)) || path.basename(process.cwd());
|
|
50
|
+
if (chooseAction.action === 'root') {
|
|
51
|
+
const response = await prompts([{
|
|
52
|
+
type: 'text',
|
|
53
|
+
name: 'name',
|
|
54
|
+
message: 'package name',
|
|
55
|
+
initial: basePackageName
|
|
56
|
+
}, {
|
|
57
|
+
type: 'text',
|
|
58
|
+
name: 'scope',
|
|
59
|
+
message: 'scope (without @ or empty)'
|
|
60
|
+
}, {
|
|
61
|
+
type: 'text',
|
|
62
|
+
name: 'description',
|
|
63
|
+
message: 'description',
|
|
64
|
+
initial: ''
|
|
65
|
+
}], { onCancel });
|
|
66
|
+
if (cancelled) {
|
|
67
|
+
process.exit(-1);
|
|
68
|
+
}
|
|
69
|
+
const fileName = path.join(dir, '.github/workflows/main.yml');
|
|
70
|
+
let actionsTemplate = (await fs.readFile(fileName)).toString();
|
|
71
|
+
actionsTemplate = actionsTemplate.replace('scope: # @echo scope', response.scope ? `scope: '@${response.scope}'` : '');
|
|
72
|
+
await fs.writeFile(fileName, actionsTemplate);
|
|
73
|
+
const readmeFileName = path.join(dir, 'README.md');
|
|
74
|
+
const readme = `# ${response.name}\n${response.description}\n\n## Packages`;
|
|
75
|
+
await fs.writeFile(readmeFileName, readme);
|
|
76
|
+
}
|
|
77
|
+
if (chooseAction.action === 'subpackage') {
|
|
78
|
+
const response = await prompts([{
|
|
79
|
+
type: 'text',
|
|
80
|
+
name: 'name',
|
|
81
|
+
message: 'package name',
|
|
82
|
+
initial: basePackageName
|
|
83
|
+
}, {
|
|
84
|
+
type: 'text',
|
|
85
|
+
name: 'version',
|
|
86
|
+
message: 'version',
|
|
87
|
+
initial: '1.0.0'
|
|
88
|
+
}, {
|
|
89
|
+
type: 'text',
|
|
90
|
+
name: 'description',
|
|
91
|
+
message: 'description',
|
|
92
|
+
initial: ''
|
|
93
|
+
}, {
|
|
94
|
+
type: 'text',
|
|
95
|
+
name: 'license',
|
|
96
|
+
message: 'license',
|
|
97
|
+
initial: 'MIT'
|
|
98
|
+
}, {
|
|
99
|
+
type: 'text',
|
|
100
|
+
name: 'author',
|
|
101
|
+
message: 'author',
|
|
102
|
+
initial: userName() ?? ''
|
|
103
|
+
}], { onCancel });
|
|
104
|
+
if (cancelled) {
|
|
105
|
+
process.exit(-1);
|
|
106
|
+
}
|
|
107
|
+
const gitInfo = {
|
|
108
|
+
homepage: '',
|
|
109
|
+
repository: undefined,
|
|
110
|
+
bugs: undefined
|
|
111
|
+
};
|
|
112
|
+
try {
|
|
113
|
+
const gitCfg = await gitConfig();
|
|
114
|
+
if (gitCfg) {
|
|
115
|
+
const url = gitCfg['remote "origin"'].url;
|
|
116
|
+
gitInfo.homepage = url.replace('.git', `/blob/main/${basePackageName}/README.md`);
|
|
117
|
+
gitInfo.repository = {
|
|
118
|
+
type: 'git',
|
|
119
|
+
url: `git+${url}`
|
|
120
|
+
};
|
|
121
|
+
gitInfo.bugs = {
|
|
122
|
+
url: url.replace('.git', '/issues')
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
/* ignore */
|
|
128
|
+
}
|
|
129
|
+
const pkg = await readPackage(dir);
|
|
130
|
+
Object.assign(pkg.pkg, response, gitInfo);
|
|
131
|
+
pkg.readme = `# ${response.name}`;
|
|
132
|
+
await writePackage(dir, pkg);
|
|
133
|
+
rootPkg.pkg.workspaces ??= [];
|
|
134
|
+
rootPkg.pkg.workspaces.push(basePackageName);
|
|
135
|
+
rootPkg.readme += `\n- [${basePackageName}](./${basePackageName}/README.md)`;
|
|
136
|
+
await writePackage(path.resolve(dir, '..'), rootPkg);
|
|
137
|
+
}
|
|
138
|
+
function onCancel() {
|
|
139
|
+
cancelled = true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
execute();
|
|
143
|
+
async function readPackage(dir) {
|
|
144
|
+
const packageFileName = path.resolve(dir, 'package.json');
|
|
145
|
+
const readmeFileName = path.resolve(dir, 'README.md');
|
|
146
|
+
try {
|
|
147
|
+
const pkgFile = await fs.readFile(packageFileName);
|
|
148
|
+
const readmeFile = await fs.readFile(readmeFileName);
|
|
149
|
+
return {
|
|
150
|
+
pkg: JSON.parse(pkgFile.toString()),
|
|
151
|
+
readme: readmeFile.toString()
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
console.error(e);
|
|
156
|
+
process.exit(-1);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async function writePackage(dir, pkg) {
|
|
160
|
+
const packageFileName = path.resolve(dir, 'package.json');
|
|
161
|
+
const readmeFileName = path.resolve(dir, 'README.md');
|
|
162
|
+
try {
|
|
163
|
+
await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2));
|
|
164
|
+
await fs.writeFile(readmeFileName, pkg.readme);
|
|
165
|
+
}
|
|
166
|
+
catch (e) {
|
|
167
|
+
console.error(e);
|
|
168
|
+
process.exit(-1);
|
|
169
|
+
}
|
|
172
170
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/dist/index.mjs
CHANGED
|
@@ -6,164 +6,162 @@ import gitConfig from 'parse-git-config';
|
|
|
6
6
|
import minimist from 'minimist';
|
|
7
7
|
import degit from 'degit';
|
|
8
8
|
|
|
9
|
-
async function execute() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
pkg.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
process.exit(-1);
|
|
168
|
-
}
|
|
9
|
+
async function execute() {
|
|
10
|
+
const myPkg = await readPackage(path.resolve(__dirname, '..'));
|
|
11
|
+
console.log('create-pkgbld ' + myPkg.pkg.version);
|
|
12
|
+
const parsedArgs = minimist(process.argv.slice(2));
|
|
13
|
+
const packageName = parsedArgs._[0];
|
|
14
|
+
const dir = packageName ?? '.';
|
|
15
|
+
let cancelled = false;
|
|
16
|
+
const chooseAction = await prompts({
|
|
17
|
+
type: 'select',
|
|
18
|
+
name: 'action',
|
|
19
|
+
message: 'What do you need to do?',
|
|
20
|
+
choices: [
|
|
21
|
+
{ title: 'Create Monorepo Root', value: 'root' },
|
|
22
|
+
{ title: 'Create a Subpackage', value: 'subpackage' }
|
|
23
|
+
],
|
|
24
|
+
initial: 1
|
|
25
|
+
}, { onCancel });
|
|
26
|
+
if (cancelled) {
|
|
27
|
+
process.exit(-1);
|
|
28
|
+
}
|
|
29
|
+
let rootPkg = {
|
|
30
|
+
pkg: {},
|
|
31
|
+
readme: ''
|
|
32
|
+
};
|
|
33
|
+
if (chooseAction.action === 'subpackage') {
|
|
34
|
+
rootPkg = await readPackage(path.resolve(dir, packageName ? '..' : '.'));
|
|
35
|
+
}
|
|
36
|
+
const template = chooseAction.action === 'root' ? 'kshutkin/monorepo-root' : 'kshutkin/monorepo-package';
|
|
37
|
+
const emitter = degit(template, {
|
|
38
|
+
cache: false,
|
|
39
|
+
force: true,
|
|
40
|
+
verbose: true,
|
|
41
|
+
});
|
|
42
|
+
emitter.on('info', (info) => {
|
|
43
|
+
console.log(info.message);
|
|
44
|
+
});
|
|
45
|
+
await emitter.clone(dir);
|
|
46
|
+
const basePackageName = (packageName && path.basename(packageName)) || path.basename(process.cwd());
|
|
47
|
+
if (chooseAction.action === 'root') {
|
|
48
|
+
const response = await prompts([{
|
|
49
|
+
type: 'text',
|
|
50
|
+
name: 'name',
|
|
51
|
+
message: 'package name',
|
|
52
|
+
initial: basePackageName
|
|
53
|
+
}, {
|
|
54
|
+
type: 'text',
|
|
55
|
+
name: 'scope',
|
|
56
|
+
message: 'scope (without @ or empty)'
|
|
57
|
+
}, {
|
|
58
|
+
type: 'text',
|
|
59
|
+
name: 'description',
|
|
60
|
+
message: 'description',
|
|
61
|
+
initial: ''
|
|
62
|
+
}], { onCancel });
|
|
63
|
+
if (cancelled) {
|
|
64
|
+
process.exit(-1);
|
|
65
|
+
}
|
|
66
|
+
const fileName = path.join(dir, '.github/workflows/main.yml');
|
|
67
|
+
let actionsTemplate = (await fs.readFile(fileName)).toString();
|
|
68
|
+
actionsTemplate = actionsTemplate.replace('scope: # @echo scope', response.scope ? `scope: '@${response.scope}'` : '');
|
|
69
|
+
await fs.writeFile(fileName, actionsTemplate);
|
|
70
|
+
const readmeFileName = path.join(dir, 'README.md');
|
|
71
|
+
const readme = `# ${response.name}\n${response.description}\n\n## Packages`;
|
|
72
|
+
await fs.writeFile(readmeFileName, readme);
|
|
73
|
+
}
|
|
74
|
+
if (chooseAction.action === 'subpackage') {
|
|
75
|
+
const response = await prompts([{
|
|
76
|
+
type: 'text',
|
|
77
|
+
name: 'name',
|
|
78
|
+
message: 'package name',
|
|
79
|
+
initial: basePackageName
|
|
80
|
+
}, {
|
|
81
|
+
type: 'text',
|
|
82
|
+
name: 'version',
|
|
83
|
+
message: 'version',
|
|
84
|
+
initial: '1.0.0'
|
|
85
|
+
}, {
|
|
86
|
+
type: 'text',
|
|
87
|
+
name: 'description',
|
|
88
|
+
message: 'description',
|
|
89
|
+
initial: ''
|
|
90
|
+
}, {
|
|
91
|
+
type: 'text',
|
|
92
|
+
name: 'license',
|
|
93
|
+
message: 'license',
|
|
94
|
+
initial: 'MIT'
|
|
95
|
+
}, {
|
|
96
|
+
type: 'text',
|
|
97
|
+
name: 'author',
|
|
98
|
+
message: 'author',
|
|
99
|
+
initial: userName() ?? ''
|
|
100
|
+
}], { onCancel });
|
|
101
|
+
if (cancelled) {
|
|
102
|
+
process.exit(-1);
|
|
103
|
+
}
|
|
104
|
+
const gitInfo = {
|
|
105
|
+
homepage: '',
|
|
106
|
+
repository: undefined,
|
|
107
|
+
bugs: undefined
|
|
108
|
+
};
|
|
109
|
+
try {
|
|
110
|
+
const gitCfg = await gitConfig();
|
|
111
|
+
if (gitCfg) {
|
|
112
|
+
const url = gitCfg['remote "origin"'].url;
|
|
113
|
+
gitInfo.homepage = url.replace('.git', `/blob/main/${basePackageName}/README.md`);
|
|
114
|
+
gitInfo.repository = {
|
|
115
|
+
type: 'git',
|
|
116
|
+
url: `git+${url}`
|
|
117
|
+
};
|
|
118
|
+
gitInfo.bugs = {
|
|
119
|
+
url: url.replace('.git', '/issues')
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
/* ignore */
|
|
125
|
+
}
|
|
126
|
+
const pkg = await readPackage(dir);
|
|
127
|
+
Object.assign(pkg.pkg, response, gitInfo);
|
|
128
|
+
pkg.readme = `# ${response.name}`;
|
|
129
|
+
await writePackage(dir, pkg);
|
|
130
|
+
rootPkg.pkg.workspaces ??= [];
|
|
131
|
+
rootPkg.pkg.workspaces.push(basePackageName);
|
|
132
|
+
rootPkg.readme += `\n- [${basePackageName}](./${basePackageName}/README.md)`;
|
|
133
|
+
await writePackage(path.resolve(dir, '..'), rootPkg);
|
|
134
|
+
}
|
|
135
|
+
function onCancel() {
|
|
136
|
+
cancelled = true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
execute();
|
|
140
|
+
async function readPackage(dir) {
|
|
141
|
+
const packageFileName = path.resolve(dir, 'package.json');
|
|
142
|
+
const readmeFileName = path.resolve(dir, 'README.md');
|
|
143
|
+
try {
|
|
144
|
+
const pkgFile = await fs.readFile(packageFileName);
|
|
145
|
+
const readmeFile = await fs.readFile(readmeFileName);
|
|
146
|
+
return {
|
|
147
|
+
pkg: JSON.parse(pkgFile.toString()),
|
|
148
|
+
readme: readmeFile.toString()
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
console.error(e);
|
|
153
|
+
process.exit(-1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function writePackage(dir, pkg) {
|
|
157
|
+
const packageFileName = path.resolve(dir, 'package.json');
|
|
158
|
+
const readmeFileName = path.resolve(dir, 'README.md');
|
|
159
|
+
try {
|
|
160
|
+
await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2));
|
|
161
|
+
await fs.writeFile(readmeFileName, pkg.readme);
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
console.error(e);
|
|
165
|
+
process.exit(-1);
|
|
166
|
+
}
|
|
169
167
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.1.
|
|
2
|
+
"version": "1.1.10",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "create-pkgbld",
|
|
5
5
|
"author": {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
17
18
|
"main": "./dist/index.cjs",
|
|
18
19
|
"module": "./dist/index.mjs",
|
|
19
20
|
"files": [
|
|
@@ -39,9 +40,9 @@
|
|
|
39
40
|
"@types/degit": "2.8.3",
|
|
40
41
|
"@types/git-user-name": "2.0.1",
|
|
41
42
|
"@types/parse-git-config": "3.0.1",
|
|
42
|
-
"@types/prompts": "2.4.
|
|
43
|
+
"@types/prompts": "2.4.4",
|
|
43
44
|
"@types/minimist": "1.2.2",
|
|
44
|
-
"pkgbld": "1.
|
|
45
|
+
"pkgbld": "1.16.3"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
48
|
"degit": "2.8.4",
|