Added app pin and startup properties
This commit is contained in:
parent
b3c44081f5
commit
001d382863
9 changed files with 91 additions and 46 deletions
32
README.md
32
README.md
|
|
@ -47,47 +47,55 @@ Each package follows a similar structure and has a `src/main.ts` entry file.
|
|||
|
||||
## Scripts
|
||||
|
||||
These are the scripts in logical order, that will be available when you have installed the dependencies. Note that certain scripts can be omitted by running another script. For more information about scripts #1, #2 and #3, check the [officiel Vite documentation](https://vitejs.dev/guide/cli.html).
|
||||
These are the scripts in logical order, that will be available when you have installed the dependencies. Note that certain scripts can be omitted by running another script. For more information about scripts #1, #2 and #3, check the [officiel Vite documentation](https://vitejs.dev/guide/cli.html). ProzillaOS uses [pnpm](https://pnpm.io/) as its package manager.
|
||||
|
||||
### Main scripts
|
||||
|
||||
1. `npm run start`
|
||||
These scripts are related to the website and its lifecycle.
|
||||
|
||||
1. `pnpm start`
|
||||
|
||||
Start Vite dev server at [localhost:3000](http://localhost:3000/). Changes to module will dynamically be hot-reloaded, so normally there is no need for hard-refreshes. VSCode is configured to run this script whenever the project is opened.
|
||||
|
||||
2. `npm run build`
|
||||
2. `pnpm run build`
|
||||
|
||||
Compile project using TypeScript and bundle all files into the `dist` directory, or the directory specified in config file. This directory can be uploaded to a web server.
|
||||
|
||||
3. `npm run serve`
|
||||
3. `pnpm run serve`
|
||||
|
||||
Start web server with preview of build at [localhost:8080](http://localhost:8080/). Can be useful for testing build before deploying.
|
||||
|
||||
4. `npm run stage`
|
||||
4. `pnpm run stage`
|
||||
|
||||
Execute [stage.ts](../scripts/stage.ts), which stages the build and prepares it for deployment. Script will generate a sitemap, robots.txt and all other necessary files.
|
||||
|
||||
5. `npm run deploy`
|
||||
5. `pnpm run deploy`
|
||||
|
||||
Run scripts #2 and #4, then execute [deploy.ts](../scripts/deploy.ts), which uploads the staged build to GitHub Pages on branch called `gh-pages`. This should then trigger a GitHub Action that deploys the build to production.
|
||||
|
||||
### Extra scripts
|
||||
|
||||
- `npm run fetch`
|
||||
- `pnpm run fetch`
|
||||
|
||||
Fetch the repository tree using GitHub's API and store it as a JSON file that will be used to populate the virtual drive. More information can be found on the [virtual drive](./features/virtual-drive/README.md) page.
|
||||
|
||||
### Packages scripts
|
||||
### Scripts/commands for packages
|
||||
|
||||
- `npm run packages:build`
|
||||
These scripts are related to the packages in this project and their lifecycles.
|
||||
|
||||
Build all packages in sequential order and output to respective `dist` directories.
|
||||
- `pnpm --filter <package_selector> build`
|
||||
|
||||
- `npm run packages:update`
|
||||
Build a sepecific subset of packages or a single package and output to respective `dist` directory/directories. For more information about selecting specific packages, read [pnpm's documentation on filtering](https://pnpm.io/filtering).
|
||||
|
||||
- `pnpm run packages:build`
|
||||
|
||||
Build all packages using Vite in sequential order and output to respective `dist` directories.
|
||||
|
||||
- `pnpm run packages:update`
|
||||
|
||||
Create a new changeset for packages and update their version accordingly.
|
||||
|
||||
- `npm run packages:release`
|
||||
- `pnpm run packages:release`
|
||||
|
||||
Publish the latest versions of each package to the npm registry.
|
||||
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@
|
|||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-react": "^7.34.3",
|
||||
"eslint-plugin-react-refresh": "^0.4.7",
|
||||
"gh-pages": "^5.0.0",
|
||||
"gh-pages": "^6.1.1",
|
||||
"stylelint": "^16.6.1",
|
||||
"tsx": "^4.15.6",
|
||||
"typescript": "^5.4.5",
|
||||
"typescript-eslint": "^7.13.1",
|
||||
"vite-plugin-checker": "^0.6.4"
|
||||
"vite-plugin-checker": "^0.7.1"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { App, Vector2 } from "@prozilla-os/core";
|
|||
import { Calculator } from "./components/Calculator";
|
||||
|
||||
const calculator = new App("Calculator", "calculator", Calculator, { size: new Vector2(400, 600) })
|
||||
.setIconUrl("https://os.prozilla.dev/assets/apps/icons/calculator.svg");
|
||||
.setIconUrl("https://os.prozilla.dev/assets/apps/icons/calculator.svg")
|
||||
.setPinnedByDefault(false);
|
||||
|
||||
export { calculator };
|
||||
|
|
@ -2,6 +2,7 @@ import { App } from "@prozilla-os/core";
|
|||
import { LogicSim } from "./components/LogicSim";
|
||||
|
||||
const logicSim = new App("Logic Sim", "logic-sim", LogicSim)
|
||||
.setIconUrl("https://os.prozilla.dev/assets/apps/icons/logic-sim.svg");
|
||||
.setIconUrl("https://os.prozilla.dev/assets/apps/icons/logic-sim.svg")
|
||||
.setPinnedByDefault(false);
|
||||
|
||||
export { logicSim };
|
||||
|
|
@ -52,6 +52,18 @@ export class App<AppProps extends WindowProps = WindowProps> {
|
|||
*/
|
||||
associatedExtensions: string[] = [];
|
||||
|
||||
/**
|
||||
* Determines whether the app is pinned by default
|
||||
* @default true
|
||||
*/
|
||||
pinnedByDefault = true;
|
||||
|
||||
/**
|
||||
* Determiens whether the app is launched at startup
|
||||
* @default false
|
||||
*/
|
||||
launchAtStartup = false;
|
||||
|
||||
isActive: boolean = false;
|
||||
isPinned?: boolean;
|
||||
|
||||
|
|
@ -114,4 +126,20 @@ export class App<AppProps extends WindowProps = WindowProps> {
|
|||
this.associatedExtensions = extensions ?? [];
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes whether this application is pinned by default or not
|
||||
*/
|
||||
setPinnedByDefault(pinnedByDefault: boolean): this {
|
||||
this.pinnedByDefault = pinnedByDefault;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes whether this application is launched at startup or not
|
||||
*/
|
||||
setLaunchAtStartup(launchAtStartup: boolean): this {
|
||||
this.launchAtStartup = launchAtStartup;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -54,11 +54,11 @@ export class VirtualFile extends VirtualBase {
|
|||
/**
|
||||
* Sets the content of this file and removes the source
|
||||
*/
|
||||
setContent(content: string): this {
|
||||
setContent(content: string | string[]): this {
|
||||
if (this.content === content || !this.canBeEdited)
|
||||
return this;
|
||||
|
||||
this.content = content;
|
||||
this.content = typeof content === "string" ? content : content.join("\n");
|
||||
this.source = null;
|
||||
|
||||
this.emit(VirtualFile.EVENT_NAMES.CONTENT_CHANGE, this);
|
||||
|
|
|
|||
|
|
@ -15,16 +15,24 @@ export function loadDefaultData(systemManager: SystemManager, virtualRoot: Virtu
|
|||
folder.setAlias("~")
|
||||
.createFolder(".config", (folder) => {
|
||||
folder.createFile("desktop", "xml", (file) => {
|
||||
file.setContent(`<options>
|
||||
<wallpaper>${desktopConfig.defaultWallpaper}</wallpaper>
|
||||
<show-icons>true</show-icons>
|
||||
</options>`);
|
||||
file.setContent([
|
||||
"<options>",
|
||||
` <wallpaper>${desktopConfig.defaultWallpaper}</wallpaper>`,
|
||||
" <show-icons>true</show-icons>",
|
||||
"</options>",
|
||||
]);
|
||||
}).createFile("taskbar", "xml", (file) => {
|
||||
file.setContent(`<options>
|
||||
<pins>${appsConfig.apps.map(({ id }) => id).join(",")}</pins>
|
||||
</options>`);
|
||||
file.setContent([
|
||||
"<options>",
|
||||
` <pins>${appsConfig.apps.filter((app) => app.pinnedByDefault).map(({ id }) => id).join(",")}</pins>`,
|
||||
"</options>",
|
||||
]);
|
||||
}).createFile("apps", "xml", (file) => {
|
||||
file.setContent("<options></options>");
|
||||
file.setContent([
|
||||
"<options>",
|
||||
` <startup>${appsConfig.apps.filter((app) => app.launchAtStartup).map(({ id }) => id).join(",")}</startup>`,
|
||||
"</options>",
|
||||
]);
|
||||
}).createFile("theme", "xml", (file) => {
|
||||
file.setContent("<options><theme>0</theme></options>");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ importers:
|
|||
specifier: ^0.2.2
|
||||
version: 0.2.2(@fortawesome/fontawesome-svg-core@6.5.2)(react@18.3.1)
|
||||
'@prozilla-os/logic-sim':
|
||||
specifier: workspace:^
|
||||
specifier: workspace:*
|
||||
version: link:packages/apps/logic-sim
|
||||
prozilla-os:
|
||||
specifier: workspace:*
|
||||
|
|
@ -82,8 +82,8 @@ importers:
|
|||
specifier: ^0.4.7
|
||||
version: 0.4.7(eslint@8.57.0)
|
||||
gh-pages:
|
||||
specifier: ^5.0.0
|
||||
version: 5.0.0
|
||||
specifier: ^6.1.1
|
||||
version: 6.1.1
|
||||
stylelint:
|
||||
specifier: ^16.6.1
|
||||
version: 16.6.1(typescript@5.4.5)
|
||||
|
|
@ -97,8 +97,8 @@ importers:
|
|||
specifier: ^7.13.1
|
||||
version: 7.13.1(eslint@8.57.0)(typescript@5.4.5)
|
||||
vite-plugin-checker:
|
||||
specifier: ^0.6.4
|
||||
version: 0.6.4(eslint@8.57.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.4.5))(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.6)(less@4.2.0))(vue-tsc@1.8.27(typescript@5.4.5))
|
||||
specifier: ^0.7.1
|
||||
version: 0.7.1(eslint@8.57.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.4.5))(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.6)(less@4.2.0))
|
||||
|
||||
packages/apps/browser:
|
||||
dependencies:
|
||||
|
|
@ -1686,8 +1686,9 @@ packages:
|
|||
comma-separated-tokens@1.0.8:
|
||||
resolution: {integrity: sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==}
|
||||
|
||||
commander@2.20.3:
|
||||
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
|
||||
commander@11.1.0:
|
||||
resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
commander@8.3.0:
|
||||
resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==}
|
||||
|
|
@ -2098,8 +2099,8 @@ packages:
|
|||
get-tsconfig@4.7.5:
|
||||
resolution: {integrity: sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==}
|
||||
|
||||
gh-pages@5.0.0:
|
||||
resolution: {integrity: sha512-Nqp1SjkPIB94Xw/3yYNTUL+G2dxlhjvv1zeN/4kMC1jfViTEqhtVz/Ba1zSXHuvXCN9ADNS1dN4r5/J/nZWEQQ==}
|
||||
gh-pages@6.1.1:
|
||||
resolution: {integrity: sha512-upnohfjBwN5hBP9w2dPE7HO5JJTHzSGMV1JrLrHvNuqmjoYHg6TBrCcnEoorjG/e0ejbuvnwyKMdTyM40PEByw==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
|
|
@ -3344,8 +3345,8 @@ packages:
|
|||
resolution: {integrity: sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==}
|
||||
engines: {node: '>= 0.10'}
|
||||
|
||||
vite-plugin-checker@0.6.4:
|
||||
resolution: {integrity: sha512-2zKHH5oxr+ye43nReRbC2fny1nyARwhxdm0uNYp/ERy4YvU9iZpNOsueoi/luXw5gnpqRSvjcEPxXbS153O2wA==}
|
||||
vite-plugin-checker@0.7.1:
|
||||
resolution: {integrity: sha512-Yby+Dr6+cJlkoPagqdQQn21+ZPaYwonNSlW3VpZzoyDAxoYt7YUDhzSYrCa15iTe+X4IpiNC882a3oomxCXyTA==}
|
||||
engines: {node: '>=14.16'}
|
||||
peerDependencies:
|
||||
eslint: '>=7'
|
||||
|
|
@ -3356,7 +3357,7 @@ packages:
|
|||
vite: '>=2.0.0'
|
||||
vls: '*'
|
||||
vti: '*'
|
||||
vue-tsc: '>=1.3.9'
|
||||
vue-tsc: '>=2.0.0'
|
||||
peerDependenciesMeta:
|
||||
eslint:
|
||||
optional: true
|
||||
|
|
@ -4808,7 +4809,7 @@ snapshots:
|
|||
|
||||
comma-separated-tokens@1.0.8: {}
|
||||
|
||||
commander@2.20.3: {}
|
||||
commander@11.1.0: {}
|
||||
|
||||
commander@8.3.0: {}
|
||||
|
||||
|
|
@ -5348,14 +5349,14 @@ snapshots:
|
|||
dependencies:
|
||||
resolve-pkg-maps: 1.0.0
|
||||
|
||||
gh-pages@5.0.0:
|
||||
gh-pages@6.1.1:
|
||||
dependencies:
|
||||
async: 3.2.5
|
||||
commander: 2.20.3
|
||||
commander: 11.1.0
|
||||
email-addresses: 5.0.0
|
||||
filenamify: 4.3.0
|
||||
find-cache-dir: 3.3.2
|
||||
fs-extra: 8.1.0
|
||||
fs-extra: 11.2.0
|
||||
globby: 6.1.0
|
||||
|
||||
glob-parent@5.1.2:
|
||||
|
|
@ -6654,7 +6655,7 @@ snapshots:
|
|||
|
||||
validator@13.12.0: {}
|
||||
|
||||
vite-plugin-checker@0.6.4(eslint@8.57.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.4.5))(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.6)(less@4.2.0))(vue-tsc@1.8.27(typescript@5.4.5)):
|
||||
vite-plugin-checker@0.7.1(eslint@8.57.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.4.5))(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.6)(less@4.2.0)):
|
||||
dependencies:
|
||||
'@babel/code-frame': 7.24.7
|
||||
ansi-escapes: 4.3.2
|
||||
|
|
@ -6664,7 +6665,6 @@ snapshots:
|
|||
fast-glob: 3.3.2
|
||||
fs-extra: 11.2.0
|
||||
npm-run-path: 4.0.1
|
||||
semver: 7.6.2
|
||||
strip-ansi: 6.0.1
|
||||
tiny-invariant: 1.3.3
|
||||
vite: 5.3.1(@types/node@20.14.6)(less@4.2.0)
|
||||
|
|
@ -6677,7 +6677,6 @@ snapshots:
|
|||
optionator: 0.9.4
|
||||
stylelint: 16.6.1(typescript@5.4.5)
|
||||
typescript: 5.4.5
|
||||
vue-tsc: 1.8.27(typescript@5.4.5)
|
||||
|
||||
vite-plugin-dts@3.9.1(@types/node@20.14.6)(rollup@4.18.0)(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.6)(less@4.2.0)):
|
||||
dependencies:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ const ENABLE_ALIASES = true;
|
|||
* Enables importing local packages from their dist (build) directory instead of their src directory
|
||||
* Useful for testing builds before publishing
|
||||
*/
|
||||
const USE_PACKAGE_BUILDS = true;
|
||||
const USE_PACKAGE_BUILDS = false;
|
||||
|
||||
function generateAliases() {
|
||||
if (!ENABLE_ALIASES) return {};
|
||||
|
|
|
|||
Loading…
Reference in a new issue