@compiiile/compiiile 2.7.3 → 2.7.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.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/bin/config.js +20 -16
  3. package/package.json +3 -1
package/README.md CHANGED
@@ -49,14 +49,14 @@ You can install Compiiile either globally or per-project:
49
49
 
50
50
  ### Globally
51
51
 
52
- Open a terminal and type the following command:
52
+ Open a terminal and type one of these commands, whether using [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/) depending on which package manager you are using:
53
53
 
54
54
  ```bash
55
+ yarn global add @compiiile/compiiile # install globally with yarn
56
+ # or
55
57
  npm install -g @compiiile/compiiile # install globally with npm
56
58
  ```
57
59
 
58
- > Global installation won't work using `yarn` because modules are not resolved the same way.
59
-
60
60
  ### Per-project
61
61
 
62
62
  Open a terminal inside the folder containing your markdown files. Then, add Compiiile as a local command using yarn or
@@ -72,14 +72,14 @@ npm install @compiiile/compiiile # install as a project dependency with npm
72
72
 
73
73
  First, copy the `./Dockerfile` from this repo to your root folder.
74
74
 
75
- Run the following commands :
75
+ Run the following commands:
76
76
 
77
77
  ```bash
78
78
  docker build -t <custom-image-name> .
79
79
  docker run -p 8080:80 <custom-image-name>
80
80
  ```
81
81
 
82
- > Replace `<custom-image-name>` with the tag you want.
82
+ > Replace `<custom-image-name>` with the tag you want. You should get Compiiile running on http://localhost:8080.
83
83
 
84
84
  ## Quick start
85
85
 
package/bin/config.js CHANGED
@@ -6,6 +6,8 @@ import mdx from "@astrojs/mdx"
6
6
  import path from "node:path"
7
7
  import { copyFileSync, cpSync } from "node:fs"
8
8
  import markdownConfig from "./vitePluginCompiiile/markdownConfig.js"
9
+ import resolvePackagePath from "resolve-package-path"
10
+ import requireg from "requireg"
9
11
 
10
12
  const source = process.cwd()
11
13
  process.env.COMPIIILE_SOURCE = source
@@ -83,6 +85,12 @@ if (packageDir) {
83
85
  viteServerFsAllowList.push(packageDir)
84
86
  }
85
87
 
88
+ const resolve = (mod) => {
89
+ const resolvedModule = requireg.resolve("vue")
90
+ const packagePath = resolvePackagePath(mod,resolvedModule)
91
+ return packagePath.slice(0, packagePath.lastIndexOf("/"))
92
+ }
93
+
86
94
  const astroConfig = {
87
95
  root: new URL("../.compiiile", import.meta.url).pathname,
88
96
  srcDir: new URL("../.compiiile/src", import.meta.url).pathname,
@@ -96,22 +104,18 @@ const astroConfig = {
96
104
  "@source": source,
97
105
 
98
106
  // Adding aliases for Compiiile's build command to work when installed globally
99
- vue: path.join(new URL("../node_modules/vue", import.meta.url).pathname),
100
- "@vue/server-renderer": path.join(
101
- new URL("../node_modules/@vue/server-renderer", import.meta.url).pathname
102
- ),
103
- "@vue/runtime-dom": path.join(new URL("../node_modules/@vue/runtime-dom", import.meta.url).pathname),
104
- "@vue/runtime-core": path.join(new URL("../node_modules/@vue/runtime-core", import.meta.url).pathname),
105
- kleur: path.join(new URL("../node_modules/kleur", import.meta.url).pathname),
106
- clsx: path.join(new URL("../node_modules/clsx", import.meta.url).pathname),
107
- "html-escaper": path.join(new URL("../node_modules/html-escaper", import.meta.url).pathname),
108
- cssesc: path.join(new URL("../node_modules/cssesc", import.meta.url).pathname),
109
- "@vue/reactivity": path.join(new URL("../node_modules/@vue/reactivity", import.meta.url).pathname),
110
- "@vue/shared": path.join(new URL("../node_modules/@vue/shared", import.meta.url).pathname),
111
- fzf: path.join(new URL("../node_modules/fzf", import.meta.url).pathname),
112
- "@astrojs/internal-helpers": path.join(
113
- new URL("../node_modules/@astrojs/internal-helpers/dist", import.meta.url).pathname
114
- )
107
+ vue: resolve("vue"),
108
+ "@vue/server-renderer": resolve("@vue/server-renderer"),
109
+ "@vue/runtime-dom": resolve("@vue/runtime-dom"),
110
+ "@vue/runtime-core": resolve("@vue/runtime-core"),
111
+ kleur: resolve("kleur"),
112
+ clsx: resolve("clsx"),
113
+ "html-escaper": resolve("html-escaper"),
114
+ cssesc: resolve("cssesc"),
115
+ "@vue/reactivity": resolve("@vue/reactivity"),
116
+ "@vue/shared": resolve("@vue/shared"),
117
+ fzf: resolve("fzf"),
118
+ "@astrojs/internal-helpers": resolve("@astrojs/internal-helpers") + "/dist"
115
119
  }
116
120
  },
117
121
  server: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@compiiile/compiiile",
3
3
  "private": false,
4
- "version": "2.7.3",
4
+ "version": "2.7.4",
5
5
  "description": "The most convenient way to render a folder containing markdown files. Previewing and searching markdown files has never been that easy.",
6
6
  "author": "AlbanCrepel <alban.crepel@gmail.com>",
7
7
  "license": "GPL-3.0-only",
@@ -41,6 +41,8 @@
41
41
  "rehype-autolink-headings": "^7.0.0",
42
42
  "rehype-slug": "^6.0.0",
43
43
  "remark-emoji": "^4.0.0",
44
+ "requireg": "^0.2.2",
45
+ "resolve-package-path": "^4.0.3",
44
46
  "reveal.js": "^5.0.4",
45
47
  "sass": "^1.66.1",
46
48
  "slugify": "^1.6.6",