From 5d53a3c87813494b49e3b897a814ae90cebffe1b Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Mon, 25 Nov 2024 16:14:31 -0300 Subject: [PATCH 1/7] Export fsFolder provider Signed-off-by: Marcos Candeia --- dev/deno.json | 3 ++- dev/mod.ts | 7 +++++++ engine/mod.ts | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 dev/mod.ts diff --git a/dev/deno.json b/dev/deno.json index 4aedcb8a2..efe863304 100644 --- a/dev/deno.json +++ b/dev/deno.json @@ -2,10 +2,11 @@ "name": "@deco/dev", "version": "1.107.0", "exports": { + ".": "./mod.ts", "./tailwind": "./tailwind.ts" }, "imports": { - "@deco/deco": "jsr:@deco/deco@^1.101.22-alpha.1", + "@deco/deco": "jsr:@deco/deco@^1.107.1", "@std/fmt": "jsr:@std/fmt@^1.0.0", "@std/fs": "jsr:@std/fs@^1.0.4", "@std/path": "jsr:@std/path@^1.0.2" diff --git a/dev/mod.ts b/dev/mod.ts new file mode 100644 index 000000000..19aa44b7a --- /dev/null +++ b/dev/mod.ts @@ -0,0 +1,7 @@ +import { build } from "./tailwind.ts"; + +await build(); + +if (Deno.args.includes("build")) { + Deno.exit(0); +} diff --git a/engine/mod.ts b/engine/mod.ts index 9a3b70e73..d930b5b54 100644 --- a/engine/mod.ts +++ b/engine/mod.ts @@ -1,4 +1,6 @@ +export { newFsFolderProvider } from "./decofile/fsFolder.ts"; export { ImportMapBuilder } from "./importmap/builder.ts"; export type { ImportMapResolver } from "./importmap/builder.ts"; export type { ParsedSource } from "./schema/deps.ts"; export { initLoader, parsePath } from "./schema/parser.ts"; + From 7b438f6a49f79c5d56c965250d17b17a61e29845 Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Mon, 25 Nov 2024 16:14:46 -0300 Subject: [PATCH 2/7] Release [1.107.2-beta.1] --- deno.json | 2 +- dev/deno.json | 2 +- scripts/deno.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deno.json b/deno.json index 6f532e1b5..f12b7da0a 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@deco/deco", - "version": "1.107.0", + "version": "1.107.2-beta.1", "lock": false, "exports": { ".": "./mod.ts", diff --git a/dev/deno.json b/dev/deno.json index efe863304..055427394 100644 --- a/dev/deno.json +++ b/dev/deno.json @@ -1,6 +1,6 @@ { "name": "@deco/dev", - "version": "1.107.0", + "version": "1.107.2-beta.1", "exports": { ".": "./mod.ts", "./tailwind": "./tailwind.ts" diff --git a/scripts/deno.json b/scripts/deno.json index b5f84f1bd..b0bca156a 100644 --- a/scripts/deno.json +++ b/scripts/deno.json @@ -1,6 +1,6 @@ { "name": "@deco/scripts", - "version": "1.107.0", + "version": "1.107.2-beta.1", "exports": { "./release": "./release.ts", "./update": "./update.run.ts", From 400e1f77c7ab4a519b0501d810fc8f7fe2d5b198 Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Mon, 25 Nov 2024 16:20:19 -0300 Subject: [PATCH 3/7] Fixes permissions Signed-off-by: Marcos Candeia --- daemon/workers/denoRun.ts | 2 +- dev/deno.json | 4 ++-- dev/mod.ts | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/daemon/workers/denoRun.ts b/daemon/workers/denoRun.ts index bf48d1fc2..ca31b467d 100644 --- a/daemon/workers/denoRun.ts +++ b/daemon/workers/denoRun.ts @@ -21,7 +21,7 @@ const buildPermissionsArgs = ( for (const [key, value] of Object.entries(perm)) { if (value === "inherit") { permCache[key] ??= Deno.permissions.querySync({ - name: key as keyof Deno.PermissionOptionsObject, + name: key as Deno.PermissionDescriptor["name"], }).state; const access = permCache[key]; access === "granted" && args.push(`--allow-${key}`); diff --git a/dev/deno.json b/dev/deno.json index 055427394..e3bd29fb2 100644 --- a/dev/deno.json +++ b/dev/deno.json @@ -1,12 +1,12 @@ { "name": "@deco/dev", - "version": "1.107.2-beta.1", + "version": "1.107.0", "exports": { ".": "./mod.ts", "./tailwind": "./tailwind.ts" }, "imports": { - "@deco/deco": "jsr:@deco/deco@^1.107.1", + "@deco/deco": "jsr:@deco/deco@^1.101.22-alpha.1", "@std/fmt": "jsr:@std/fmt@^1.0.0", "@std/fs": "jsr:@std/fs@^1.0.4", "@std/path": "jsr:@std/path@^1.0.2" diff --git a/dev/mod.ts b/dev/mod.ts index 19aa44b7a..27eb4231a 100644 --- a/dev/mod.ts +++ b/dev/mod.ts @@ -1,5 +1,4 @@ import { build } from "./tailwind.ts"; - await build(); if (Deno.args.includes("build")) { From b17aecf45f5e9abe0af0258d4b84ee0c1661723a Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Mon, 25 Nov 2024 16:43:19 -0300 Subject: [PATCH 4/7] Add build decofile and decofile priority Signed-off-by: Marcos Candeia --- dev/deno.json | 4 ++-- dev/mod.ts | 24 +++++++++++++++++++----- engine/decofile/provider.ts | 15 ++++++++++++--- scripts/codemod.ts | 18 ++++++++++++++++++ 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/dev/deno.json b/dev/deno.json index e3bd29fb2..d5ee28d8f 100644 --- a/dev/deno.json +++ b/dev/deno.json @@ -1,12 +1,12 @@ { "name": "@deco/dev", - "version": "1.107.0", + "version": "1.107.2-beta.1", "exports": { ".": "./mod.ts", "./tailwind": "./tailwind.ts" }, "imports": { - "@deco/deco": "jsr:@deco/deco@^1.101.22-alpha.1", + "@deco/deco": "jsr:@deco/deco@^1.107.2-beta.1", "@std/fmt": "jsr:@std/fmt@^1.0.0", "@std/fs": "jsr:@std/fs@^1.0.4", "@std/path": "jsr:@std/path@^1.0.2" diff --git a/dev/mod.ts b/dev/mod.ts index 27eb4231a..a1e7278b8 100644 --- a/dev/mod.ts +++ b/dev/mod.ts @@ -1,6 +1,20 @@ -import { build } from "./tailwind.ts"; -await build(); +import { newFsFolderProvider } from "@deco/deco/engine"; +import { exists } from "@std/fs/exists"; +import { join } from "@std/path"; +import { build as tailwindBuild } from "./tailwind.ts"; -if (Deno.args.includes("build")) { - Deno.exit(0); -} +const DECO_FOLDER = ".deco"; +export const build = async () => { + await tailwindBuild(); + const decoFolder = join(Deno.cwd(), DECO_FOLDER); + if ( + Deno.args.includes("build") && await exists(decoFolder) + ) { + const provider = newFsFolderProvider(join(DECO_FOLDER, "blocks")); + const decofile = await provider.state(); + await Deno.writeTextFile( + join(decoFolder, "decofile.json"), + JSON.stringify(decofile, null, 2), + ); + } +}; diff --git a/engine/decofile/provider.ts b/engine/decofile/provider.ts index 9873d7aae..8c91345c6 100644 --- a/engine/decofile/provider.ts +++ b/engine/decofile/provider.ts @@ -88,10 +88,15 @@ const DECOFILE_RELEASE_ENV_VAR = "DECO_RELEASE"; // if decofile does not exists but blocks exists so it should be lazy const BLOCKS_FOLDER = join(Deno.cwd(), ".deco", "blocks"); +const BUILT_DECOFILE_PATH = join(Deno.cwd(), ".deco", "decofile.json"); const blocksFolderExistsPromise = exists(BLOCKS_FOLDER, { isDirectory: true, isReadable: true, }); +const builtDecofileExistsPromise = exists(BUILT_DECOFILE_PATH, { + isFile: true, + isReadable: true, +}); const DECOFILE_PATH_FROM_ENV = Deno.env.get(DECOFILE_RELEASE_ENV_VAR); /** @@ -110,9 +115,13 @@ export const getProvider = async ( return newFsProvider(); } - const endpoint = await blocksFolderExistsPromise - ? `folder://${BLOCKS_FOLDER}` - : DECOFILE_PATH_FROM_ENV; + let endpoint = DECOFILE_PATH_FROM_ENV; + if (await builtDecofileExistsPromise) { + endpoint = `file://${BUILT_DECOFILE_PATH}`; + } else if (await blocksFolderExistsPromise) { + endpoint = `folder://${BLOCKS_FOLDER}`; + } + if (endpoint) { console.info( colors.brightCyan( diff --git a/scripts/codemod.ts b/scripts/codemod.ts index 8551ced82..2e61f2b8c 100644 --- a/scripts/codemod.ts +++ b/scripts/codemod.ts @@ -712,12 +712,30 @@ export const runCodeMod = async (context?: CodeModContext): Promise => { return pinDecoVersion.apply(txt, ctx); }, }, + { + options: { + match: [/.gitignore$/], + }, + apply: (txt) => { + if (txt.content.includes(".deco/blocks/decofile.json")) { + return txt; + } + return { + content: `${txt.content}\n.deco/blocks/decofile.json\n`, + }; + }, + }, { options: { match: [/dev.ts$/], }, apply: (txt) => { if (txt.content.includes("@deco/dev/tailwind")) { + return { + content: txt.content.replace("@deco/dev/tailwind", "@deco/dev"), + }; + } + if (txt.content.includes("@deco/dev")) { return txt; } return { From f95633b13990cf8060b6977758e6a994ecce0a7f Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Mon, 25 Nov 2024 16:47:31 -0300 Subject: [PATCH 5/7] Fix explicit return type Signed-off-by: Marcos Candeia --- dev/mod.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/mod.ts b/dev/mod.ts index a1e7278b8..c2367ffda 100644 --- a/dev/mod.ts +++ b/dev/mod.ts @@ -4,7 +4,7 @@ import { join } from "@std/path"; import { build as tailwindBuild } from "./tailwind.ts"; const DECO_FOLDER = ".deco"; -export const build = async () => { +export const build = async (): Promise => { await tailwindBuild(); const decoFolder = join(Deno.cwd(), DECO_FOLDER); if ( From 58052f1340c362fd3d819e527da67285109b60ca Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Mon, 25 Nov 2024 16:47:56 -0300 Subject: [PATCH 6/7] Release [1.107.2-beta.3] --- deno.json | 2 +- dev/deno.json | 2 +- scripts/deno.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deno.json b/deno.json index f12b7da0a..ddb54f3f3 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@deco/deco", - "version": "1.107.2-beta.1", + "version": "1.107.2-beta.3", "lock": false, "exports": { ".": "./mod.ts", diff --git a/dev/deno.json b/dev/deno.json index d5ee28d8f..201338320 100644 --- a/dev/deno.json +++ b/dev/deno.json @@ -1,6 +1,6 @@ { "name": "@deco/dev", - "version": "1.107.2-beta.1", + "version": "1.107.2-beta.3", "exports": { ".": "./mod.ts", "./tailwind": "./tailwind.ts" diff --git a/scripts/deno.json b/scripts/deno.json index b0bca156a..26a32c7c7 100644 --- a/scripts/deno.json +++ b/scripts/deno.json @@ -1,6 +1,6 @@ { "name": "@deco/scripts", - "version": "1.107.2-beta.1", + "version": "1.107.2-beta.3", "exports": { "./release": "./release.ts", "./update": "./update.run.ts", From 33c323b1de6e18f357d0207e4b8d56d144759354 Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Mon, 25 Nov 2024 20:37:10 -0300 Subject: [PATCH 7/7] Fix github path Signed-off-by: Marcos Candeia --- scripts/codemod.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/codemod.ts b/scripts/codemod.ts index 2e61f2b8c..e234c553a 100644 --- a/scripts/codemod.ts +++ b/scripts/codemod.ts @@ -717,11 +717,11 @@ export const runCodeMod = async (context?: CodeModContext): Promise => { match: [/.gitignore$/], }, apply: (txt) => { - if (txt.content.includes(".deco/blocks/decofile.json")) { + if (txt.content.includes(".deco/decofile.json")) { return txt; } return { - content: `${txt.content}\n.deco/blocks/decofile.json\n`, + content: `${txt.content}\n.deco/decofile.json\n`, }; }, },