roamjs-components 0.76.2 → 0.76.4
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roamjs-components",
|
|
3
3
|
"description": "Expansive toolset, utilities, & components for developing RoamJS extensions.",
|
|
4
|
-
"version": "0.76.
|
|
4
|
+
"version": "0.76.4",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
"preversion": "npm run lint",
|
|
12
12
|
"version": "npm run format && git add -A src",
|
|
13
13
|
"test": "playwright test",
|
|
14
|
-
"
|
|
15
|
-
"start:new": "http-server -p 8000 build",
|
|
16
|
-
"start": "roamjs-scripts dev --depot"
|
|
14
|
+
"start": "samepage dev"
|
|
17
15
|
},
|
|
18
16
|
"sideEffects": false,
|
|
19
17
|
"license": "MIT",
|
|
@@ -45,7 +43,7 @@
|
|
|
45
43
|
"tslib": "2.2.0"
|
|
46
44
|
},
|
|
47
45
|
"dependencies": {
|
|
48
|
-
"@samepage/scripts": "^0.
|
|
46
|
+
"@samepage/scripts": "^0.62.5",
|
|
49
47
|
"@testing-library/react": "^12.1.5",
|
|
50
48
|
"aws-sdk-plus": "^0.5.3",
|
|
51
49
|
"color": "^4.0.1",
|
|
@@ -76,5 +74,35 @@
|
|
|
76
74
|
},
|
|
77
75
|
"bin": {
|
|
78
76
|
"roamjs": "./scripts/index.js"
|
|
77
|
+
},
|
|
78
|
+
"samepage": {
|
|
79
|
+
"external": [
|
|
80
|
+
"react-dom/client",
|
|
81
|
+
"@blueprintjs/core=window.Blueprint.Core",
|
|
82
|
+
"@blueprintjs/datetime=window.Blueprint.DateTime",
|
|
83
|
+
"@blueprintjs/select=window.Blueprint.Select",
|
|
84
|
+
"chrono-node=window.ChronoNode",
|
|
85
|
+
"crypto-js=window.CryptoJS",
|
|
86
|
+
"cytoscape=window.RoamLazy.Cytoscape",
|
|
87
|
+
"file-saver=window.FileSaver",
|
|
88
|
+
"jszip=window.RoamLazy.JSZip",
|
|
89
|
+
"idb=window.idb",
|
|
90
|
+
"insect=window.RoamLazy.Insect",
|
|
91
|
+
"marked=window.RoamLazy.Marked",
|
|
92
|
+
"marked-react=window.RoamLazy.MarkedReact",
|
|
93
|
+
"nanoid=window.Nanoid",
|
|
94
|
+
"react=window.React",
|
|
95
|
+
"react-dom=window.ReactDOM",
|
|
96
|
+
"react-youtube=window.ReactYoutube",
|
|
97
|
+
"tslib=window.TSLib"
|
|
98
|
+
],
|
|
99
|
+
"include": [
|
|
100
|
+
"package.json",
|
|
101
|
+
"README.md"
|
|
102
|
+
],
|
|
103
|
+
"out": "extension",
|
|
104
|
+
"mirror": ".",
|
|
105
|
+
"format": "esm",
|
|
106
|
+
"review": "node_modules/roamjs-components/scripts/publishToRoamDepot"
|
|
79
107
|
}
|
|
80
108
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
7
|
+
const dotenv_1 = tslib_1.__importDefault(require("dotenv"));
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
dotenv_1.default.config();
|
|
10
|
+
const opts = () => ({
|
|
11
|
+
headers: {
|
|
12
|
+
Accept: "application/vnd.github+json",
|
|
13
|
+
Authorization: `token ${process.env.GITHUB_TOKEN}`,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
const publishToRoamDepot = ({ owner = process.env.GITHUB_REPOSITORY_OWNER, repo = path_1.default.basename(process.cwd()), branch = repo, proxy = owner, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
console.log("Attempting to publish to Roam Depot...");
|
|
18
|
+
const pr = yield axios_1.default
|
|
19
|
+
.get(`https://api.github.com/repos/Roam-Research/roam-depot/pulls?head=${owner}:${branch}`, opts())
|
|
20
|
+
.then((r) => { var _a; return (_a = r.data[0]) === null || _a === void 0 ? void 0 : _a.html_url; });
|
|
21
|
+
const cwd = process.cwd();
|
|
22
|
+
process.chdir("/tmp");
|
|
23
|
+
(0, child_process_1.execSync)(`git clone https://${owner}:${process.env.GITHUB_TOKEN}@github.com/${owner}/roam-depot.git`, { stdio: "inherit" });
|
|
24
|
+
process.chdir("roam-depot");
|
|
25
|
+
const manifestFile = `extensions/${proxy}/${repo.replace(/^roam(js)?-/, "")}.json`;
|
|
26
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(`${cwd}/package.json`).toString());
|
|
27
|
+
const { name: authorName, email: authorEmail } = yield axios_1.default
|
|
28
|
+
.get(`https://api.github.com/user`, opts())
|
|
29
|
+
.then((r) => r.data)
|
|
30
|
+
.catch(() => packageJson.author || {});
|
|
31
|
+
(0, child_process_1.execSync)(`git config --global user.email "${authorEmail}"`, {
|
|
32
|
+
stdio: "inherit",
|
|
33
|
+
});
|
|
34
|
+
(0, child_process_1.execSync)(`git config --global user.name "${authorName}"`, {
|
|
35
|
+
stdio: "inherit",
|
|
36
|
+
});
|
|
37
|
+
(0, child_process_1.execSync)(`git remote add roam https://github.com/Roam-Research/roam-depot`, {
|
|
38
|
+
stdio: "inherit",
|
|
39
|
+
});
|
|
40
|
+
(0, child_process_1.execSync)(`git pull roam main --rebase`, { stdio: "inherit" });
|
|
41
|
+
(0, child_process_1.execSync)(`git push origin main -f`, { stdio: "inherit" });
|
|
42
|
+
if (pr) {
|
|
43
|
+
console.log("Found existing PR");
|
|
44
|
+
(0, child_process_1.execSync)(`git checkout ${branch}`, { stdio: "inherit" });
|
|
45
|
+
(0, child_process_1.execSync)(`git rebase origin/main`, { stdio: "inherit" });
|
|
46
|
+
const manifest = fs_1.default.readFileSync(manifestFile).toString();
|
|
47
|
+
fs_1.default.writeFileSync(manifestFile, manifest.replace(/"source_commit": "[a-f0-9]+",/, `"source_commit": "${process.env.GITHUB_SHA}",`));
|
|
48
|
+
console.log("Editing", manifestFile, "from", manifest, "to", process.env.GITHUB_SHA);
|
|
49
|
+
(0, child_process_1.execSync)("git add --all", { stdio: "inherit" });
|
|
50
|
+
(0, child_process_1.execSync)(`git commit -m "Version ${packageJson.version}"`, {
|
|
51
|
+
stdio: "inherit",
|
|
52
|
+
});
|
|
53
|
+
(0, child_process_1.execSync)(`git push origin ${branch} -f`, { stdio: "inherit" });
|
|
54
|
+
console.log(`Updated pull request: ${pr}`);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.log("Creating new PR");
|
|
58
|
+
(0, child_process_1.execSync)(`git checkout -b ${branch}`, { stdio: "inherit" });
|
|
59
|
+
if (!fs_1.default.existsSync(`extensions/${proxy}`))
|
|
60
|
+
fs_1.default.mkdirSync(`extensions/${proxy}`);
|
|
61
|
+
const name = repo
|
|
62
|
+
.replace(/^roam(js)?-/, "")
|
|
63
|
+
.split("-")
|
|
64
|
+
.map((s) => `${s.slice(0, 1).toUpperCase()}${s.slice(1)}`)
|
|
65
|
+
.join(" ");
|
|
66
|
+
if (fs_1.default.existsSync(manifestFile)) {
|
|
67
|
+
const manifest = fs_1.default.readFileSync(manifestFile).toString();
|
|
68
|
+
fs_1.default.writeFileSync(manifestFile, manifest.replace(/"source_commit": "[a-f0-9]+",/, `"source_commit": "${process.env.GITHUB_SHA}",`));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
fs_1.default.writeFileSync(manifestFile, JSON.stringify({
|
|
72
|
+
name,
|
|
73
|
+
short_description: (packageJson === null || packageJson === void 0 ? void 0 : packageJson.description) ||
|
|
74
|
+
"Description missing from package json",
|
|
75
|
+
author: authorName,
|
|
76
|
+
tags: (packageJson === null || packageJson === void 0 ? void 0 : packageJson.tags) || [],
|
|
77
|
+
source_url: `https://github.com/${owner}/${repo}`,
|
|
78
|
+
source_repo: `https://github.com/${owner}/${repo}.git`,
|
|
79
|
+
source_commit: process.env.GITHUB_SHA,
|
|
80
|
+
stripe_account: packageJson.stripe,
|
|
81
|
+
}, null, 4) + "\n");
|
|
82
|
+
}
|
|
83
|
+
const title = `${name}: Version ${packageJson.version}`;
|
|
84
|
+
(0, child_process_1.execSync)("git add --all", { stdio: "inherit" });
|
|
85
|
+
(0, child_process_1.execSync)(`git commit -m "${title}"`, { stdio: "inherit" });
|
|
86
|
+
(0, child_process_1.execSync)(`git push origin ${branch} -f`, { stdio: "inherit" });
|
|
87
|
+
const url = yield axios_1.default
|
|
88
|
+
.post(`https://api.github.com/repos/Roam-Research/roam-depot/pulls`, {
|
|
89
|
+
head: `${owner}:${branch}`,
|
|
90
|
+
base: "main",
|
|
91
|
+
title,
|
|
92
|
+
}, opts())
|
|
93
|
+
.then((r) => r.data.html_url)
|
|
94
|
+
.catch((e) => Promise.reject(e.response.data || e.message));
|
|
95
|
+
console.log(`Created pull request: ${url}`);
|
|
96
|
+
}
|
|
97
|
+
process.chdir(cwd);
|
|
98
|
+
});
|
|
99
|
+
exports.default = publishToRoamDepot;
|
|
100
|
+
//# sourceMappingURL=publishToRoamDepot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishToRoamDepot.js","sourceRoot":"","sources":["../../src/scripts/publishToRoamDepot.ts"],"names":[],"mappings":";;;AAAA,oDAAoB;AACpB,wDAAwB;AACxB,0DAA0B;AAC1B,4DAA4B;AAC5B,iDAAyC;AACzC,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC;IAClB,OAAO,EAAE;QACP,MAAM,EAAE,6BAA6B;QACrC,aAAa,EAAE,SAAS,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE;KACnD;CACF,CAAC,CAAC;AAEH,MAAM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