Skip to content

Commit 3fa56ae

Browse files
committed
Init
1 parent e0f06eb commit 3fa56ae

19 files changed

+9899
-8
lines changed

.browserslistrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
last 2 versions

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_size = 2
6+
indent_style = space
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const DISABLED = 0;
2+
const WARNING = 1;
3+
const ERROR = 2;
4+
5+
module.exports = {
6+
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
7+
extends: [
8+
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
9+
'plugin:prettier/recommended' // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
10+
],
11+
parserOptions: {
12+
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
13+
sourceType: 'module' // Allows for the use of imports
14+
},
15+
rules: {
16+
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
17+
// "@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: true }],
18+
'@typescript-eslint/camelcase': DISABLED,
19+
'@typescript-eslint/interface-name-prefix': DISABLED,
20+
'@typescript-eslint/no-empty-interface': DISABLED,
21+
'@typescript-eslint/no-var-requires': DISABLED,
22+
'react/prop-types': DISABLED,
23+
'react/prop': DISABLED,
24+
'no-unused-expressions': DISABLED
25+
}
26+
};

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
node_modules/
3+
packages/**/dist/
4+
packages/**/src/

.prettierrc.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
semi: true,
3+
singleQuote: true,
4+
tabWidth: 2,
5+
bracketSpacing: true,
6+
trailingComma: 'none',
7+
printWidth: 120,
8+
endOfLine: 'auto'
9+
};

.stylelintrc

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"extends": "stylelint-prettier/recommended",
3+
"ignoreFiles": ["**/*.html", "**/*.js", "**/*.ts"],
4+
"plugins": [
5+
"stylelint-prettier",
6+
],
7+
"rules": {
8+
"prettier/prettier": true,
9+
"at-rule-no-unknown": null,
10+
"font-family-no-missing-generic-family-keyword": null,
11+
"no-missing-end-of-source-newline": null,
12+
"no-empty-source": null,
13+
"shorthand-property-no-redundant-values": null,
14+
"block-no-empty": null,
15+
"indentation": 2,
16+
"string-quotes": "single",
17+
"no-duplicate-selectors": true,
18+
"color-hex-length": "long",
19+
"color-named": "never",
20+
"selector-no-qualifying-type": true,
21+
"selector-combinator-space-after": "always",
22+
"selector-attribute-quotes": "always",
23+
"selector-attribute-operator-space-before": "never",
24+
"declaration-block-trailing-semicolon": "always",
25+
"declaration-colon-space-before": "never",
26+
"declaration-colon-space-after": "always",
27+
"property-no-vendor-prefix": true,
28+
"value-no-vendor-prefix": true,
29+
"at-rule-no-vendor-prefix": true,
30+
"selector-pseudo-element-colon-notation": "single",
31+
"selector-no-vendor-prefix": true,
32+
"media-feature-range-operator-space-before": "always",
33+
"media-feature-range-operator-space-after": "always",
34+
"media-feature-parentheses-space-inside": "never",
35+
"media-feature-name-no-vendor-prefix": true,
36+
"media-feature-colon-space-before": "never",
37+
"media-feature-colon-space-after": "always",
38+
"max-empty-lines": null,
39+
}
40+
}

README.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# papanasi
2+
23
🥯Papanasi is the Frontend UI library to use cross Frameworks. A set of components to use in React, Vue, Angular, and more.
34

45
## Manifesto
6+
57
A Component...
6-
- ...should be cross-libraries but the code should be written once.
7-
- ...should have a minimun style and should be easy to extend it via CSS by the user.
8-
- ...should provide an optional style library.
9-
- ...should be easy to wrap to set basic properties for the project where is used.
10-
- ...should be three-shakable.
11-
- ...should be compatible with StoryBook.
12-
- ...should be inspired in other UI Libraries to don't reinvent the wheel.
13-
- ...should be easy to create new variants.
8+
* ...should be cross-libraries but the code should be written once.
9+
* ...should have a minimun style and should be easy to extend it via CSS by the user.
10+
* ...should provide an optional style library.
11+
* ...should be easy to wrap to set basic properties for the project where is used.
12+
* ...should be three-shakable.
13+
* ...should be compatible with StoryBook.
14+
* ...should be inspired in other UI Libraries to don't reinvent the wheel.
15+
* ...should be easy to create new variants.

lerna.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"npmClient": "yarn",
3+
"command": {
4+
"publish": {
5+
"allowBranch": "main",
6+
"conventionalCommits": true,
7+
"ignoreChanges": ["*.md", ".spec.ts", ".stories.ts"]
8+
}
9+
},
10+
"packages": ["packages/*"],
11+
"version": "independent"
12+
}

mitosis.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
files: 'src/**/*.lite.tsx',
3+
dest: 'packages',
4+
options: {},
5+
targets: ['react']
6+
};

