Skip to content

Commit

Permalink
Adding Nx and Deno (#26)
Browse files Browse the repository at this point in the history
* researching deno

* adding nx

* setting up nx projects with deno

* building out schema

* working on spec

* adding supplemental sections

* adjusting spec generation script
  • Loading branch information
tgadam authored Jun 11, 2022
1 parent feaf530 commit 40a4bbf
Show file tree
Hide file tree
Showing 33 changed files with 4,199 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting

/dist
/coverage
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [

"nrwl.angular-console",
"esbenp.prettier-vscode"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deno.enable": false
}
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@


# FsmlOrg

This project was generated using [Nx](https://nx.dev).

<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="450"></p>

🔎 **Smart, Fast and Extensible Build System**

## Adding capabilities to your workspace

Nx supports many plugins which add capabilities for developing different types of applications and different tools.

These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well.

Below are our core plugins:

- [React](https://reactjs.org)
- `npm install --save-dev @nrwl/react`
- Web (no framework frontends)
- `npm install --save-dev @nrwl/web`
- [Angular](https://angular.io)
- `npm install --save-dev @nrwl/angular`
- [Nest](https://nestjs.com)
- `npm install --save-dev @nrwl/nest`
- [Express](https://expressjs.com)
- `npm install --save-dev @nrwl/express`
- [Node](https://nodejs.org)
- `npm install --save-dev @nrwl/node`

There are also many [community plugins](https://nx.dev/community) you could add.

## Generate an application

Run `nx g @nrwl/react:app my-app` to generate an application.

> You can use any of the plugins above to generate applications as well.
When using Nx, you can create multiple applications and libraries in the same workspace.

## Generate a library

Run `nx g @nrwl/react:lib my-lib` to generate a library.

> You can also use any of the plugins above to generate libraries as well.
Libraries are shareable across libraries and applications. They can be imported from `@fsml.org/mylib`.

## Development server

Run `nx serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

## Code scaffolding

Run `nx g @nrwl/react:component my-component --project=my-app` to generate a new component.

## Build

Run `nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests

Run `nx test my-app` to execute the unit tests via [Jest](https://jestjs.io).

Run `nx affected:test` to execute the unit tests affected by a change.

## Running end-to-end tests

Run `nx e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).

Run `nx affected:e2e` to execute the end-to-end tests affected by a change.

## Understand your workspace

Run `nx graph` to see a diagram of the dependencies of your projects.

## Further help

Visit the [Nx Documentation](https://nx.dev) to learn more.



## ☁ Nx Cloud

### Distributed Computation Caching & Distributed Task Execution

<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-cloud-card.png"></p>

Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly.

Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers.

Visit [Nx Cloud](https://nx.app/) to learn more.
3 changes: 3 additions & 0 deletions app/cli/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deno.enable": true
}
5 changes: 5 additions & 0 deletions app/cli/deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tasks": {
"start": "deno run --allow-read --allow-env src/main.ts"
}
}
5 changes: 5 additions & 0 deletions app/cli/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"root": "./",
"sourceRoot": "./src",
"projectType": "application"
}
14 changes: 14 additions & 0 deletions app/cli/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import yargs from "https://deno.land/x/[email protected]/deno.ts"
import { Arguments } from "https://deno.land/x/[email protected]/deno-types.ts"

yargs(Deno.args)
.command('download <files...>', 'download a list of files', (yargs: any) => {
return yargs.positional('files', {
describe: 'a list of files to do something with'
})
}, (argv: Arguments) => {
console.info(argv)
})
.strictCommands()
.demandCommand(1)
.parse()
14 changes: 14 additions & 0 deletions fsml-org.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"folders": [
{
"path": "../fsml.org"
},
{
"path": "app/cli"
},
{
"path": "packages/spec"
}
],
"settings": {}
}
33 changes: 33 additions & 0 deletions notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

How to get a deno dep graph
https://deno.land/x/[email protected]

Writing a CLI with Deno
https://dev.to/unorthodev/build-a-simple-cli-tool-with-deno-1fmk
https://startfunction.com/2020/07/03/how-to-create-deno-cli-tool/
https://www.twilio.com/blog/use-deno-build-cli
https://levelup.gitconnected.com/build-a-cli-tool-deno-by-example-79d39f25eb0a
https://www.loginradius.com/blog/engineering/build-a-cli-tool-using-deno/


Runtype Lib for Deno
https://github.com/brandonkal/runtypes
https://github.com/brandonkal/deno-lib

TypeBox
https://github.com/sinclairzx81/typebox
https://deno.land/x/[email protected]
https://github.com/sinclairzx81/typebox/issues/143 How to output the schema

Deno + Other Projects Ergonomics
https://github.com/microsoft/vscode/issues/45470
https://github.com/denoland/vscode_deno/issues/488
https://github.com/denoland/vscode_deno/blob/main/docs/workspaceFolders.md

Audit Tools
https://github.com/SAP/fosstars-rating-core
https://deno.land/x/[email protected]
https://github.com/renovatebot/renovate/issues/12724
https://github.com/dependabot/dependabot-core/issues/2417
https://github.com/hayd/deno-udd
https://github.com/advisories
24 changes: 24 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"extends": "nx/presets/core.json",
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "fsml.org",
"affected": {
"defaultBase": "main"
},
"cli": {
"defaultCollection": "@nrwl/workspace"
},
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"e2e"
]
}
}
}
}
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "fsml.org",
"version": "0.0.0",
"license": "MIT",
"scripts": {},
"private": true,
"dependencies": {},
"devDependencies": {
"nx": "14.1.9",
"@nrwl/cli": "14.1.9",
"@nrwl/workspace": "14.1.9",
"typescript": "~4.6.2",
"prettier": "^2.5.1"
}
}
Empty file added packages/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions packages/spec/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deno.enable": true
}
5 changes: 5 additions & 0 deletions packages/spec/deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tasks": {
"start": "deno run --allow-read --allow-env example/example1.ts"
}
}
4 changes: 4 additions & 0 deletions packages/spec/example/example1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Manifest } from '../src/model.ts';

// console.log('Example 1');
console.log(JSON.stringify(Manifest, null, 2));
5 changes: 5 additions & 0 deletions packages/spec/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"root": "./",
"sourceRoot": "./src",
"projectType": "library"
}
2 changes: 2 additions & 0 deletions packages/spec/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
deno run --allow-read --allow-env example/example1.ts > spec.json && cat spec.json
Loading

0 comments on commit 40a4bbf

Please sign in to comment.