@blinkk/create-root 1.0.0-beta.0 → 1.0.0-beta.1
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/dist/create-root.js +20 -9
- package/package.json +6 -2
package/dist/create-root.js
CHANGED
|
@@ -7,15 +7,14 @@ import fs from "fs";
|
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
import degit from "degit";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var ROOT_VERSION = "1.0.0-beta.0";
|
|
13
|
-
|
|
14
|
-
// src/create-root.ts
|
|
10
|
+
import { bgGreen, black } from "kleur/colors";
|
|
11
|
+
import { dim } from "kleur/colors";
|
|
15
12
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
16
13
|
var require2 = createRequire(import.meta.url);
|
|
17
14
|
var packageJson = require2(path.join(__dirname, "../package.json"));
|
|
15
|
+
var ROOT_VERSION = packageJson.version;
|
|
18
16
|
async function main() {
|
|
17
|
+
console.log(`\u{1F331} ${bgGreen(black(" root.js "))} v${ROOT_VERSION}`);
|
|
19
18
|
const program = new Command("create-root");
|
|
20
19
|
program.version(packageJson.version);
|
|
21
20
|
program.argument("[dir]", "output dir");
|
|
@@ -33,9 +32,10 @@ async function main() {
|
|
|
33
32
|
const repo = options.repo || "blinkk/rootjs/examples";
|
|
34
33
|
const template = options.template || "starter";
|
|
35
34
|
const githubPath = path.join(repo, template);
|
|
36
|
-
console.log(
|
|
37
|
-
console.log(
|
|
38
|
-
console.log(
|
|
35
|
+
console.log();
|
|
36
|
+
console.log(`${dim("\u2503")} github path: ${githubPath}`);
|
|
37
|
+
console.log(`${dim("\u2503")} output dir: ${maybeRelativePath(outputDir)}`);
|
|
38
|
+
console.log();
|
|
39
39
|
const emitter = degit(githubPath, {
|
|
40
40
|
cache: false,
|
|
41
41
|
force: true,
|
|
@@ -53,13 +53,24 @@ async function updatePackageJson(packageJsonPath) {
|
|
|
53
53
|
const packageJson2 = JSON.parse(str);
|
|
54
54
|
packageJson2.name = path.basename(path.dirname(packageJsonPath));
|
|
55
55
|
packageJson2.version = "1.0.0";
|
|
56
|
-
packageJson2.dependencies
|
|
56
|
+
updateWorkspaceDeps(packageJson2.dependencies);
|
|
57
|
+
updateWorkspaceDeps(packageJson2.peerDependencies);
|
|
57
58
|
await fs.promises.writeFile(
|
|
58
59
|
packageJsonPath,
|
|
59
60
|
JSON.stringify(packageJson2, null, 2),
|
|
60
61
|
"utf-8"
|
|
61
62
|
);
|
|
62
63
|
}
|
|
64
|
+
function updateWorkspaceDeps(deps) {
|
|
65
|
+
if (!deps) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
for (const key in deps) {
|
|
69
|
+
if (deps[key] === "workspace:*") {
|
|
70
|
+
deps[key] = `^${ROOT_VERSION}`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
63
74
|
function maybeRelativePath(filePath) {
|
|
64
75
|
const cwd = process.cwd();
|
|
65
76
|
const fullPath = path.resolve(filePath);
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blinkk/create-root",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "s@blinkk.com",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=16.0.0"
|
|
9
|
+
},
|
|
7
10
|
"repository": {
|
|
8
11
|
"type": "git",
|
|
9
12
|
"url": "git+https://github.com/blinkk/rootjs.git",
|
|
@@ -18,7 +21,8 @@
|
|
|
18
21
|
},
|
|
19
22
|
"dependencies": {
|
|
20
23
|
"commander": "^10.0.0",
|
|
21
|
-
"degit": "^2.8.4"
|
|
24
|
+
"degit": "^2.8.4",
|
|
25
|
+
"kleur": "^4.1.5"
|
|
22
26
|
},
|
|
23
27
|
"devDependencies": {
|
|
24
28
|
"@types/degit": "^2.8.3",
|