Skip to content

Commit

Permalink
updates and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
renhiyama committed Oct 26, 2023
1 parent c8b7dad commit e5cdcb9
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reejs",
"version": "0.15.5",
"version": "0.16.0",
"description": "",
"type": "module",
"main": "src/cli/index.js",
Expand Down Expand Up @@ -32,4 +32,4 @@
".": "./imports.js",
"./packit": "./packit-intellisense.js"
}
}
}
7 changes: 6 additions & 1 deletion src/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ let shouldInstall = await clack.confirm({
message: g("Should we install dependencies for you?"),
});
const s = await clack.spinner();
s.start(g("Setting up..."));
s.start(g("Setting up"));

async function getLatestVersion(packageName) {
let res = await fetch(`https://registry.npmjs.org/${packageName}`);
Expand Down Expand Up @@ -221,6 +221,11 @@ fs.writeFileSync(
//setup import maps URLs
let importmap = {},
browserimportmap = {};
importmap["@reejs/server"] = GetPackage("@reejs/server");
importmap["@reejs/utils/log.js"] = GetPackage("@reejs/utils/log.js");
importmap["@reejs/react/app.jsx"] = GetPackage("@reejs/react/app.jsx");
importmap["@reejs/imports/debug.js"] = GetPackage("@reejs/imports/debug.js");

if (features.includes("react")) {
importmap["react"] = GetPackage("react");
importmap["react-dom"] = GetPackage("react-dom");
Expand Down
4 changes: 2 additions & 2 deletions src/create/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-reejs",
"version": "0.15.5",
"version": "0.16.0",
"description": "",
"type": "module",
"main": "index.js",
Expand All @@ -13,4 +13,4 @@
"bin": {
"create-reejs": "./index.js"
}
}
}
59 changes: 27 additions & 32 deletions src/imports/URLImportInstaller.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ if (!fs.existsSync(path.join(_reejsDir, "failsafe", "package.json")))
if (!globalThis.fetch) {
if (!fs.existsSync(path.join(_reejsDir, "failsafe", "fetch.js"))) {
let fetchFileCode = await fetchUrl(
`${
process.env.ESM_SERVER || "https://esm.sh"
`${process.env.ESM_SERVER || "https://esm.sh"
}/v128/[email protected]/node/node-fetch.bundle.mjs`
);
fs.writeFileSync(
Expand Down Expand Up @@ -163,21 +162,21 @@ let URLToFile = function (url, noFolderPath = false, reejsDir) {

let fileString = noFolderPath
? "./" +
crypto
.createHash("sha256")
.update(url + UA)
.digest("hex")
.slice(0, 6) +
fileExt
: path.join(
reejsDir == true ? path.join(processCwd, ".reejs") : _reejsDir,
"cache",
crypto
.createHash("sha256")
.update(url + UA)
.digest("hex")
.slice(0, 6) +
fileExt
: path.join(
reejsDir == true ? path.join(processCwd, ".reejs") : _reejsDir,
"cache",
crypto
.createHash("sha256")
.update(url + UA)
.digest("hex")
.slice(0, 6) + fileExt
);
.slice(0, 6) + fileExt
);
return fileString;
};

Expand All @@ -187,9 +186,9 @@ let followRedirect = async function (url, forBrowser = false) {
return (
await fetch(
(process.env.ESM_SERVER || "https://esm.sh/") +
"/" +
url.replace("npm:", "") +
"?bundle",
"/" +
url.replace("npm:", "") +
"?bundle",
{
headers: {
"User-Agent": forBrowser
Expand Down Expand Up @@ -239,8 +238,7 @@ let lexer, parser;

if (!fs.existsSync(path.join(_reejsDir, "failsafe", "spinnies.js"))) {
let spinniesCode = await fetchUrl(
`${process.env.ESM_SERVER || "https://esm.sh"}/v128/[email protected]/${
globalThis?.Deno ? "denonext" : "node"
`${process.env.ESM_SERVER || "https://esm.sh"}/v128/[email protected]/${globalThis?.Deno ? "denonext" : "node"
}/spinnies.bundle.mjs`
);
fs.writeFileSync(
Expand Down Expand Up @@ -326,11 +324,10 @@ let dl = async function (
});
let res = await followRedirect(url, forBrowser); //returns url
if (fs.existsSync(URLToFile(res, null, cli))) {
if (res != url && !NOTIFIED_UPDATE_URL.startsWith(url)) {
if (res != url && !NOTIFIED_UPDATE_URL.some(u => u == url)) {
spinners.succeed(originalUrl, {
text: styleit(
`${
isChild ? "├─ " : ""
`${isChild ? "├─ " : ""
}🪄 %c Please use specific version for %c${url} %cto access %c${res} %cfaster without pinging for latest version`,
"",
"color: yellow",
Expand Down Expand Up @@ -386,8 +383,7 @@ let dl = async function (
//set timeout for fetch for 30 secs, after which throw error
let timeout = setTimeout(async () => {
throw new Error(
`Failed to download ${finalURL}\nUser Agent: ${
forBrowser ? `Mozilla/5.0 (reejs/${pkgJson.version})` : UA
`Failed to download ${finalURL}\nUser Agent: ${forBrowser ? `Mozilla/5.0 (reejs/${pkgJson.version})` : UA
}\n${await res.text()}`
);
}, 30000);
Expand Down Expand Up @@ -471,10 +467,10 @@ let dl = async function (
ext === "jsx"
? ["jsx"]
: ext === "ts"
? ["typescript"]
: ext === "tsx"
? ["typescript", "jsx"]
: [];
? ["typescript"]
: ext === "tsx"
? ["typescript", "jsx"]
: [];
code = parser.transform(code, {
transforms,
production: true,
Expand Down Expand Up @@ -561,9 +557,9 @@ let dl = async function (
if (e.startsWith("npm:")) {
return await followRedirect(
(process.env.ESM_SERVER || "https://esm.sh") +
"/" +
e.replace("npm:", "") +
"?bundle",
"/" +
e.replace("npm:", "") +
"?bundle",
forBrowser
);
} else if (e.startsWith("/")) {
Expand Down Expand Up @@ -692,8 +688,7 @@ let dl = async function (
if ((isChild && process.env.DEBUG) || !isChild)
spinners.update(originalUrl, {
text: styleit(
`${isChild ? "├─ " : ""}%c${finalURL} %cin %c${
(Date.now() - start) / 1000
`${isChild ? "├─ " : ""}%c${finalURL} %cin %c${(Date.now() - start) / 1000
}s`,
"",
"color: blue",
Expand Down
4 changes: 2 additions & 2 deletions src/imports/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reejs/imports",
"version": "2.7.5",
"version": "2.8.0",
"description": "URL Imports, Native Imports and Dynamic Imports helper for Reejs. Can be easily used without installing Reejs.",
"main": "index.js",
"type": "module",
Expand All @@ -17,4 +17,4 @@
"type": "git",
"url": "https://github.com/rovelstars/reejs.git"
}
}
}
4 changes: 2 additions & 2 deletions src/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reejs/react",
"version": "0.15.5",
"version": "0.16.0",
"description": "",
"type": "module",
"main": "index.js",
Expand All @@ -10,4 +10,4 @@
"keywords": [],
"author": "",
"license": "MIT"
}
}
4 changes: 2 additions & 2 deletions src/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reejs/server",
"version": "0.15.5",
"version": "0.16.0",
"description": "",
"type": "module",
"main": "index.js",
Expand All @@ -10,4 +10,4 @@
"keywords": [],
"author": "",
"license": "MIT"
}
}
4 changes: 2 additions & 2 deletions src/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reejs/utils",
"version": "1.6.5",
"version": "1.7.0",
"description": "",
"type": "module",
"scripts": {
Expand All @@ -12,4 +12,4 @@
"dependencies": {
"@reejs/imports": "*"
}
}
}

0 comments on commit e5cdcb9

Please sign in to comment.