package.json

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "papanasi",
3+
"version": "0.0.0",
4+
"license": "MIT",
5+
"scripts": {
6+
"build": "run-s build:**",
7+
"build:clean": "rimraf packages/react/src",
8+
"build:mitosis": "mitosis build",
9+
"build:dts": "npx copyfiles src/**/*.d.ts packages/react",
10+
"build:lerna": "lerna run build",
11+
"lint": "run-p lint:**",
12+
"lint:scripts": "eslint --fix \"./src/**/*.tsx\"",
13+
"lint:styles": "stylelint \"./src/**/*.(css)\" --fix",
14+
"lint:editor": "eclint fix"
15+
},
16+
"dependencies": {},
17+
"devDependencies": {
18+
"@builder.io/mitosis": "^0.0.56-11",
19+
"@builder.io/mitosis-cli": "^0.0.17-10",
20+
"@types/node": "16.11.7",
21+
"@typescript-eslint/eslint-plugin": "~5.18.0",
22+
"@typescript-eslint/parser": "~5.18.0",
23+
"copyfiles": "^2.4.1",
24+
"eclint": "^2.8.1",
25+
"eslint": "^8.15.0",
26+
"eslint-config-prettier": "^8.5.0",
27+
"eslint-plugin-prettier": "^4.0.0",
28+
"husky": "^8.0.1",
29+
"lerna": "^4.0.0",
30+
"npm-run-all": "^4.1.5",
31+
"prettier": "^2.6.2",
32+
"prettier-stylelint": "^0.4.2",
33+
"rimraf": "^3.0.2",
34+
"stylelint": "^14.8.2",
35+
"stylelint-config-prettier": "^9.0.3",
36+
"stylelint-config-standard": "^25.0.0",
37+
"stylelint-prettier": "^2.0.0",
38+
"ts-node": "9.1.1",
39+
"typescript": "~4.6.2",
40+
"vite": "^2.6.11",
41+
"vite-dts": "^1.0.4"
42+
},
43+
"husky": {
44+
"hooks": {
45+
"pre-commit": "yarn run lint"
46+
}
47+
}
48+
}

packages/react/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './src/button';

packages/react/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "papanasi-react",
3+
"version": "0.0.0",
4+
"author": "ckgrafico/papanasi",
5+
"description": "Papanasi React UI Library",
6+
"main": "dist/papanasi-react.es.js",
7+
"module": "dist/papanasi-react.es.js",
8+
"scripts": {
9+
"build": "vite build",
10+
"build:watch": "vite build --watch"
11+
},
12+
"types": "./src/papanasi-react.d.ts"
13+
}

packages/react/vite.config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { defineConfig } from "vite";
2+
import { getBaseViteConfig } from "../../vite.config";
3+
4+
export default defineConfig(getBaseViteConfig(__dirname));

src/button/button.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.pa-button {
2+
color: #ff00ff;
3+
}

src/button/button.lite.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export type ButtonProps = {
2+
name: string;
3+
};
4+
5+
export default function Button(props: ButtonProps) {
6+
return <button>{props.name}</button>;
7+
}

src/button/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export type ButtonProps = {
2+
name: string;
3+
};

tsconfig.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true,
4+
"alwaysStrict": true,
5+
"esModuleInterop": true,
6+
"forceConsistentCasingInFileNames": true,
7+
"isolatedModules": true,
8+
"jsx": "react-jsx",
9+
"lib": [
10+
"dom",
11+
"esnext",
12+
"dom.iterable",
13+
],
14+
"module": "esnext",
15+
"noEmit": true,
16+
"moduleResolution": "node",
17+
"sourceMap": true,
18+
"noUnusedLocals": true,
19+
"noUnusedParameters": true,
20+
"resolveJsonModule": true,
21+
"skipLibCheck": true,
22+
"strict": true,
23+
"target": "esnext",
24+
"allowSyntheticDefaultImports": true,
25+
},
26+
"include": [
27+
"./packages",
28+
"*.d.ts"
29+
],
30+
"exclude": [
31+
"node_modules",
32+
"dist"
33+
]
34+
}

vite.config.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import path from 'path';
2+
import { UserConfigExport } from 'vite';
3+
import dts from 'vite-dts';
4+
5+
export function getBaseViteConfig(dirname: string, override?: UserConfigExport): UserConfigExport {
6+
const isExternal = (id: string) => !id.startsWith('.') && !path.isAbsolute(id);
7+
8+
return {
9+
esbuild: {
10+
jsxInject: "import React from 'react'"
11+
},
12+
build: {
13+
lib: {
14+
entry: path.resolve(dirname, 'index.ts'),
15+
formats: ['es']
16+
},
17+
rollupOptions: {
18+
external: isExternal
19+
}
20+
},
21+
plugins: [dts()],
22+
...override
23+
};
24+
}

0 commit comments

Comments
 (0)