@prozilla-os/shared 1.0.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/LICENSE.md +21 -0
- package/README.md +59 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.js +39 -0
- package/dist/main.js.map +1 -0
- package/package.json +40 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Sieben De Beule
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<br />
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://os.prozilla.dev/"><img src="https://os.prozilla.dev/assets/logo.svg" height="200" alt="ProzillaOS" /></a>
|
|
5
|
+
</p>
|
|
6
|
+
<p>
|
|
7
|
+
<a href="https://github.com/prozilla-os/ProzillaOS/blob/main/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/Prozilla/ProzillaOS?style=flat-square&color=FF4D5B&label=License"></a>
|
|
8
|
+
<a href="https://github.com/prozilla-os/ProzillaOS"><img alt="Stars" src="https://img.shields.io/github/stars/Prozilla/ProzillaOS?style=flat-square&color=FED24C&label=%E2%AD%90"></a>
|
|
9
|
+
<a href="https://github.com/prozilla-os/ProzillaOS"><img alt="Forks" src="https://img.shields.io/github/forks/Prozilla/ProzillaOS?style=flat-square&color=4D9CFF&label=Forks&logo=github"></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/prozilla-os"><img alt="NPM Version" src="https://img.shields.io/npm/v/prozilla-os?logo=npm&style=flat-square&label=prozilla-os&color=FF4D5B"></a>
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
## About
|
|
15
|
+
|
|
16
|
+
`@prozilla-os/shared` is a library of shared utility functions for ProzillaOS packages.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
$ npm install @prozilla-os/shared
|
|
22
|
+
$ yarn add @prozilla-os/shared
|
|
23
|
+
$ pnpm add @prozilla-os/shared
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### `appViteConfig(basePath, entryPath)`
|
|
29
|
+
|
|
30
|
+
Helper function for creating Vite configurations for ProzillaOS apps.
|
|
31
|
+
|
|
32
|
+
#### Params
|
|
33
|
+
|
|
34
|
+
- `basePath` (string) - Path of base directory
|
|
35
|
+
- `entryPath` (string) - Path of library entry
|
|
36
|
+
|
|
37
|
+
#### Example
|
|
38
|
+
```tsx
|
|
39
|
+
// vite.config.ts
|
|
40
|
+
|
|
41
|
+
import { defineConfig } from "vite";
|
|
42
|
+
import { appViteConfig } from "@prozilla-os/shared";
|
|
43
|
+
|
|
44
|
+
export default defineConfig({
|
|
45
|
+
...appViteConfig(__dirname, "src/main.ts")
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Links
|
|
50
|
+
|
|
51
|
+
- [Website/demo][website]
|
|
52
|
+
- [GitHub][github]
|
|
53
|
+
- [npm][npm]
|
|
54
|
+
- [Ko-fi][ko-fi]
|
|
55
|
+
|
|
56
|
+
[website]: https://os.prozilla.dev/
|
|
57
|
+
[github]: https://github.com/prozilla-os/ProzillaOS/tree/convert-to-monorepo/packages/shared
|
|
58
|
+
[npm]: https://www.npmjs.com/package/@prozilla-os/shared
|
|
59
|
+
[ko-fi]: https://ko-fi.com/prozilla
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UserConfig } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper function for creating Vite configurations for ProzillaOS apps
|
|
5
|
+
* @param basePath - Path of base directory
|
|
6
|
+
* @param entryPath - Path of library entry
|
|
7
|
+
* @returns Vite configuration
|
|
8
|
+
* @see https://vitejs.dev/config/
|
|
9
|
+
*/
|
|
10
|
+
export declare const appViteConfig: (basePath: string, entryPath: string) => UserConfig;
|
|
11
|
+
|
|
12
|
+
export { }
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import r from "@vitejs/plugin-react-swc";
|
|
2
|
+
import i from "vite-plugin-dts";
|
|
3
|
+
import { libInjectCss as l } from "vite-plugin-lib-inject-css";
|
|
4
|
+
import { resolve as n, sep as t, posix as p } from "path";
|
|
5
|
+
const f = (s, o) => {
|
|
6
|
+
let e = n(s, o);
|
|
7
|
+
return t === "\\" && (e = e.split(t).join(p.sep)), console.log("Using Vite config for app"), console.log("Entry: " + e), {
|
|
8
|
+
plugins: [
|
|
9
|
+
r(),
|
|
10
|
+
l(),
|
|
11
|
+
i({
|
|
12
|
+
include: ["src"],
|
|
13
|
+
outDir: "dist",
|
|
14
|
+
rollupTypes: !0,
|
|
15
|
+
strictOutput: !0,
|
|
16
|
+
pathsToAliases: !1,
|
|
17
|
+
tsconfigPath: "tsconfig.build.json"
|
|
18
|
+
})
|
|
19
|
+
],
|
|
20
|
+
build: {
|
|
21
|
+
lib: {
|
|
22
|
+
entry: e,
|
|
23
|
+
formats: ["es"]
|
|
24
|
+
},
|
|
25
|
+
rollupOptions: {
|
|
26
|
+
external: ["react", "react/jsx-runtime", "@prozilla-os/core"],
|
|
27
|
+
output: {
|
|
28
|
+
assetFileNames: "assets/[name][extname]",
|
|
29
|
+
entryFileNames: "[name].js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
sourcemap: !0
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
f as appViteConfig
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/configs/app.vite.config.ts"],"sourcesContent":["import { UserConfig } from \"vite\";\r\nimport react from \"@vitejs/plugin-react-swc\";\r\nimport dts from \"vite-plugin-dts\";\r\nimport { libInjectCss } from \"vite-plugin-lib-inject-css\";\r\nimport { posix, resolve, sep } from \"path\";\r\n\r\n/**\r\n * Helper function for creating Vite configurations for ProzillaOS apps\r\n * @param basePath - Path of base directory\r\n * @param entryPath - Path of library entry\r\n * @returns Vite configuration\r\n * @see https://vitejs.dev/config/\r\n */\r\nexport const appViteConfig = (basePath: string, entryPath: string): UserConfig => {\r\n\tlet entryFile = resolve(basePath, entryPath);\r\n\r\n\t// Normalize paths for Windows compatibility\r\n\tif (sep === \"\\\\\")\r\n\t\tentryFile = entryFile.split(sep).join(posix.sep);\r\n\r\n\tconsole.log(\"Using Vite config for app\");\r\n\tconsole.log(\"Entry: \" + entryFile);\r\n\r\n\treturn {\r\n\t\tplugins: [\r\n\t\t\treact(),\r\n\t\t\tlibInjectCss(),\r\n\t\t\tdts({\r\n\t\t\t\tinclude: [\"src\"],\r\n\t\t\t\toutDir: \"dist\",\r\n\t\t\t\trollupTypes: true,\r\n\t\t\t\tstrictOutput: true,\r\n\t\t\t\tpathsToAliases: false,\r\n\t\t\t\ttsconfigPath: \"tsconfig.build.json\"\r\n\t\t\t})\r\n\t\t],\r\n\t\tbuild: {\r\n\t\t\tlib: {\r\n\t\t\t\tentry: entryFile,\r\n\t\t\t\tformats: [\"es\"],\r\n\t\t\t},\r\n\t\t\trollupOptions: {\r\n\t\t\t\texternal: [\"react\", \"react/jsx-runtime\", \"@prozilla-os/core\"],\r\n\t\t\t\toutput: {\r\n\t\t\t\t\tassetFileNames: \"assets/[name][extname]\",\r\n\t\t\t\t\tentryFileNames: \"[name].js\",\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tsourcemap: true\r\n\t\t}\r\n\t};\r\n};"],"names":["appViteConfig","basePath","entryPath","entryFile","resolve","sep","posix","react","libInjectCss","dts"],"mappings":";;;;AAaa,MAAAA,IAAgB,CAACC,GAAkBC,MAAkC;AAC7E,MAAAC,IAAYC,EAAQH,GAAUC,CAAS;AAG3C,SAAIG,MAAQ,SACXF,IAAYA,EAAU,MAAME,CAAG,EAAE,KAAKC,EAAM,GAAG,IAEhD,QAAQ,IAAI,2BAA2B,GAC/B,QAAA,IAAI,YAAYH,CAAS,GAE1B;AAAA,IACN,SAAS;AAAA,MACRI,EAAM;AAAA,MACNC,EAAa;AAAA,MACbC,EAAI;AAAA,QACH,SAAS,CAAC,KAAK;AAAA,QACf,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,cAAc;AAAA,QACd,gBAAgB;AAAA,QAChB,cAAc;AAAA,MAAA,CACd;AAAA,IACF;AAAA,IACA,OAAO;AAAA,MACN,KAAK;AAAA,QACJ,OAAON;AAAA,QACP,SAAS,CAAC,IAAI;AAAA,MACf;AAAA,MACA,eAAe;AAAA,QACd,UAAU,CAAC,SAAS,qBAAqB,mBAAmB;AAAA,QAC5D,QAAQ;AAAA,UACP,gBAAgB;AAAA,UAChB,gBAAgB;AAAA,QACjB;AAAA,MACD;AAAA,MACA,WAAW;AAAA,IACZ;AAAA,EAAA;AAEF;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prozilla-os/shared",
|
|
3
|
+
"description": "A library of shared utility functions for ProzillaOS packages.",
|
|
4
|
+
"version": "1.0.1",
|
|
5
|
+
"homepage": "https://os.prozilla.dev",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Prozilla",
|
|
8
|
+
"email": "business@prozilla.dev",
|
|
9
|
+
"url": "https://prozilla.dev/"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "dist/main.js",
|
|
13
|
+
"types": "dist/main.d.ts",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/prozilla-os/ProzillaOS.git",
|
|
17
|
+
"directory": "packages/shared"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^20.14.5",
|
|
23
|
+
"@types/react": "^18.3.3",
|
|
24
|
+
"@vitejs/plugin-react-swc": "^3.7.0",
|
|
25
|
+
"typescript": "^5.4.5",
|
|
26
|
+
"vite": "^5.3.1",
|
|
27
|
+
"vite-plugin-dts": "^3.9.1",
|
|
28
|
+
"vite-plugin-lib-inject-css": "^2.1.1"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"registry": "https://registry.npmjs.org/",
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc && vite build"
|
|
39
|
+
}
|
|
40
|
+
}
|