Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit ecf2aff

Browse files
committed
interweb build 🛠
0 parents  commit ecf2aff

File tree

21 files changed

+7318
-0
lines changed

21 files changed

+7318
-0
lines changed

.eslintrc.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"node": true,
6+
"jest": true
7+
},
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:@typescript-eslint/recommended",
11+
"prettier"
12+
],
13+
"overrides": [],
14+
"parser": "@typescript-eslint/parser",
15+
"parserOptions": {
16+
"ecmaVersion": "latest",
17+
"sourceType": "module"
18+
},
19+
"plugins": [
20+
"@typescript-eslint",
21+
"simple-import-sort",
22+
"unused-imports"
23+
],
24+
"rules": {
25+
"indent": [
26+
"error",
27+
2
28+
],
29+
"quotes": [
30+
"error",
31+
"single",
32+
{
33+
"avoidEscape": true,
34+
"allowTemplateLiterals": true
35+
}
36+
],
37+
"quote-props": [
38+
"error",
39+
"as-needed"
40+
],
41+
"semi": [
42+
"error",
43+
"always"
44+
],
45+
"simple-import-sort/imports": 1,
46+
"simple-import-sort/exports": 1,
47+
"unused-imports/no-unused-imports": 1,
48+
"@typescript-eslint/no-unused-vars": [
49+
1,
50+
{
51+
"argsIgnorePattern": "React|res|next|^_"
52+
}
53+
],
54+
"@typescript-eslint/no-explicit-any": 0,
55+
"@typescript-eslint/no-var-requires": 0,
56+
"no-console": 0,
57+
"@typescript-eslint/ban-ts-comment": 0,
58+
"prefer-const": 0,
59+
"no-case-declarations": 0,
60+
"no-implicit-globals": 0,
61+
"@typescript-eslint/no-unsafe-declaration-merging": 0
62+
}
63+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/node_modules/
2+
**/.DS_Store
3+
**/dist
4+
**/yarn-error.log
5+
lerna-debug.log

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"useTabs": false,
6+
"singleQuote": false
7+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 Dan Lynch <[email protected]>
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.

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# build
2+
3+
<p align="center">
4+
<img src="https://user-images.githubusercontent.com/545047/188804067-28e67e5e-0214-4449-ab04-2e0c564a6885.svg" width="80"><br />
5+
__MODULEDESC__
6+
</p>
7+
8+
## install
9+
10+
```sh
11+
npm install build
12+
```
13+
## Table of contents
14+
15+
- [build](#build)
16+
- [Install](#install)
17+
- [Table of contents](#table-of-contents)
18+
- [Developing](#developing)
19+
- [Credits](#credits)
20+
21+
## Developing
22+
23+
When first cloning the repo:
24+
25+
```sh
26+
yarn
27+
# build the prod packages. When devs would like to navigate to the source code, this will only navigate from references to their definitions (.d.ts files) between packages.
28+
yarn build
29+
```
30+
31+
Or if you want to make your dev process smoother, you can run:
32+
33+
```sh
34+
yarn
35+
# build the dev packages with .map files, this enables navigation from references to their source code between packages.
36+
yarn build:dev
37+
```
38+
39+
## Related
40+
41+
Checkout these related projects:
42+
43+
* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
44+
* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.
45+
* [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
46+
* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
47+
* [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command.
48+
* [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
49+
* [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain.
50+
51+
## Credits
52+
53+
🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.zone/validator)
54+
55+
56+
## Disclaimer
57+
58+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
59+
60+
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.

lerna.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"lerna": "6",
3+
"conventionalCommits": true,
4+
"npmClient": "yarn",
5+
"npmClientArgs": [
6+
"--no-lockfile"
7+
],
8+
"packages": [
9+
"packages/*"
10+
],
11+
"version": "independent",
12+
"registry": "https://registry.npmjs.org",
13+
"command": {
14+
"create": {
15+
"homepage": "https://github.com/cosmology-tech/build",
16+
"license": "SEE LICENSE IN LICENSE",
17+
"access": "restricted"
18+
},
19+
"publish": {
20+
"allowBranch": "main",
21+
"message": "chore(release): publish"
22+
}
23+
}
24+
}

package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "build",
3+
"version": "0.0.1",
4+
"author": "Dan Lynch <[email protected]>",
5+
"private": true,
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/cosmology-tech/build"
9+
},
10+
"license": "SEE LICENSE IN LICENSE",
11+
"publishConfig": {
12+
"access": "restricted"
13+
},
14+
"workspaces": [
15+
"packages/*"
16+
],
17+
"scripts": {
18+
"clean": "lerna run clean",
19+
"build": "lerna run build --stream",
20+
"build:dev": "lerna run build:dev --stream; yarn symlink",
21+
"lint": "lerna run lint --parallel",
22+
"symlink": "symlink-workspace --logLevel error",
23+
"postinstall": "yarn symlink"
24+
},
25+
"devDependencies": {
26+
"@types/jest": "^29.5.11",
27+
"@types/node": "^20.12.7",
28+
"@typescript-eslint/eslint-plugin": "^7.10.0",
29+
"@typescript-eslint/parser": "^7.10.0",
30+
"copyfiles": "^2.4.1",
31+
"eslint-config-prettier": "^9.1.0",
32+
"eslint-plugin-simple-import-sort": "^12.1.0",
33+
"eslint-plugin-unused-imports": "^4.0.0",
34+
"eslint": "^8.56.0",
35+
"jest": "^29.6.2",
36+
"lerna": "^6",
37+
"prettier": "^3.0.2",
38+
"rimraf": "4.4.1",
39+
"strip-ansi": "^6",
40+
"symlink-workspace": "^1.9.0",
41+
"ts-jest": "^29.1.1",
42+
"ts-node": "^10.9.2",
43+
"typescript": "^5.1.6"
44+
}
45+
}

packages/build/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# @interweb/build
2+
3+
<p align="center">
4+
<img src="https://user-images.githubusercontent.com/545047/188804067-28e67e5e-0214-4449-ab04-2e0c564a6885.svg" width="80"><br />
5+
build tools for interweb
6+
</p>
7+
8+
## install
9+
10+
```sh
11+
npm install @interweb/build
12+
```
13+
## Table of contents
14+
15+
- [build](#build)
16+
- [Install](#install)
17+
- [Table of contents](#table-of-contents)
18+
- [Developing](#developing)
19+
- [Credits](#credits)
20+
21+
## Developing
22+
23+
When first cloning the repo:
24+
25+
```sh
26+
yarn
27+
# build the prod packages. When devs would like to navigate to the source code, this will only navigate from references to their definitions (.d.ts files) between packages.
28+
yarn build
29+
```
30+
31+
Or if you want to make your dev process smoother, you can run:
32+
33+
```sh
34+
yarn
35+
# build the dev packages with .map files, this enables navigation from references to their source code between packages.
36+
yarn build:dev
37+
```
38+
39+
## Related
40+
41+
Checkout these related projects:
42+
43+
* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
44+
* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.
45+
* [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
46+
* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
47+
* [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command.
48+
* [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
49+
* [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain.
50+
51+
## Credits
52+
53+
🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.zone/validator)
54+
55+
56+
## Disclaimer
57+
58+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
59+
60+
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export function farewell(name: string): string {
2+
myname();
3+
return `Goodbye, ${name}!`;
4+
}
5+
6+
function myname() {
7+
console.log('hello');
8+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function greet(name: string): string {
2+
return `Hello, ${name}!`;
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { greet } from './greet';
2+
import { farewell } from './farewell';
3+
4+
function myname() {
5+
console.log('hello');
6+
}
7+
8+
console.log(greet('World'));
9+
console.log(farewell('World'));
10+
myname();

packages/build/__output__/first/bundle.js

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/build/__output__/first/bundle.js.map

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import fs from 'fs/promises';
2+
import { join, resolve } from 'path';
3+
4+
import { InterwebBuild, InterwebBuildOptions } from '../src/index';
5+
6+
const fixtureDir = resolve(join(__dirname, '/../__fixtures__/', 'first'));
7+
const outputDir = resolve(join(__dirname, '/../__output__/', 'first'));
8+
9+
describe('InterwebBuild', () => {
10+
it('builds the fixture project successfully', async () => {
11+
const outfile = join(outputDir, 'bundle.js');
12+
13+
const options: Partial<InterwebBuildOptions> = {
14+
entryPoints: [join(fixtureDir, 'src/index.ts')],
15+
outfile
16+
};
17+
18+
await InterwebBuild.build(options);
19+
20+
// Check if the output file exists
21+
const outfileExists = await fs.access(outfile)
22+
.then(() => true)
23+
.catch(() => false);
24+
25+
expect(outfileExists).toBe(true);
26+
27+
// Optionally, you can read the contents of the file and perform additional checks
28+
const bundleContent = await fs.readFile(outfile, 'utf-8');
29+
expect(bundleContent).toContain('function greet');
30+
expect(bundleContent).toContain('function farewell');
31+
});
32+
});

0 commit comments

Comments
 (0)