athennaio / common Goto Github PK
View Code? Open in Web Editor NEW๐งฐ The Athenna common helpers to use in any Node.js ESM project.
Home Page: https://athenna.io
License: MIT License
๐งฐ The Athenna common helpers to use in any Node.js ESM project.
Home Page: https://athenna.io
License: MIT License
3.0.1
Call Path.resolveEnvironment()
Expect that when env IS_TS
is true, that the Path.defaultBeforePath
becomes just ''
.
The Path.defaultBeforePath
is being set as /build
.
No response
System:
OS: macOS 13.1
CPU: (8) arm64 Apple M1 Pro
Memory: 91.56 MB / 16.00 GB
Shell: 5.8 - /opt/homebrew/bin/zsh
Binaries:
Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
Add the Exec.install()
method to install packages using any kind of package manager.
Using Exec.shell()
or Exec.command()
is not possible to install libraries correctly. Exec.install()
would use the package manager CLI directly to do that.
No response
Add support to Path
class to change the path of some method.
With this behavior, we are going to remove the destination
logic of make
commands in .athennarc.json
file. Also, it will be very good for the developer to use his own project structure.
Adding this behavior to Path
class will enable us to add the directories
property in our .athennarc.json
, mapping the exactly directories that Path
class should follow. And also
import { Path } from '@athenna/common'
Path.setRoutes(Path.pwd('src/routes'))
console.log(Path.routes()) // ..../src/routes
1 - Implement the Path.ext
method. This method will be responsible to return js
or ts
by verifying if the process.env.IS_TS
is true or false.
2 - Make Path.getAllJSFilesFrom
use Path.ext
to determine if the glob pattern will get .js
files or .ts
.
Athenna is totally focused in using JavaScript with ESM. But there is a big portion of developers that prefers to use TypeScript. The tc39/proposal-type-annotations is still in Stage 1. It should take a long time for this proposal to start moving, so we are going to implement helpers to support TypeScript implementation in Athenna scaffolds project.
Athenna will still be developed using JS with ESM.
No response
4.15.3
Try to read a file that does not exist. The exception will be thrown.
I expect to see a better error message that follows the actual API of File
.
The help and message content, talks about the File.create
method, which does not exist anymore.
No response
System:
OS: macOS 13.5.2
CPU: (8) arm64 Apple M1 Pro
Memory: 182.02 MB / 16.00 GB
Shell: 5.9 - /opt/homebrew/bin/zsh
Binaries:
Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
3.5.0
1 - Create an error class that does not extend vanilla JS/Node.js errors.
2 - Call Is.Exception(new YourCustomError())
.
Expected the return value to be false
.
The result is true
.
The Exception
class could have a simple instance argument called isException
. In Is.Exception
method, we can continue validating vanilla JS/Node.js errors, and also if isException
argument is true
and if the prettify
method exists inside the error instance.
System:
OS: macOS 13.2.1
CPU: (8) arm64 Apple M1 Pro
Memory: 123.92 MB / 16.00 GB
Shell: 5.9 - /opt/homebrew/bin/zsh
Binaries:
Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
The HttpClient
class will be responsible to make http requests to other services. With this class, we should be able to define global settings to use in all requests that use the HttpClient
class. This global settings will be based in HttpClientBuilder
of Apache, and we should be able to set a global instance of this builder for all HttpClient
or create another instance of HttpClient
using different HttpClientBuilder
instances.
Nowadays in Athenna if the developer needs to make any Http request he will need to use the vanilla http or https of Node.js or some library like axios or node-fetch. It would be nice if Athenna has her own implementation to do that.
No response
The FakeApi
class will be responsible for creating fake, but not totally fake, endpoints using fastify. This class should have an enjoyable API to create new endpoints, it should be very easy to create endpoints that return the following specific data in the response:
It would be very nice if FakeApi
helper could be configured using .json
files, the same way that Wiremock does. Let's suppose that we have created the resources/fakeapi/create-user.json
file:
When calling the await FakeApi.start()
helper, it should read the resources/fakeapi
folder and register all the routes inside it. The create-user.json
content would have the route path, method, status code, headers and body defined for the response:
{
"path": "/users",
"method": "POST",
"statusCode": 201,
"headers": {
"Content-Type": "application/json"
},
"body": {
"id": 1,
"name": "Robson Trasel"
}
}
Sometimes the developer needs to create more realistic tests, where he really needs to make a Http request. We have tryed to use Wiremock for this purpose, but is very hard to configure it for Node.js inside pipelines like Github Actions.
Here is an example of using the FakeApi
helper API in runtime:
const path = '/users'
const statusCode = 200
const user = { id: 1, name: 'Joรฃo Lenon' }
const arrayOfUsers = [user]
const headers = {
Content-Type: 'application/json'
}
await FakeApi.builder()
.method('GET')
.path(path)
.statusCode(statusCode)
.body(arrayOfUsers)
.headers(headers)
// Register the fake route and clear FakeApi static state:
.register()
const port = 8080
await FakeApi.start(port)
// Requesting to the endpoint we have created:
const users = await HttpClient.get('http://localhost:8080').json()
// Stop the fake server:
await FakeApi.stop()
The version of this package needs to be updated to 3.0.0.
We are going to start versioning the Athenna packages using Semver. All packages of Athenna will be updated to version 3.0.0 to start following Semver rules.
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.