Skip to content

Commit 1750992

Browse files
authored
Version 1.0 (#16)
* set up typescript (#1) * set up package (#2) * set up package * Change exit code to 1 * fix error * fix error * add build all * fix error * add package-init script * change run script * 변수 명 수정 * change script name * fix error * Add npm i @types/node --save-dev * Feature/set up gulp (#8) * feature/refactoring (#9) * Feature/set up husky (#10) * Feature/set up nvmrc (#14) * Feature/set_up_lint (#11) * Feature/set_up_rust (#13) * Feature/set up jest (#15)
1 parent 855aae4 commit 1750992

27 files changed

Lines changed: 870 additions & 0 deletions

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
script
2+
node_modules
3+
dist
4+
gulpfile.js

.eslintrc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2020": true,
5+
"jest": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"plugin:prettier/recommended",
11+
"prettier/@typescript-eslint",
12+
"airbnb-base"
13+
],
14+
"parser": "@typescript-eslint/parser",
15+
"parserOptions": {
16+
"ecmaVersion": 12,
17+
"sourceType": "module",
18+
"project": [
19+
"tsconfig.json"
20+
]
21+
},
22+
"plugins": [
23+
"@typescript-eslint"
24+
],
25+
"rules": {
26+
"no-console": "off"
27+
}
28+
}

.gitignore

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Logs
2+
old/logs
3+
*.log
4+
*.log.*
5+
npm-debug.log*
6+
yarn-debug.log*
7+
yarn-error.log*
8+
lerna-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc tests coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules
43+
jspm_packages/
44+
45+
# TypeScript v1 declaration files
46+
typings/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Microbundle cache
58+
.rpt2_cache/
59+
.rts2_cache_cjs/
60+
.rts2_cache_es/
61+
.rts2_cache_umd/
62+
63+
# Optional REPL history
64+
.node_repl_history
65+
66+
# Output of 'npm pack'
67+
*.tgz
68+
69+
# Yarn Integrity file
70+
.yarn-integrity
71+
72+
# dotenv environment variables file
73+
.env
74+
.env.test
75+
76+
# parcel-bundler cache (https://parceljs.org/)
77+
.cache
78+
79+
# Next.js build output
80+
.next
81+
82+
# Nuxt.js build / generate output
83+
.nuxt
84+
dist
85+
86+
# Gatsby files
87+
.cache/
88+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
89+
# https://nextjs.org/blog/next-9-1#public-directory-support
90+
# public
91+
92+
# vuepress build output
93+
.vuepress/dist
94+
95+
# Serverless directories
96+
.serverless/
97+
98+
# FuseBox cache
99+
.fusebox/
100+
101+
# DynamoDB Local files
102+
.dynamodb/
103+
104+
# TernJS port file
105+
.tern-port
106+
107+
package-lock.json
108+
/storage/
109+
mongodb-binaries/
110+
/profiling/
111+
/.vscode/
112+
.idea

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12.18.3

.prettierrc

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

gulpfile.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const gulp = require('gulp');
2+
const ts = require('gulp-typescript');
3+
4+
function getTsconfig(env) {
5+
if (env != null) {
6+
return `tsconfig.${env.toLowerCase()}.json`;
7+
}
8+
9+
return 'tsconfig.json';
10+
}
11+
12+
const tsProject = ts.createProject(getTsconfig(process.env.NODE_ENV));
13+
14+
const outDir = 'dist'
15+
16+
gulp.task('default', () => tsProject.src()
17+
.pipe(tsProject())
18+
.pipe(gulp.dest(outDir))
19+
);

