jiek 0.4.7-alpha.10 → 0.4.7-alpha.12
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.cjs +106 -64
- package/dist/cli.js +38 -5
- package/dist/cli.min.cjs +4 -4
- package/dist/cli.min.js +4 -4
- package/dist/rollup/index.cjs +43 -29
- package/dist/rollup/index.js +3 -1
- package/dist/rollup/index.min.cjs +4 -4
- package/dist/rollup/index.min.js +1 -1
- package/package.json +1 -1
- package/src/commands/build.ts +1 -2
- package/src/rollup/index.ts +1 -0
- package/src/utils/tsRegister.ts +4 -0
package/dist/cli.cjs
CHANGED
@@ -19,7 +19,10 @@ var bumper = require('@jiek/utils/bumper');
|
|
19
19
|
var entrypoints = require('@jiek/pkger/entrypoints');
|
20
20
|
|
21
21
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
22
|
-
function
|
22
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
23
|
+
|
24
|
+
function _interopNamespace(e) {
|
25
|
+
if (e && e.__esModule) return e;
|
23
26
|
var n = Object.create(null);
|
24
27
|
if (e) {
|
25
28
|
Object.keys(e).forEach(function (k) {
|
@@ -36,14 +39,20 @@ function _interopNamespaceDefault(e) {
|
|
36
39
|
return Object.freeze(n);
|
37
40
|
}
|
38
41
|
|
39
|
-
var
|
42
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
43
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
44
|
+
var detectIndent__default = /*#__PURE__*/_interopDefault(detectIndent);
|
45
|
+
var inquirer__default = /*#__PURE__*/_interopDefault(inquirer);
|
46
|
+
var require$$0__default = /*#__PURE__*/_interopDefault(require$$0);
|
47
|
+
var require$$0__default$1 = /*#__PURE__*/_interopDefault(require$$0$1);
|
48
|
+
var childProcess__namespace = /*#__PURE__*/_interopNamespace(childProcess);
|
40
49
|
|
41
50
|
let root;
|
42
51
|
function getRoot() {
|
43
52
|
if (root)
|
44
53
|
return root;
|
45
54
|
const rootOption = commander.program.getOptionValue("root");
|
46
|
-
root = rootOption ?
|
55
|
+
root = rootOption ? path__default.default.isAbsolute(rootOption) ? rootOption : path__default.default.resolve(process.cwd(), rootOption) : void 0;
|
47
56
|
return root;
|
48
57
|
}
|
49
58
|
|
@@ -87,18 +96,18 @@ async function getSelectedProjectsGraph() {
|
|
87
96
|
const root = getRoot();
|
88
97
|
const { wd, notWorkspace } = getWD();
|
89
98
|
if (!notWorkspace && type$1 === "pnpm") {
|
90
|
-
const pnpmWorkspaceFilePath =
|
91
|
-
const pnpmWorkspaceFileContent =
|
99
|
+
const pnpmWorkspaceFilePath = path__default.default.resolve(wd, "pnpm-workspace.yaml");
|
100
|
+
const pnpmWorkspaceFileContent = fs__default.default.readFileSync(pnpmWorkspaceFilePath, "utf-8");
|
92
101
|
const pnpmWorkspace = jsYaml.load(pnpmWorkspaceFileContent);
|
93
102
|
if (root === wd && !filter) {
|
94
103
|
throw new Error("root path is workspace root, please provide a filter");
|
95
104
|
}
|
96
105
|
if (root !== wd && !filter) {
|
97
|
-
const packageJSONIsExist =
|
106
|
+
const packageJSONIsExist = fs__default.default.existsSync(path__default.default.resolve(root, "package.json"));
|
98
107
|
if (!packageJSONIsExist) {
|
99
108
|
throw new Error("root path is not workspace root, please provide a filter");
|
100
109
|
}
|
101
|
-
const packageJSON = JSON.parse(
|
110
|
+
const packageJSON = JSON.parse(fs__default.default.readFileSync(path__default.default.resolve(root, "package.json"), "utf-8"));
|
102
111
|
if (!packageJSON.name) {
|
103
112
|
throw new Error("root path is not workspace root, please provide a filter");
|
104
113
|
}
|
@@ -125,14 +134,14 @@ async function getSelectedProjectsGraph() {
|
|
125
134
|
wd,
|
126
135
|
root,
|
127
136
|
value: {
|
128
|
-
[wd]: JSON.parse(
|
137
|
+
[wd]: JSON.parse(fs__default.default.readFileSync(path__default.default.resolve(wd, "package.json"), "utf-8"))
|
129
138
|
}
|
130
139
|
};
|
131
140
|
}
|
132
141
|
|
133
142
|
var name = "jiek";
|
134
143
|
var type = "module";
|
135
|
-
var version = "0.4.7-alpha.
|
144
|
+
var version = "0.4.7-alpha.11";
|
136
145
|
var description = "YiJie's personal kits.";
|
137
146
|
var bin = {
|
138
147
|
jiek: "bin/jiek.js",
|
@@ -204,6 +213,38 @@ var devDependencies = {
|
|
204
213
|
postcss: "^8.4.47",
|
205
214
|
"rollup-plugin-postcss": "^4.0.2"
|
206
215
|
};
|
216
|
+
var publishConfig = {
|
217
|
+
exports: {
|
218
|
+
"./package.json": "./package.json",
|
219
|
+
".": {
|
220
|
+
source: "./src/index.ts",
|
221
|
+
require: "./dist/index.cjs",
|
222
|
+
"default": "./dist/index.js"
|
223
|
+
},
|
224
|
+
"./cli": {
|
225
|
+
source: "./src/cli.ts",
|
226
|
+
require: "./dist/cli.cjs",
|
227
|
+
"default": "./dist/cli.js"
|
228
|
+
},
|
229
|
+
"./rollup": {
|
230
|
+
source: "./src/rollup/index.ts",
|
231
|
+
require: "./dist/rollup/index.cjs",
|
232
|
+
"default": "./dist/rollup/index.js"
|
233
|
+
},
|
234
|
+
"./cli.js": {
|
235
|
+
source: "./src/cli.ts",
|
236
|
+
require: "./dist/cli.cjs",
|
237
|
+
"default": "./dist/cli.js"
|
238
|
+
},
|
239
|
+
"./rollup.js": {
|
240
|
+
source: "./src/rollup/index.ts",
|
241
|
+
require: "./dist/rollup/index.cjs",
|
242
|
+
"default": "./dist/rollup/index.js"
|
243
|
+
}
|
244
|
+
},
|
245
|
+
main: "./dist/index.cjs",
|
246
|
+
module: "./dist/index.js"
|
247
|
+
};
|
207
248
|
var pkg = {
|
208
249
|
name: name,
|
209
250
|
type: type,
|
@@ -216,7 +257,8 @@ var pkg = {
|
|
216
257
|
imports: imports,
|
217
258
|
dependencies: dependencies,
|
218
259
|
optionalDependencies: optionalDependencies,
|
219
|
-
devDependencies: devDependencies
|
260
|
+
devDependencies: devDependencies,
|
261
|
+
publishConfig: publishConfig
|
220
262
|
};
|
221
263
|
|
222
264
|
commander.program.version(pkg.version).description(pkg.description).option("--root <root>", "root path").option("-c, --config-path <configPath>", "config path");
|
@@ -229,9 +271,10 @@ function actionRestore() {
|
|
229
271
|
new Promise((r) => resolve = r);
|
230
272
|
}
|
231
273
|
|
274
|
+
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
|
232
275
|
function packageIsExist(name) {
|
233
276
|
try {
|
234
|
-
require.resolve(name);
|
277
|
+
require$2.resolve(name);
|
235
278
|
return true;
|
236
279
|
} catch (e) {
|
237
280
|
return false;
|
@@ -256,19 +299,19 @@ function getConfigPath(root, dir) {
|
|
256
299
|
const isSupportTsLoader = !!tsRegisterName;
|
257
300
|
function configWithExtIsExist(ext) {
|
258
301
|
const filenames = [
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
302
|
+
path__default.default.resolve(process.cwd(), `${configName}.${ext}`),
|
303
|
+
path__default.default.resolve(process.cwd(), `.${configName}.${ext}`),
|
304
|
+
path__default.default.resolve(root, `${configName}.${ext}`),
|
305
|
+
path__default.default.resolve(root, `.${configName}.${ext}`)
|
263
306
|
];
|
264
307
|
if (dir) {
|
265
308
|
filenames.unshift(...[
|
266
|
-
|
267
|
-
|
309
|
+
path__default.default.resolve(dir, `${configName}.${ext}`),
|
310
|
+
path__default.default.resolve(dir, `.${configName}.${ext}`)
|
268
311
|
]);
|
269
312
|
}
|
270
313
|
for (const filename of filenames) {
|
271
|
-
if (
|
314
|
+
if (fs__default.default.existsSync(filename) && fs__default.default.lstatSync(filename).isFile()) {
|
272
315
|
return filename;
|
273
316
|
}
|
274
317
|
}
|
@@ -280,7 +323,7 @@ function getConfigPath(root, dir) {
|
|
280
323
|
if (isSupportTsLoader) {
|
281
324
|
configName = configWithExtIsExist("ts") ?? configName;
|
282
325
|
}
|
283
|
-
return
|
326
|
+
return path__default.default.resolve(root, configName);
|
284
327
|
}
|
285
328
|
function loadConfig(dir) {
|
286
329
|
const { wd: root } = getWD();
|
@@ -288,14 +331,14 @@ function loadConfig(dir) {
|
|
288
331
|
if (!configPath) {
|
289
332
|
configPath = getConfigPath(root, dir);
|
290
333
|
} else {
|
291
|
-
if (!
|
334
|
+
if (!fs__default.default.existsSync(configPath)) {
|
292
335
|
throw new Error(`config file not found: ${configPath}`);
|
293
336
|
}
|
294
|
-
if (!
|
295
|
-
configPath =
|
337
|
+
if (!path__default.default.isAbsolute(configPath)) {
|
338
|
+
configPath = path__default.default.resolve(root, configPath);
|
296
339
|
}
|
297
340
|
}
|
298
|
-
const ext =
|
341
|
+
const ext = path__default.default.extname(configPath);
|
299
342
|
let module;
|
300
343
|
switch (ext) {
|
301
344
|
case ".js":
|
@@ -304,7 +347,7 @@ function loadConfig(dir) {
|
|
304
347
|
case ".json":
|
305
348
|
return require(configPath);
|
306
349
|
case ".yaml":
|
307
|
-
return jsYaml.load(
|
350
|
+
return jsYaml.load(fs__default.default.readFileSync(configPath, "utf-8"));
|
308
351
|
case ".ts":
|
309
352
|
if (tsRegisterName) {
|
310
353
|
require(tsRegisterName);
|
@@ -326,8 +369,7 @@ function loadConfig(dir) {
|
|
326
369
|
}
|
327
370
|
|
328
371
|
const FILE_TEMPLATE = (manifest) => `
|
329
|
-
|
330
|
-
module.exports = require('jiek/rollup').template(manifest)
|
372
|
+
module.exports = require('jiek/rollup').template(${JSON.stringify(manifest, null, 2)})
|
331
373
|
`.trimStart();
|
332
374
|
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
|
333
375
|
commander.program.command("build").option("-s, --silent", "Don't display logs.").option("-e, --entries <ENTRIES>", "Specify the entries of the package.json's 'exports' field.(support glob)").action(async ({
|
@@ -344,13 +386,13 @@ commander.program.command("build").option("-s, --silent", "Don't display logs.")
|
|
344
386
|
if (Object.keys(value).length === 0) {
|
345
387
|
throw new Error("no package found");
|
346
388
|
}
|
347
|
-
const wdNodeModules =
|
348
|
-
if (!
|
349
|
-
|
389
|
+
const wdNodeModules = path__default.default.resolve(wd, "node_modules");
|
390
|
+
if (!fs__default.default.existsSync(wdNodeModules)) {
|
391
|
+
fs__default.default.mkdirSync(wdNodeModules);
|
350
392
|
}
|
351
|
-
const jiekTempDir = (...paths) =>
|
352
|
-
if (!
|
353
|
-
|
393
|
+
const jiekTempDir = (...paths) => path__default.default.resolve(wdNodeModules, ".jiek", ...paths);
|
394
|
+
if (!fs__default.default.existsSync(jiekTempDir())) {
|
395
|
+
fs__default.default.mkdirSync(jiekTempDir());
|
354
396
|
}
|
355
397
|
const rollupBinaryPath = require$1.resolve("rollup").replace(/dist\/rollup.js$/, "dist/bin/rollup");
|
356
398
|
const multiBars = new cliProgress.MultiBar({
|
@@ -365,7 +407,7 @@ commander.program.command("build").option("-s, --silent", "Don't display logs.")
|
|
365
407
|
const configFile = jiekTempDir(
|
366
408
|
`${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`
|
367
409
|
);
|
368
|
-
|
410
|
+
fs__default.default.writeFileSync(configFile, FILE_TEMPLATE(manifest));
|
369
411
|
let prefix = "";
|
370
412
|
if (tsRegisterName) {
|
371
413
|
prefix = `node -r ${tsRegisterName} `;
|
@@ -951,7 +993,7 @@ function requireFillRange () {
|
|
951
993
|
if (hasRequiredFillRange) return fillRange;
|
952
994
|
hasRequiredFillRange = 1;
|
953
995
|
|
954
|
-
const util = require$$
|
996
|
+
const util = require$$0__default.default;
|
955
997
|
const toRegexRange = requireToRegexRange();
|
956
998
|
|
957
999
|
const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
@@ -1970,7 +2012,7 @@ function requireConstants () {
|
|
1970
2012
|
if (hasRequiredConstants) return constants;
|
1971
2013
|
hasRequiredConstants = 1;
|
1972
2014
|
|
1973
|
-
const path = require$$
|
2015
|
+
const path = require$$0__default$1.default;
|
1974
2016
|
const WIN_SLASH = '\\\\/';
|
1975
2017
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
1976
2018
|
|
@@ -2157,7 +2199,7 @@ function requireUtils () {
|
|
2157
2199
|
hasRequiredUtils = 1;
|
2158
2200
|
(function (exports) {
|
2159
2201
|
|
2160
|
-
const path = require$$
|
2202
|
+
const path = require$$0__default$1.default;
|
2161
2203
|
const win32 = process.platform === 'win32';
|
2162
2204
|
const {
|
2163
2205
|
REGEX_BACKSLASH,
|
@@ -3728,7 +3770,7 @@ function requirePicomatch$1 () {
|
|
3728
3770
|
if (hasRequiredPicomatch$1) return picomatch_1;
|
3729
3771
|
hasRequiredPicomatch$1 = 1;
|
3730
3772
|
|
3731
|
-
const path = require$$
|
3773
|
+
const path = require$$0__default$1.default;
|
3732
3774
|
const scan = requireScan();
|
3733
3775
|
const parse = requireParse();
|
3734
3776
|
const utils = requireUtils();
|
@@ -4089,7 +4131,7 @@ function requireMicromatch () {
|
|
4089
4131
|
if (hasRequiredMicromatch) return micromatch_1;
|
4090
4132
|
hasRequiredMicromatch = 1;
|
4091
4133
|
|
4092
|
-
const util = require$$
|
4134
|
+
const util = require$$0__default.default;
|
4093
4135
|
const braces = requireBraces();
|
4094
4136
|
const picomatch = requirePicomatch();
|
4095
4137
|
const utils = requireUtils();
|
@@ -4604,8 +4646,8 @@ function getTemplateStr(wd, template) {
|
|
4604
4646
|
isTemplateFile = true;
|
4605
4647
|
}
|
4606
4648
|
if (isTemplateFile) {
|
4607
|
-
const templatePath =
|
4608
|
-
templateString =
|
4649
|
+
const templatePath = path__default.default.resolve(wd, template);
|
4650
|
+
templateString = fs__default.default.readFileSync(templatePath, "utf-8");
|
4609
4651
|
}
|
4610
4652
|
return templateString;
|
4611
4653
|
}
|
@@ -4614,8 +4656,8 @@ function getWDPackageJSONFiled(wd, field) {
|
|
4614
4656
|
if (wdCache.has(wd)) {
|
4615
4657
|
return wdCache.get(wd)[field];
|
4616
4658
|
}
|
4617
|
-
const packageJSONPath =
|
4618
|
-
const packageJSON = JSON.parse(
|
4659
|
+
const packageJSONPath = path__default.default.resolve(wd, "package.json");
|
4660
|
+
const packageJSON = JSON.parse(fs__default.default.readFileSync(packageJSONPath, "utf-8"));
|
4619
4661
|
wdCache.set(wd, packageJSON);
|
4620
4662
|
return packageJSON[field];
|
4621
4663
|
}
|
@@ -4625,7 +4667,7 @@ async function getName(named, name, {
|
|
4625
4667
|
workspaceName
|
4626
4668
|
}) {
|
4627
4669
|
const relativePath = cwd.replace(`${wd}/`, "");
|
4628
|
-
let basename =
|
4670
|
+
let basename = path__default.default.basename(cwd);
|
4629
4671
|
if (typeof named === "function") {
|
4630
4672
|
return named(name, {
|
4631
4673
|
full: wd,
|
@@ -4638,7 +4680,7 @@ async function getName(named, name, {
|
|
4638
4680
|
if (typeof named === "object") {
|
4639
4681
|
const isWD = cwd === wd;
|
4640
4682
|
if (isWD) {
|
4641
|
-
const { rule } = await
|
4683
|
+
const { rule } = await inquirer__default.default.prompt({
|
4642
4684
|
type: "list",
|
4643
4685
|
name: "rule",
|
4644
4686
|
message: "choose a rule",
|
@@ -4673,7 +4715,7 @@ async function getName(named, name, {
|
|
4673
4715
|
throw new Error("no matched rule");
|
4674
4716
|
}
|
4675
4717
|
if (!name && isParentMatched) {
|
4676
|
-
basename = await
|
4718
|
+
basename = await inquirer__default.default.prompt({
|
4677
4719
|
type: "input",
|
4678
4720
|
name: "name",
|
4679
4721
|
message: `the matched rule is \`${String(matchedRule)}\`, please input the basename
|
@@ -4701,7 +4743,7 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
|
|
4701
4743
|
const cwd = process.cwd();
|
4702
4744
|
const { init = {} } = loadConfig() ?? {};
|
4703
4745
|
const { wd } = getWD();
|
4704
|
-
const workspaceName =
|
4746
|
+
const workspaceName = path__default.default.basename(wd);
|
4705
4747
|
const {
|
4706
4748
|
named,
|
4707
4749
|
template,
|
@@ -4716,11 +4758,11 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
|
|
4716
4758
|
};
|
4717
4759
|
let readme = _readme;
|
4718
4760
|
if (readmeTemplate) {
|
4719
|
-
const readmeTemplatePath =
|
4720
|
-
readme =
|
4761
|
+
const readmeTemplatePath = path__default.default.resolve(wd, readmeTemplate);
|
4762
|
+
readme = fs__default.default.readFileSync(readmeTemplatePath, "utf-8");
|
4721
4763
|
}
|
4722
4764
|
const templateString = getTemplateStr(wd, template);
|
4723
|
-
const { indent = " " } =
|
4765
|
+
const { indent = " " } = detectIndent__default.default(templateString);
|
4724
4766
|
const formattingOptions = {
|
4725
4767
|
tabSize: indent.length,
|
4726
4768
|
insertSpaces: true
|
@@ -4747,7 +4789,7 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
|
|
4747
4789
|
workspaceName
|
4748
4790
|
});
|
4749
4791
|
if (!pkgDir) {
|
4750
|
-
const { dir } = await
|
4792
|
+
const { dir } = await inquirer__default.default.prompt({
|
4751
4793
|
type: "input",
|
4752
4794
|
name: "dir",
|
4753
4795
|
message: "package directory",
|
@@ -4756,7 +4798,7 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
|
|
4756
4798
|
pkgDir = dir;
|
4757
4799
|
}
|
4758
4800
|
if (!pkgName) {
|
4759
|
-
const { name: inputName } = await
|
4801
|
+
const { name: inputName } = await inquirer__default.default.prompt({
|
4760
4802
|
type: "input",
|
4761
4803
|
name: "name",
|
4762
4804
|
message: "package name",
|
@@ -4813,15 +4855,15 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
|
|
4813
4855
|
function pkgDirTo(to) {
|
4814
4856
|
if (!pkgDir)
|
4815
4857
|
throw new Error("pkgDir is not defined");
|
4816
|
-
return
|
4858
|
+
return path__default.default.resolve(pkgDir, to);
|
4817
4859
|
}
|
4818
|
-
if (!
|
4819
|
-
|
4860
|
+
if (!fs__default.default.existsSync(pkgDir))
|
4861
|
+
fs__default.default.mkdirSync(pkgDir);
|
4820
4862
|
const pkgJSONFilePath = pkgDirTo("package.json");
|
4821
|
-
if (
|
4863
|
+
if (fs__default.default.existsSync(pkgJSONFilePath)) {
|
4822
4864
|
throw new Error("package.json already exists");
|
4823
4865
|
}
|
4824
|
-
|
4866
|
+
fs__default.default.writeFileSync(pkgJSONFilePath, newJSONString);
|
4825
4867
|
console.log(newJSONString, "written to", pkgJSONFilePath);
|
4826
4868
|
const license = getWDPackageJSONFiled(wd, "license");
|
4827
4869
|
const readmeFilePath = pkgDirTo("README.md");
|
@@ -4832,7 +4874,7 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
|
|
4832
4874
|
});
|
4833
4875
|
}
|
4834
4876
|
const readmeContent = readme.replace(/\$name/g, pkgName).replace(/\$license/g, license);
|
4835
|
-
|
4877
|
+
fs__default.default.writeFileSync(readmeFilePath, readmeContent);
|
4836
4878
|
});
|
4837
4879
|
|
4838
4880
|
const intersection = (a, b) => new Set([...a].filter((i) => b.has(i)));
|
@@ -4929,10 +4971,10 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
|
|
4929
4971
|
return acc;
|
4930
4972
|
}, []);
|
4931
4973
|
for (const [dir, manifest] of manifests) {
|
4932
|
-
const oldJSONString =
|
4974
|
+
const oldJSONString = fs__default.default.readFileSync(path__default.default.join(dir, "package.json"), "utf-8");
|
4933
4975
|
const oldJSON = JSON.parse(oldJSONString) ?? "0.0.0";
|
4934
4976
|
const newVersion = bumper.bump(oldJSON.version, bumper$1);
|
4935
|
-
const { indent = " " } =
|
4977
|
+
const { indent = " " } = detectIndent__default.default(oldJSONString);
|
4936
4978
|
const formattingOptions = {
|
4937
4979
|
tabSize: indent.length,
|
4938
4980
|
insertSpaces: true
|
@@ -5004,8 +5046,8 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
|
|
5004
5046
|
}
|
5005
5047
|
}
|
5006
5048
|
try {
|
5007
|
-
|
5008
|
-
|
5049
|
+
fs__default.default.renameSync(path__default.default.join(dir, "package.json"), path__default.default.join(dir, "package.json.bak"));
|
5050
|
+
fs__default.default.writeFileSync(path__default.default.join(dir, "package.json"), newJSONString);
|
5009
5051
|
console.log(newJSONString);
|
5010
5052
|
if (preview) {
|
5011
5053
|
console.warn("preview mode");
|
@@ -5016,10 +5058,10 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
|
|
5016
5058
|
stdio: "inherit"
|
5017
5059
|
});
|
5018
5060
|
const modifyVersionPackageJSON = jsoncParser.applyEdits(oldJSONString, jsoncParser.modify(oldJSONString, ["version"], newVersion, {}));
|
5019
|
-
|
5061
|
+
fs__default.default.writeFileSync(path__default.default.join(dir, "package.json.bak"), modifyVersionPackageJSON);
|
5020
5062
|
} finally {
|
5021
|
-
|
5022
|
-
|
5063
|
+
fs__default.default.unlinkSync(path__default.default.join(dir, "package.json"));
|
5064
|
+
fs__default.default.renameSync(path__default.default.join(dir, "package.json.bak"), path__default.default.join(dir, "package.json"));
|
5023
5065
|
}
|
5024
5066
|
}
|
5025
5067
|
actionDone();
|
package/dist/cli.js
CHANGED
@@ -110,7 +110,7 @@ async function getSelectedProjectsGraph() {
|
|
110
110
|
|
111
111
|
var name = "jiek";
|
112
112
|
var type = "module";
|
113
|
-
var version = "0.4.7-alpha.
|
113
|
+
var version = "0.4.7-alpha.11";
|
114
114
|
var description = "YiJie's personal kits.";
|
115
115
|
var bin = {
|
116
116
|
jiek: "bin/jiek.js",
|
@@ -182,6 +182,38 @@ var devDependencies = {
|
|
182
182
|
postcss: "^8.4.47",
|
183
183
|
"rollup-plugin-postcss": "^4.0.2"
|
184
184
|
};
|
185
|
+
var publishConfig = {
|
186
|
+
exports: {
|
187
|
+
"./package.json": "./package.json",
|
188
|
+
".": {
|
189
|
+
source: "./src/index.ts",
|
190
|
+
require: "./dist/index.cjs",
|
191
|
+
"default": "./dist/index.js"
|
192
|
+
},
|
193
|
+
"./cli": {
|
194
|
+
source: "./src/cli.ts",
|
195
|
+
require: "./dist/cli.cjs",
|
196
|
+
"default": "./dist/cli.js"
|
197
|
+
},
|
198
|
+
"./rollup": {
|
199
|
+
source: "./src/rollup/index.ts",
|
200
|
+
require: "./dist/rollup/index.cjs",
|
201
|
+
"default": "./dist/rollup/index.js"
|
202
|
+
},
|
203
|
+
"./cli.js": {
|
204
|
+
source: "./src/cli.ts",
|
205
|
+
require: "./dist/cli.cjs",
|
206
|
+
"default": "./dist/cli.js"
|
207
|
+
},
|
208
|
+
"./rollup.js": {
|
209
|
+
source: "./src/rollup/index.ts",
|
210
|
+
require: "./dist/rollup/index.cjs",
|
211
|
+
"default": "./dist/rollup/index.js"
|
212
|
+
}
|
213
|
+
},
|
214
|
+
main: "./dist/index.cjs",
|
215
|
+
module: "./dist/index.js"
|
216
|
+
};
|
185
217
|
var pkg = {
|
186
218
|
name: name,
|
187
219
|
type: type,
|
@@ -194,7 +226,8 @@ var pkg = {
|
|
194
226
|
imports: imports,
|
195
227
|
dependencies: dependencies,
|
196
228
|
optionalDependencies: optionalDependencies,
|
197
|
-
devDependencies: devDependencies
|
229
|
+
devDependencies: devDependencies,
|
230
|
+
publishConfig: publishConfig
|
198
231
|
};
|
199
232
|
|
200
233
|
program.version(pkg.version).description(pkg.description).option("--root <root>", "root path").option("-c, --config-path <configPath>", "config path");
|
@@ -207,9 +240,10 @@ function actionRestore() {
|
|
207
240
|
new Promise((r) => resolve = r);
|
208
241
|
}
|
209
242
|
|
243
|
+
const require$2 = createRequire(import.meta.url);
|
210
244
|
function packageIsExist(name) {
|
211
245
|
try {
|
212
|
-
require.resolve(name);
|
246
|
+
require$2.resolve(name);
|
213
247
|
return true;
|
214
248
|
} catch (e) {
|
215
249
|
return false;
|
@@ -304,8 +338,7 @@ function loadConfig(dir) {
|
|
304
338
|
}
|
305
339
|
|
306
340
|
const FILE_TEMPLATE = (manifest) => `
|
307
|
-
|
308
|
-
module.exports = require('jiek/rollup').template(manifest)
|
341
|
+
module.exports = require('jiek/rollup').template(${JSON.stringify(manifest, null, 2)})
|
309
342
|
`.trimStart();
|
310
343
|
const require$1 = createRequire(import.meta.url);
|
311
344
|
program.command("build").option("-s, --silent", "Don't display logs.").option("-e, --entries <ENTRIES>", "Specify the entries of the package.json's 'exports' field.(support glob)").action(async ({
|