package.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"name": "design-system",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "dist/index.js",
6+
"scripts": {
7+
"run": "node dist/index.js",
8+
"build:production": "cross-env NODE_ENV=production npm run build",
9+
"build": "gulp",
10+
"neon": "neon",
11+
"lint": "eslint --fix . --resolve-plugins-relative-to .",
12+
"lint:staged": "lint-staged",
13+
"test": "jest",
14+
"package:init": "script/init-package.sh package",
15+
"package:sync": "script/sync-package.sh package",
16+
"package:neon:init": "script/init-neon-package.sh package",
17+
"tsc:init": "tsc --init",
18+
"eslint": "eslint",
19+
"all:build": "script/run-script-all-package.sh build",
20+
"all:build:production": "script/run-script-all-package.sh build:production"
21+
},
22+
"repository": {
23+
"type": "git",
24+
"url": "git+https://github.com/CourseDesign/design-system.git"
25+
},
26+
"author": "",
27+
"license": "ISC",
28+
"bugs": {
29+
"url": "https://github.com/CourseDesign/design-system/issues"
30+
},
31+
"homepage": "https://github.com/CourseDesign/design-system#readme",
32+
"husky": {
33+
"hooks": {
34+
"pre-push": "npm run test",
35+
"pre-commit": "npm run lint:staged"
36+
}
37+
},
38+
"lint-staged": {
39+
"src/*.{js,ts}": [
40+
"eslint --fix"
41+
]
42+
},
43+
"jest": {
44+
"transform": {
45+
"^.+\\.ts$": "ts-jest"
46+
},
47+
"testRegex": "\\.spec\\.ts$",
48+
"moduleFileExtensions": [
49+
"ts",
50+
"js"
51+
],
52+
"modulePathIgnorePatterns": [
53+
"dist"
54+
],
55+
"globals": {
56+
"ts-jest": {
57+
"diagnostics": true
58+
}
59+
}
60+
},
61+
"devDependencies": {
62+
"@types/jest": "^26.0.10",
63+
"@types/node": "^14.6.0",
64+
"@typescript-eslint/eslint-plugin": "^3.10.1",
65+
"@typescript-eslint/parser": "^3.10.1",
66+
"cross-env": "^7.0.2",
67+
"eslint": "^7.7.0",
68+
"eslint-config-airbnb-base": "^14.2.0",
69+
"eslint-config-prettier": "^6.11.0",
70+
"eslint-plugin-import": "^2.22.0",
71+
"eslint-plugin-prettier": "^3.1.4",
72+
"gulp": "^4.0.2",
73+
"gulp-typescript": "^6.0.0-alpha.1",
74+
"husky": "^4.2.5",
75+
"jest": "^26.4.2",
76+
"lint-staged": "^10.2.13",
77+
"neon-cli": "^0.4.0",
78+
"prettier": "^2.1.1",
79+
"ts-jest": "^26.3.0",
80+
"typescript": "^4.0.2"
81+
}
82+
}

script/add-eslint-parse-option.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const rootPackagePath = process.argv[2];
5+
if (rootPackagePath == null) {
6+
console.error('Root package is undefined!');
7+
process.exit(1);
8+
}
9+
10+
const packagePath = process.argv[3];
11+
if (packagePath == null) {
12+
console.error('Package is undefined!');
13+
process.exit(1);
14+
}
15+
const eslintrcJson = require(`${rootPackagePath}/.eslintrc.json`);
16+
17+
const { project } = eslintrcJson.parserOptions;
18+
19+
const diff = path.relative(rootPackagePath, packagePath);
20+
21+
project.push(`${diff}/tsconfig.json`);
22+
23+
fs.writeFileSync(`${rootPackagePath}/.eslintrc.json`, JSON.stringify(eslintrcJson, null, 2) + '\n');

script/add-scipt-in-package.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const fs = require('fs');
2+
3+
const packagePath = process.argv[2];
4+
if (packagePath == null) {
5+
console.error('Package is undefined!');
6+
process.exit(1);
7+
}
8+
9+
const scriptName = process.argv[3];
10+
if (scriptName == null) {
11+
console.error('Script name is undefined!');
12+
process.exit(1);
13+
}
14+
15+
const script = process.argv[4];
16+
if (script == null) {
17+
console.error('Script is undefined!');
18+
process.exit(1);
19+
}
20+
21+
const packageJson = require(packagePath);
22+
packageJson.scripts[scriptName] = script;
23+
24+
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n');

script/change-package.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const fs = require('fs');
2+
3+
const packagePath = process.argv[2];
4+
if (packagePath == null) {
5+
console.error('Package is undefined!');
6+
process.exit(1);
7+
}
8+
9+
const packageJson = require(packagePath);
10+
11+
const key = process.argv[3];
12+
if (key == null) {
13+
console.error('Key is undefined!');
14+
process.exit(1);
15+
}
16+
17+
const value = process.argv[4];
18+
if (value == null) {
19+
console.error('Value is undefined!');
20+
process.exit(1);
21+
}
22+
23+
packageJson[key] = value;
24+
25+
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n');

0 commit comments

Comments
 (0)